function sendPassword(){

	if (document.mainForm.client_email.value == ''){
		document.mainForm.client_email.focus();
		alert("Proszę wypełnić pole Adres email !");
	} else {	
		if ((document.mainForm.client_email.value.indexOf("@")==document.mainForm.client_email.value.lastIndexOf("@"))&&(document.mainForm.client_email.value.charAt(document.mainForm.client_email.value.indexOf("@")+1) != '.')&&(document.mainForm.client_email.value.charAt(document.mainForm.client_email.value.indexOf("@")-1) != '.')&&(document.mainForm.client_email.value.indexOf("@") != 0)&&(document.mainForm.client_email.value.indexOf(".") != 0)&&(document.mainForm.client_email.value.lastIndexOf(".") > document.mainForm.client_email.value.indexOf("@"))){
			document.mainForm.submit();
		} else {
			alert('Proszę wypełnić poprawnie pole Adres email !');
			document.mainForm.client_email.focus();
		} 	
	}
}

function addTrash(pole){

	var o = document.getElementById(pole);
	switch (isInteger(o.value))
	{
	 case true:
		if (o.value == 0 || o.value < 0){
			alert("Proszę wpisać poprawną ilość !");
		} else {
			document.trash.rid.value=pole;
			document.trash.ile.value=o.value;
			document.trash.submit();
			//window.location = "?pid=81&rid="+pole+"&val="+o.value;
			//alert('Dodajemy do koszyka :' + document.getElementById(pole).value); 
		}
	 break;
	 case false:
		alert("Proszę wpisać poprawną ilość !");
	} 
}

function updateTrash(){
	document.trash.action.value = 'update';

	var blad = 0;
	
	for (i=0; i < document.trash.elements.length; i++) {
		ele = document.trash.elements[i];
		if (ele.type == 'text' && ele.name != 'pid' && ele.name != 'action')
		{
			var o = ele.value;
			switch (isInteger(o))
			{
			 case true:
				if (o == 0 || o < 0){
					alert("Proszę wpisać poprawną ilość !");
					blad = 1;
				} 
			 break;
			 case false:
				alert("Proszę wpisać poprawną ilość !");
				blad = 1;
			}
		}
	}
	if (blad == 0)
	{
		//alert('submit');
		document.trash.submit();
	}
}

function order(){
	document.trash.pid.value = '83.html';
	document.trash.submit();
}




function isInteger (s){
	var i;

	if (isEmpty(s))
	if (isInteger.arguments.length == 1) return 0;
	else return (isInteger.arguments[1] == true);

	for (i = 0; i < s.length; i++)
	{
	 var c = s.charAt(i);

	 if (!isDigit(c)) return false;
	}

	return true;
}

function isEmpty(s)
{
  if ((s == null) || (s.length == 0)){
		alert("Proszę wpisać ilość !");
		return true;
  } else {
		return false;
  }
}

function isDigit (c)
{
  return ((c >= "0") && (c <= "9"))
}


function prompter(pcid,cid,prid) {
	var reply = prompt("Proszę wpisać adres email", "")
	if (reply != null)
	{
		window.location = "/36.html?pcid="+pcid+"&cid="+cid+"&prid="+prid+"&email="+reply;
	}
} 

