
//SuckerTree Vertical Menu 1.1 (Nov 8th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["jsmenu"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
    ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle"
		if (ultags[t].parentNode.parentNode.id==menuids[i]) //if this is a first level submenu
			ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
		else //else if this is a sub level submenu (ul)
		  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.display="block"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.display="none"
    }
    }
		for (var t=ultags.length-1; t>-1; t--){ //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
		ultags[t].style.visibility="visible"
		ultags[t].style.display="none"
		}
  }
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)

var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

/* ================================================================== */

var bo_ns_id = 0;

function startIeFix(){
  if(isIE()){
    document.write('<div id="bo_ns_id_' + bo_ns_id + '"><!-- ');
  }
}

function endIeFix(){
  if(isIE()){
    document.write('</div>');
    var theObject = document.getElementById("bo_ns_id_" + bo_ns_id++);
    var theCode = theObject.innerHTML;
    theCode = theCode.substring(4 ,9+theCode.indexOf("</object>"))
    document.write(theCode);
  }
}

function isIE(){
  // only for Win IE 6+
  // But not in Windows 98, Me, NT 4.0, 2000
  var strBrwsr= navigator.userAgent.toLowerCase();
  if(strBrwsr.indexOf("msie") > -1 && strBrwsr.indexOf("mac") < 0){
    if(parseInt(strBrwsr.charAt(strBrwsr.indexOf("msie")+5)) < 6){
      return false;
    }
    if(strBrwsr.indexOf("win98") > -1 ||
       strBrwsr.indexOf("win 9x 4.90") > -1 ||
       strBrwsr.indexOf("winnt4.0") > -1 ||
       strBrwsr.indexOf("windows nt 5.0") > -1)
    {
      return false;
    }
    return true;
  }else{
    return false;
  }
}
/* ================================================== */

function ReloadPage(t,h,c) {
	if(c>0) {
		window.location = "http://"+h+"?cat="+c+"&z="+t.value;
	}else{
		window.location = "http://"+h+"?w="+c+"&z="+t.value;
	}
	//alert(t.value+" "+h+" "+c);
}

/* ================================================== */
function ValidateF() {
	document.getElementById('komunikat').innerHTML = '';
	from = document.getElementById('from').value;
	mail = document.getElementById('mail').value;
	subj = document.getElementById('subj').value;
	text = document.getElementById('text').value;
	
	if(from.length == 0) {
		document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Uzupełnij imię i nazwisko.</span>';
		document.getElementById('from').focus();
		return false;
	}
	if(mail.length == 0) {
		document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Uzupełnij adres e-mail.</span>';
		document.getElementById('mail').focus();
		return false;
	}
	if(subj.length == 0) {
		document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Uzupełnij temat wiadomo¶ci.</span>';
		document.getElementById('subj').focus();
		return false;
	}
	if(text.length == 0) {
		document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Uzupełnij tre¶ć wiadomo¶ci.</span>';
		document.getElementById('text').focus();
		return false;
	}
	
	Send(from,mail,subj,text);
	
}
function Send(from,mail,subj,text) {

if (window.XMLHttpRequest) {
    http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
    http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
	//http_request.overrideMimeType('text/xml');
	
http_request.onreadystatechange = function() { alertContents(http_request); };
http_request.open('GET', 'send.php?from='+from+'&mail='+mail+'&subj='+subj+'&text='+text, true);
http_request.send(null);

}
	
function alertContents(http_request) {

	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
      	document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Dziękujemy. Zapytanie zostało wysłane.</span>';
			document.getElementById('from').value = '';
	 		document.getElementById('mail').value = '';
			document.getElementById('subj').value = '';
			document.getElementById('text').value = '';
      }else{
			document.getElementById('komunikat').innerHTML = '<span style="color:#880000;font-weight:bold;">Wyst±pił bł±d przy wysyłaniu...</span>';
		}
   }

}
	
Nowe=null; 
function Pokaz(id,nr) { 
winwidth = 400;
winheight = 400;
xpoz = screen.width/2 - winwidth/2;
ypoz = screen.height/2 - winheight/2;
Nowe=null;
Nowe=window.open("pokaz.php?name="+id+"&nr="+nr, "","toolbar=no,menubar=no,location=no,personalbar=no, scrollbars=yes,status=no,directories=no,resizable=yes,height="+winheight+",width="+winwidth+",left="+xpoz+",top="+ypoz);
Nowe.focus();
}

Nowe=null; 
function Okienko(id) { 
winwidth = 600;
winheight = 500;
xpoz = screen.width/2 - winwidth/2;
ypoz = screen.height/2 - winheight/2;
Nowe=null;
Nowe=window.open(id, "","toolbar=no,menubar=no,location=no,personalbar=no, scrollbars=yes,status=no,directories=no,resizable=yes,height="+winheight+",width="+winwidth+",left="+xpoz+",top="+ypoz);
Nowe.focus();
}

/* ================================================== */

function CheckR(n) {
	if(!Number(n.value)) {
		n.value = 0;
	}
	if(n.value<0) {
		n.value = n.value * -1;
	}
	if(n.value%1 != 0) {
		n.value = Math.round(n.value);
	}
	Reload();
}

/* ================================================================== */

function Reload() {
	
	count = document.getElementById("count").value*1+1;
	
	tsum = 0;
	tsumc = 0;
	
	for(x=1;x<count;x++){
		sum = 0;
		sump = 0;
		store = document.getElementById("ProdSt_"+x).value * 1;
		quant = document.getElementById("PQ_"+x).value * 1;
		if(document.getElementById("AP_"+x).checked == true && quant>0) {
			if(quant > store) {
				quant = store;
				document.getElementById("PQ_"+x).value = store;
			}
			sum += quant * document.getElementById("ProdPr_"+x).value;
			tsumc += quant * 1;
			document.getElementById("PPra_"+x).innerHTML = (Math.round(sum*100)/100)+" zł";
		}else{
	 		document.getElementById("PPra_"+x).innerHTML = "";
		}
		tsum += sum;
	}
	
	document.getElementById("TPr").innerHTML = (Math.round(tsum*100)/100)+" zł";
	document.getElementById("TPc").innerHTML = tsumc;
}

/* ================================================================== */

function Methods(pr,prom) {
	pr = pr * 1;
	prom = prom * 1;
	if(pr > prom) {
		document.getElementById("Deliv").innerHTML = "gratis";
		document.sendorder.delprice.value = "";
	}else{
	id = document.sendorder.del_met.selectedIndex;
	
	if(id > 0) {
		
		if((pr*1) < 70) {
			document.getElementById("Deliv").innerHTML = tabprice[id]+" zł";
			document.getElementById("TPr").innerHTML = ((pr*1)+(tabprice[id]*1))+" zł";
			document.sendorder.delprice.value = tabprice[id];
		}else{
			document.getElementById("Deliv").innerHTML = "gratis";
			document.getElementById("TPr").innerHTML = pr+" zł";
			document.sendorder.delprice.value = "";
		}
		
	}else{
		document.getElementById("Deliv").innerHTML = "- - -";
		document.getElementById("TPr").innerHTML = pr+" zł";
		document.sendorder.delprice.value = "";
	}
	}
} 

/* ================================================================== */

function ZmianaTik() {
	if(document.sendorder.fdtik.checked == true){
		document.sendorder.fdfname.disabled = false;
		document.sendorder.fdname.disabled = false;
		document.sendorder.fdsubname.disabled = false;
		document.sendorder.fdstreet.disabled = false;
		document.sendorder.fdnumber.disabled = false;
		document.sendorder.fdcity.disabled = false;
		document.sendorder.fdcode.disabled = false;
		document.sendorder.fdnip.disabled = false;
	}else{
		document.sendorder.fdfname.value = '';
		document.sendorder.fdname.value = '';
		document.sendorder.fdsubname.value = '';
		document.sendorder.fdstreet.value = '';
		document.sendorder.fdnumber.value = '';
		document.sendorder.fdcity.value = '';
		document.sendorder.fdcode.value = '';
		document.sendorder.fdnip.value = '';
		
		document.sendorder.fdfname.disabled = true;
		document.sendorder.fdname.disabled = true;
		document.sendorder.fdsubname.disabled = true;
		document.sendorder.fdstreet.disabled = true;
		document.sendorder.fdnumber.disabled = true;
		document.sendorder.fdcity.disabled = true;
		document.sendorder.fdcode.disabled = true;
		document.sendorder.fdnip.disabled = true;
	}
}

/* ================================================================== */

function Validate() {
	
	w_oname = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ ]{2,100}$/;
	if(!w_oname.test(document.sendorder.oname.value)) {
		ShowAlert('Imię w danych kontaktowych powinno mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery i spacja.','document.sendorder.oname.focus();');
		return false;
	}
	w_osubname = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ ]{2,100}$/;
	if(!w_osubname.test(document.sendorder.osubname.value)) {
		ShowAlert('Nazwisko w danych kontaktowych powinno mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery i spacja.','document.sendorder.osubname.focus();');
		return false;
	}
	w_ftel = /^[0-9- ]{9,30}$/;
	if(!w_ftel.test(document.sendorder.otel.value)) {
		ShowAlert('W numerze telefonu w danych kontaktowych dozwolone s± cyfry, my¶lnik i spacja !!!','document.sendorder.otel.focus();');
		return false;
	}
	t1 = document.sendorder.oemail.value.split("@");
	if(t1.length>1) t2 = t1[1].split(".");
	if(t1.length<2 || t2.length<2) {
		ShowAlert('Błędny adres email w danych kontaktowych !!!','document.sendorder.oemail.focus();');
		return false;
	}
	
	w_fstreet = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ -]{2,100}$/;
	if(!w_fstreet.test(document.sendorder.dstreet.value)) {
		ShowAlert('Ulica w adresie dostawy powina mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery, spacja i my¶lnik.','document.sendorder.dstreet.focus();');
		return false;
	}
	w_fnumber = /^[a-z0-9 -/]{1,5}$/;
	if(!w_fnumber.test(document.sendorder.dnumber.value)) {
		ShowAlert('Numer w adresie dostawy powinien mieć min 2 i max 5 znaków !!!<BR /><BR />Dozwolone s± cyfry, małe litery i spacja.','document.sendorder.dnumber.focus();');
		return false;
	}
	w_fcity = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ ]{2,100}$/;
	if(!w_fcity.test(document.sendorder.dcity.value)) {
		ShowAlert('Miejscowo¶ć w adresie dostawy powinien mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery i spacja.','document.sendorder.dcity.focus();');
		return false;
	}
	w_fcode = /^[0-9]{2}-[0-9]{3}$/;
	if(!w_fcode.test(document.sendorder.dcode.value)) {
		ShowAlert('Kod pocztowy w adresie dostawy powinien mieć 6 znaków !!!<BR /><BR />Kod należy wpisać wg wzoru (00-000) !!!','document.sendorder.dcode.focus();');
		return false;
	}
	
	
	
	if(document.sendorder.fdtik.checked == true){
	
	w_fname = /^[A-Za-z0-9ęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ .-]{2,255}$/;
	if(!w_fname.test(document.sendorder.fdfname.value)) {
		ShowAlert('Pełna nazwa firmy w danych dostawy powina mieć min 2 i max 255 znaków !!!<BR /><BR />Dozwolone s± litery, cyfry, spacja, kropka i my¶lnik.','document.sendorder.fdfname.focus();');
		return false;
	}
	w_opname = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ .-]{2,100}$/;
	if(!w_opname.test(document.sendorder.fdname.value)) {
		ShowAlert('Imię w danych osoby płac±cej powinno mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery, spacja, kropka i my¶lnik.','document.sendorder.fdname.focus();');
		return false;
	}
	w_opsubname = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ -]{2,100}$/;
	if(!w_opsubname.test(document.sendorder.fdsubname.value)) {
		ShowAlert('Nazwisko w danych osoby płac±cej powinno mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery, spacja i my¶lnik.','document.sendorder.fdsubname.focus();');
		return false;
	}
	w_fstreet = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ -]{2,100}$/;
	if(!w_fstreet.test(document.sendorder.fdstreet.value)) {
		ShowAlert('Ulica w danych dostawy powina mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery, spacja i my¶lnik.','document.sendorder.fdstreet.focus();');
		return false;
	}
	w_fnumber = /^[a-z0-9 -/]{1,5}$/;
	if(!w_fnumber.test(document.sendorder.fdnumber.value)) {
		ShowAlert('Numer w danych dostawy powina mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± cyfry, małe litery i spacja.','document.sendorder.fdnumber.focus();');
		return false;
	}
	w_fcity = /^[A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ ]{2,100}$/;
	if(!w_fcity.test(document.sendorder.fdcity.value)) {
		ShowAlert('Miejscowo¶ć w danych dostawy powina mieć min 2 i max 100 znaków !!!<BR /><BR />Dozwolone s± litery i spacja.','document.sendorder.fdcity.focus();');
		return false;
	}
	w_fcode = /^[0-9]{2}-[0-9]{3}$/;
	if(!w_fcode.test(document.sendorder.fdcode.value)) {
		ShowAlert('Kod pocztowy w danych dostawy powinien mieć 6 znaków !!!<BR /><BR />Kod należy wpisać wg wzoru (00-000) !!!','document.sendorder.fdcode.focus();');
		return false;
	}
	
	w_fnip = /^[0-9]{3}-[0-9]{3}-[0-9]{2}-[0-9]{2}$/;
	if(!w_fnip.test(document.sendorder.fdnip.value)) {
		ShowAlert('NIP w danych do faktury powinien mieć 13 znaków !!!<BR /><BR />NIP należy wpisać wg wzoru (000-000-00-00) !!!','document.sendorder.fdnip.focus();');
		return false;
	}else{
	nip = document.sendorder.fdnip.value.replace(/-/,"");
	nip = nip.replace(/-/,"");
	nip = nip.replace(/-/,"");
	checkSumParts = '657234567';
	checkSum = 0;
	for(n=0;n<9;n++) checkSum += checkSumParts[n] * nip[n];
	if(nip[9] != (checkSum % 11 % 10)) {
		ShowAlert('Błędna suma kontrolna numeru NIP !!!','document.sendorder.fdnip.focus();');
		return false;
	}
	}
	}
	
	return true;
}

/* ================================================================== */

function LogIn() {
	w_login = /^[A-Za-z0-9]{6,32}$/;
	if(!w_login.test(document.login.login.value)) {
		ShowAlert('Login powinien mieć min 6 i max 32 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry.','document.login.login.focus();');
		return;
	}
	w_pass = /^[A-Za-z0-9]{6,16}$/;
	if(!w_pass.test(document.login.password.value)) {
		ShowAlert('Hasło powinno mieć min 6 i max 16 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry.','document.login.password.focus();');
		return;
	}
	
	document.login.oper.value = "login";
	document.login.submit();
}
function LogOut() {
		document.login.oper.value = "logout";
		document.login.submit();
}
function Add2Cart() {
		document.product.oper.value = "add";
		document.product.action = "koszyk.php";
		document.product.submit();
}
function Add2CartVar(v) {
		document.product.ProdVariation.value = v;
		document.product.oper.value = "add";
		document.product.action = "koszyk.php";
		document.product.submit();
}

function GoSearch() {
	w_login = /^[A-Za-z0-9A-Za-zęĘóÓ±ˇ¶¦łŁżŻˇ¬ćĆńŃ ]{2,32}$/;
	if(!w_login.test(document.search.w.value)) {
		ShowAlert('Wyszukiwana fraza powinna mieć min 2 i max 32 znaków !!!<BR /><BR />Dozwolone s± litery cyfry i spacja.','document.search.w.focus();');
		return false;
	}else{
		document.search.action = "szukaj.php";
		document.search.submit();
	}
}

/* ================================================================== */

function AddAccount() {
	w_login = /^[A-Za-z0-9]{6,32}$/;
	if(!w_login.test(document.sendorder.login.value)) {
		ShowAlert('Login powinien mieć min 6 i max 32 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry, bez polskich znaków.','document.sendorder.login.focus();');
		return false;
	}
	if(document.sendorder.pass) {
		if(document.sendorder.pass.value.length>0) {
		pass = document.sendorder.pass.value;
		repass = document.sendorder.repass.value;
		w_pass = /^[A-Za-z0-9]{6,16}$/;
		if(!w_pass.test(pass)) {
			ShowAlert('Hasło powinno mieć min 6 i max 16 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry.','document.sendorder.pass.focus();');
			return false;
		}
		if(pass!=repass) {
			ShowAlert('Hasła nie s± zgodne...<BR /><BR />Proszę wprowadzić nowe hasło i potwierdzić je w polu poniżej.','document.sendorder.pass.focus();');
			return false;
		}
	}
	}
	
	if(Validate() == true) {
		document.sendorder.oper.value = 'addaccount';
		document.sendorder.action = 'konto.php';
		document.sendorder.submit();
	}
}

function ApplyAccount() {
	w_login = /^[A-Za-z0-9]{6,32}$/;
	if(!w_login.test(document.sendorder.login.value)) {
		ShowAlert('Login powinien mieć min 6 i max 32 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry, bez polskich znaków.','document.sendorder.login.focus();');
		return false;
	}
	if(document.sendorder.pass) {
		if(document.sendorder.pass.value.length>0) {
		pass = document.sendorder.pass.value;
		repass = document.sendorder.repass.value;
		w_pass = /^[A-Za-z0-9]{6,16}$/;
		if(!w_pass.test(pass)) {
			ShowAlert('Hasło powinno mieć min 6 i max 16 znaków !!!<BR /><BR />Dozwolone s± litery i cyfry.','document.sendorder.pass.focus();');
			return false;
		}
		if(pass!=repass) {
			ShowAlert('Hasła nie s± zgodne...<BR /><BR />Proszę wprowadzić nowe hasło i potwierdzić je w polu poniżej.','document.sendorder.pass.focus();');
			return false;
		}
	}
	}
	
	if(Validate() == true) {
		document.sendorder.oper.value = 'applyaccount';
		document.sendorder.action = 'konto.php';
		document.sendorder.submit();
	}
}

function AddOrder() {

	if(document.sendorder.del_met.selectedIndex == 0) {
		ShowAlert('Wybierz forme dostawy !!!','document.sendorder.del_met.focus();');
		return;
	}
	if(document.sendorder.zgoda.checked == false) {
		ShowAlert('Musisz zaakceptować regulamin sklepu i wyrazić zgode na przetwarzanie danych osobowych.','document.sendorder.zgoda.focus();');
		return false;
	}
	
	if(Validate() == true) {
		document.sendorder.oper.value = 'addorder';
		document.sendorder.action = 'wyslij.php';
		document.sendorder.submit();
	}
}

function AddOrderLog() {

	if(document.sendorder.del_met.selectedIndex == 0) {
		ShowAlert('Wybierz forme dostawy !!!','document.sendorder.del_met.focus();');
		return;
	}
	if(document.sendorder.zgoda.checked == false) {
		ShowAlert('Musisz zaakceptować regulamin sklepu i wyrazić zgode na przetwarzanie danych osobowych.','document.sendorder.zgoda.focus();');
		return false;
	}
	
	
	document.sendorder.oper.value = 'addorderlog';
	document.sendorder.action = 'wyslij.php';
	document.sendorder.submit();
	
}

function ReloadCart() {
	document.cart.oper.value = 'reloadcart';
	document.cart.action = 'koszyk.php';
	document.cart.submit();
}

function ClearCart() {
	document.cart.oper.value = 'clearcart';
	document.cart.action = 'koszyk.php';
	document.cart.submit();
}

function ClearCartM() {
	document.minipanel.oper.value = 'clearcart';
	document.minipanel.action = 'koszyk.php';
	document.minipanel.submit();
}
function LogOutM() {
		document.minipanel.oper.value = "logout";
		document.minipanel.submit();
}

function SendOrder() {
	
	count = document.getElementById("count").value*1+1;
	tsumc = 0;
	for(x=1;x<count;x++){
		if(document.getElementById("AP_"+x).checked == true && document.getElementById("PQ_"+x).value>0) {
			tsumc += document.getElementById("PQ_"+x).value * 1;
		}
	}
	if(tsumc == 0) {
		ShowAlert('Koszyk jest pusty ....<br /><br />Nie możesz wysłać zamówienia.','document.cart.focus();');
		return false;
	}
	document.cart.oper.value = 'sendorder';
	document.cart.action = 'wyslij.php';
	document.cart.submit();
}

function Back2Cart() {
	document.sendorder.action = 'wyslij.php';
	document.sendorder.submit();
}

function ChangeAccount() {
	document.sendorder.oper.value = "changeaccount";
	document.sendorder.action = 'konto.php';
	document.sendorder.submit();
}

function ShowAccount() {
	document.login.oper.value = "changeaccount";
	document.login.action = 'konto.php';
	document.login.submit();
}
function GoDelAccount() {
	document.login.oper.value = "godelaccount";
	document.login.action = 'konto.php';
	document.login.submit();
}

function DeleteAccountQ() {
	
	if(document.getElementById("log").value.length==0) {
		ShowAlert('Proszę wpisać swój login.','document.getElementById("log").focus();');
		return false;
	}
	if(document.getElementById("pass").value.length==0) {
		ShowAlert('Proszę wpisać swój hasło.','document.getElementById("pass").focus();');
		return false;
	}
	if(document.getElementById("repass").value.length==0) {
		ShowAlert('Proszę wpisać powtórnie swoje hasło.','document.getElementById("repass").focus();');
		return false;
	}
	if(document.getElementById("pass").value!=document.getElementById("repass").value) {
		ShowAlert('Wpisane hasła nie s± zgodne.','document.getElementById("pass").focus();');
		return false;
	}
	
	ShowQuery('Czy na pewno chcesz usun±ć swoje konto ??','DeleteAccount();');
	return false;
}
//DeleteAccount
function DeleteAccount() {
	document.delacc.oper.value = "deleteaccount";
	document.delacc.action = "konto.php";
	document.delacc.submit();
}

function OrderHistory() {
	document.login.action = 'historia.php';
	document.login.submit();
}

function AddNewAccount() {
	document.login.oper.value = "addnewaccount";
	document.login.action = "konto.php";
	document.login.submit();
}
function SendPass() {
	w_login = /^[A-Za-z0-9 .-_]{6,32}$/;
	if(!w_login.test(document.login.sendpasslogin.value)) {
		ShowAlert('Błędny adres email.','document.login.sendpasslogin.focus();');
		return false;
	}
	t1 = document.login.sendpasslogin.value.split("@");
	if(t1.length>1) t2 = t1[1].split(".");
	if(t1.length<2 || t2.length<2) {
		ShowAlert('Błędny adres email !!!','document.login.sendpasslogin.focus();');
		return false;
	}
	document.login.oper.value = "sendpass";
	document.login.action = "konto.php";
	document.login.submit();
}
/* ================================================================== */

function GetBroswer(win) {
	if (browserType == "gecko") document.poppedLayer = eval("document.getElementById('"+win+"')");
	else if (browserType == "ie") document.poppedLayer = eval("document.all['"+win+"']");
	else document.poppedLayer = eval("document.layers['"+win+"']");
	return document.poppedLayer;
}

function ShowQuery(info,el) {
	var scrollPos = (window["pageYOffset"]) ? window["pageYOffset"] : (document["documentElement"]||document["body"]).scrollTop ;
	document.windowquery_f.varsq.value = el;
	Layer = GetBroswer('windowquery');
	winwidth = 400;
	winheight = 100;
	xpoz = document.body.offsetWidth/2 - winwidth/2;
	ypoz = screen.height/2 - winheight/2;
	scrollPos = scrollPos - winheight;
	document.getElementById("txtquery").innerHTML = info;
	Layer.style.display = "block";
	Layer.style.left = xpoz+"px";
	Layer.style.top = (ypoz + scrollPos)+"px";
}
function AnswerQuery(odp) {
	Layer = GetBroswer('windowquery');
	Layer.style.display = "none";
	if(odp==true) eval(document.windowquery_f.varsq.value);
}

function ShowAlert(info,el) {
	var scrollPos = (window["pageYOffset"]) ? window["pageYOffset"] : (document["documentElement"]||document["body"]).scrollTop ;
	document.windowalert_f.varsa.value = el;
	Layer = GetBroswer('windowalert');
	winwidth = 400;
	winheight = 100;
	xpoz = document.body.offsetWidth/2 - winwidth/2;
	ypoz = screen.height/2 - winheight/2;
	scrollPos = scrollPos - winheight;
	document.getElementById("txtalert").innerHTML = info;
	Layer.style.display = "block";
	Layer.style.left = xpoz+"px";
	Layer.style.top = (ypoz + scrollPos)+"px";
}
function HideAlert() {
	Layer = GetBroswer('windowalert');
	Layer.style.display = "none";
	eval(document.windowalert_f.varsa.value);
}

/* ================================================================== */

function Return(path) {
	window.open("http://"+path,"_self");
}


nn4=(document.layers) ? true : false;
ie4=(document.all) ? true : false;
Nowe=null;
function Show(id) {
winwidth = 400;
winheight = 400;
xpoz = screen.width/2 - winwidth/2;
ypoz = screen.height/2 - winheight/2;
if (Nowe) {
 if (ie4) Nowe.close();
 else if (nn4) Nowe.closed;
 Nowe=null
 };
Nowe=window.open("../pokaz2.php?id="+id, "","toolbar=no,menubar=no,location=no,personalbar=no, scrollbars=yes,status=no,directories=no,resizable=no,height="+winheight+",width="+winwidth+",left="+xpoz+",top="+ypoz);
Nowe.focus()
}