﻿
function showView(id)
{
// openPopWindow('../Popups/ArticleView.aspx?id='+id,800,600,0,100);600,800,100,0
 
   var w;                           
   w=window.open('../popups/ArticleView.aspx?id='+id,'_blank','height=' + 600 + ',width=' + 800 + ',left=' + 100 + ',top=' + 0 + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
   w.focus();
   return false;
}
function showScriptView(id)
{
var w;                           
   w=window.open('../popups/ScriptView.aspx?id='+id,'_blank','height=' + 600 + ',width=' + 800 + ',left=' + 100 + ',top=' + 0 + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
   w.focus();
   return false;
}

function showAdviceView(id)
{
var w;                           
   w=window.open('../popups/AdviceView.aspx?id='+id,'_blank','height=' + 600 + ',width=' + 800 + ',left=' + 100 + ',top=' + 0 + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
   w.focus();
   return false;
}

function openWindow(page,height,width,left,top)
{
  var w;                           
   w=window.open(page,'_blank','height=' + height + ',width=' + width + ',left=' + left + ',top=' + top + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
   w.focus();
   return false;
}
//function openWindow(page,height,width,left,top)
//{
//  var w;                           
//   w=window.open(page,'_blank','height=' + height + ',width=' + width + ',left=' + left + ',top=' + top + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes');
//   w.focus();
//   return false;
//}

function goToPage(page)
{
 location.href = page;
 return null;
}

function resize(elem, max) {
  //var elem = document.getElementById(which);
  if (elem == undefined || elem == null) return false;
  if (max == undefined) max = 200;
  if (elem.width > elem.height) {
    if (elem.width > max) elem.width = max;
  } else {
    if (elem.height > max) elem.height = max;
  }
}





// function showRow() {
//    var div = document.getElementById('<%=rowDiv.ClientID%>');
//    div.style.display = (div.style.display == '') ? 'none' : '';
//}

function fixHeight()
{
	setTimeout('fixHeight1()', 500);
}
function fixHeight1()
{
	var l = document.getElementById('div_left').offsetHeight;
	var r = document.getElementById('div_right').offsetHeight;
	var c = document.getElementById('div_center').offsetHeight;
	var lrMax = Math.max(l,r);
	if (lrMax > c)
	{
		document.getElementById('div_center').style.height = lrMax + 'px';
		//document.getElementById('div_center').style.height = lrMax + 1 + 'px';
	}
}


var panel_time = new Array();

function show_panel(i, name)
{
 clearTimeout(panel_time[name]);
 if (document.getElementById('div_'+name+'_'+i) != null)
 { 
 for (var j = 1; j <= 3; j++)
 {
	 try { document.getElementById('div_'+name+'_'+j).style.display = 'none'; } 
	 catch(err) { document.getElementById('a_'+name+'_'+j).style.display = 'none'; }
	 document.getElementById('a_'+name+'_'+j).className = '';
 }
 

	document.getElementById('div_'+name+'_'+i).style.display = ''; 
	document.getElementById('a_'+name+'_'+i).className = 'select';
}
 next_i = i + 1;
 if (next_i > 3) next_i = 1;
 panel_time[name] = setTimeout('show_panel('+next_i+',\''+name+'\')',8000);
}

function swapQuickFaq(elementId)
{
	var el = document.getElementById(elementId);
	//alert(el);
	if (el.style.display != 'none')
	{
	    el.style.display = 'none'
		//Effect.BlindUp(elementId, {duration: 0.5, queue: {position:'end', scope: 'qf', limit:1} })
		//$$('body')[0].setAttribute('onclick', '');
	}
	else
	{
	    el.style.display = ''
		//Effect.BlindDown(elementId, {duration: 0.5, queue: {position:'end', scope: 'qf', limit:1} })
		//$$('body')[0].setAttribute('onclick', 'swapQuickFaq("quick_faq"); return false;');
	}
}

function CreateBookmarkLink() {

 title = "Portal vista.pl"; 

 url = "http://www.vista.pl";

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
 
 function getDayOfMonth()
 {
  var curdate = new Date();
  var wday = curdate.getDate();
  return wday;
 }
 
 /* Cookies functions */
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function existCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return 1;
	}
	return 0;
}

function getCookieValue(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		//c = c.substring(nameEQ.length, c.length - nameEQ.length);
		//return c;
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) 
		{
		    //return c;
		    c = c.substring(nameEQ.length, c.length);
		    return c;
		}
	}
	return 0;
}
