function onlinevoucherForm()
{
    var form=document.voucherform;
    document.voucherform.action="onlinevoucher.php";
    
    if(form.fname.value=="")
    {
        alert("You must enter the First Name");
        form.fname.focus();
        return(false);
    }
        
    var check="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    var checkstr=form.fname.value;
    var valid=true;
    for(i=0;i<checkstr.length;i++)
    {
        ch=checkstr.charAt(i);
        for(j=0;j<check.length;j++)
        if(ch==check.charAt(j))
            break;
        if(j==check.length)
        {
            valid=false;
            break;
        }
     }
     if(!valid)
     {
         alert("Please enter only character and numeric field in the First name field");
         form.fname.focus();
         return(false);
     }
     if(form.fname.value.length < 3)
    {
        alert("Please enter atleast 3 charters in the \"First Name\" field");
        form.fname.focus();
        return(false);
    }
    
    
    if(form.lname.value=="")
    {
        alert("You must enter the Last Name");
        form.lname.focus();
        return(false);
    }
    
     if(form.store.selectedIndex==0)
    {
        alert("Please select a \"valid Store\" ");
        form.store.focus();
        return(false);        
    }
    
      
    if(form.email.value=="")
    {
        alert("You must enter the email address");
        form.email.focus();
        return(false);
    }
    
    
    var checkemail="@.";
    var checkstr=form.email.value;
    var emailvalid=false;
    var emailat=false;
    var emailperoid=false;
    for(i=0;i<checkstr.length;i++)
    {
        ch=checkstr.charAt(i);
        for(j=0;j<checkemail.length;j++)
        {
        if(ch==checkemail.charAt(j) && ch=="@")
        emailat=true;
        if(ch==checkemail.charAt(j) && ch==".")
        emailperiod=true;
        if(emailat && emailperiod)
        break;
        if(j==checkemail.length)
        break;
        }
        if(emailat && emailperiod)
        {
            emailvalid=true;
            break;
        }
    }
    if(!emailvalid)
    {
        alert("please enter the valid email which contain a \"@\" and \".\".");
        form.email.focus();
        return(false);
    }
    
   
    //alert("hai");
    document.voucherform.submit();   
}

