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){

		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){

		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){

		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){

		    return false
		 }

 		 return true					
	}




function validate_form ( )
{
    valid = true;
	error_message = "";
/*

    if ( document.subscribe_form.customer_type.value != 0 && document.subscribe_form.customer_type.value != 1)
    {

        error_message += "Please select from 'Check One' box. \n" ;
        valid = false;
    }

    if ( document.subscribe_form.term.value == "" )
    {
        error_message += "Please select one from 'Subscription' box. \n" ;
        valid = false;
    }
	
    if ( document.subscribe_form.payment_method.value == "" )
    {
        error_message += "Please select one from 'Payment Method' box. \n" ;
        valid = false;
    }	
*/	

    if ( document.subscribe_form.cname.value == "" )
    {
        error_message += "Please check the 'Your Name' box. \n" ;
        valid = false;
    }
	
	    if ( document.subscribe_form.cphone.value == "" )
    {
        error_message += "Please check the 'Phone Number' box. \n" ;
        valid = false;
    }
	
	 if ( document.subscribe_form.ccompany.value == "" )
    {
        error_message += "Please check the 'Company' box. \n" ;
        valid = false;
    }
	
	if (echeck(document.subscribe_form.cemail.value)==false){
        error_message += "Please check the 'Email' box. \n" ;
        valid = false;
	}
	
	
	 if ( document.subscribe_form.cstreet.value == "" )
    {
        error_message += "Please check the 'Street' box. \n" ;
        valid = false;
    }	
	
	 if ( document.subscribe_form.ccity.value == "" )
    {
        error_message += "Please check the 'City' box. \n" ;
        valid = false;
    }

	 if ( document.subscribe_form.cprovince.value == "" )
    {
        error_message += "Please check the 'State / Province' box. \n" ;
        valid = false;
    }
	
	 if ( document.subscribe_form.cpostcode.value == "" )
    {
        error_message += "Please check the 'Postcode' box. \n" ;
        valid = false;
    }	
	
	 if ( document.subscribe_form.ccountry.value == "" )
    {
        error_message += "Please check the 'Country' box. \n" ;
        valid = false;
    }	
	
	if(error_message != "")
	alert(error_message);
    return valid;
			
}


