function checkFields( )   {

	var cName = document.forms[0].elements[0].value;
	var eMail = document.forms[0].elements[1].value;
	var phone1 = document.forms[0].elements[2].value;
	var phone2 = document.forms[0].elements[3].value;
	
var dName = document.forms[0].elements[4].value;
	
	var cSubject = document.forms[0].elements[5].value;
	var cContent = document.forms[0].elements[6].value;

	

	
           /*            בדיקת תקינות שם              */

	if (cName == '' )   {                    
		alert('עליך למלא שם');
		document.forms[0].elements[0].focus( );
		return false;
	}
	else   {
		if (! checkCharsCName(cName))   {
			alert("עליך למלא שם חוקי")
			document.forms[0].elements[0].value = '';
			document.forms[0].elements[0].focus( );	
 			return false;
		}
	}

	
	
		
		   /*              בדיקת תקינות של דוא"ל             */
		
		if (eMail == '')   {
			alert ('עליך למלא דוא"ל')
			document.forms[0].elements[1].focus( );
			return false;
		}
		else
			if ( !(checkEmail(eMail)) )   {
				alert ('עליך למלא דוא"ל חוקי');
				document.forms[0].elements[1].value = '';
				document.forms[0].elements[1].focus( );
				return false;
			}




           /*           1 בדיקת תקינות מספר טלפון              */
		   	
	if (phone1 == '' )   {                    
		alert('עליך למלא מספר טלפון להתקשרות');
		document.forms[0].elements[2].focus( );
		return false;
	}
	else   {
		if (! checkCharsPhoneNumber(phone1))   {
			alert("עליך למלא מספר טלפון חוקי")
			document.forms[0].elements[2].value = '';
			document.forms[0].elements[2].focus( );	
 			return false;
		}
	}


	
	
           /*           2 בדיקת תקינות מספר טלפון              */
		   	
	if (phone2 != '' )   {                    
		if (! checkCharsPhoneNumber(phone2))   {
			alert("עליך למלא מספר טלפון חוקי")
			document.forms[0].elements[3].value = '';
			document.forms[0].elements[3].focus( );	
 			return false;
		}
	}
	
	


	   /*              בדיקת תקינות של דומיין             */
	
	if (dName == '')   {
		alert ('עליך למלא דומיין')
		document.forms[0].elements[4].focus( );
		return false;
	}
	else
		if ( !(checkdName(dName)) )   {
			alert ('עליך למלא דומיין חוקי');
			document.forms[0].elements[4].value = '';
			document.forms[0].elements[4].focus( );
			return false;
		}


	

	
           /*            בדיקת תקינות נושא הפנייה              */

	if (cSubject == '' )   {                    
		alert('עליך למלא נושא פנייתך');
		document.forms[0].elements[5].focus( );
		return false;
	}
	else   {
		if (! checkCharsSubjectAndMessage(cSubject))   {
			alert("תוכן של שדה הנושא, אינו חוקי")
			document.forms[0].elements[5].value = '';
			document.forms[0].elements[5].focus( );	
 			return false;
		}
	}	
	
	


           /*            בדיקת תקינות תוכן הפנייה              */

	if (cContent == '' )   {                    
		alert('עליך למלא תוכן פנייתך');
		document.forms[0].elements[6].focus( );
		return false;
	}
//	else   {
//		if (! checkCharsSubjectAndMessage(cContent))   {
//			alert("תוכן פנייתך אינו חוקי")
//			document.forms[0].elements[5].value = '';
//			document.forms[0].elements[5].focus( );	
//			return false;
//		}
//	}	

	
	
							
return true;
}







function checkCharsCName(CName)   {
	var i;
	var Len = CName.length;
	var validChars = " קראטוןםפףךלחיעכגדשזסבהנמצתץ";
	
	for(i=0 ; i<Len ; i++)    {
		if(validChars.indexOf(CName.charAt(i)) == -1)
			return false;	
	}
		
   return true;
}




function checkCharsSubjectAndMessage(CName)   {
	var i;
	var Len = CName.length;
	var validChars = " קראטוןםפףךלחיעכגדשזסבהנמצתץ.0123456789-";

	
	for(i=0 ; i<Len ; i++)    {
		if(validChars.indexOf(CName.charAt(i)) == -1)
			return false;	
	}
		
   return true;
}





function checkCharsPhoneNumber(pNumber)   {
	var i;
	var Len = pNumber.length;
	var validChars = "0123456789";
	
	for(i=0 ; i<Len ; i++)    {
		if(validChars.indexOf(pNumber.charAt(i)) == -1)
			return false;	
	}
		
	if(Len < 9 || Len >10)
		return false;
				
   return true;
}




function checkdName(strURL)   {
	var Len = strURL.length;
	var validChars = "-:/.qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789";
	var iCount;
	
	for (iCount=0 ; iCount<Len ; iCount++)
		if (validChars.indexOf(strURL.charAt(iCount)) == -1)
			return false;
			
	return true;
}





function checkEmail(eMail)   {
	var Len = eMail.length;
	var validChars = "@.qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM0123456789";
	var iCount;
	
	for (iCount=0 ; iCount<Len ; iCount++)
		if (validChars.indexOf(eMail.charAt(iCount)) == -1)
			return false;
			
	return true;
}








