function doClubSubmit(){
	fName=document.formClub.fName.value;
	if (fName=="")
	 	{ msg="נא למלא שם ";
		  alert(msg);
		  document.formClub.fName.select();
		  return;}
	lName=document.formClub.lName.value;
	if (lName=="")
	 	{ msg="נא למלא משפחה ";
		  alert(msg);
		  document.formClub.lName.select();
		  return;}
	phone=document.formClub.phone.value;
	if (phone=="")
	 	{ msg="נא למלא טלפון ";
		  alert(msg);
		  document.formClub.phone.select();
		  return;}
    street=document.formClub.street.value;
	if (street=="")
	 	{ msg="נא למלא רחוב ";
		  alert(msg);
		  document.formClub.street.select();
		  return;}
    homeNumber=document.formClub.homeNumber.value;
	if (homeNumber=="")
	 	{ msg="נא למלא את מספר הבית ";
		  alert(msg);
		  document.formClub.homeNumber.select();
		  return;}
    flat=document.formClub.flat.value;
	if (flat=="")
	 	{ msg="נא למלא את מספר הדירה ";
		  alert(msg);
		  document.formClub.flat.select();
		  return;}
    city=document.formClub.city.value;
	if (city=="")
	 	{ msg="נא למלא את העיר ";
		  alert(msg);
		  document.formClub.city.select();
		  return;}
	Email=document.formClub.email.value;
	if ((Email=='דוא"ל')||(Email==''))
	 	{ msg= "נא למלא דוא''ל";
		  alert(msg);
		  document.formClub.email.select();
		  return;}
	
	if ((Email.indexOf("@")<2) || (Email.lastIndexOf(".")<=(Email.indexOf("@")+2) || ((Email.length<8)) || (Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "@" || Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "."))) 
	  	{ msg= "נא למלא דוא''ל תקין";
		  alert(msg);
		  document.formClub.email.select();
		  return;} 
	dAge=document.formClub.dAge.value;
	mAge=document.formClub.mAge.value;
	yAge=document.formClub.yAge.value;	
	if ((dAge!="")||(mAge!="")||(yAge!=""))
		{if (checkBirthDate(dAge,mAge,yAge)==false)
			{document.formClub.dAge.select();
			return;}}			
	document.formClub.submit();
	ClearClubForm();
}
function checkBirthDate(d,m,y){
	if ((d<0) ||(d>31)) 
		{getFalseDate();return false;}				
	if ((m<0) ||(m>12)) 
		{getFalseDate();return false;}				
	var myDate=new Date();
	var CY =myDate.getFullYear();
	if ((y<1900) ||(y>CY)) 
		{getFalseDate();return false;}
	if ((d>30) && ((m==4)||(m==6)||(m==9)||(m==11)))
			{getFalseDate();return false;}
	if (checkFeb(d,m,y))
			{getFalseDate();return false;}
	return true;		  
}
function checkFeb(d1,m1,y1)
	{if (m1!=2)
		return false;
	else
		{if ((y1%4==0)&&(d1>29))
			return true;
		else if ((y1%4!=0)&&(d1>28))
			return true; 
		else	
			return false;}
	}
function getFalseDate()
		{ var msg= "התאריך לא תקין";
		  alert(msg);}

function ClearClubForm()
	{ 
	 var el = formClub.elements;
	 for(i=0;i<el.length;i++)
 	   {
 	   if ((el(i).type=="text")||(el(i).type=="textarea")||(el(i).type=="hidden"))
	   	 	el(i).value="";	   
	   if (el(i).type=="select-one")
	   	 	el(i).value="0";	 
	   if (el(i).type=="checkbox")
			el(i).checked=false;	
		}	
	 }
	 
	 

function doContactSubmit(){
	fName=document.formContact.fName.value;
	if (fName=="")
	 	{ msg="נא למלא שם ";
		  alert(msg);
		  document.formContact.fName.select();
		  return;}
	lName=document.formContact.lName.value;
	if (lName=="")
	 	{ msg="נא למלא משפחה ";
		  alert(msg);
		  document.formContact.lName.select();
		  return;}
	companyCat=document.formContact.companyCat.value;
	if (companyCat=="0")
	 	{ msg="נא לבחור סוג לקוח ";
		  alert(msg);
		  document.formContact.companyCat.select();
		  return;}
	phone=document.formContact.phone.value;
	if (phone=='')
	 	{ msg= "נא למלא טלפון";
		  alert(msg);
		  document.formContact.phone.select();
		  return;}
	Email=document.formContact.email.value;
	if ((Email=='דוא"ל')||(Email==''))
	 	{ msg= "נא למלא דוא''ל";
		  alert(msg);
		  document.formContact.email.select();
		  return;}
	
	if ((Email.indexOf("@")<2) || (Email.lastIndexOf(".")<=(Email.indexOf("@")+2) || ((Email.length<8)) || (Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "@" || Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "."))) 
	  	{ msg= "נא למלא דוא''ל תקין";
		  alert(msg);
		  document.formContact.email.select();
		  return;} 
	address=document.formContact.address.value;
	if (address=='')
	 	{ msg= "נא למלא כתובת";
		  alert(msg);
		  document.formContact.address.select();
		  return;}
	subject=document.formContact.subject.value;
	if (subject=='')
	 	{ msg= "נא למלא נושא";
		  alert(msg);
		  document.formContact.subject.select();
		  return;}
	document.formContact.submit();
	ClearContactForm();
}

function ClearContactForm()
	{ 
	 var el = formContact.elements;
	 for(i=0;i<el.length;i++)
 	   {
 	   if ((el(i).type=="text")||(el(i).type=="textarea")||(el(i).type=="hidden"))
	   	 	el(i).value="";	   
	   if (el(i).type=="select-one")
	   	 	el(i).value="0";	 
		}	
	 }
	 
	 

function doHPSubmit(){
	Email=document.formHP.email.value;
	if ((Email=='דוא"ל')||(Email==''))
	 	{ msg= "נא למלא דוא''ל";
		  alert(msg);
		  document.formHP.email.select();
		  return;}
	
	if ((Email.indexOf("@")<2) || (Email.lastIndexOf(".")<=(Email.indexOf("@")+2) || ((Email.length<8)) || (Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "@" || Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "."))) 
	  	{ msg= "נא למלא דוא''ל תקין";
		  alert(msg);
		  document.formHP.email.select();
		  return;} 
	fullName=document.formHP.fullName.value;
	if ((fullName=="שם מלא")||(fullName==""))
	 	{ msg="נא למלא שם מלא";
		  alert(msg);
		  document.formHP.fullName.select();
		  return;}
	document.formHP.submit();
	ClearHPForm();
}

function ClearHPForm()
	{ 
	 var el = formHP.elements;
	 for(i=0;i<el.length;i++)
 	   {
 	   if ((el(i).type=="text")||(el(i).type=="textarea")||(el(i).type=="hidden"))
	   	 	el(i).value="";	   
		}	
	 }
	 
	 
function doHPSearchSubmit(){
	text1=document.formHPSearch.text1.value;
	
	if (text1=='טקסט חופשי')
	 	{ msg= "נא למלא את תיבת החיפוש";
		  alert(msg);
		  document.formHPSearch.text1.select();
		  return;}
	document.formHPSearch.submit();
	ClearHPSearchForm();
}
function ClearSearchForm()
	{ 
	 var el = formHPSearch.elements;
	 for(i=0;i<el.length;i++)
 	   {
 	   if ((el(i).type=="text")||(el(i).type=="textarea")||(el(i).type=="hidden"))
	   	 	el(i).value="";	
	   if (el(i).type=="select-one")   
			el(i).value="0";	
		}	
	 }	  
function doSearchSubmit(){
	RecCatId=document.formSearch.RecCatId.value;
	ProdCatId=document.formSearch.ProdCatId.value;
	text1=document.formSearch.text1.value;
	
	if ((RecCatId=='0')&&(ProdCatId=='0')&&(text1=='טקסט חופשי'))
	 	{ msg= "נא למלא אחת מתיבות החיפוש";
		  alert(msg);
		  document.formSearch.text1.select();
		  return;}
	/*if ((RecCatId=='0')&&(ProdCatId=='0')&&(text1!='טקסט חופשי'))
		document.formSearch.action = "searchFT.asp";
	else*/
	if (text1=='טקסט חופשי')
		document.formSearch.text1.value='';
	document.formSearch.action = "search.asp";
	document.formSearch.submit();
	ClearSearchForm();
}

function ClearSearchForm()
	{ 
	 var el = formSearch.elements;
	 for(i=0;i<el.length;i++)
 	   {
 	   if ((el(i).type=="text")||(el(i).type=="textarea")||(el(i).type=="hidden"))
	   	 	el(i).value="";	
	   if (el(i).type=="select-one")   
			el(i).value="0";	
		}	
	 }	  
function doSubmitSend2Friend(){
	SenderName=document.formSendMail.SenderName.value;
	if (SenderName=="")
	 	{ msg="נא למלא את השם שלך";
		  alert(msg);
		  document.formSendMail.SenderName.focus();
		  return;}
	FriendName=document.formSendMail.FriendName.value;
	if (FriendName=="")
	 	{ msg="נא למלא את שם החבר שלך";
		  alert(msg);
		  document.formSendMail.FriendName.focus();
		  return;}	
	Email=document.formSendMail.FriendEmail.value;
	if (Email=="")
	 	{ msg= "נא למלא את הדוא''ל של החבר שלך";
		  alert(msg);
		  document.formSendMail.FriendEmail.focus();
		  return;}
	
	if ((Email.indexOf("@")<2) || (Email.lastIndexOf(".")<=(Email.indexOf("@")+2) || ((Email.length<8)) || (Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "@" || Email.charAt(0) == "-" || Email.charAt(0) == "_" || Email.charAt(0) == "."))) 
	  	{ msg= "נא למלא דוא''ל תקין";
		  alert(msg);
		  document.formSendMail.email.select();
		  return;} 	
	document.formSendMail.submit();
	ClearFormSend2Friend();
}
function ClearFormSend2Friend()
	{ 
	 var el = formSendMail.elements;
	 for(i=0;i<el.length;i++)
 	   if (el(i).type=="text")	
	   	 	el(i).value="";
	 }
function doAlert()
	{alert("הדוא''ל נשלח לחבר");}	 

function isTel(e){	
	var strCheck = '0123456789-';
	var whichCode = (window.Event) ? e.which : e.keyCode;	
	if (whichCode != 0){
		if (whichCode == 13) return true;
		key = String.fromCharCode(whichCode);
		if (strCheck.indexOf(key) >-1 ) return  true;
		else return false;
	}
}

function isMail(e){	
	var strCheck = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_.@';
	var whichCode = (window.Event) ? e.which : e.keyCode;		
	if (whichCode != 0){
		if (whichCode == 13) return true;
		key = String.fromCharCode(whichCode);
		if (strCheck.indexOf(key) == -1 ) return false;
		else return true;
	}
}
function isNmbr(e){	
	var strCheck = '0123456789';
	var whichCode = (window.Event) ? e.which : e.keyCode;	
	if (whichCode != 0){
		if (whichCode == 13) return true;
		key = String.fromCharCode(whichCode);
		if (strCheck.indexOf(key) >-1 ) return  true;
		else return false;
	}
}

function newWindow(winWidth,winHeight,imgName){
  myWindow=window.open(imgName,'mama','scrollbars=no,width='+winWidth+',height ='+winHeight+',left='+(screen.width/2-winWidth/2)+',top='+(screen.height/2-winHeight/2)+'');
  myWindow.focus();
}
