function MaximizeWindow(){
	top.window.moveTo(0,0);
	if (document.all) {
		top.window.resizeTo(screen.availWidth,screen.availHeight);
	}
	else if (document.layers||document.getElementById) {
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth){
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
		}
	}
}


//funkcja zwraca maxymalny rozmiar tabelki (rozdzielczosc - iIleOdjac)
function getWindowMaxHeight(iIleOdjac) { 
 MaximizeWindow();
 if( typeof( window.innerWidth ) == 'number' ) { 
   //Non-IE 
   //myWidth = window.innerWidth; 
   myHeight = window.innerHeight; 
 } else if( document.documentElement && 
	 ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { 
   //IE 6+ in 'standards compliant mode' 
   //myWidth = document.documentElement.clientWidth; 
   myHeight = document.documentElement.clientHeight; 
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { 
   //IE 4 compatible 
   //myWidth = document.body.clientWidth; 
   myHeight = document.body.clientHeight; 
 } 
 hiY = myHeight - iIleOdjac; 
 return hiY;
}

function PopUp(ImageName) {
  PopUpWindow=window.open("","Popup","status=no, width=1, height=1");     // open the new window with just the title and status bar and name it 'PopUpWindow'
  PopUpWindow.document.writeln('<html>');
  PopUpWindow.document.writeln('<head>');
  PopUpWindow.document.writeln('<title>Popup</title>');   // put the name of the pic in the title bar
  PopUpWindow.document.writeln('</head>');
  PopUpWindow.document.writeln('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" onLoad="window.resizeTo(document.images[0].width+10, document.images[0].height+29); window.moveTo(((screen.width-document.images[0].width)/2), ((screen.height-document.images[0].height)/2))" onBlur="self.close()">');   // resize the window to match the picture
  PopUpWindow.document.writeln('<img  src="'+ImageName+'" onClick="self.close()">');  //load the image in the window
  PopUpWindow.document.writeln('</body>');
  PopUpWindow.document.writeln('</html>');
  PopUpWindow.document.close();
  PopUpWindow.focus();  // place the window in front
}

function enterSubmit(){
  if (window.event && window.event.keyCode == 13) {
	  document.loginform.submit();
	  return false;
  }
  else 
	  return true;
}


function MM_findObj(n, d) { //v4.01
	var p,i,x;  
  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) 
		x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) 
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) 
	x=d.getElementById(n); 
	return x;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; 
  
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x; 
			if(!x.oSrc) 
				x.oSrc=x.src; 
			//alert(x.src);
			//alert(x.src);
			x.src=a[i+2];
			
		}
}  

function MM_swapImage1() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; 
  
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x; 
			if(!x.oSrc) 
				x.oSrc=x.src; 
			x.src=a[i+2];
		}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
		x.src=x.oSrc;
}

function MM_swapImagePNG() { //v3.0
	var i,j=0,x,a=MM_swapImagePNG.arguments; 
  
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x; 
			if(!x.oStyle) 
				x.oStyle=x.style.cssText; 
			//alert(x.style.cssText);
			x.style.cssText='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + a[i+2] + '\')';
		}
}  

function MM_swapImgRestorePNG() { //v3.0
	var i,x,a=document.MM_sr;
	
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oStyle;i++) 
		x.style.cssText=x.oStyle;
}



function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
	var myLeft = (screen.width-myWidth)/2;
	var myTop = (screen.height-myHeight)/2;
	features+=(features!='')?',':'';
	features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function MM_openBrWindowObject(theURL,winName,myWidth, myHeight, isCenter) 
{ //v3.0
  if(window.screen)
	if(isCenter)
		var myLeft = 5;
		var myTop = 5;
		if(isCenter=="true"){	
			myLeft = (screen.width-myWidth)/2;
			myTop = (screen.height-myHeight)/2;
		}
		okno = window.open(theURL,winName,'location=0,directories=0,scrollbars=no,toolbar=0,menubar=0,resizable=0,status=0,width='+myWidth+',height='+myHeight+',left=' + myLeft+ ',top=' + myTop)
;
  return okno;													  
}


function MM_openBrWindowLocation(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
	var myLeft = (screen.width-myWidth)/2;
	var myTop = (screen.height-myHeight)/2;
	features+=(features!='')?',':'';
	features+=',left='+myLeft+',top='+myTop;
  }
	var okno = window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
	
	okno.location = okno.opener.location;	
}

function openTarget (form, windowName,features, myWidth, myHeight, isCenter) {
	if(window.screen)if(isCenter)if(isCenter=="true"){
	   var myLeft = (screen.width-myWidth)/2;
	   var myTop = (screen.height-myHeight)/2;
	   features+=(features!='')?',':'';
	   features+=',left='+myLeft+',top='+myTop;
	 };
	var formularz = document.getElementById('restauracja');
	alert(form.name);
	
  if (!windowName)
	windowName = 'formTarget' + (new Date().getTime());
  formularz.target = windowName;
  open ('popup.html', windowName, features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}



function openParent(){
   alert(window.opener.document.location);
  //  var parent = window.opener.document;
	//if(parent != null){
	//	parent.location = parent.location;
   // }
}
   
function ChangeDateSearch(form_name, num, path) {
		data_szukania = eval("document."+form_name+".datetype");
		data_szukania.value = num;
	    
		pom1 = eval("document."+form_name+".p1");
		pom2 = eval("document."+form_name+".p2");        
		pom3 = eval("document."+form_name+".p3");
                
		if(num == 1) {
		  pom1.src = path + '/img/radiobutton_on.gif';
		  pom2.src = path + '/img/radiobutton_off.gif';
		  pom3.src = path + '/img/radiobutton_off.gif';
		}
		if(num == 2) {
		  pom2.src = path + '/img/radiobutton_on.gif';
		  pom1.src = path + '/img/radiobutton_off.gif';
		  pom3.src = path + '/img/radiobutton_off.gif';        
		}
		if(num == 3) {
		  pom3.src = path + '/img/radiobutton_on.gif';
		  pom2.src = path + '/img/radiobutton_off.gif';
		  pom1.src = path + '/img/radiobutton_off.gif';
		}
}

function wlacz(){
	okno_radio=MM_openBrWindowObject('radio.html','radio', '208', '124', 'true')
;
}

function wylacz(){
	okno_radio.close();
}

 function Checkminiwyszukiwarka(){
	 if(!CheckString(document.miniwyszukiwarka.tekst_szukaj.value))
	{		alert("Podaj coś do wyszukania.");
				document.miniwyszukiwarka.tekst_szukaj.focus();
				return false;
	}
	return true;
}

 function CheckLoginForm(){
	 if(!CheckString(document.loginform.email.value))
	{		alert("Wpisz login");
				document.loginform.login.focus();
				return false;
	}
	if(!CheckString(document.loginform.hasloAux.value))
   {		alert("Wpisz hasło");
			   document.loginform.haslo.focus();
			   return false;
   }
	return true;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
