 $(document).ready(function(){
    
	/** $("#ins").click(function () { 
		
		 $("#newsa").attr({value:"insert"});
	 });
	 $("#del").click(function () {
		
		 $("#newsa").attr({value:"delete"});
	 });**/

    $("#cargo").click(function () { 
      $("#osobowe").attr("src", "gfx/find_po_off.gif") ;
	  $("#cargo").attr("src", "gfx/find_pc_on.gif");
	  $("#helpdla").removeClass("bad");
	  $("#helpdla").html("Wybierz ten rodzaj rezerwacji jeśli chcesz zarezerwować przejazd cargo,<br /> autobus, samochód ciężarowy itp.");
		$("#jakiform").attr("value", "2");
		$("#miesiacod").attr("value", "0");
		$("#dzienwyj").attr("value", "0");
		$("#miesiacpo").attr("value", "0");
		$("#powrotdn").attr("value", "0");
		
    });
	$("#osobowe").click(function () { 
      $("#osobowe").attr("src", "gfx/find_po_on.gif") ;
	  $("#cargo").attr("src", "gfx/find_pc_off.gif");
	  $("#helpdla").removeClass("bad");
	   $("#helpdla").html("Wybierz ten rodzaj rezerwacji jeśli chcesz płynąć sam, z rodziną, z przyjaciółmi.<br />Opcjonalnie możesz zabrać samochód, rower, motocykl, możesz wynająć kabinę.");
	    $("#jakiform").attr("value", "1");
		$("#miesiacod").attr("value", "0");
		$("#dzienwyj").attr("value", "0");
		$("#miesiacpo").attr("value", "0");
		$("#powrotdn").attr("value", "0");
		
    });
	

	$("#buton").click(function () { 
			
		
		//alert($("#dzienwyj").attr("value"));
		if($("#strona").attr("value")==1 && $("#powrotdn").attr("value")==0)
		{
			$("#helpdla").removeClass("ok");
			$("#helpdla").addClass("bad");
			$("#helpdla").html("Wypełnij pole \"Powrót dnia\" jest to pole wymagane! <br />Wybierz miesiąc i dzień powrotu.");
			return false;
		}
		else if($("#strona").attr("value")==0 && $("#dzienwyj").attr("value")==0)
		{
			$("#helpdla").removeClass("ok");
			$("#helpdla").addClass("bad");
			$("#helpdla").html("Wypełnij pole \"Wyjazd dnia\" jest to pole wymagane! <br />Wybierz miesiąc i dzień wyjazdu.");
			return false;
		}
		else 
		{
			return true;
		}
		
		
	 });
	
	
	$(".powrot").hide();
	$("#strona").change(function () {
        if($("#strona").attr("value") == "1")
		{			 
			  $("#tr").removeAttr("style");
			 
			  $(".powrot").fadeIn("slow");
			  //$("#dzienwyj").attr({onchange:"this.form.submit();"});
		}
		else
		{
			 $(".powrot").fadeOut("slow");
			 $("#dzienwyj").removeAttr("onchange");
		}
        })
        .change();
		

  });
 
 
/** menu **/

b0off = new Image();
b0off.src = "gfx/btn_rez.gif";
b0on = new Image();
b0on.src = "gfx/btn_rez1a.gif";

b1off = new Image();
b1off.src = "gfx/btn_pol.gif";
b1on = new Image();
b1on.src = "gfx/btn_pol1a.gif";

b2off = new Image();
b2off.src = "gfx/btn_zap.gif";
b2on = new Image();
b2on.src = "gfx/btn_zap1a.gif";

b3off = new Image();
b3off.src = "gfx/btn_car.gif";
b3on = new Image();
b3on.src = "gfx/btn_car1a.gif";

b4off = new Image();
b4off.src = "gfx/btn_akt.gif";
b4on = new Image();
b4on.src = "gfx/btn_akt1a.gif";

b5off = new Image();
b5off.src = "gfx/btn_onas.gif";
b5on = new Image();
b5on.src = "gfx/btn_onas1a.gif";

b6off = new Image();
b6off.src = "gfx/btn_oarmatorach.gif";
b6on = new Image();
b6on.src = "gfx/btn_oarmatorach1a.gif";

b7off = new Image();
b7off.src = "gfx/btn_kontakt.gif";
b7on = new Image();
b7on.src = "gfx/btn_kontakt1a.gif";

function myfun() {
	if (xmenu == 0) {
		document.gfx['b1'].src=b1off.src;
	}
}

function myfun2() {
	if (ymenu == 0) {
		document.gfx['b2'].src=b2off.src;
	}
}

 function pokaz(co) {


	if (document.getElementById){
		
		if(document.getElementById(co).style.display=="none"){
			document.getElementById(co).style.display="block";
		}
		else{
			document.getElementById(co).style.display="none";
		}
	}
	else if (document.all){
		
		if(document.getElementById[co].style.display=="none"){
			document.all[co].style.display="block";
		}
		else{
			document.all[co].style.display="none";
		}

	}
	else{
		alert("Twoja przegl?darka nie obsługuje JS poprawnie.");
	}

}

function opensmallwindow(w,h) {
 smallwindow = window.open("", "smallwindow", "width="+w+", height="+h+", toolbar=no, scrollbars=yes");
 x = (screen.Width/2)-(w/2);
 y = (screen.Height/2)-(h/2);
 smallwindow.moveTo(x,y);
 smallwindow.focus();
}