	function isBlank(s)
     {
         var len=s.length
         var i
         for (i=0;i<len;++i)
         {
             if (s.charAt(i)!=" ") return false
         }
         return true
     }


    function validate01()
     {

        if (isBlank(document.contact_form.con_name.value))
          {
             //alert("Please enter the name");
             document.contact_form.con_name.focus();
             menuobj('name');
             return false;
          }

        /*
		if (isBlank(document.contact_form.con_email.value))
          {
             //alert("Please enter the email");
             document.contact_form.con_email.focus();
             menuobj('email');
             return false;
          }
		*/

		var emailID=document.contact_form.con_email

		if ((emailID.value==null)||(emailID.value==""))
		{
			//alert("Please Enter your Email ID")
			emailID.focus()
			menuobj('email')
			return false
		}
		if (echeck(emailID.value)==false)
		{
			emailID.value=""
			emailID.focus()
			menuobj('email');
			return false
		}

/*
        if (isBlank(document.contact_form.con_sub.value))
          {
             //alert("Please enter the Subject");
             document.contact_form.con_sub.focus();
             menuobj('subject');
             return false;
          }
*/

        if (isBlank(document.contact_form.con_query.value))
          {
             //alert("Please enter the Query");
             document.contact_form.con_query.focus();
             menuobj('query');
             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
	}



function menuobj(desc){
switch(desc){
	case 'name':
		document.getElementById('err_msg1').style.display='inline';
		document.getElementById('err_msg1').style.visibility='visible';
		document.getElementById('err_msg2').style.display='none';
		document.getElementById('err_msg3').style.display='none';
		document.getElementById('err_msg4').style.display='none';
		break;
	case 'email':
		document.getElementById('err_msg1').style.display='none';
		document.getElementById('err_msg2').style.display='inline';
		document.getElementById('err_msg2').style.visibility='visible';
		document.getElementById('err_msg3').style.display='none';
		document.getElementById('err_msg4').style.display='none';
		break;
	case 'subject':
		document.getElementById('err_msg1').style.display='none';
		document.getElementById('err_msg2').style.display ='none';
		document.getElementById('err_msg3').style.display='inline';
		document.getElementById('err_msg3').style.visibility='visible';
		document.getElementById('err_msg4').style.display='none';
		break;
	case 'query':
		document.getElementById('err_msg1').style.display='none';
		document.getElementById('err_msg2').style.display='none';
		document.getElementById('err_msg3').style.display='none';
		document.getElementById('err_msg4').style.display='inline';
		document.getElementById('err_msg4').style.visibility='visible';
		break;
} // switch

}

