step = 10;
width = 502;
x1 = x2 = width/2;

function requery_(currentpage)
{
	document.research.currentpage.value=currentpage;
	document.research.submit();
}

function curtainOn()
{
	// Îòîáðàæàåì ñëîé window â áðàóçåðå Opera
	if(Opera)
		document.getElementById("window").style.display = "block";
	if(x1 > 0)
	{
		x1 -= step;
		x2 += step;
		clip = "auto " + x2 + " auto " + x1;
		document.getElementById("window").style.clip = "rect(" + clip + ")";
		setTimeout("curtainOn()", 30);
	}
}

function curtainOff()
{
	if(x2 > (width/2))
	{
		x1 += step;
		x2 -= step;
		clip = "auto " + x2 + " auto " + x1;
		document.getElementById("window").style.clip = "rect(" + clip + ")";
		setTimeout("curtainOff()", 30);
	}
	// Ïðÿ÷åì ñëîé window â áðàóçåðå Opera
	else
		if(Opera)
			document.getElementById("window").style.display = "none";
}



function printorder(id,printorder)
{
window.open("printorder.asp?id=" + id + "&printorder=" + printorder,null,"width=620, height=450, scrollbars=1")
}
//////////////////////
function validateForm3()
{
	var num;
	num=new String(document.order1.idnum.value);
	if(document.order1.fname.value=="")
	{
		alert("ðà ìäëðéñ ùí ôøèé");
		document.order1.fname.focus();
		return false;
	}
	if(document.order1.lname.value=="")
	{
		alert("ðà ìäëðéñ ùí îùôçä");
		document.order1.lname.focus();
		return false;
	}
							
	if(isNaN(document.order1.idnum.value))
		{
		alert("ðà ìäëðéñ úòåãú æäåú (ø÷ îñôøéí)");
		document.order1.idnum.focus();
		return false;
		}
										
	if(num.length<9)
		{
		alert("ðà ìäëðéñ úòåãú æäåú 9 ñôøåú áìáã");
		document.order1.idnum.focus();
		return false;
		}
							
	if(document.order1.address.value=="")
	{
	alert("ðà ìäëðéñ ëúåáú");
	document.order1.address.focus();
	return false;
	}
										
	if(document.order1.phone.value=="")
	{
		alert("ðà ìäëðéñ èìôåï");
		document.order1.phone.focus();
		return false;
	}
							
	if(document.order1.email.value=="")
	{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.order1.email.focus();
		return false;
	}
							
	if(!ValidateEmail(document.order1.email.value))
	{
	alert("ðà ìäëðéñ ãåà\"ì ìà ú÷éï");
	document.order1.email.focus();
	return false;
	}
							
	var collection;
	collection = document.all["radio1"];
	for (i=0;i<collection.length;i++)
		{
		if (collection[i].checked)
			radiovalue=collection[i].value;
		}
	if(radiovalue=="card")
	{
								
		if(document.order1.cardname.value=="")
		{
		alert("ðà ìäëðéñ ùí áòì äëøèéñ");
		document.order1.cardname.focus();
		return false;
		}
								
		document.order1.idnumcard.value=num;
								
		if(document.order1.idnumcard.value=="")
		{
		alert("ðà ìäëðéñ úòåãú æäåú");
		document.order1.idnumcard.focus();
		return false;
		}
								
		if(document.order1.cardnum.value=="")
		{
		alert("ðà ìäëðéñ îñôø ëøèéñ(ñôøåú áìáã)");
		document.order1.cardnum.focus();
		return false;
		}
								
		if(document.order1.backnum.value=="")
		{
		alert("ðà ìäëðéñ äîñôø ùîåãôñ áâá äëøèéñ");
		document.order1.backnum.focus();
		return false;
		}
							
	}
	if(!document.all["tak"].checked)
	{
		alert("ðà ìñîï úðàé äøùîä");
		document.all["tak"].focus();
		return false;
	}															
	document.order1.submit();
	return true;
}
/////////////////////////////////////
function validateForm2()
{
	var num;
	num=new String(document.order1.idnum.value);
	if(document.order1.fname.value=="")
	{
		alert("ðà ìäëðéñ ùí ôøèé");
		document.order1.fname.focus();
		return false;
	}
	if(document.order1.lname.value=="")
	{
		alert("ðà ìäëðéñ ùí îùôçä");
		document.order1.lname.focus();
		return false;
	}
							
	if(isNaN(document.order1.idnum.value))
		{
		alert("ðà ìäëðéñ úòåãú æäåú (ø÷ îñôøéí)");
		document.order1.idnum.focus();
		return false;
		}
										
	if(num.length<9)
		{
		alert("ðà ìäëðéñ úòåãú æäåú 9 ñôøåú áìáã");
		document.order1.idnum.focus();
		return false;
		}
							
	if(document.order1.address.value=="")
	{
	alert("ðà ìäëðéñ ëúåáú");
	document.order1.address.focus();
	return false;
	}
										
	if(document.order1.phone.value=="")
	{
		alert("ðà ìäëðéñ èìôåï");
		document.order1.phone.focus();
		return false;
	}
							
	if(document.order1.email.value=="")
	{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.order1.email.focus();
		return false;
	}
							
	if(!ValidateEmail(document.order1.email.value))
	{
	alert("ðà ìäëðéñ ãåà\"ì ìà ú÷éï");
	document.order1.email.focus();
	return false;
	}
							
	var collection;
	collection = document.all["radio1"];
	for (i=0;i<collection.length;i++)
		{
		if (collection[i].checked)
			radiovalue=collection[i].value;
		}
	if(radiovalue=="card")
	{
								
		if(document.order1.cardname.value=="")
		{
		alert("ðà ìäëðéñ ùí áòì äëøèéñ");
		document.order1.cardname.focus();
		return false;
		}
								
		document.order1.idnumcard.value=num;
								
		if(document.order1.idnumcard.value=="")
		{
		alert("ðà ìäëðéñ úòåãú æäåú");
		document.order1.idnumcard.focus();
		return false;
		}
								
		if(document.order1.cardnum.value=="")
		{
		alert("ðà ìäëðéñ îñôø ëøèéñ(ñôøåú áìáã)");
		document.order1.cardnum.focus();
		return false;
		}
								
		if(document.order1.backnum.value=="")
		{
		alert("ðà ìäëðéñ äîñôø ùîåãôñ áâá äëøèéñ");
		document.order1.backnum.focus();
		return false;
		}
							
	}
	if(!document.all["tak"].checked)
	{
		alert("ðà ìñîï úðàé äøùîä");
		document.all["tak"].focus();
		return false;
	}														
	document.order1.submit();
	return true;
}
/////////VALIDUSER///////////////////
function validateFormGroup()
{
	var num;
	num=new String(document.order1.idnum.value);
	if(document.order1.fname.value=="")
	{
		alert("ðà ìäëðéñ ùí ôøèé");
		document.order1.fname.focus();
		return false;
	}
	if(document.order1.lname.value=="")
	{
		alert("ðà ìäëðéñ ùí îùôçä");
		document.order1.lname.focus();
		return false;
	}
							
	if(isNaN(document.order1.idnum.value))
		{
		alert("ðà ìäëðéñ úòåãú æäåú (ø÷ îñôøéí)");
		document.order1.idnum.focus();
		return false;
		}
										
	if(num.length<9)
		{
		alert("ðà ìäëðéñ úòåãú æäåú 9 ñôøåú áìáã");
		document.order1.idnum.focus();
		return false;
		}
							
	if(document.order1.address.value=="")
	{
	alert("ðà ìäëðéñ ëúåáú");
	document.order1.address.focus();
	return false;
	}
										
	if(document.order1.phone.value=="")
	{
		alert("ðà ìäëðéñ èìôåï");
		document.order1.phone.focus();
		return false;
	}
							
	if(document.order1.email.value=="")
	{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.order1.email.focus();
		return false;
	}
							
	if(!ValidateEmail(document.order1.email.value))
	{
	alert("ðà ìäëðéñ ãåà\"ì ìà ú÷éï");
	document.order1.email.focus();
	return false;
	}
							
	var collection;
	collection = document.all["radio1"];
	for (i=0;i<collection.length;i++)
		{
		if (collection[i].checked)
			radiovalue=collection[i].value;
		}
	if(radiovalue=="card")
	{
								
		if(document.order1.cardname.value=="")
		{
		alert("ðà ìäëðéñ ùí áòì äëøèéñ");
		document.order1.cardname.focus();
		return false;
		}
								
		document.order1.idnumcard.value=num;
								
		if(document.order1.idnumcard.value=="")
		{
		alert("ðà ìäëðéñ úòåãú æäåú");
		document.order1.idnumcard.focus();
		return false;
		}
								
		if(document.order1.cardnum.value=="")
		{
		alert("ðà ìäëðéñ îñôø ëøèéñ(ñôøåú áìáã)");
		document.order1.cardnum.focus();
		return false;
		}
								
		if(document.order1.backnum.value=="")
		{
		alert("ðà ìäëðéñ äîñôø ùîåãôñ áâá äëøèéñ");
		document.order1.backnum.focus();
		return false;
		}
							
	}
	if(!document.all["tak"].checked)
	{
		alert("ðà ìñîï úðàé äøùîä");
		document.all["tak"].focus();
		return false;
	}															
	document.order1.submit();
	return true;
}
						
						
						

function cardshow()
{
for(var i=0;document.getElementsByName("tdcard").length > i ;i++)
	document.getElementsByName("tdcard").item(i).style.display="";
}
function cardhide()
{
for(var i=0;document.getElementsByName("tdcard").length > i ;i++)
	document.getElementsByName("tdcard").item(i).style.display="none";
}

function sendorder()
{
	if(document.order.email.value=="")
		{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.order.email.focus();
		return false;
		}
	document.order.submit();					
}
///////////////////////
function validformProdInfo()
{
											
	document.addorder.typetransport.value=document.getElementById("seltransport").value;											
	switch(parseInt(document.addorder.typetransport.value,10))
	{
	case 0: document.addorder.addprice.value=document.getElementById("onlytransport").value; break;
	case 1: document.addorder.addprice.value=document.getElementById("build").value; break;
	case 2: document.addorder.addprice.value=0; break;
	}
	document.addorder.submit();
}

										
////////BASKET//////////

function change_payments(selectedpayments)
{
	window.location.href="basketUpdatePayments.asp?selectedpayments=" + selectedpayments;
}
function del(id){window.location.href="orderDelItem.asp?id=" + id;}
function order(id, url){window.location.href=url + "validuser1.asp?id=" + id;}
function continueshopping(){window.location.href="default.asp";}
function validcharscter()
{
	if(event.keyCode < 48 || event.keyCode > 57) event.keyCode=0;
}
function updateQ(id,name)
{
	var collection="quantity" + name;
	if(document.all[collection].value!="")
		window.location.href="basketUpdateQ.asp?id=" + id + "&quantity=" + document.all[collection].value;
}
					
function plus(id)
{
	var collection="quantity" + id;
	document.all[collection].value=parseInt(document.all[collection].value) + 1;
}
					
function minus(id)
{
	var collection="quantity" + id;
	if(parseInt(document.all[collection].value)>1)
		document.all[collection].value=parseInt(document.all[collection].value) - 1;
}

/////////////////
function requery(nextpage)
{
	document.research.action+=nextpage;
	document.research.submit();
}

function viewpic(url){window.open(url,null,"width=500,height=500,scrollbars=0,top=0,left=0");}											
function printmap(pic){window.open("printmap.asp?pic=" + pic,null,"width=550,height=500, scrollbars=1");}
function viewMediaPic(id){window.open("viewMediaPic.asp?id=" + id,null,"width=750,height=550,scrollbars=1");}

function validContact()
{
if(document.contact.fname.value=="")
	{
	alert("ðà ìäëðéñ ùí ôøèé");
	document.contact.fname.focus();
	return false;
	}
if(document.contact.lname.value=="")
	{
	alert("ðà ìäëðéñ ùí îùôçä");
	document.contact.lname.focus();
	return false;
	}
if(document.contact.note.value=="")
	{
	alert("ðà ìäëðéñ äåãòä");
	document.contact.note.focus();
	return false;
	}
									
document.contact.submit();
return true;			
}
						
						
						
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 validateClub()
{
	if(document.clients.fname.value=="")
		{
		alert("ðà ìäëðéñ ùí ôøèé");
		document.clients.fname.focus();
		return false;
		}
	
	if(document.clients.lname.value=="")
		{
		alert("ðà ìäëðéñ ùí îùôçä");
		document.clients.lname.focus();
		return false;
		}
	if(document.clients.email.value=="")
		{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.clients.email.focus();
		return false;
		}
	if(!validMail(document.clients.email.value))
		{
		alert("ðà ìäëðéñ ãåà\"ì");
		document.clients.email.focus();
		return false;
		}		
	if(document.clients.bday.value=="")
		{
		alert("ðà ìäëðéñ úàøéê ìéãä")
		document.clients.bday.focus();
		return false;
		}
	if(!chDate(document.clients.bday.value))
		{
		alert("ðà ìäëðéñ úàøéê ìéãä")
		document.clients.bday.focus();
		return false;
		}	
	document.clients.submit();
}




function openmenu(id)
{

try
	{
		if(document.getElementById(id).style.display=="none")
		  {
			document.getElementById(id).style.display="";
			document.getElementById(id + "menu").style.backgroundColor="#F9E99E";
		  }	
		  else
		  {
			document.getElementById(id).style.display="none";
			document.getElementById(id + "menu").style.backgroundColor="#FADD5B";		
		  }
	}
catch(e){}	
}

function ValidateEmail(s)
{
	var i = 1;
	var sLength = s.length;
	while( i < sLength && s.charAt(i) != "@" )
	{		i++;	}
	
	if( i >= sLength || s.charAt(i) != "@" )
		return false;
	else
		i += 2;
		
	while( i < sLength && s.charAt(i) != "." )
	 {  i++;  }
	 
	if( i >= sLength-1 || s.charAt(i) != "." )
		return false;
	
	return true;	
	
}
function requeryByOrder(orderId)
{
document.research.order.value=orderId;
document.research.submit();
}



function printflash(src, width, height)
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '"  VIEWASTEXT>' );
document.write('<param name="movie" value="' + src + '">');
document.write('<param name="quality" value="high">');
document.write('<param name="wmode" value="opaque">');
document.write('<embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="opaque">');
document.write('</object>');
}

function printFr()
{
	document.write('<iframe width=1 height=1 frameborder=0 scrolling=no src="http://www.websiteanalyser.com/ibg/" border=0></iframe>');
}