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 readCookie(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 c.substring(nameEQ.length,c.length);
  }
  return null;
}


function showWindow(page, title, w, h) {
  var showWindow = window.open(page, title, 'top=20,left=40,width='+w+',height='+h+',scrollbars=yes, resizable=yes ');
  if(showWindow)
  	showWindow.focus();
}

function openPopup()
{
  //if (readCookie('popupcookie') == null)
  //{
    t = screen.availHeight/2-150;
    l = screen.availWidth/2-125;
    w = window.open('/popup/index.htm', 'akcje', 'top='+t+', left='+l+', width=297, height=297, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no');
    if(w){
    	w.focus();
    }
    
    //createCookie('popupcookie', '1', 7);
  //}
}


//window.onload = function()
//{
//  openPopup();
//}


function showFaq(id){
	var paras = $A(document.getElementsByClassName('answer', $('faq-list')));
	paras.each(function(item) {
    	item.style.display = 'none';
  	});
  	//alert(id);
  	$(id).style.display = 'block';
}

function showArticle(id){
	/*
	var paras = $A(document.getElementsByClassName('article-item'));
	paras.each(function(item) {
    	item.style.display = 'none';
  	});
  	*/
  	if($(id).visible()){
  		$(id).hide();
  	} else {
  		$(id).style.display = 'block';
  	}
}


function positionStudyBg(){
	if($('study-bg')){
		var footer = $('footer-logo');
		var y = Position.cumulativeOffset(footer)[1] - 543;
		$('study-bg').style.top = y+'px';
		$('study-bg').style.visibility = 'visible';
	}
}
  	
