function Sprawdz() {
	
	var regname = /^[A-Za-z ęĘóÓąĄśŚłŁżŻĄŹćĆńŃ]{3,100}$/;
	var regphone = /^[0-9 -+]{7,30}$/;
	var regemail = /^[a-z0-9][\w\.-]*\w@([\w-]+\.)*[a-z]{2,4}$/;
	var regtxt = /^[A-Za-z ęĘóÓąĄśŚłŁżŻĄŹćĆńŃ 0-9 -=.,+]{1,1000}$/;
	
	var name = document.getElementById("name").value;
	var phone = document.getElementById("phone").value;
	var mail = document.getElementById("mail").value;
	var txt = document.getElementById("txt").value;

	if(!regname.test(name)||name=='Imię i Nazwisko') return ShowMessage("Podaj swoje imię");
	//if(!regphone.test(phone)) return ShowMessage("Podaj numer telefonu");
	if(!regemail.test(mail)) return ShowMessage("Podaj prawidłowy adres email");
	//if(!regtxt.test(txt)||txt=='Wiadomo¶ć') return ShowMessage("Wpisz tre¶ć wiadomo¶ci");
	return true;
}

function Sprawdz_zamow_kat() {
	
	var regname = /^[A-Za-z ęĘóÓąĄśŚłŁżŻĄŹćĆńŃ]{3,100}$/;
	var regphone = /^[0-9 -+]{7,30}$/;
	var regemail = /^[a-z0-9][\w\.-]*\w@([\w-]+\.)*[a-z]{2,4}$/;
	var regtxt = /^[A-Za-z ęĘóÓąĄśŚłŁżŻĄŹćĆńŃ 0-9 -=.,+]{1,1000}$/;
	
	var imie = document.getElementById("imie").value;
	var nazwisko = document.getElementById("nazwisko").value;
	var ulica = document.getElementById("ulica").value;
	var miasto = document.getElementById("miasto").value;
	var kod = document.getElementById("kod").value;

	if(imie!='' && nazwisko!='' && ulica!='' && miasto!='' && kod!='')
	{
		alert("Wiadomość została wysłana");
		return true;
	}
	else
	{
		alert("Wiadomość nie została wysłana.\n Wypełnij pola z gwiazdką.");
		return false;
	}
}

function ShowMessage(txt) {
	document.getElementById("Message").innerHTML = '<b><font color="#800000">'+txt+'</font></b>';
	return false;
}


$(document).ready(function(){
  //$.preloadCssImages({ 'imgDir': '../pliki' });
  $(".lightbox").lightbox();
  $("html").css({"overflow-y":"scroll"});
  
   $("input.wyslij").hover(
      function () {
        $(this).attr("src","pliki/wyslij_over.gif");
      }, 
      function () {
        $(this).attr("src","pliki/wyslij.gif");
      }
    );

  for(ni=1;ni<=5;ni++)
  {
   $(".buttony a.but"+ni).hover(
      function () {
        nazwa_css=$(this).attr('class');
		id_but=nazwa_css.replace(" graf", "");
		id_but=id_but.replace("but", "");
		//alert(id_but)
		$("#linia"+id_but).css("visibility", "visible");//css({"visibility":"visible"});
      }, 
      function () {
        $("#linia"+id_but).css("visibility", "hidden");//css({"visibility":"hidden"});
      }
    );
  }

    $(".lightbox").hover(
      function () {
			$(this).children("img").animate({opacity: 0.7}, 300,"linear");
      }, 
      function () {
			$(this).children("img").animate({opacity: 1}, 300,"linear");        
      }
    ); 

/*	
	$('.lightbox').ahover({moveSpeed: 100, hoverEffect: function() {
        $(this)
            .css({opacity: 0.99})
            .animate({opacity: 0.5}, 750)
            .animate({opacity: 0.99}, 750)
            .dequeue();
        $(this).queue(arguments.callee);
    }});
*/
	
  /*
			css({opacity: 0.99})
            .animate({opacity: 0.5}, 750)
            .animate({opacity: 0.99}, 750)
			*/
  
  
      $(".menu_lewe .main li a.rozwin").each(function () {
		if($(this).next().css('display')=='block')
		{
          $(this).html("-");
		}
      });

  

	  $(".menu_lewe .main li a.rozwin").click(function(){

			if ($(this).next().is(":hidden")){$(this).next().show('slow');}
			else{$(this).next().hide('slow');}
			if($(this).html()=='+'){$(this).html('-');}
			else{$(this).html('+');}
			return false;

	  }); 

  
    var options_wyslij = {
          //target:        '#myList',   // target element(s) to be updated with server response
          //beforeSubmit:  showRequest,  // pre-submit callback
          url: 'ajax.php',
		  resetForm: true,
          success:       showResponse_tekst
      };
  function showResponse_tekst(responseText, statusText)  {
   //alert('zmiany zapisane\n'+responseText);
	//$("#form_kontaktowy textarea").text(responseText);
	//editable_kat(".kategorie p");
    alert(responseText);
	//$('td.but_radio').jForms();
	//$('td.but_radio .chosen').removeClass('chosen');	
	//$('td.but_radio .radioAreaChecked').removeClass('radioAreaChecked');
  }

$("#form_kontaktowy").submit(function(){
	/*
	var imie = document.getElementById("imie").value;
	var nazwisko = document.getElementById("nazwisko").value;
	var ulica = document.getElementById("ulica").value;
	var miasto = document.getElementById("miasto").value;
	var kod = document.getElementById("kod").value;
	
   if(imie!='' && nazwisko!='' && ulica!='' && miasto!='' &&kod!='')
   {
	alert("Wiadomość została wysłana.");
	$(this).ajaxSubmit(options_wyslij);
   }
   else
   {
	alert("Wiadomość nie została wysłana.\n Wypełnij pola z gwiazdką.");
   }
   */
   $(this).ajaxSubmit(options_wyslij);
   return false;
  }); 

$("#formz").submit(function(){
	var p2a=document.formz['2a'].value;
	var p2b=document.formz['2b'].value;
	var p2c=document.formz['2c'].value;
	var p3a=document.formz['3a'].value;
	var p3b=document.formz['3b'].value;
	var p3c=document.formz['3c'].value;
	var p3d=document.formz['3d'].value;
	var p3e=document.formz['3e'].value;
	var p4a=document.formz['4a'].value;
	var p4b=document.formz['4b'].value;
	var p4c=document.formz['4c'].value;
	
   if(p2a!='' && p2b!='' && p2c!='' && p3a!='' && p3b!='' && p3c!='' && p3d!='' && p3e!='' && p4a!='' && p4b!='' && p4c!='')
   {
	//alert("Wiadomość została wysłana.");
	$(this).ajaxSubmit(options_wyslij);
   }
   else
   {
	alert('Wypełnij pola z gwiazdką !!!');
   }
   return false;
  }); 
  
  
$("table.fotorelacje tr:odd").css("background-color", "#f1efdc");
$("table.fotorelacje tr:even").css("background-color", "#eee7c9");
  
});
function otworz(adres,szer,wys,tytul,wj,hj) {
//wj jednostka szerokosci
//hj jednostka wysokosci
//1 => px, 2 => %	
  /* szer=690;
  wys=390; */
  if(wj==2)
  {
  szer=(screen.width*szer)/100;
  lewa=(screen.width-szer)/2;  
  }
  else
  {
  lewa=(screen.width-szer)/2;
  }
  
  if(hj==2)
  {
  wys=(screen.height*wys)/100;
  prawa=(screen.height-wys)/2;   
  }  
  else
  {
  prawa=(screen.height-wys)/2;
  }
noweOkno = window.open(adres, tytul, 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=no, status=no, width='+szer+', height='+wys+', left='+lewa+', top='+prawa)
noweOkno.focus();
}
/* var so = new SWFObject("pliki/flash.swf", "mymovie", "910", "268", "8", "#000000");
so.addParam("wmode", "transparent");
so.write("baner"); */
