// JavaScript Document
function news(which){// maxym- liczba serwerow which 'litera'+'liczba' r-strzalka w prawo, l-strzalka w lewo
	//document.write(which);
	maxym=4;
	direction=which.substr(0,1);
	which_int=parseInt(which.substr(1,which.length-1));
	which1=1;
	if (direction=="r") {
		if (which_int==1) which1=maxym;
		else which1=which_int-1;
	}
	else {
		if (which_int==maxym) which1=1;
		else which1=which_int+1;
	}
	which_str=""+which_int;

	
	document.getElementById('news'+which1).style.display='none';
	document.getElementById('news'+which_int).style.display='block';
	setCookie('special_box','news'+which_int);
	
}


function menu_change(id){
	document.getElementById(id+'_left').style.display='block';
	document.getElementById(id+'_right').style.display='block';
	}


function menu_out(id){
	document.getElementById(id+'_left').style.display='none';
	document.getElementById(id+'_right').style.display='none';
	}
	
function list_change(id){
	
	str=id.substr(0,2);
	str2=id.substr(3,id.length-3);
	//document.write(str);
//document.write(str2);
	if (str=='on'){
	
	document.getElementById(id).style.display='none';
	document.getElementById('of_'+str2).style.display='block';
	document.getElementById(str2).style.display='block';
	}
	
	if (str=='of'){
	
	document.getElementById(id).style.display='none';
	document.getElementById('on_'+str2).style.display='block';
	document.getElementById(str2).style.display='none';
	}

	//document.getElementById('rightpas').className='sub-top-bookmarks r-active';		
}

function zamien(id) {
	document.getElementById(id).style.display='none';
	document.getElementById(id+'_hover').style.display='block';

}

function zamien_back(id) {
	document.getElementById(id+'_hover').style.display='none';
	document.getElementById(id).style.display='block';

}


function pointer_cursor (){
	document.body.style.cursor = 'pointer';
	
}


function default_cursor (){
	document.body.style.cursor = 'default';
}


function pokazCookie(nazwa) { 
  if (document.cookie!="") { 
  var toCookie=document.cookie.split("; "); //split("; ") zapisuje do tablicy wyrazy oddzielone "; " w zadanym ciągu
    for (i=0; i<toCookie.length; i++) { 
      var nazwaCookie=toCookie[i].split("=")[0]; //przypisuje wyraz przed znakiem =
      var wartoscCookie=toCookie[i].split("=")[1]; //przypisuje wyraz za znakiem =
      if (nazwaCookie==nazwa) return unescape(wartoscCookie) //unescape() dekoduje wartość na znak np #20 na spacje
    }
  }
} 

function setCookie(nazwa, wartosc) {
	Teraz=new Date();
  	Teraz.setTime(Termin = (15*60*1000) + Teraz.getTime()); //ważność 15min
  	Termin= (Teraz.toGMTString());//konwersja daty wg standardow
  	document.cookie= nazwa+"=" + escape(wartosc) + "; expires="+Termin; //escape() koduje znaki np spacja to #20
	//po przypisaniu nowej wartości i terminu do takiej samej nazwy zostaje ona nadpisana
	//toCookie = document.cookie.split("; ")
	//document.write(toCookie[0])
	//document.write( toCookie[0].split("=")[0] + "=" + toCookie[0].split("=")[1] ) 
}


function check_special_box(){
	
	if (pokazCookie('special_box') != undefined){
		document.getElementById(pokazCookie('special_box')).style.display='block';
	}
	else {
		document.getElementById('news1').style.display='block';
	}
	
}


