/*function validateForm(formname) { //v4.0
	var p, formname, varname, vartype, varvalue, varcap, errors='', args=validateForm.arguments;
	for (i=1; i<(args.length-2); i+=3) { 
		varname = args[i];
		varcap = args[i+1];
		vartype = args[i+2];
		if( vartype != "checkboxes" && vartype != "P" )
			varvalue = eval( 'document.'+formname+'.'+varname+'.value' );
		
//			alert( varcap + "    " + vartype );
		
		if( vartype == "R" ) {
			if( varvalue.length == "0" )
				errors += '- '+varcap+' is required.\n'
		} else if( vartype == "N" ) {
			if( varvalue.length == 0 || isNaN(varvalue) )
				errors += '- '+varcap+' must contain a number.\n'
		} else if( vartype == "P" ) {
			varvalue1 = eval( 'document.'+formname+'.'+varname+'1.value' );
			varvalue2 = eval( 'document.'+formname+'.'+varname+'2.value' );
			varvalue3 = eval( 'document.'+formname+'.'+varname+'3.value' );
			if( (varvalue1.length != 0 || varvalue2.length != 0 || varvalue3.length != 0 ) &&
			  	( varvalue1.length < 3 || varvalue2.length < 3 || varvalue3.length < 4 ||
			  	  isNaN(varvalue1) || isNaN(varvalue2) || isNaN(varvalue3) ) )
				errors += '- '+varcap+' must be a valid phone number.\n'
		} else if( vartype == "Z" ) {
			varvalue = varvalue.replace(/-/gi, '');
			if( varvalue.length != 0 && ( varvalue.length < 5  || isNaN(varvalue) ) )
				errors += '- '+varcap+' must be a valid zip code.\n'
		} else if( vartype == "Drop" ) {
			if( varvalue == "default" )
				errors += '- '+varcap+' must contain a valid selection.\n';
		} else if( vartype == "Email" ) {
			p = varvalue.indexOf('@');
    		if (p<1 || p==(varvalue.length-1))
    			errors+='- '+varcap+' must contain an e-mail address.\n';
		} else if( vartype == "checkboxes" ) {
			var elements = eval( 'document.'+formname+'.elements' );
			var size = elements.length;
			var good = false;
			for( p = 0; p < size; p++ ) {
				if( elements[p].name.substring(0,varname.length) == varname )
					if( elements[p].checked == true )
						good = true;
			}
			if( good == false )
				errors+='- '+varcap+' must contain a valid selection.\n';
		}
	}
	if (errors != "" ) {
		alert('The following error(s) occurred:\n'+errors);
		return false;
	} else
		return true;
}*/



function submitForm()
{
	
		if ((document.title.blname.value=="")||(document.title.bfname.value=="") || (document.title.ssn1.value=="") || (document.title.hphone1.value=="")||(document.title.wphone1.value=="")||(document.title.stadd.value=="") ||(document.title.state.value=="")||(document.title.city.value=="")||(document.title.zip.value=="")||(document.title.country.value == "") || (document.title.marital.value=="")|| (document.title.order.value=="")|| (document.title.company.value=="")|| (document.title.tel.value=="")|| (document.title.fax.value=="")|| (document.title.email.value==""))
		
		{
			
			alert("Please fill all required (*)fields.");
		}	
		else
		{
		var emailID=document.title.email.value;
	
		if (echeck(emailID)==false)
		{
			
			document.title.email.focus();
			
		}
		else
		{
			document.title.submit();	
			
		}
		}
}

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					
	}	







