
 var m_id=0;
 
 /* pokaz/ukryj blok/modul */
 function toggle_block(id)
 {
	var obj=document.getElementById( 'content_menu_' + id);
	var img=document.getElementById( 'img_menu_' + id);
	var bool_res=0;
	
	if( obj.className=="show m2_content" )
	 {
	 	obj.className="hide m2_content";
	 	bool_res=0;
	 	img.src="/images/down.png";
	 } else
	 {
	 	obj.className="show m2_content";
	 	bool_res=1;
	 	img.src="/images/up.png";
	 }
 }

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);
} 

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);
} 

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){}
}

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ść
}

/*
 * 
 * 
 * @author P Walak
 */
function resizePicture(pic, maxWidth, maxHeight){
	alert("wlaze");
	if (!pic.tagName || pic.tagName != "IMG") {
		return;
	}
	
	w = pic.width;
	h = pic.height;
	
	alert("przed: " + w + " x " + h);
	
	if (w > maxWidth) {
		h = Math.ceil(h * (maxWidth / w));
		w = maxWidth;
	}
	if (h > maxHeight) {
		w = Math.ceil(w * (maxHeight / h));
		h = maxHeight;
	}
	alert("po: " + w + " x " + h);
	pic.style.width = w;
	pic.style.height = h;
}
