
	function popup(id_strony,id_gal)
		{
		
		window.open('popup.php?id_strony='+id_strony+'&id_gal='+id_gal,'','toolbar=0,status=0,location=0, scrollbars=yes,resizable=no,width=550,height=440');	
		}	


function popup2(jpg)
		{
		window.open('popup.php?jpg='+jpg,'','toolbar=0,status=0,location=0, scrollbars=yes,resizable=no,width=580,height=400');	
		}							



					        function verify(form)
					        {
					           var passed = false;
					        var blnRetval, intAtSign, intDot, intComma, intSpace, intLastDot, intDomain, intStrLen;
					        if (form.Email){
					                       intAtSign=form.Email.value.indexOf("@");
					                        intDot=form.Email.value.indexOf(".",intAtSign);
					                        intComma=form.Email.value.indexOf(",");
					                        intSpace=form.Email.value.indexOf(" ");
					                        intLastDot=form.Email.value.lastIndexOf(".");
					                        intDomain=intDot-intAtSign;
					                        intStrLen=form.Email.value.length;
					                // *** CHECK FOR BLANK EMAIL VALUE
					                   if (form.Email.value == "" )
					                   {
					                alert("Please enter e-mail.");
					                form.Email.focus();
					                passed = false;
					                }
					                // **** CHECK FOR THE  @ SIGN?
					                else if (intAtSign == -1)
					                {
					
					                alert("Please enter valid e-mail : \"@\".");
					                        form.Email.focus();
					                passed = false;
					
					                }
					                // **** Check for commas ****
					
					                else if (intComma != -1)
					                {
					                alert("Please enter valid data...");
					                form.Email.focus();
					                passed = false;
					                }
					
					                // **** Check for a space ****
					
					                else if (intSpace != -1)
					                {
					                alert("Please enter valid data");
					                form.Email.focus();
					                passed = false;
					                }
					
					                // **** Check for char between the @ and dot, chars between dots, and at least 1 char after the last dot ****
					
					                else if ((intDot <= 2) || (intDomain <= 1)  || (intStrLen-(intLastDot+1) < 2))
					                {
					                alert("Please check this .\n" + form.Email.value + " is invalid.");
					                form.Email.focus();
					                passed = false;
					                }  else {
					                 passed = true;
					                }
					        	} else    {
					              passed = true;
					        }  return passed;
					  }










function check_form_optional(form_name) 
  {
  var form = form_name;

  var firstname = form.elements['firstname'].value;
  var lastname = form.elements['lastname'].value;
  var street_address = form.elements['street_address'].value;

  if (firstname == '' && lastname == '' && street_address == '') {
    return true;
  } else {
    return check_form(form_name);
  }
}







function walidacja(thisform)
{
with (thisform)
{
if (emptyvalidation(data_przyjazdu,"Wszystkie wymagane pola muszą być wypełnione : Data przyjazdu")==false) {data_przyjazdu.focus(); return false;};

if (emptyvalidation(imie_nazwisko,"Wszystkie wymagane pola muszą być wypełnione : Imię i Nazwisko")==false) {imie_nazwisko.focus(); return false;};
if (emptyvalidation(adres,"Wszystkie wymagane pola muszą być wypełnione : Adres")==false) {adres.focus(); return false;};
if (emptyvalidation(telefon,"Wszystkie wymagane pola muszą być wypełnione : Telefon")==false) {telefon.focus(); return false;};
if (emptyvalidation(email,"Wszystkie wymagane pola muszą być wypełnione : Adres E-mail")==false) {email.focus(); return false;};
if (emailvalidation(email,"Wprowadzono błędny adres e-mail")==false) {email.focus(); return false;};

}
}


function walidacja_kontaktu(thisform)
{
with (thisform)
{
if (emptyvalidation(imie_nazwisko,"Wszystkie wymagane pola muszą być wypełnione : Imię i Nazwisko")==false) {imie_nazwisko.focus(); return false;};
if (emptyvalidation(email,"Wszystkie wymagane pola muszą być wypełnione : Adres E-mail")==false) {email.focus(); return false;};
if (emailvalidation(email,"Wprowadzono błędny adres e-mail")==false) {email.focus(); return false;};
if (emptyvalidation(telefon,"Wszystkie wymagane pola muszą być wypełnione : Telefon")==false) {telefon.focus(); return false;};

}
}



function walidacja_newsletter(thisform)
{

with (thisform)
{


if (oferty.checked==false && aktualnosci.checked==false)
	{
	alert('Proszę zaznaczyć przynajmniej\n jedną z opcji : oferty, aktualności');	
	return false;
	}

if (emptyvalidation(email,"Wprowadź adres E-mail")==false) {email.focus(); return false;};
if (emailvalidation(email,"Wprowadzono błędny adres e-mail")==false) {email.focus(); return false;};
}
}





function walidacja_rozszerzona(thisform)
{
with (thisform)
{
if (emptyvalidation(data_przyjazdu,"Wszystkie wymagane pola muszą być wypełnione : Data przyjazdu")==false) {data_przyjazdu.focus(); return false;};
if (emptyvalidation(data_wyjazdu,"Wszystkie wymagane pola muszą być wypełnione : Data wyjazdu")==false) {data_wyjazdu.focus(); return false;};

if (emptyvalidation(ilosc_osob,"Wszystkie wymagane pola muszą być wypełnione : Ilość osób")==false) {ilosc_osob.focus(); return false;};
if (digitvalidation(ilosc_osob,1,2,"Wprowadzono błędną ilość osób [poprawnie: od 1 do 2 cyfr]","I")==false) {ilosc_osob.focus(); return false;};


if (emptyvalidation(imie_nazwisko,"Wszystkie wymagane pola muszą być wypełnione : Imię i Nazwisko")==false) {imie_nazwisko.focus(); return false;};
if (emptyvalidation(adres,"Wszystkie wymagane pola muszą być wypełnione : Adres")==false) {adres.focus(); return false;};
if (emptyvalidation(telefon,"Wszystkie wymagane pola muszą być wypełnione : Telefon")==false) {telefon.focus(); return false;};
if (emptyvalidation(email,"Wszystkie wymagane pola muszą być wypełnione : Adres E-mail")==false) {email.focus(); return false;};

if (emailvalidation(email,"Wprowadzono błędny adres e-mail")==false) {email.focus(); return false;};
}
}


function emptyvalidation(entered, alertbox)
{

with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function digitvalidation(entered, min, max, alertbox, datatype)
{

with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") 
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 


function valuevalidation(entered, min, max, alertbox, datatype)
{

with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
}
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 


function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.length-1;
if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 


