function echeck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("خطأ : البريد الالكترونى تم أدخاله بشكل غير صحيح")
		    return false
		 }

 		 return true					
	 }
	 

function IsNumeric(strString){
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }	 
	 

function ValidateForm(){

if (document.contact.name.value == "") {
alert("لم تقم بأدخال أسمك ثلاثي")
document.contact.name.focus()
return false 
}
if (document.contact.name.value.length <= 1) {
alert("عفوا ، أسمك لابد ان يكون أكثر من حرف واحد")
document.contact.name.value= ""
document.contact.name.focus()
return false 
}
    var emailID=document.contact.email
    
	if ((emailID.value==null)||(emailID.value=="")){
		alert("لم تقم بأدخال بريدك الالكترونى")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
if (document.contact.kiend.value == "none" ) {
alert("لم تقم بأختيار الغرض من الاتصال")
document.contact.kiend.focus()
return false
}
if (document.contact.imer.value == "none" ) {
alert("لم تقم بأختيار درجه الأهمية")
document.contact.imer.focus()
return false
}
if (document.contact.subject.value == "" ) {
alert("لم تقم بأدخال عنوان الرسالة")
document.contact.subject.value = ""
document.contact.subject.focus()
return false
}
if (document.contact.subject.value.length <= 1 ) {
alert("عنوان الرساله يجب ان لا تقل عن حرفين")
document.contact.subject.value = ""
document.contact.subject.focus()
return false
}
if (document.contact.message.value == "" ) {
alert("لم تقم بأدخال محتوى الرسالة")
document.contact.message.focus()
return false
}
if (document.contact.message.value.length <= 1 ) {
alert("محتوى الرساله لابد ان لا يكون أقل من حرفين")
document.contact.message.focus()
return false
}
if (document.contact.cap.value == "" ) {
alert("لم تقم بكتابه كود التحقيق")
document.contact.cap.focus()
return false
}
if (document.contact.cap.value.length < 5 ) {
alert("كود التحقيق يتكون من 5 أرقام")
document.contact.cap.value = ""
document.contact.cap.focus()
return false
}
	return true
 }