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 PopUp_old(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)" 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; 
			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_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 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;
}
