function valid(form)
         {
            var emailEmpty = 0;
			var errorMsg = "";
			
			var nameBox= form.nameBox.value; 
			var addressBox= form.addressBox.value; 
			var emailBox= form.emailBox.value; 
			var detailsBox= form.detailsBox.value; 
			
			
			   if(nameBox == '')
               {                 
				  errorMsg = errorMsg + "Please enter your Name/Company !! \n";
               }
			   if(addressBox == '')
               {                 
				  errorMsg = errorMsg + "Please enter Address! \n";
               }
			   if(emailBox == '')
               {                 
				  errorMsg = errorMsg + "Please enter your E mail Address!! \n";
				  emailEmpty = 1;
               }
			   if(detailsBox == '')
               {                 
				  errorMsg = errorMsg + "Please enter Your Comments/Feedback Details !! \n";
               }
			   
			   if(emailEmpty == 0)
			   {
			      if(echeck(emailBox) == false)
		   	      {
			         errorMsg = errorMsg + "Your E mail address is incorrect !! \n";
			      }
			   }
			   
			   if(errorMsg == '')
			   {
			      return true;
			   }
			   else
			   {
			      alert(errorMsg);
				  return false;
			   }
		 }
function checkNum(x)
{
			 
	  var s_len=x.value.length ;
	  var s_charcode = 0;
		for (var s_i=0;s_i<s_len;s_i++)
		{
		 s_charcode = x.value.charCodeAt(s_i);
		 if(!((s_charcode>=48 && s_charcode<=57 )))
		  {
				 alert("Only Number Allowed");
				 x.value='';
				 x.focus();
   				 return false;			 
		  }
		}
		return true;
}


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("Invalid E-mail ID")
		       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
	     }


