	function ChangeImage(action, co)

	{

		if (action == "on")

		{

			podmiana = co.src.substring(0,co.src.length - 4)+"_over.gif"

			co.src=podmiana;

		}

		else

		{

			podmiana = co.src.substring(0,co.src.length - 9)+".gif"

			co.src=podmiana;

		}

	}

		

	function ustawCookie(nazwa, wartosc, expire)

	{

		document.cookie = nazwa + "=" + escape(wartosc) + ((expire==null)?"" : ("; expires=" + expire.toGMTString()))

	} 

		

	function pokazCookie(nazwa)

	{

		if (document.cookie!="")

		{

			var toCookie=document.cookie.split("; ");

			for (i=0; i<toCookie.length; i++)

			{

				var nazwaCookie=toCookie[i].split("=")[0];

				var wartoscCookie=toCookie[i].split("=")[1];

				if (nazwaCookie==nazwa) return unescape(wartoscCookie)

			}

		}

	}

	

	function setTypeMaps(typ)

	{

		if (typ == 'map')

		{

			mapa.setMapType(G_NORMAL_MAP);

		}

		else if (typ == 'teren')

		{

			mapa.setMapType(G_PHYSICAL_MAP);

		}

		else if (typ == 'satelite')

		{

			mapa.setMapType(G_SATELLITE_MAP);

		}

		ustawCookie('typmapy', typ);

	}

		

	function ustawTypMapy()

	{

		var typ = pokazCookie('typmapy');

			

		if (typ == "")

		{

			var ntyp = "map";

		}

		setTypeMaps(typ);

		$("#typ#"+typ).addClass('mapTypSel');

	}

		

	function MM_jumpMenu(targ,selObj,restore)

	{

		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

		if (restore) selObj.selectedIndex=0;

	}

	

	function wylacz ()

	{

		document.getElementById("divek").style.display="none";

		document.getElementById("popup").style.display="none";

	}

	

	function zIndexOff()

	{

		$("#topmenu").css({'z-index':''});

	}

		

		jQuery(function($){
		
		$("#fb_widget").hover(function(){
			$("#fb_widget").stop(true, false).animate({right:"0"},"medium");
		},function(){
			$("#fb_widget").stop(true, false).animate({right:"-292"},"medium");
		},500);
		
		$("#op_widget").hover(function(){
			$("#op_widget").stop(true, false).animate({right:"0"},"medium");
		},function(){
			$("#op_widget").stop(true, false).animate({right:"-292"},"medium");
		},500);
		
		$("#op_widget form img").click(function()
		{
			var sugestia = $("#filed_sugestia").attr("value");
			var email = $("#filed_sugestia_email").attr("value");
			var error = parseInt(0);
			
			if (sugestia == "")
			{
				$("#text_sugestia").text("Musisz podać treść opini!");
				$("#text_sugestia").addClass('alert');
				error = error + 1;
			}
			else if (sugestia != "")
			{
				$("#text_sugestia").text("Twoja sugestia:");
				$("#text_sugestia").removeClass('alert');
				error = error + 0;
			}
			
			if (email == "")
			{
				$("#text_sugestia_email").text("Musisz podać adres e-mail!");
				$("#text_sugestia_email").addClass('alert');
				error = error + 1;
			}
			else if (email != "")
			{
				$("#text_sugestia_email").text("Twój adres e-mail:");
				$("#text_sugestia_email").removeClass('alert');
				error = error + 0;
			}
			
			if (error == 0)
			{
				$.ajax({
					async : false,
					type: 'POST',
					url: "http://www.vtour.pl/vtour/ajax/mail/opinia.php",
					data : { 
						"sugestia" : sugestia, 
						"email" : email
					}
				});
				$("#op_widget form").html('<strong class="alert">Dziękujęmy za Twoją sugestię!</strong>');
			}
		});


			

			$.fn.wait = function(time, type)

			{

				time = time || 1000;

				type = type || "fx";

				return this.queue(type, function()

				{

					var self = this;

					setTimeout(function()

					{

						$(self).dequeue();

					}, time);

				});

			};

			

			$("#popup").flash({ 

				src: 'http://www.vtour.pl/vtour/files/Flash/gigapano.swf',

				width: 688,

				height: 400,

				wmode: 'transparent'

			});

			

			$("#topmenu").flash({ 

					src: 'http://www.vtour.pl/vtour/files/Flash/menu_top.swf',

					width: 1100,

					height: 240,

					wmode: 'transparent'

			});

			

			$("#topmenuSlim").flash({ 

				src: 'http://www.vtour.pl/vtour/files/Flash/menu_top_slim.swf',

				width: 1100,

				height: 40,

				wmode: 'transparent'

			});

			

			$("#topmenu").mouseenter(function()

			{

				$(this).css({'z-index':'1'});

			}).mouseleave(function()

			{

				zIndexOff();

			});

		

			$("#home_offer_no a").click(function()

			{

				zmienObrazek($(this).attr("href"));

			});

		

			$("#maps").flash({ 

					src: 'http://www.vtour.pl/vtour/files/Flash/map_gps.swf',

					width: 247,

					height: 210,

					wmode: 'transparent'

				});

				



				

			$("#ban750").flash({ 

					src: 'http://www.vtour.pl/vtour/files/Flash/banner/konkurs750.swf',

					width: 750,

					height: 100

				});

				

				$('#banners').flash({ 

					src: 'http://www.vtour.pl/vtour/files/Flash/vtour.swf',

					width: 239,

					height: 73,

					wmode: 'transparent'

				});

			

			

			$(".FlashHomeNext, .FlashHomePrev").click(function()

			{

				var opt = $(this).attr("id").split("#");

				changeHomeFlash(opt[0], opt[1]);

			});

			

			$(".FlashHomeHd").click(function()

			{

				var ids = $(this).attr("id").split("#");

				var status = $("#hd_"+ids[1]).attr("value");

				var curr = $("#position_"+ids[1]).attr("value");

				var flash = "";

				

				if (ids[1] == 'town')

				{

					var flashDir = 'miasta';

				}

				else if (ids[1] == 'local')

				{

					var flashDir = 'obiekty';

				}

				

				window.open('http://www.vtour.pl/vtour/files/Flash/best/'+flashDir+'/'+curr+'_out.swf');

			});

			

			$(".FlashHomeQuality").click(function()

			{

				var ids = $(this).attr("id").split(":");

				var status = $("#hd_"+ids[1]).attr("value");

				var curr = $("#position_"+ids[1]).attr("value");

				var flash = "";

						

				if (ids[1] == 'town')

				{

					var flashDir = 'miasta';

				}

				else if (ids[1] == 'local')

				{

					var flashDir = 'obiekty';

				}

						

				window.open('http://www.vtour.pl/vtour/files/Flash/best/'+flashDir+'/'+curr+'.jpg');

			});

		

			$(".woj_maps_list span").click(function()

			{

				$(".woj_maps_list div").hide();

				var ids = $(this).attr("id").split("-");

				var id = ids[1];

				$("#box-"+id).show();

			});

		

			$("div#object_town_list_box span").click(function()

			{

				$("#woj_title").text($(this).attr("name"));

				var link = $(this).attr("id");

				$("#lista_obiektow_woj").html('<div style="padding:10px; text-align:center"><img src="http://www.vtour.pl/vtour/files/Image/gfx/load_objekty.gif" alt="" /></div>');

				$("#lista_obiektow_woj").load("http://www.vtour.pl/vtour/ajax/lista_obiektow_woj.php?woj="+link);

			});

			

			$("#town_list_region").change(function()

			{

				$("#town_list_box").html('<em>Pobieram listę miast... Czekaj</em>');

				

				var id = $(this).attr("value");

			

				var link = "select_town.php?id="+id;

				$.get("http://"+window.location.host+"/vtour/ajax/"+link+"&nocache="+(Math.random()*555), function(data){ $("#town_list_box").html(data) });

			});

			

			$("#town_list_region_reccom").change(function()

			{

				$("#town_list_box_reccom").html('<em>Pobieram listę miast... Czekaj</em>');

				

				var id = $(this).attr("value");

			

				var link = "select_town.php?id="+id;

				$.get("http://"+window.location.host+"/vtour/ajax/"+link+"&nocache="+(Math.random()*555), function(data){ $("#town_list_box_reccom").html(data) });

			});

			

			$("#recommended_enter").click(function()

			{

				var idm = $("#town_list_box select").attr("value");

				var link = "http://"+window.location.host+"/pl/polec/"+idm;

				document.location=link;

			});

			

			/*

			$("#town_list_box_reccom select").livequery('change', function(event)

			{

				var idm = $(this).attr("value");

				var link = "http://"+window.location.host+"/pl/polec/"+idm;

				document.location=link;

			});

			*/

			

			$("#pan_others").change(function()

			{

				var v = $(this).attr("value");

				document.location=v;

			});

			

			$("#btn_search").click(function()

			{

				var fraza = $("#input_search").attr("value");

				

				if (fraza.length > 2)

				{

					document.location='http://www.vtour.pl/pl/tag/'+fraza;

				}

			});

		

			$("#townTitle select").change(function()

			{

				var v = $(this).attr("value");

				$("#townSelect").text('Trwa wyszukiwanie w bazie...');

				$("#townSelect").load('http://'+window.location.host+'/vtour/ajax/lista_miast.php?woj='+v);

			});

		

			$("#townSelect").load('http://'+window.location.host+'/vtour/ajax/lista_miast.php');

			

			$("#woj_list_top").change(function()

			{

				var idwoj = $(this).attr("value");

				

				$(".login_select_town").hide();

				$("#select_woj_"+idwoj).show();

				$("#select_woj_"+idwoj).val('');

				$("#maps img").hide();

				

				$("#maps img.maps_point").show();

				$("#woj"+idwoj).show();

			});

			

			$(".maps_point").mouseover(function()

			{

				var pos = $(this).offset();



				vleft = pos.left + 12;

				vtop = pos.top + 12

				

				var alt = $(this).attr("alt");

				

				$("#town_alt").show();

				$("#town_alt").text(alt);

				$("#town_alt").css({left: vleft+'px', top : vtop+'px'});

			}).mouseout(function()

			{

				$("#town_alt").hide();

			});

			

			$(".login_select_town").change(function()

			{

				var nm = $(this).attr("value");

				var link = "http://"+window.location.host+"/pl/miasto/"+nm;

				document.location=link;

			});

			

			$("#panInfoRealList img").click(function()

			{

				var link = $(this).attr("src");

				var ids = $(this).attr("id").split("-");

				$("#realisation-no").val(ids[2]);

				$("#realisation-big").attr({src: link});

			});

			

			$(".realNavig").click(function()

			{

				var nav = $(this).attr("name");

				

				var currents = $("#realisation-no").attr("value");

				var maxs = parseInt($("#realisation-maxs").attr("value")) - 1;

				

				if (nav == "next")

				{

					var position = parseInt(currents) + parseInt(1);

				}

				else

				{

					var position = parseInt(currents) - parseInt(1);

				}

				

				if (position >= 0)

				{

					if (position <= maxs)

					{

						var link = $("#realisation-img-"+position).attr("src");

						$("#realisation-big").attr({src: link});

						$("#realisation-no").val(position);

					}

				}

			});

			

			$("#select_category, #sel_search_real_obj").change(function()

			{

				var val = $(this).attr("value");

				

				if (val != "")

				{

					var link = "http://www.vtour.pl/pl/obiekty/"+val;

					document.location.href = link;

				}

			});

			

			$("#sel_search_real_woj").change(function()

			{

				var val = $(this).attr("value");

				

				if (val != "")

				{

					var link = "http://www.vtour.pl/pl/realizacje/"+val;

				}

				else

				{

					var link = "http://www.vtour.pl/pl/realizacje";

				}

				

				document.location.href = link;

			});

			

			$("#form-register input").blur(function()

			{

				var field = $(this).attr("value");

				

				if (field == "")

				{

					alert ('u');

				}

			});

			

			$(".obj_pos, .obj_pos_sel").click(function()

			{

				var ids = $(this).attr("id").split("_");

				

				var check = $("#obj_inp_"+ids[2]).attr('value');

				if (check == 0)

				{

					$(this).removeClass('obj_pos');

					$(this).addClass('obj_pos_sel');

				

					$("#obj_img_"+ids[2]).attr({'src' : 'http://www.vtour.pl/vtour/files/Image/gfx/arrow_sel.gif'});

					$("#obj_inp_"+ids[2]).val('1');

				}

				else

				{

					$(this).removeClass('obj_pos_sel');

					$(this).addClass('obj_pos');

				

					$("#obj_img_"+ids[2]).attr({'src' : 'http://www.vtour.pl/vtour/files/Image/gfx/arrow_nosel.gif'});

					$("#obj_inp_"+ids[2]).val('0');

				}

			});

			

			$(".woj_pos, .woj_pos_sel").click(function()

			{

				var ids = $(this).attr("id").split("_");

				

				var check = $("#woj_inp_"+ids[2]).attr('value');

				if (check == 0)

				{

					$(this).removeClass('woj_pos');

					$(this).addClass('woj_pos_sel');

				

					$("#woj_img_"+ids[2]).attr({'src' : 'http://www.vtour.pl/vtour/files/Image/gfx/arrow_sel.gif'});

					$("#woj_inp_"+ids[2]).val('1');

				}

				else

				{

					$(this).removeClass('woj_pos_sel');

					$(this).addClass('woj_pos');

				

					$("#woj_img_"+ids[2]).attr({'src' : 'http://www.vtour.pl/vtour/files/Image/gfx/arrow_nosel.gif'});

					$("#woj_inp_"+ids[2]).val('0');

				}

			});

			

			$("#home_offer_no a").click(function()

			{

				var l = $(this).attr("href").split("-");

				

				$("#home_offer_no li").removeClass('home_offer_no_selected');

				$("#home_offer_no li#home-no-"+l[1]).addClass('home_offer_no_selected');

			});

			

			$("#hd").click(function()

			{

				var ch = $("#check_hd").attr("value");

				

				if (ch == 0)

				{

					alert ('Przepraszamy, tej panoramy nie moĹĽesz oglÄ…daÄ‡ w innej jakoĹ›ci');

				}

				else

				{

					var lengt = $("#patch_hd").attr("value").length;

					var extension = $("#patch_hd").attr("value").substring(lengt - 7,lengt);

					if (extension == "out.swf")

					{

						var new_url = $("#patch_hd").attr("value").substring(0,lengt - 8)+'.swf';

						var hd_icon = 'http://www.vtour.pl/vtour/files/Image/gfx/btn_hd_off.gif';

						var hd_icon_alt = "WĹ‚Ä…cz wysokÄ… jakoĹ›Ä‡ panoramy";

						settings ('Hd', 0);

						

						$("#patch_hd").val(new_url);



						$('#hd').attr({src: hd_icon, title: hd_icon_alt, alt: hd_icon_alt});

						$('#panFlash').html('');

						$('#panFlash').flash({ 

							src: new_url,

							width: 590,

							height: 400,

							wmode: 'transparent',

							allowfullscreen: true

						});

						

					}

					else

					{

						var new_url = $("#patch_hd").attr("value").substring(0,lengt - 4)+'_out.swf';

						var hd_icon = 'http://www.vtour.pl/vtour/files/Image/gfx/btn_hd_on.gif';

						var hd_icon_alt = "WyĹ‚Ä…cz wysokÄ… jakoĹ›Ä‡ panoramy";

						settings ('Hd', 1);

						

						$("#patch_hd").val(new_url);



						$('#hd').attr({src: hd_icon, title: hd_icon_alt, alt: hd_icon_alt});

						$('#panFlash').html('');

						$('#panFlash').flash({ 

							src: new_url,

							width: 590,

							height: 400,

							wmode: 'transparent',

							allowfullscreen: true

						});

						

					}

					

				}

			});

			

			$("#pan_dost").click(function()

			{

				$("#pan_dostosuj").show();

			});

			

			$("#pan_dostosuj input").blur(function()

			{

				var pan_x = $("#pan_x").attr("value");

				var pan_y = $("#pan_y").attr("value");

				var pan_miasto = $("#pan_miasto").attr("value");

				var pan_panorama = $("#pan_panorama").attr("value");

				

				$("#code_iframe_pan").val('<br /><small><a href="http://www.vtour.pl/hd.php?im='+pan_miasto+'&id='+pan_panorama+'">WyĹ›wietl wiÄ™kszÄ… panoramÄ™</a></small>')

			});

			

			$("#last_aktu_slider strong").click(function()

			{

				var years = $(this).attr("id").split("_");

				var year = years[1];

				

				$("#last_aktu_slider strong").removeClass("year_active");

				$(this).addClass("year_active");

				

				$("#news_in_year").html('<div style="text-align:center; padding:20px;"><img src="http://www.vtour.pl/vtour/files/Image/gfx/ajax_news_load.gif" alt="" /></div>');

				

				$("#news_in_year").load('http://'+window.location.host+'/vtour/ajax/news_list.php?y='+year);

			});

			

			$("#new_reccom_no span").click(function()

			{

				var poss = $(this).attr("id").split("_");

				var pos = poss[1];

				

				$("#new_reccom_no span").removeClass("reccom_no_selected");

				$(this).addClass("reccom_no_selected");

				

				$(".news_reccom_box").hide();

				$("#reccom_"+pos).show();

			});

			

			$("#real_list span").click(function()

			{

				wczytajRealizacje($(this).attr("id"));

			});

			

			$("#bootom_navig img").mouseenter(function()

			{

				var toll = $(this).attr("name");

			

				if (toll != "")

				{

					$("#footer_tolltip").text(toll);

					$("#footer_tolltip").show();

					

					// ustawienia pozycji dymku

					var pos = $(this).offset();

					var vleft = pos.left;

					$("#footer_tolltip").css({left: vleft+'px'});

				}

			}).mouseleave(function()

			{

				$("#footer_tolltip").hide();

			});

			

			// rozwijanie rollupow

			$("#footer_last").click(function()

			{

				$("#footer_tolltip").hide();

				var stan = $("#footer_rollup").css('display');

				

				if (stan == 'none')

				{

					$("#footer_rollup").html('');

					var pos = $(this).offset();

					var vleft = pos.left;

					$("#footer_rollup").css({left: vleft+'px'});

					$("#footer_rollup").slideDown("slow", function () { $("#footer_rollup").html('<div style="text-align:center; margin-top:190px"><img src="http://www.vtour.pl/vtour/files/Image/gfx/load_fotter_rollup.gif" /></div>'); });

					$("#footer_rollup").load("http://"+window.location.host+"/vtour/ajax/footer_last_pans.php");

				}

				else

				{

					$("#footer_rollup").slideUp("slow");

				}

			});

						

			$("#powiadom_save").click(function()

			{

				var email = $("#powiadom_email").attr("value");

				var idm = $("#powiadom_idm").attr("value");

				

				$("#alert_powiadom").text('');

				

				$("#load_powiadom").show();

				

				if (email == "")

				{

					$("#load_powiadom").hide();

					$("#alert_powiadom").html('<br />Prosimy wpisać adres e-mail.');

				}

				else if(!email.match(/^([a-z0-9_.-]+)@[a-z0-9-_]+([.][a-z0-9-_]+)+$/i))

				{

					$("#load_powiadom").hide();

					$("#alert_powiadom").html('<br />Podany adres e-mail jest niepoprawny.');

				}

				else

				{

					$.get("http://"+window.location.host+"/vtour/ajax/check_email_powiadom.php?email="+email+"&idm="+idm, function(data){ viewAlertPowiadom(data) });

				}

			});

			

			

			function viewAlertPowiadom(data)

			{

				$("#load_powiadom").hide();

				$("#alert_powiadom").html(data)

			}

			

			$("#patch a").hover(

			

			function()

			{

			

				var box = $(this).attr("name").split("&");

				var pos = $(this).offset();

				

				if (box != "")

				{

					vleft = pos.left + 22;

					vtop = pos.top + 12;

				

					$("#patch_link").show();

					$("#patch_link").html('pobieram dane...');

					$("#patch_link").load('http://'+window.location.host+'/vtour/mod/header_'+box[0]+'.php?id='+box[1]);

					$("#patch_link").css({left: vleft+'px', top : vtop+'px'});

				}

				

			},

			function()

			{

				setTimeout("timedCount()",4000);

			});

		});

		

		function timedCount()

		{

			$("#patch a").mouseleave(function()

			{

				$("#patch_link").hide();

			

				$("#patch_link").hover(function()

				{

					$("#patch_link").show();

				},

				function()

				{

					$("#patch_link").hide();

				});

			});

		}

		

		

		function wczytajRealizacje(id)

		{

			var ids = $('#'+id).attr("name").split("#");

			$("#real_list span").removeClass('realSelected');

			$('#'+id).addClass('realSelected');

				

			$("#question_name").text(ids[2]);

			$("#question_real").attr({src: 'http://www.vtour.pl/vtour/files/Image/gfx/img_selected_real_'+ids[1]+'.jpg'});

				

			$("#load_ctn_pan").text(ids[3]);

			$("#load_ctn_obj").text(ids[4]);

			$("#question_link").text(ids[5]);

			$("#question_link").attr({ href : 'http://'+ids[5]});

			$("#real_list_now").val(id);

		}

		

			function changeHomeFlash(direction, div)

			{

				var position = $("#position_"+div).attr("value");

				var quality = $("#hd_"+div).attr("value");

				var curr = 0;

				

				if (div == 'town')

				{

					var flashMax = 14;

					var flashDir = 'miasta';

				}

				else if (div == 'local')

				{

					var flashMax = 29;

					var flashDir = 'obiekty';

				}

				

				if (quality == 1)

				{

					var flashQuality = "out";

				}

				else if (quality == 0)

				{

					var flashQuality = "mini";

				}

				

				if (direction == 'next')

				{

					if (position < flashMax)

					{

						curr = parseInt(position) + parseInt(1);

					}

					else

					{

						curr = 0;

					}

				}

				else if (direction == 'prev')

				{

					if (position <= 0)

					{

						curr = flashMax;

					}

					else

					{

						curr = parseInt(position) - parseInt(1);

					}

				}

				

				$("#position_"+div).val(curr);

				

				$("#flash_"+div).html('');

				$("#flash_"+div).flash({ 

					src: 'http://www.vtour.pl/vtour/files/Flash/best/'+flashDir+'/'+curr+'_mini.swf',

					width: 260,

					height: 110

				});

			}

			setInterval("changeHomeFlash('next', 'town');", 15000);

			setInterval("changeHomeFlash('next', 'local');", 20000);

			

			function zmienObrazek(stan)

			{

				var n = stan.split("#");

				stan = n[1];

				

				$("#home_offer_no li").removeClass('home_offer_no_selected');

				



				var curr = $("#offerCurrent").attr("value");

				$("#offerCurrent").val(stan);

				

				$("#offer"+curr).animate({opacity: 0.0}, 2000);

				$("#offer"+stan).animate({opacity: 1.0}, 2000);

				

				$("#home_offer_no li#home-no-"+curr).addClass('home_offer_no_selected');

			}

		

		function wczytajRealizacjeAuto()

		{

			var next = parseInt($("#real_list_now").attr("value")) + 1;

			if (next == 11) { next = 1; }

			wczytajRealizacje(next);

		}

		setInterval("wczytajRealizacjeAuto();", 15000);

		



		

		function settings(names, values)

		{

			//alert (values);

			var link = "session.php?names="+names+"&values="+values;

			$.get("http://"+window.location.host+"/vtour/ajax/"+link+"&nocache="+(Math.random()*555), function(data){ settingAllert(data) });

		}

		

		function settingAllert(data)

		{

			

		}


