function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
}

function validate(){
	if (Form.ocase.value == "" || Form.ocase.value.length < 2){
		alert("Please fill in your case.");
		Form.ocase.focus();
		return false;
	}
	return true;
}

function validatefromitta(){
	if (formitta.cemail.value == "" || formitta.cemail.value.indexOf('@',1)== -1 || formitta.cemail.value.indexOf('.',2)==-1){
		alert("Your email is invalid.");
		formitta.cemail.focus();
		return false;
	}
	return true;
}


function validatform(){
	if (theForm.cfirstname.value == "" || theForm.cfirstname.value.length < 2){
		alert("Please fill in your first name.");
		theForm.cfirstname.focus();
		return false;
	}
	if (theForm.cmiddlename.value == "" || theForm.cmiddlename.value.length < 2){
		alert("Please fill in your middle name.");
		theForm.cmiddlename.focus();
		return false;
	}
	if (theForm.clastname.value == "" || theForm.clastname.value.length < 2){
		alert("Please fill in your last name.");
		theForm.clastname.focus();
		return false;
	}
	if(theForm.cphone1.value != ""){
		if(! IsNumeric(theForm.cphone1.value)){
			alert('Residential Phone Number Must be numeric');	
			theForm.cphone1.value = "";
			theForm.cphone1.focus();
			return false;
		}	
	}
	if(theForm.cphone2.value != ""){
		if(! IsNumeric(theForm.cphone2.value)){
			alert('Mobile Number Must be numeric');	
			theForm.cphone2.value = "";
			theForm.cphone2.focus();
			return false;
		}	
	}
	if (theForm.cnationality.value == "" || theForm.cnationality.value.length < 2){
		alert("Please fill in nationality.");
		theForm.cnationality.focus();
		return false;
	}
	if (theForm.cemail.value == "" || theForm.cemail.value.indexOf('@',1)== -1 || theForm.cemail.value.indexOf('.',2)==-1){
		alert("Your email is invalid.");
		theForm.cemail.focus();
		return false;
	}
	if (theForm.cuser.value == "" || theForm.cuser.value.length < 2){
		alert("Please fill in your Username.");
		theForm.cuser.focus();
		return false;
	}
	if (theForm.cpass1.value == "" || theForm.cpass1.value.length < 6){
		alert("Please fill in your Password.");
		theForm.cpass1.focus();
		return false;
	}
	if (theForm.cpass.value == "" || theForm.cpass.value != theForm.cpass1.value){
		alert("Password does not matche.");
		theForm.cpass.focus();
		return false;
	}
	return true;
}
