<!-- //

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;" />');
}

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);
}

var global_index = 1;
function startBoxAnimation(index, id)
{
	var ilosc = jQuery('.'+id).length;
	jQuery('#'+id+'_'+index).css("opacity", "1");
	jQuery('#'+id+'_'+index).show();
	
	if(ilosc > 1)
	{
		var time = setInterval("BoxAnimation('"+id+"', '"+ilosc+"');",3000);
	}
}

function BoxAnimation(id, ilosc)
{
	var index = global_index;
	jQuery('#'+id+'_'+index).fadeTo(300,0, function () {
		jQuery('.'+id).css("opacity", "0");											 
		jQuery('.'+id).hide();
		index++;
		if(index > ilosc)
		{
			index =1;
		}
		
		global_index = index;

		jQuery('#'+id+'_'+index).show();
		jQuery('#'+id+'_'+index).fadeTo(300,1);
	});
	return true;
}

function Szukaj(link)
{
	var fraza = jQuery('#fraza').val();
	fraza = fraza.replace(/;/g,"");
	fraza = fraza.replace(/-/g,"");
	jQuery('#searching').attr('action',link+';fraza-'+fraza);
	jQuery('#searching').submit();
}

function SzukajZaawansowana(link)
{
	var fraza = jQuery('#s_fraza').val();
	fraza = fraza.replace(/;/g,"");
	fraza = fraza.replace(/-/g,"");
	var nrkat = jQuery('#s_nrkat').val();
	nrkat = nrkat.replace(/;/g,"");
	nrkat = nrkat.replace(/-/g,"");
	
	var checkboxes = '';
	jQuery("#wyszCheckboxes input:checked").each(function (i) { checkboxes = checkboxes+';'+this.id.replace('s_','')+'-1'; });
	
	jQuery('#searchingZ').attr('action',link+';fraza-'+fraza+';nrkat-'+nrkat+';seria-'+jQuery("#s_seria").val()+';producent-'+jQuery("#s_producent").val()+checkboxes);
	jQuery('#searchingZ').submit();
}

function ShowPrevious()
{
	jQuery('#visible_box .lightbox:first').remove().appendTo('#hide_box'); 
	jQuery('#hide_box .lightbox:first').remove().appendTo('#visible_box'); 
	$(".lightbox").lightbox();
}

function ShowNext()
{
	jQuery('#visible_box .lightbox:last').remove().prependTo('#hide_box'); 
	jQuery('#hide_box .lightbox:last').remove().prependTo('#visible_box'); 
	$(".lightbox").lightbox();
}

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 rozwinWszystkieFaq(obj)
{
	if($(obj).attr("class") == "faqN1")
	{
		$(obj).html("Zwi&#65533;zystkie");
		$(obj).attr("class","faqN2");
		$(".faq").css("display","block");
	}
	else
	{
		$(obj).html("Rozwi&#65533;zystkie");
		$(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 changePic(url,id)
{
	jQuery("#"+id).attr("src",url);
}

function wyslijEmail(uzytkownik, domena, temat)
{
	var OtworzProgramPocztowy = "mailto:" + uzytkownik + "@" + domena + "?Subject=" + temat;
	window.location = OtworzProgramPocztowy;
}

function SendForm(form,send)
{
	jQuery("#send").val(jQuery("#"+send).val());
	jQuery("#"+form).submit();
}

function Newsletter(lang,newsletter_action)
{
	jQuery.post("/ajax/newsletter.php", { a: newsletter_action, e: jQuery('#newsletter_email').val(), jezyk: lang }, function(data){ jQuery('#newsletter_info').html(data); jQuery('#newsletter_email').focus(); });
}

function CheckValidEmail(adres)
{
   a = adres.search(/@/i);
   a1 = adres.substring(0,a);
   a2 = a1.length;
   a = a + 1;
   b = adres.indexOf(".");
   b1 = adres.substring(a,b);
   b2 = b1.length;
   b = b + 1;
   c = adres.length;
   c1 = adres.substring(b,c);
   c2 = c1.length;
   if(adres.indexOf("@") != "-1" && adres.indexOf(".") != "-1" && a2 >= 1 && b2 >= 1 && c2 >= 1)
   {
   	return true;
   }
   else
   {
   	return false;
   }
}

function PrintPage(content,lang)
{
	var okno = null;
	ScrWidth = 640;
	 width = 700;
	ScrHeight = 480;
	height = 480;
	if(window.screen)
	{
		ScrWidth = window.screen.width;
		ScrHeight = window.screen.height;
	}
	if(okno != null && !document.layers)
	{
		okno.close();
	}
	PosX = Math.round((ScrWidth - width) / 2);
	PosY = Math.round((ScrHeight - height) / 2);
	okno = window.open("/print.php?content="+content+"&lang="+lang, "print", "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.focus();
}

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;
	}
}

function OtworzEdytor(pole)
{
	var oknoEdytor = null;
  	oknoEdytor = window.open("edytor.php?pole="+pole, "edytor", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=no,width=800,height=800,left=0,top=0");
	oknoEdytor.focus();
}

function PowiekszZdjecie(url)
{
	var okno = null;
	if(okno) okno.close();
	var width = 800;
	var height = 600;
	if(window.screen)
  	{
   	ScrWidth = window.screen.width;
		ScrHeight = window.screen.height;
  	}
	var PosX = Math.round((ScrWidth - width) / 2);
  	var PosY = Math.round((ScrHeight - height) / 2);
	
	okno = window.open("", "", "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
  	okno.document.open();
  	okno.document.clear();
  	okno.document.write("<HTML><head><meta http-equiv=\"Content-type\" content=\"text/html; charset=iso-8859-2\"><title>CMS BullDesign - powi&#39603;zenie zdj&#39081;a</title></HEAD><body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0><a href='javascript:window.close()'><img src="+url+" alt='Kliknij gdziekolwiek aby zamknħ&#18420;o okno.' border='0'></a></BODY></HTML>");
  	okno.document.close();
  	okno.focus();
}

function keepMeAlive(imgName)
{
   myImg = document.getElementById(imgName);
   if (myImg) myImg.src = myImg.src.replace(/\?.*$/, '?' + Math.random());
}

function selectAll(box)
{
	for(var i=0; i<box.length; i++) {
		box.options[i].selected = true;
	}
}

function sprawdz(wiadomosc)
{
	var czy_potwierdzony = confirm(wiadomosc);
   if(czy_potwierdzony) { return true; }
	else { return false; }
}

function SetActive(obj)
{
	var data = obj.id.split("_");
	jQuery.post("ajax/ustawAktywnosc.php", { id: data[2], value: obj.checked, lang: data[1], module: data[3] },	
	  	function(data){
			if(data != "OK") alert("B3ħd: " + data);
	});
}

function ZaznaczOdznaczWszystkie(f,pole,akcja)
{
	var checkboxy = document.getElementById(f).getElementsByTagName('input');
	for(i = 0; i < checkboxy.length; i++)
	if(checkboxy[i].type == 'checkbox' && checkboxy[i].name.substr(0,3) == pole)
	{
		checkboxy[i].checked = akcja;
	}
}

// -->
