// JavaScript Document

function chk_frm2(obj)
{
	alert('Hello');
}
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;
   
  }


function chk_frm(obj)
{
	
	if(obj.name1.value=="")
	{
		alert('Please enter your name to continue!');
		obj.name1.focus();
		return false;
	}
	
	
	if(obj.b_email.value=="")
	{
		alert('Please enter your Email Address to continue!');
		obj.b_email.focus();
		return false;
	}
	else
	{
		if(echeck(obj.b_email.value)==false)
		{
			obj.b_email.focus();
			return false;
		}
	}
	if(obj.contact.value=="")
	{
		alert('Please Enter your Contact No. to continue!');
		obj.contact.focus();
		return false;
	}
	if(obj.Enquiry.value=="")
	{
		alert('Please Enter your Enquiry to continue!');
		obj.Enquiry.focus();
		return false;
	}
	
	if(obj.security_code.value=="")
	{
		alert('Please enter the code to continue!');
		obj.security_code.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					
	}
