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("-your emial-id is invalid - try again...");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		  

 		 return true	;				
	}

function ValidateFeedback(){
    
	if(document.feadBackAction.textName.value==""){
		alert("-please enter your first name-");
		document.feadBackAction.textName.focus();
		return false;
	}
	var emailID=document.feadBackAction.txtEmail;
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("-please enter your email id-");
		emailID.focus();
		return false;
	}
	if (echeck(emailID.value)==false){
		emailID.value="";
		emailID.focus();
		return false;
	}
	
	
	
	if(document.feadBackAction.textMobile.value==0) {
     alert("-please enter mobile number");
     document.feadBackAction.textMobile.focus();
     return false;
  }
  if(document.feadBackAction.textMobile.value.length!=10){
     alert("-please enter valid mobile number-");
	   document.feadBackAction.textMobile.value="";
     document.feadBackAction.textMobile.focus();
     return false;
  }
   
  
  if(document.feadBackAction.textMobile.value.charAt(0)!=9){
		  alert("-start with number 9-");
          document.feadBackAction.textMobile.value="";
		  document.feadBackAction.textMobile.focus();
		  return false;
  }
  if(!IsNumeric(document.feadBackAction.textMobile.value)){
    alert("-please enter valid mobile number-"); 
   document.feadBackAction.textMobile.value="";
   document.feadBackAction.textMobile.focus();
    return false;
   }
   if(document.feadBackAction.textArea.value.length > 299){
       alert("-message length exceeds-");
       return false;
   }
   if(document.feadBackAction.textArea.value==0){
     alert("-please enter your message-");
     document.feadBackAction.textArea.focus();
     return false;
  }
  if(document.feadBackAction.selectOptions.value==0){
  	alert("-please tell us how you heard about us-");
	document.feadBackAction.selectOptions.focus();
	return false;
 }
	return true;
 }
 function IsNumeric(sText){
       var ValidChars = "0123456789.";
       var IsNumber=true;
       var Char;
       for (i = 0; i < sText.length && IsNumber == true; i++) { 
         Char = sText.charAt(i); 
         if (ValidChars.indexOf(Char) == -1) {
            IsNumber = false;
         }
       }
       return IsNumber;
}
 //message count validation
 function countChars(l){
       var len=document.feadBackAction.textArea.value.length;
       var str=document.feadBackAction.textArea.value;
       if(len<=l){
        document.feadBackAction.textValue.value=l-len;
       }
       else {
          document.feadBackAction.textArea.value=str.substr(0,str.length-1);
       } 
 }
 