<!-- //

//============ bochniarz =======================
function wyslijOpinie()
{
	var email = jQuery("#email_opinia").val();
	var tresc = jQuery("#opinia").val();
	
	jQuery("#komunikat_opinia").show();
	jQuery("#komunikat_opinia").html("Wysyłanie wiadomości...");
	
	jQuery.post("/ajax/wyslijOpinie.php", { email: email, tresc: tresc, jezyk: 1 }, 
		function(data){ 
			
			
			
			var info = data.split("|");
			//alert(info[0]+" - "+info[1]) ;
			
			if(info[0]=="OK")
			{				
				jQuery("#email_opinia").val("");
				jQuery("#opinia").val("");
			}
			
			jQuery("#komunikat_opinia").html(info[1]).delay(2000);	
			jQuery("#komunikat_opinia").hide(200);
		});
	
	//alert(email+" "+tresc);
}

function wyslijWiadomosc()
{
	var email = jQuery("#email_wiadomosc").val();
	var tresc = jQuery("#zapytanie_wiadomosc").val();
	
	jQuery("#komunikat_wiadomosc").show();
	jQuery("#komunikat_wiadomosc").html("Wysyłanie wiadomości...");
	
	jQuery.post("/ajax/wyslijZapytanie.php", { email: email, tresc: tresc, jezyk: 1 }, 
		function(data){
			
			var info = data.split("|");
			
			if(info[0]=="OK")
			{				
				jQuery("#email_wiadomosc").val("");
				jQuery("#zapytanie_wiadomosc").val("");
			}
			
			
			jQuery("#komunikat_wiadomosc").html(info[1]).delay(2000)
			jQuery("#komunikat_wiadomosc").hide(200);
			//alert(info[1]);	
	
		});
}

//============ bochniarz =======================

function BullStatistic()
{
	var colorDepth = window.screen.colorDepth;
	var res = window.screen.width + "," + window.screen.height;
	var referer = escape(document.referrer);
	document.write('<img src="/statystyka/zlicz.php?colors=' + colorDepth + '&resolution=' + res + '&referer=' + referer + '" style="width:0;height:0;" />');
}

jQuery(document).ready(function () {
	
	$(".datepickerGaleria").datepicker(
		{ 
			dateFormat: 'yy-mm-dd',
			dayNamesMin: ['Nd', 'Pn', 'Wt', 'Śr', 'Cz', 'Pt', 'So'] , 
			monthNames: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'] 
		}
		);
	
	
	jQuery('form').bind('submit', function(){
		jQuery('input[type=submit]', this).attr('disabled','disabled');
	})
	
	
});

function dodajDoUlubionych()
{
	var tytul = 'Bochniarz.pl';
	var adres = 'http://www.bochniarz.pl';

    //FireFox
    if (window.sidebar) { 

        window.sidebar.addPanel(tytul, adres, ""); 

    //IE
    } else if (window.external) {

        window.external.AddFavorite(adres, tytul); 

    //Opera
    } else if (window.opera && window.print) {

        var a = document.createElement('a');
        a.setAttribute('href', adres);
        a.setAttribute('title', tytul);
        a.setAttribute('rel','sidebar');
        a.click();
    }
}

function kalendarzNawigacja()
{
}

function kalendarzZmienMiesiac(miesiac,rok,lang)
{
	jQuery.post("/ajax/kalendarz.php", { miesiac: miesiac, rok: rok, jezyk: lang }, function(data){ jQuery('#kalendarzHtml').html(data); });
}

function ankietaWyslijOdpowiedz(lang,ankieta_id,odp_id,msg)
{
	if(ankieta_id > 0 && odp_id > 0)
	{
		jQuery.post("/ajax/ankieta.php", { ankieta_id: ankieta_id, odp_id: odp_id, jezyk: lang }, function(data){ jQuery('#ankietaHtml').html(data); createCookie('ankieta_'+ankieta_id,"1",30); });
	}
	else
	{
		alert(msg);
	}
}

function polecZnajomemu()
{
	jQuery.post("/ajax/polecSerwis.php", { }, function(data){
		jQuery('#layout').append(data);
		
		var tips = jQuery("#validateTips");
		var name = jQuery("#ps_name");
		var email = jQuery("#ps_email");
		var allFields = jQuery([]).add(name).add(email);

		jQuery("#dialogPolecSerwis").dialog({
			bgiframe: true,
			autoOpen: true,
			height: 300,
			modal: true,
			buttons: {
				'Poleć serwis': function() {
					var bValid = true;
					allFields.removeClass('ui-state-error');

					bValid = bValid && checkLength(tips,name,"Podane imię i nazwisko  musi składać się przynajmniej z",3,200);
					bValid = bValid && checkLength(tips,email,"Podany adres e-mail jest za krótki. Min ",6,200);
					var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
					bValid = bValid && checkRegexp(tips,email,reg,"Podany poprawny adres e-mail.");
	 					
					if (bValid) {
						var url = window.location;
						jQuery.post("/ajax/polecSerwisWyslij.php", {e: email.val(), n: name.val(), l: url.toString() }, 
						 function(data)
						 {
							if(data == 'OK')
							{
								updateTips(tips,'Wiadomość została poprawnie wysłana.');
								jQuery("#ps_name").val('');
								jQuery("#ps_email").val('');
							}
							else
							{
								updateTips(tips,data);
							}
						 });
					}
				},
				Anuluj: function() {
					jQuery(this).dialog('close');
				}
			},
			close: function() {
				allFields.val('').removeClass('ui-state-error');
			}
		});
	});
}

function updateTips(tips,t)
{
	tips.text(t).effect("highlight",{},1500);
}

function checkLength(tips,o,n,min,max)
{
	if ( o.val().length > max || o.val().length < min ) {
		o.addClass('ui-state-error');
		updateTips(tips,n + " "+min+" znaków.");
		return false;
	} else {
		return true;
	}
}
		
function checkRegexp(tips,o,regexp,n) {

	if ( !( regexp.test( o.val() ) ) ) {
		o.addClass('ui-state-error');
		updateTips(tips,n);
		return false;
	} else {
		return true;
	}

}

function isInt(x)
{ 
	var y = parseInt(x); 
   if(isNaN(y)) return false; 
   return x==y && x.toString()==y.toString(); 
}

function wyslijFormularzKlienta()
{
	jQuery("#formKlienta").submit();
}

function wyslijFormularzKlientaZmienHaslo()
{
	jQuery("#formKlientaZmienHaslo").submit();
}

function Zaloguj(lang,user,pass,formularz)
{
	jQuery.post("/ajax/klientLoguj.php", { jezyk: lang, user: jQuery("#"+user).val(), pass: jQuery("#"+pass).val() },
	function(data){
		var tab = data.split("|");
		if(tab[0] != 'OK')
		{
			alert(tab[1]);
		}
		else
		{
			jQuery("#"+formularz).attr("onsubmit","");
			jQuery("#"+formularz).submit();
		}
	});
	return false;
}

function Newsletter(lang,newsletter_action,info)
{
	jQuery.post("/ajax/newsletter.php", { a: newsletter_action, e: jQuery('#newsletter_email').val(), jezyk: lang }, function(data) {
		var tab = data.split("|");
		if(tab[0] == 'OK')
		{
			jQuery('#newsletter_info').html(tab[1]);
			jQuery('#newsletter_email').val("");
		}
		else
		{
			jQuery('#newsletter_info').html(tab[1]);
			jQuery('#newsletter_email').focus();
		}
	});
}

function ZoomText(zoom,contener)
{
	if(zoom == "+1")
	{
		$('#'+contener).css('font-size',(parseInt($('#'+contener).css('font-size')) + 2)+'px');
		$('#'+contener).css('line-height',(parseInt($('#'+contener).css('line-height')) + 2)+'px');
	}
	else if(zoom == "-1")
	{
		$('#'+contener).css('font-size',(parseInt($('#'+contener).css('font-size')) - 2)+'px');
		$('#'+contener).css('line-height',(parseInt($('#'+contener).css('line-height')) - 2)+'px');
	}
	else
	{
		$('#'+contener).css('font-size','12px');
		$('#'+contener).css('line-height','18px');
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function Szukaj(link)
{
	var fraza = jQuery('#fraza').val();
	fraza = fraza.replace(/;/g,"");
	fraza = fraza.replace(/-/g,"");
	jQuery('#searching').attr('action',link+',fraza-'+fraza+',gdzie-'+jQuery("#szukaj_gdzie").val());
	jQuery('#searching').attr("onsubmit","");
	jQuery('#searching').submit();
}

function rozwinWszystkieFaq(obj,msg1,msg2)
{
	if($(obj).attr("class") == "faqN1")
	{
		$(obj).html(msg1);
		$(obj).attr("class","faqN2");
		$(".faq").css("display","block");
	}
	else
	{
		$(obj).html(msg2);
		$(obj).attr("class","faqN1");
		$(".faq").css("display","none");
	}
}

function pokazFaq(id)
{
	if(jQuery("#faq"+id).css("display") == 'block')
	{
		jQuery(".faq").css("display","none");
		jQuery(".faqK").css("font-weight","normal");
	}
	else
	{
		jQuery(".faq").css("display","none");
		jQuery(".faqK").css("font-weight","normal");
		jQuery("#faqK"+id).css("font-weight","bold");
		jQuery("#faq"+id).css("display","block");
	}
}

function SendForm(form,send)
{
	jQuery("#send").val(jQuery("#"+send).val());
	jQuery("#"+form).submit();
}


function EaZyMap()
{
	this.arrMarkers = new Array();
	this.mapaSM = '';
	this.addMarker = function(lat,lon,txt) {
		var marker = new GMarker(new GLatLng(lat,lon),{title: txt});
		marker.txt = txt;
		GEvent.addListener(marker,"click",function() {
			marker.openInfoWindowHtml(marker.txt);
		});
		this.arrMarkers.push(marker);
		this.mapaSM.addOverlay(marker);
		marker.openInfoWindowHtml(marker.txt);
	}
	this.load = function (box_id,centerPointLat,centerPointLng,zoom) {
		
	
		this.mapaSM = new GMap2(document.getElementById(box_id));
		if(zoom == 0) zoom = 15;
		this.mapaSM.setCenter(new GLatLng(centerPointLat,centerPointLng),zoom);
		this.mapaSM.addControl(new GLargeMapControl());
		this.mapaSM.addControl(new GOverviewMapControl());
		this.mapaSM.addControl(new GMapTypeControl());
		if(this.arrMarkers.length>0)
		{
			for(var i = 0; i < this.arrMarkers.length; i++)
			{
				this.mapaSM.addOverlay(this.arrMarkers[i]);
			}
		}
		return this.mapaSM;
	}
}


/* ================================================================ 
This copyright notice must be kept untouched in the stylesheet at 
all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/menu/pro_drop_1.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

stuHover = function() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
		
	if(document.getElementById("nav")!=null)
	{
		var getElm = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<getElm.length; i++) {
			getElm[i].onmouseover=function() {
				this.className+=" iehover";
			}
			getElm[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", stuHover);



// -->
