
/**
Otwiera wyskakujace okienko 
*/
function openWindow(url,windowName,width,height) {
//	var h = top.innerHeight? top.innerHeight : (document.documentElement.clientHeight);
//	var w = top.innerHeight? top.innerWidth : (document.documentElement.clientWidth);
	var h = screen.height;
	var w = screen.width;
  	w = Math.floor((w - width) / 2);
  	h = Math.floor((h - height) / 2);
  parameters = 'width=' + width + ',height=' + height + 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left='+w+',top='+h;
  return window.open(url,windowName,parameters);
} 

/** 
Otwiera wyskakujace okienko bez mozliwosci zmiany jego rozmiaru
*/
function openWindowNoScrollNoResize(url,windowName,width,height) {
//	var h = top.innerHeight? top.innerHeight : (document.documentElement.clientHeight);
//	var w = top.innerHeight? top.innerWidth : (document.documentElement.clientWidth);
	var h = screen.height;
	var w = screen.width;
  	w = Math.floor((w - width) / 2);
  	h = Math.floor((h - height) / 2);
  parameters = 'width=' + width + ',height=' + height + 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left='+w+',top='+h;
  return window.open(url,windowName,parameters);
} 

/**
Laduje skrytp js
*/
function load_script(u){
	try{
		if(navigator.appVersion.indexOf('MSIE')>=0 && ('uninitialized'!=document.readyState&&'loading'!=document.readyState)){
			document.write('<s'+'cript language="javascript" src="'+u+'"></s'+'cript>');
		}else{
			var spt=document.createElement("script");
			spt.type="text/javascript";
			spt.src=u;
			document.getElementsByTagName("body")[0].appendChild(spt);
		}
	}catch(e){}
}

/**
Odczytuje wratosc cookie
*/
function readCookie(nazwa)
 {
  nazwa+='='; //uzupełnia nazwę
  startCookie=document.cookie.indexOf(nazwa); //sprawdza czy istnieje cookie o podanej nazwie
  if (startCookie==-1) {return null} //jeżeli nie istnieje
  startCookie += nazwa.length; //początek treści cookie
  if (document.cookie.indexOf(';',startCookie)==-1) //jeżeli jest więcej cookie
  {
   	koniecCookie=document.cookie.length; //jeżeli nie ma podstawia jako koniec cookie, koniec całego tekstu
  } else {
    koniecCookie=document.cookie.indexOf(';',startCookie); // podstawia pod koniec miejsce występowania ";" (czyli początek następnego cookie)
  }
  textCookie=document.cookie.substring(startCookie,koniecCookie); //kopiuje treść cookie
  textCookie=unescape(textCookie); //rozkodowuje treść
  return textCookie; //zwraca wartość
}

