var submitDone;
submitDone = 0;

var selectedproDone;
selectedproDone= 0;


function isEmail(s)
	{
		var test=""+s ;
		for (var k=0; k <test.length; k++)
		{
			var c=test.substring(k,k+1);
			if (c=="@")
			{
				return (true);
			}
		}
		return (false);
	}

function _CF_onError(form_object, input_object, object_value, error_message)
    {
	alert(error_message);
		input_object.focus();
       	return false;	
    }



function _CF_hasValue(obj, obj_type)
    {
    if (obj_type == "TEXT")
	{
    	if (obj.value.length == 0) 
      		return false;
    	else 
      		return true;
   	}
    else if (obj_type == "EMAIL")
	{
		if (isEmail(obj.value)==false)
      		return false;
    	else 
      		return true;
	}   	
    else if (obj_type == "RADIO")
	{

        for (i=0; i < obj.length; i++)
	    	{
		if (obj[i].checked)
			return true;
		}

       	return false;	
	}	
    else if (obj_type == "CHECKBOX")
	{
		if (obj.checked)
			return true;

       	return false;	
	}
	}

function  _CF_checkcheckform(_CF_this)

    {


    if  (!_CF_hasValue(_CF_this.contactname, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.contactname, _CF_this.contactname.value, "Please enter your contact name"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.contacttitle, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.contacttitle, _CF_this.contacttitle.value, "Please enter your title"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.email, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.email, _CF_this.email.value, "Please enter your email"))

   	        {

       	    return false; 

           	}
        }
    else if  (!_CF_hasValue(_CF_this.email, "EMAIL" )) 
    	{
        if  (!_CF_onError(_CF_this, _CF_this.email, _CF_this.email.value, "Please enter a right value for the 'Email' field."))

   	        {

       	    return false; 

           	}    	
    	}

     if  (_CF_this.email.value != _CF_this.confirm_email.value) 

        {

        if  (!_CF_onError(_CF_this, _CF_this.confirm_email, _CF_this.confirm_email.value, "You must retype your email address same as above email address"))

            {

            return false; 

            }

        }

    if  (!_CF_hasValue(_CF_this.homepage, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.homepage, _CF_this.homepage.value, "Please enter your homepage"))

   	        {

       	    return false; 

           	}
        }

    if  (_CF_hasValue(_CF_this.product1, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product2, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product3, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product4, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product5, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product6, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product7, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product8, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product9, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product10, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product11, "CHECKBOX" )) { selectedproDone= 1; }
    else if  (_CF_hasValue(_CF_this.product12, "CHECKBOX" )) { selectedproDone= 1; }
    else { selectedproDone= 0; }
    
    if (selectedproDone == 0) {
       if  (!_CF_onError(_CF_this, _CF_this.product1, _CF_this.product1.value, "Please select at least one of our software"))
       {
    	    return false; 

       	}
    }



    if  (!_CF_hasValue(_CF_this.publishdate, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.publishdate, _CF_this.publishdate.value, "Please enter your publish date"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.magazine, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.magazine, _CF_this.magazine.value, "Please enter your magazine"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.issuenumber, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.issuenumber, _CF_this.issuenumber.value, "Please enter your issue number"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.covermount, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.covermount, _CF_this.covermount.value, "Please enter your cover mount system"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.magazinedistribution, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.magazinedistribution, _CF_this.magazinedistribution.value, "Please enter your magazine distribution/location"))

   	        {

       	    return false; 

           	}
        }
        
    if  (!_CF_hasValue(_CF_this.magazinecirculation, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.magazinecirculation, _CF_this.magazinecirculation.value, "Please enter your magazine circulation"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.magazinefrequency, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.magazinefrequency, _CF_this.magazinefrequency.value, "Please enter your magazine frequency"))

   	        {

       	    return false; 

           	}
        }

    if  (!_CF_hasValue(_CF_this.readership, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.readership, _CF_this.readership.value, "Please enter your readership"))

   	        {

       	    return false; 

           	}
        }
        
    if  (!_CF_hasValue(_CF_this.txtNumber, "TEXT" )) 

        {
        if  (!_CF_onError(_CF_this, _CF_this.txtNumber, _CF_this.txtNumber.value, "Please fill out your verify code"))

   	        {

       	    return false; 

           	}
        }

	if (document.all && document.mediaform.submit) {
		document.mediaform.submit.disabled = true;
		document.mediaform.submit.value = '  please wait...  ';
	}

	if (submitDone == 0) {
		submitDone = 1;
		return true;
	}
	else { 
		if (!document.mediaform.submit || !document.all) {
			alert("Please wait..."); 
		}
		return false; 
	}   	    


    } 