<!-- //

var from = escape(document.referrer);
var query = location.search;
var colorDepth = window.screen.colorDepth;
var res = window.screen.width + "," + window.screen.height;
document.write("<img src='/statystyka/zlicz.php?referer=" + from + "&query=" + query + "&kolory=" + colorDepth + "&rozdzielczosc=" + res + "' align='middle' style='display:none'>");

function PowiekszZdjecie(url, width, height, info, tytul)
{
	var okno = null;
	if(okno) okno.close();
	ScrWidth = 640;
	ScrHeight = 480;
	if(window.screen)
	{
		ScrWidth = window.screen.width;
		ScrHeight = window.screen.height;
	}
	PosX = Math.round((ScrWidth - width) / 2);
	PosY = Math.round((ScrHeight - height) / 2);
	width = width;
	height = height;
	okno = window.open("", "zdjecie", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.document.clear();
	okno.document.write("<html><head><title>" + tytul + "</title><meta http-equiv='content-type' content='text/html; charset=ISO-8859-2'></head><style type=\"text/css\">body { margin:0; padding:0; }</style><body><div align=\"center\"><img src=\""+ url +"\" alt=\"" + info + "\" title=\"" + info + "\" border=\"0\" onclick=\"window.close();\" /></div></body></html>");
	okno.document.close();
	okno.focus();
}

function SprawdzFormularzKontaktu(msg1,msg2)
{
	var form = document.forms["FormularzKontaktu"];
	var error = false;
	if(form.elements["imie_i_nazwisko"].value == "")
	{
		alert(msg1);
		form.elements["imie_i_nazwisko"].focus();
		return false;
	}
	if(!error && form.elements["email"].value == "")
	{
		alert(msg1);
		form.elements["email"].focus();
		return false;
	}
	if(!error && form.elements["email"].value != "")
	{
		if(!SprawdzEmail(form.elements["email"]))
		{
			alert(msg2);
			form.elements["email"].focus();
			return false;
		}
	}
	if(!error && form.elements["tresc"].value == "")
	{
		alert(msg1);
		form.elements["tresc"].focus();
		return false;
	}

	return true;
}
function SendForm(form,send)
{
	jQuery("#send").val(jQuery("#"+send).val());
	jQuery("#"+form).submit();
}
function SprawdzEmail(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 Drukuj(podstrona_id,akcja,q,akt_id)
{
	var okno = null;
	okno = window.open("/drukuj.php?pod_id="+podstrona_id+"&action="+akcja+"&q="+q+"&akt_id="+akt_id+"", "wersja_do_druku", "menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=600,height=600,left=50,top=50");
	okno.focus();
}
function $(id)
{
	return document.getElementById(id);
}


function zaloguj()
{
	var email 		= $('l_email').value;
	var password 	= $('l_haslo').value;

	if(SprawdzEmail($('l_email')))
	{
		if(password!='')
		{
			advAJAX.get({
				url: "/include/ajax_logowanie.php?e="+email+"&p="+password,
				onLoading : function(obj)
				{$('pasek_konta_err').innerHTML= 'trwa weryfikacja danych';},
				onSuccess : function(obj) {
					if(obj.responseText=="true")
					{
						//alert('test');
						window.location=window.location;
					}else
					{
						$('pasek_konta_err').innerHTML="B��dny adres email lub has�o";
					} },
					onError : function(obj) { alert("Error: " + obj.status); }
			});
		}else
		{
			$('pasek_konta_err').innerHTML= 'podaj has�o';
		}
	}else
	{
		$('pasek_konta_err').innerHTML= ' wpisz poprawny adres email';
	}
}

var pozycje = new Array();
var tmpDaty = new Array();

function sprawdz_pozycje_koszyka(forma_reklamy_id,harmonogram_id)
{
	//alert(forma_reklamy_id+''+harmonogram_id);
	if(!pozycje[forma_reklamy_id])
	{
		pozycje[forma_reklamy_id] = new Array;
		pozycje[forma_reklamy_id][harmonogram_id]=0;
	}

	if(pozycje[forma_reklamy_id][harmonogram_id]==1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function odswiez_pozycje_koszyka(forma_reklamy_id)
{
	if(forma_reklamy_id=='')
	{
		$('harmonogram').style.display='none';
	}else
	{
		$('harmonogram').style.display='';

		var pozReklama = pozycje[forma_reklamy_id];
		for(i=0;i<tmpDaty.length;i++)
		{
			if($('poz_'+i))
			{
				$('poz_'+i).style.backgroundColor='#FFFFFF';
			}
		}
		for(i=0;i<pozReklama.length;i++)
		{
			if($('poz_'+i))
			{
				if(pozReklama[i]==1)
				{
					$('poz_'+i).style.backgroundColor='#D3D3D3';
				}
			}
		}
	}

}


function getFileBox(type,id,link)
{
	//jQuery('#files_box').css('display','none');
	jQuery.get('/include/ajax/getFileBox.php',{type: type,id: id}, function(data){jQuery('#files_box').html(data).show(300);});
}

function getFileBoxOffline(type)
{
	jQuery('.filebox').hide();
	jQuery('#'+type).show(300);

}

function getAllProducts(id,obj,showBriefcaseCheckbox,sid)
{
	jQuery.get('/include/ajax/getAllProducts.php',{id: id, sid: sid,showBriefcaseCheckbox:showBriefcaseCheckbox}, function(data){jQuery(obj).hide(100);jQuery('#products').html(data).show(200);jQuery(obj).hide(100); if(showBriefcaseCheckbox){jQuery(".addToBriefcase").css("display","");}});
}

function setBriefcaseProducts(id,briefcaseId)
{
	var tab = jQuery('.addToBriefcase > input');
	var params='';
	for(var i=0; i< tab.length;i++)
	{
		tmp = tab[i];
		if(tmp.checked)
		params += ','+tmp.value;

	}
	jQuery.get('/include/ajax/setBriefcaseProducts.php?params='+(params)+'&briefcase_id='+briefcaseId+'&rp_id='+id ,'',function(data){if(data=="true"){jQuery('#zapisz_produkty').hide();};});
}
function getProducts(id,obj,showBriefcaseCheckbox,sid)
{
	//jQuery('#products').html('proszę czekać');
	jQuery.get('/include/ajax/getProducts.php',{id: id, sid: sid}, function(data){jQuery(obj).show(100);jQuery('#products').html(data).show(200); if(showBriefcaseCheckbox){jQuery(".addToBriefcase").css("display","");}});
}
var briefcaseID = '';
function setBriefcase(id,obj,sid,type)
{
	jQuery("#wybor_schowka > .pozycja").css("background","#EEEEEE");
	jQuery(obj).css("background","#DDDDDD");
	briefcaseID = jQuery(obj).attr("id");
	addFamilyToBriefcase(sid,id,type);
	//getAllProducts(id,'.wszystkie_produkty',1,briefcaseID)
}

function showMenu(menu_id)
{
	jQuery('.hidden_menu').hide(200);
	jQuery(menu_id).show(200);
	jQuery(menu_id).blur();
}


function galleryStart()
{
	jQuery(document).ready(function()
	{

		jQuery(".miniRefPhoto").hover
		(
		function(){if(jQuery(this).attr('clicked')!='true')jQuery(this).fadeTo(100,0.8) }
		,
		function(){if(jQuery(this).attr('clicked')!='true')jQuery(this).fadeTo(10,0.5);}
		);
		jQuery(".miniRefPhoto").click
		(
		function(e)
		{
			jQuery(".miniRefPhoto").fadeTo(10,0.6);
			jQuery(this).fadeTo(10,1);
			jQuery(".miniRefPhoto").attr('clicked', 'false' );
			jQuery(this).attr('clicked', 'true' );
			jQuery("#bigRefPhoto").fadeTo(200,0.5);
			jQuery("#bigRefPhoto").html('<img id="flashImg" /><br /> '+this.title+'' ).show(400);
			var imgUrl = this.src;
			$("flashImg").src = imgUrl;
			//jQuery("#bigRefPhoto").click();
			jQuery("#bigRefPhoto").fadeTo(200,1);
			return false;
		}
		);
		jQuery(".miniRefPhoto").fadeTo(400,0.5);
	}
	);
}

var animTime='';
function startAnimation(cycle,items_count,item_no)
{
	clearTimeout(animTime);
	if(item_no>items_count) item_no =1;
	else if(item_no<=0) item_no =items_count;

	jQuery('#polecamyBox').fadeTo(300,0.1,function(){
										jQuery('.polecane').hide();
										jQuery('#polecany'+item_no).show();
										jQuery('#polecamyBox').fadeTo(300,1 , function(){

												if(cycle==1){animTime = setTimeout("startAnimation(1,"+items_count+","+(item_no+1)+");",10000);}
										})
									}
								  );
	//jQuery.get('/include/ajax/getAnimationProduct.php',{id: prodIndex}, function(data){jQuery('#polecamyBox').html(data);jQuery('#polecamyBox').fadeTo(300,1);prodIndex++});




}




function drukuj(location)
{
	var okno;
	ScrWidth = 640;
	width = 640;
	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("", "aktualnosci", "menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.document.open();
	okno.document.clear();
	okno.document.write("<html><head><title>Philips</title><link href=\"/css/wydruk.css\" rel=\"stylesheet\" type=\"text/css\"  /><style>body{margin:0px;text-align:center; }#layout{width:640px;text-align:left;margin:auto; margin-top:10px; } </style><style media=\"print\">#zamknij{display:none;} #wydrukuj{display:none; } #layout{width:600px; text-align:left; margin:auto; border: 0; }</style></head><body><a href=\"javascript:window.close();\" id=\"zamknij\" >Zamknij okno</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:window.print();\" id=\"wydrukuj\" >Wydrukuj</a><br /><div id=\"layout\" >"+jQuery(location).html()+"</div></body></html>");
	okno.document.close();
	okno.focus();
}

function drukuj_produkt(id)
{

var okno;
	jQuery.get('/include/ajax/ajax_drukuj_produkt.php',{id:id}, function(data){if(data!=""){



	ScrWidth = 640;
	width = 640;
	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("", "drukuj", "menubar=yes,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.document.open();
	okno.document.clear();
	okno.document.write("<html><head><title>Philips</title><link href=\"/css/wydruk.css\" rel=\"stylesheet\" type=\"text/css\"  /><style>body{margin:0px;text-align:center; }#layout{width:640px;text-align:left;margin:auto; margin-top:10px; } </style><style media=\"print\">#zamknij{display:none;} #wydrukuj{display:none; } #layout{width:600px; text-align:left; margin:auto; border: 0; }</style></head><body><a href=\"javascript:window.close();\" id=\"zamknij\" >Zamknij okno</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:window.print();\" id=\"wydrukuj\" >Wydrukuj</a><br /><div id=\"layout\" >"+data+"</div></body></html>");
	okno.document.close();
	okno.focus();
	};});
}



function logIn()
{

	var email 		= jQuery('#l_e').val();
	var password 	= jQuery('#l_h').val();

	jQuery('#l_e').keypress(function(){jQuery('#l_e').css("background-color","#FFFFFF");jQuery('#l_e').css("color","#666666");});
	jQuery('#l_h').keypress(function(){jQuery('#l_h').css("background-color","#FFFFFF");jQuery('#l_h').css("color","#666666");});

	if(SprawdzEmail(email))
	{
		if(password!='')
		{
			jQuery.get('/include/ajax/ajax_logowanie.php',{e: email,p:password}, function(data){if(data=="true"){window.location='/';}else{jQuery('#hBox').css("color","red");jQuery('#eBox').css("color","red");jQuery('#loginErr').html('błędne hasło lub login');jQuery('#loginErr').show(300);};});
		}else
		{
			jQuery('#l_h').css("background-color","red");
			jQuery('#l_h').css("color","white");
			jQuery('#l_h').focus();
		}
	}else
	{
		jQuery('#l_e').css("background-color","#FF0000");
		jQuery('#l_e').css("color","white");
		jQuery('#l_e').focus();
		jQuery('#l_e').select();
	}
	return false;
}
function showLoginBox()
{
	jQuery('#eBox').show(200);
	jQuery('#hBox').show(200);
	jQuery('#cBox').show(200);
	jQuery('#l_e').focus();

}

function hideLoginBox()
{
	jQuery('#eBox').hide(200);
	jQuery('#hBox').hide(200);
	jQuery('#cBox').hide(200);
}
function showAccountBox()
{
	jQuery('#AccountBox').show(200);
}

function hideAccountBox()
{
	jQuery('#AccountBox').hide(200);
}
function pokaz_obrazek2(arg,szerokosc,wysokosc)
{
	szerokosc+=20
	wysokosc+=10

	LeftPosition=(screen.width)?(screen.width-szerokosc)/2:100;
	TopPosition=(screen.height)?(screen.height-wysokosc)/2:100;
	var param='width='+szerokosc+',height='+wysokosc+',top='+TopPosition+',left='+LeftPosition+'toolbar=no,menubar=no,status=no,resizable=no'

	popwin=window.open(arg,"luk",param)
}


function sendProdMsg(e,id,i,obj)
{
	jQuery.get('/include/ajax/ajax_polec_produkt.php',{e: e, id:id, i:i}, function(data){if(data!="false"){jQuery(obj).html(data);}else{jQuery(obj).html("blad");}});
}
function showPhoto(url,width,height,Label) {
	var win=window.open(null,"displayWindow",'width='+(width+20)+',height='+(height+25+(Label!=null?25:0))+',resizable=0,scrollbars=no,menubar=no,top=100' );
	win.document.writeln('<html><head><title></title></head><body onclick="window.close();"><center><img src="/'+url+'"/>');

	if (Label!=null)
	win.document.writeln('<div class="basictxt">'+Label+'</div>');
	win.document.writeln('</center></body></html>');
}

function open_win(link)
{
	window.open('http://klubswiatla.pl/VIDEO/'+link, '_blank','width=400,height=350');
}
function openVideo2(link) {
		window.open('http://klubswiatla.pl/VIDEO/'+link, '_blank','width=415,height=335');
	}
function openVideo(link) {
		window.open('http://klubswiatla.pl/VIDEO/'+link, '_blank','width=400,height=260');
	}

function showProductDescription(objOK,id)
{
	jQuery("#produkt_opis_prawa > .wstep, #produkt_opis_prawa > .opis ").show("slow");
	jQuery("#produkt_subpanel_schowek ").hide("slow");
	jQuery(".wszystkie_produkty").show("slow");
	jQuery(objOK).hide();
	getProducts(id,'.wszystkie_produkty',1,briefcaseID);
}

function addNewBriefcase(name)
{
	jQuery.get('/include/ajax/ajax_dodaj_schowek.php',{name: name}, function(data){if(data!="false"){window.location="/schowek";}else{jQuery(obj).html("blad");}});
}

function  delBriefcase(id,sid)
{
	jQuery.get('/include/ajax/ajax_usun_schowek.php',{id: id, sid:sid}, function(data){if(data!="false"){jQuery('#BriefcaseTabs > ul').tabs('remove', id); }});
}
function  delBriefcaseItem(id)
{
	jQuery.get('/include/ajax/ajax_usun_pozycje_showka.php',{id: id}, function(data){if(data=="true"){jQuery('#briefcaseItem-'+id).hide(); }});
}
// -->