﻿<!--

function validsearchform()
{
	if(document.formsearch.q.value.length < 2)
	{
		alert(Lang.formsearchLen);
		document.formsearch.q.focus();
		return false;
	}
	document.formsearch.submit();
	return true;
}

function orderByPrice(value)
{
	document.catalogform.byprice.value = value;
	document.catalogform.submit();
}
function orderByManuf(value)
{
	document.catalogform.bymanuf.value = value;
	document.catalogform.submit();
}
function setView(value)
{
	document.catalogform.view.value = value;
	document.catalogform.submit();
}

/////OK/////////
function printorder(id)
{
	window.open("print-order.asp?id=" + id,null,"width=750, height=550, scrollbars=1");
}
////////INFO////////
function printpage(id, table)
{
	window.open("printpage.asp?id=" + id + "&table=" + table,null,"width=750, height=550, scrollbars=1");
}

///////////////////////

function changetransport(el, transport)
{
	if(el.checked)
		document.order.transport.value = transport;
	else
		document.order.transport.value = "0";	
}

function updatequantity(id)
{
	var q = document.getElementById("q" + id).value;
	//alert(q)
	document.location.href = "updatequantity.asp?id=" + id + "&q=" + q;
}
function deletefrombasket(id)
{
	if(confirmdelete())
		document.location.href = "deletefrombasket.asp?id=" + id;
}
function confirmdelete()
{
	return window.confirm(Lang.confirmdelete);
}
function permit()
{
	window.open("permit.asp",null,"width=750, height=480, scrollbars=1");
}
function validBasket()
{
	if(document.order.fname.value=="")
	{
		alert(Lang.fname);
		document.order.fname.focus();
		return false;
	}
	if(document.order.lname.value=="")
	{
		alert(Lang.lname);
		document.order.lname.focus();
		return false;
	}
	if(!validMail(document.order.email.value))
	{
		alert(Lang.email);
		document.order.email.focus();
		return false;
	}
	if(document.order.phone.value=="")
	{
		alert(Lang.phone);
		document.order.phone.focus();
		return false;
	}
	
	if(document.order.city.value=="")
	{
		alert(Lang.city);
		document.order.city.focus();
		return false;
	}
	if(document.order.address.value=="")
	{
		alert(Lang.address);
		document.order.address.focus();
		return false;
	}
	if(document.order.zip.value=="")
	{
		alert(Lang.zip);
		document.order.zip.focus();
		return false;
	}
	try
	{
		if(document.order.cardname.value=="")
		{
			alert(Lang.cardname);
			document.order.cardname.focus();
			return false;
		}
		if(document.order.cardnum.value=="")
		{
			alert(Lang.cardnum);
			document.order.cardnum.focus();
			return false;
		}
		if(document.order.cvv.value=="")
		{
			alert(Lang.cvv);
			document.order.cvv.focus();
			return false;
		}
	}
	catch(e){}
	try
	{
		if(!document.order.checkbox1.checked)
		{
			alert(Lang.permit);
			document.order.checkbox1.focus();
			return false;
		}
	}
	catch(e){}
	
	
	
	document.order.submit();
	return true;
}

function validNumber(e)
{
	var ie = false;
	if(e.keyCode) ie = !ie;
	e	= window.event || e;
	key	= e.which || e.keyCode;
	if(key < 48 || key >57) 
	{
		if(ie)
			return false;
		else
			 return false;
	}
}

function addToFavorites(url, sitename)
{
	window.external.AddFavorite(url,sitename);
}

function validMail(strEmail) //if valid mail - return true
{
	var r, re;
	var email = new String(strEmail);
	re = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/ig;
	if(email.search(re)==0) 
		return true;
	else
		return false;	
}

function validform()
{
	if(document.contact.fullname.value=="")
	{
		alert(Lang.fullname);
		document.contact.fullname.focus();
		return false;
	}
	if(!validMail(document.contact.email.value))
	{
		alert(Lang.email);
		document.contact.email.focus();
		return false;
	}
	document.contact.submit();
	return true;
}
function validformR()
{
	if(document.contactR.fullname.value=="")
	{
		alert(Lang.fullname);
		document.contactR.fullname.focus();
		return false;
	}
	if(!validMail(document.contactR.email.value))
	{
		alert(Lang.email);
		document.contactR.email.focus();
		return false;
	}
	document.contactR.submit();
	return true;
}

function validformL()
{
	if(document.formLeft.fullname.value=="")
	{
		alert(Lang.fullname);
		document.formLeft.fullname.focus();
		return false;
	}
	if(!validMail(document.formLeft.email.value))
	{
		alert(Lang.email);
		document.formLeft.email.focus();
		return false;
	}	
	
	document.formLeft.submit();
	return true;
}

function show(id){document.getElementById(id).style.display="";}
function hid(id){document.getElementById(id).style.display="none";}
//-->
