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 storysubmit() {

	var storytext = document.storyform.report_story.value;
    var storycontact = document.storyform.report_contact.checked;
    var storyoptin = document.storyform.report_optin.checked;
    var storyemail = document.storyform.report_reporter_email.value;
    var storyconfirmemail = document.storyform.report_reporter_email_confirm.value;

	
	if (storytext == ""){
		alert("Please enter in your story before submitting this form.");
		return false;
	}
	
	if (storycontact == true || storyoptin == true){
	
		if (storyemail == "" || storyconfirmemail == ""){
		alert("You have indicated that it is ok to contact you, but one of the email fields are empty.  Please complete the eMail section at the bottom of this form.");
		return false;
		}
	
		if (storyemail != storyconfirmemail){
		alert("You have indicated that it is ok to contact you, but the email fields do not match, please confirm your email address by retyping it in the second field.");
		return false;
		}
		
		if (!echeck(storyemail)){
		alert("We're sorry, your e-mail doesn't appear to be in the correct format, please check and try again.");
		return false;
		}		
		
		
	}
	

}

function detailsubmit() {

	var detailname = document.detailform.report_product_name.value;
	var detailbinary = document.detailform.report_binary_name.value;
	var detailsource = document.detailform.report_source_url.value;
	
	var detailconsent = document.detailform.report_consent.value;
	var detailinform = document.detailform.report_inform.value;
	var detailuninstall = document.detailform.report_uninstall.value;
	
    var detailcontact = document.detailform.report_contact.checked;
    var detailoptin = document.detailform.report_optin.checked;
    var detailemail = document.detailform.report_reporter_email.value;
    var detailconfirmemail = document.detailform.report_reporter_email_confirm.value;
    
    var firstblock = false;
    var secondblock = false;
    
    if ((detailname != "") || (detailbinary != "") || (detailsource != "")){
    	firstblock = true;
    }
    
    if ((detailconsent != "99") || (detailinform != "99") || (detailuninstall != "99")){
    	secondblock = true;
    }    
    
    
    if (firstblock == false){
    	alert("Please answer at least one question from the 'Describe the Suspected Badware' section.");
    	return false;
    }
    
    if (secondblock == false){
    	alert("Please answer at least one of the drop down questions from the 'How does the suspected badware act?' section.");
    	return false;
    }    
    
	if (detailcontact == true || detailoptin == true){
	
		if (detailemail == "" || detailconfirmemail == ""){
		alert("You have indicated that it is ok to contact you, but one of the email fields are empty.  Please complete the eMail section at the bottom of this form.");
		return false;
		}
	
		if (detailemail != detailconfirmemail){
		alert("You have indicated that it is ok to contact you, but the email fields do not match, please confirm your email address by retyping it in the second field.");
		return false;
		}
		
		if (!echeck(detailemail)){
		alert("We're sorry, your e-mail doesn't appear to be in the correct format, please check and try again.");
		return false;
		}		
		
	}
	

}

function reviewsubmit() {

    var alertmsg = "The following fields are required before submission:\n\n";
    var alertcontent = "";
    
    var alertflag = false;
    
	var reviewowner = document.reviewform.appealsstage_owner.checked;
	
	var reviewfullname = document.reviewform.appealsstage_fullname.value;
	var reviewemail = document.reviewform.appealsstage_email.value;
	var reviewdescription = document.reviewform.appealsstage_source_description.value;
	var reviewcertified = document.reviewform.appealsstage_certified.checked;
	
	//var reviewcaptcha = document.reviewform.captchamodel_captcha_validation.value;
	
	if (reviewfullname == ""){
	   alertcontent = alertcontent + "Full Name\n";
	   alertflag = true;
	} 

    if (reviewemail == "") {
	   alertcontent = alertcontent + "Email\n";
	   alertflag = true;	
	} else if (echeck(reviewemail) == false) {
	   alertcontent = alertcontent + "Valid Email Address\n";
	   alertflag = true;		
	}
    
    if (reviewdescription == "") {
	   alertcontent = alertcontent + "Reason for Review\n";
	   alertflag = true;	
	}

    if (reviewcertified == false) {
	   alertcontent = alertcontent + "Certification\n";
	   alertflag = true;	
	}
 
 	/*
    if (reviewcaptcha == "") {
	   alertcontent = alertcontent + "CAPTCHA (Human Validation)\n";
	   alertflag = true;	
	}
	*/

	
	if (alertflag == true) {
	   alert(alertmsg + alertcontent);
	   return false;
	}
	
	if (reviewowner == true)
	{
        input_box=confirm("You have indicated that you are the site owner. Correspondence regarding this review will be sent to the email address you provided.  Do you wish to continue?");
    }
    else
    {
        input_box=confirm("You have indicated that you are NOT the site owner.  Correspondence regarding this review will NOT be sent to the email address you provided.  Do you wish to continue?");
    }
        
    if (input_box==true) {return true;}
    else {return false;}

}

function additionalcommentssubmit() {

    var alertmsg = "The following fields are required before submission:\n\n";
    var alertcontent = "";
    
    var alertflag = false;
    
    var additionalcommentowner = document.additionalcommentsform.query_owner.checked;
	var additionalcommentemail = document.additionalcommentsform.query_email.value;
	var additionalcommentquery = document.additionalcommentsform.query_query.value;
	
	//var additionalcommentcaptcha = document.additionalcommentsform.captchamodel_captcha_validation.value;
	
	if (additionalcommentemail == "") {
	   alertcontent = alertcontent + "Email\n";
	   alertflag = true;	
	} else if (echeck(additionalcommentemail) == false) {
	   alertcontent = alertcontent + "Valid Email Address\n";
	   alertflag = true;		
	}
	
	if (additionalcommentquery == ""){
	   alertcontent = alertcontent + "Comment\n";
	   alertflag = true;
	} 

	/*
	if (additionalcommentcaptcha == "") {
	   alertcontent = alertcontent + "CAPTCHA (Human Validation)\n";
	   alertflag = true;	
	}
	*/
	
	if (alertflag == true) {
	   alert(alertmsg + alertcontent);
	   return false;
	}

}

function othercommentssubmit() {

    var alertmsg = "The following fields are required before submission:\n\n";
    var alertcontent = "";
    
    var alertflag = false;
    
	var othercommentsowner = document.othercommentsform.appealsstage_owner.checked;
	
	var othercommentsfullname = document.othercommentsform.appealsstage_fullname.value;
	var othercommentssourceurl = document.othercommentsform.appealsstage_source_url.value;
	var othercommentsemail = document.othercommentsform.appealsstage_email.value;
	var othercommentscomments = document.othercommentsform.appealsstage_comments.value;
	
	//var othercommentscaptcha = document.othercommentsform.captchamodel_captcha_validation.value;
	
	if (othercommentsfullname == ""){
	   alertcontent = alertcontent + "Full Name\n";
	   alertflag = true;
	} 
	
	if (othercommentssourceurl == ""){
	   alertcontent = alertcontent + "Website\n";
	   alertflag = true;
	} 	

    if (othercommentsemail == "") {
	   alertcontent = alertcontent + "Email\n";
	   alertflag = true;	
	} else if (echeck(othercommentsemail) == false) {
	   alertcontent = alertcontent + "Valid Email Address\n";
	   alertflag = true;		
	}
	
    if (othercommentscomments == ""){
	   alertcontent = alertcontent + "Comment or question\n";
	   alertflag = true;	
	}	

	
	/*
    if (othercommentscaptcha == "") {
	   alertcontent = alertcontent + "CAPTCHA (Human Validation)\n";
	   alertflag = true;	
	}
	*/

	
	if (alertflag == true) {
	   alert(alertmsg + alertcontent);
	   return false;
	}
	
	if (othercommentsowner == true)
	{
        input_box=confirm("You have indicated that you are the site owner. Correspondence regarding this review will be sent to the email address you provided.  Do you wish to continue?");
    }
    else
    {
        input_box=confirm("You have indicated that you are NOT the site owner.  Correspondence regarding this review will NOT be sent to the email address you provided.  Do you wish to continue?");
    }
        
    if (input_box==true) {return true;}
    else {return false;}

}


function announcesubmit() {

    var announceemail = document.announceform.report_reporter_email.value;
    var announceconfirmemail = document.announceform.report_reporter_email_confirm.value;

	
		if (announceemail == "" || announceconfirmemail == ""){
		alert("You have indicated that it is ok to contact you, but one of the email fields are empty.  Please complete the eMail section at the bottom of this form.");
		return false;
		}
	
		if (announceemail != announceconfirmemail){
		alert("You have indicated that it is ok to contact you, but the email fields do not match, please confirm your email address by retyping it in the second field.");
		return false;
		}
		
		if (!echeck(announceemail)){
		alert("We're sorry, your e-mail doesn't appear to be in the correct format, please check and try again.");
		return false;
		}			
		
	

}