<!--

function printflash(src, w, h)
{
	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="'+w+'" height="'+h+'" VIEWASTEXT>');
	document.write('<param name="movie" value="'+src+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" wmode="transparent">');
	document.write('</object>');	
}


var img = "7";
function hidenote(){document.getElementById("tooltip2").style.visibility="hidden";}
function shownote(txt)
{
	document.getElementById("tooltip2").style.pixelLeft = event.clientX + document.body.scrollLeft - 65;
	document.getElementById("tooltip2").style.pixelTop	= event.clientY + document.body.scrollTop - 65;
	document.getElementById("tooltip2").innerHTML=txt;
	document.getElementById("tooltip2").style.visibility="visible";
}

function viewpic(itemid, place){window.open("viewpic.asp?id=" + itemid + "&place=" + place,null,"height=450, width=450, scrollbars=1");}
function permitT(){window.open("permitT.asp",null,"height=470, width=750, scrollbars=0");}

function viewpicBig(itemid){window.open("viewpicBig.asp?id=" + itemid,null,"height=450, width=450, scrollbars=1");}
function openAddress(id){window.open("provider.asp?id=" + id,null,"height=300, width=300, scrollbars=1");}
function viewColor(id){window.open("viewColor.asp?id=" + id,null,"height=300, width=300, scrollbars=1");}
function viewpicItem(id)
{
	try
	{
	if(document.getElementById("itemimage").src!=null || document.getElementById("itemimage").src!="")
		window.open("viewpicItem.asp?img=" + img + "&id=" + id,null,"height=450, width=450, scrollbars=0");
	}
	catch(e){}	
}
function setimg(src,id)
{
	if(src!="")
	{
		document.getElementById("itemimage").src = src;
		img = id;
	}
}
function validformR()
{
	if(document.dilers.fname.value=="")
	{
	alert("נא לרשום שם פרטי/משפחה");
	document.dilers.fname.focus();
	return false;
	}
	
	
	if(document.dilers.email.value=="")
	{
	alert("נא לרשום אי-מייל");
	document.dilers.email.focus();
	return false;
	}
		
	if(!validMail(document.dilers.email.value))
	{
	alert("נא לרשום אי-מייל");
	document.dilers.email.focus();
	return false;
	}	
	
	if(document.dilers.contact.value=="")
	{
	alert("נא לרשום איש קשר");
	document.dilers.contact.focus();
	return false;
	}
	document.dilers.submit();
	return true;
}

function validsearch()
{
	if(document.formsearch.q.value=="")
	{
		alert("נא להכניס מילת חיפוש");
		document.formsearch.q.focus();
		return false;
	}
	document.formsearch.submit();
	return true;
}

function changeDetails(val)
{
	if(val=="idclient")
	{
		document.getElementById("idclient1").style.display="";
		document.getElementById("idclient2").style.display="";
		document.getElementById("idcompany1").style.display="none";
		document.getElementById("idcompany2").style.display="none";
	}
	else
	{
		document.getElementById("idclient1").style.display="none";
		document.getElementById("idclient2").style.display="none";
		document.getElementById("idcompany1").style.display="";
		document.getElementById("idcompany2").style.display="";
	}
	
}


function detect()
{
    if(document.getElementsByName("cl").item(0).checked)
        return true;
    else 
        return false;
}

function validateOrder()
{
	var num;
	
	
	if(detect())
	{
		if(document.order1.fname1.value=="")
		{
			alert("נא להכניס שם פרטי");
			document.order1.fname1.focus();
			return false;
		}
		
		if(document.order1.lname1.value=="")
		{
			alert("נא להכניס שם משפחה");
			document.order1.lname1.focus();
			return false;
		}
		
		num=new String(document.order1.idnum1.value);
		
		if(isNaN(document.order1.idnum1.value))
		{
			alert("נא להכניס תעודת זהות (רק מספרים)");
			document.order1.idnum1.focus();
			return false;
		}
											
		if(num.length<9)
		{
			alert("נא להכניס תעודת זהות 9 ספרות בלבד");
			document.order1.idnum1.focus();
			return false;
		}
		if(document.order1.address1.value=="")
		{
			alert("נא להכניס כתובת למשלוח");
			document.order1.address1.focus();
			return false;
		}	
	}
	else
	{
		if(document.order1.fname2.value=="")
		{
			alert("נא להכניס שם חברה");
			document.order1.fname2.focus();
			return false;
		}		
		
		num=new String(document.order1.idnum2.value);
		
		if(isNaN(document.order1.idnum2.value))
		{
			alert("נא להכניס ח.פ/עוסק מורשה ספרות בלבד");
			document.order1.idnum2.focus();
			return false;
		}
											
		if(num.length < 5)
		{
			alert("נא להכניס ח.פ/עוסק מורשה מינימום 5 ספרות");
			document.order1.idnum2.focus();
			return false;
		}
		if(document.order1.address2.value=="")
		{
			alert("נא להכניס כתובת למשלוח");
			document.order1.address2.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(!validMail(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 printorder(id,printorder){window.open("printorder.asp?id=" + id + "&printorder=" + printorder,null,"width=620, height=450, scrollbars=1");}
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 validcharscter(){if(event.keyCode < 48 || event.keyCode > 57) event.keyCode=0;	}
function change_payments(selectedpayments){window.location.href="basketUpdatePayments.asp?selectedpayments=" + selectedpayments;}
function del(id){window.location.href="basket_delitem.asp?id=" + id;}
function order(){window.location.href="validuser1.asp";}
function continueshopping(){window.location.href="default.asp";}
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 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.fname.value=="")
	{
	alert("נא לרשום שם פרטי");
	document.contact.fname.focus();
	return false;
	}
	if(document.contact.lname.value=="")
	{
	alert("נא לרשום שם משפחה");
	document.contact.lname.focus();
	return false;
	}
	
	if(document.contact.email.value=="")
	{
	alert("נא לרשום אי-מייל");
	document.contact.email.focus();
	return false;
	}	
	if(!validMail(document.contact.email.value))
	{
	alert("נא לרשום אי-מייל");
	document.contact.email.focus();
	return false;
	}
	
	if(document.contact.nameto.value=="0")
	{
	alert("נא לרשום איש מחירות");
	document.contact.nameto.focus();
	return false;
	}
	
	if(document.contact.note.value=="")
	{
	alert("נא לרשום טקסט");
	document.contact.note.focus();
	return false;
	}
	document.contact.submit();
	return true;
}

//-->
