function sendData () {
	var url = '/rebrand/ContactUs/proc_maillist.asp?frmpage=3';
	var pars = Form.serialize('mail_form');
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} );
}
function showLoad () {
        $('MailingListLoad').style.display = 'block';
	    $('SubmitButton').style.display = 'none';
}
function showResponse (originalRequest) {
	var newData = originalRequest.responseText;
   	    $('MailingListLoad').style.display = 'none';
	    $('MailingListStatus').innerHTML = newData;
   	    $('SubmitButton').style.display = 'none';
    //document.writeln('test' + newData);
}

function sendDataNo () {
	var url = '/rebrand/ContactUs/proc_maillist.asp?frmpage=3';
	var pars = Form.serialize('mail_form');
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoadNo, onComplete: showResponseNo} );
}
function showLoadNo () {
        $('MailingListLoadNo').style.display = 'block';
	    $('SubmitButtonNo').style.display = 'none';
}
function showResponseNo (originalRequest) {
	var newDataNo = originalRequest.responseText;
   	    $('MailingListLoadNo').style.display = 'none';
	    $('MailingListStatusNo').innerHTML = newDataNo;
   	    $('SubmitButtonNo').style.display = 'none';
    //document.writeln('test' + newData);
}

function clearStatusMsg() {
    $('MailingListStatus').innerHTML = "";
}
function clearStatusMsgNo() {
    $('MailingListStatusNo').innerHTML = "";
}
function openTarget (form, features, windowName) {
    if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
    form.target = windowName;
    open ('', windowName, features);
}

function checkmailform(form)
{
	if ((document.mail_form.announcements[0].checked != true) && (document.mail_form.announcements[1].checked != true))  {
		alert("Please indicate whether or not you would like to be sent notices about new health topics, our company's products, special promotions and savings.")
		return false;
		}
	if (document.mail_form.announcements[0].checked)
		{	
			if ((document.mail_form.email_addr_yes.value == "") || (document.mail_form.email_addr_yes.value.indexOf('@', 0) == -1) || (document.mail_form.email_addr_yes.value.indexOf('.', 0) == -1)) {
			    alert( "Please enter a valid email address." );
	
				return false ;
			}
			if (document.mail_form.email_addr_yes.value != document.mail_form.confm_email_addr_yes.value ) 
			{
			    alert("Your email address entries did not match.");
				return false ;
			}
			if (document.mail_form.first_name.value == "") {
			    alert( "First name is a required field. Please fill in before submitting." );
			  
			    return false ;
			}
			if (document.mail_form.last_name.value == "") {
			    alert( "Last name is a required field. Please fill in before submitting." );
			  
			    return false ;
			}
			if (!document.mail_form.nature_made.checked && !document.mail_form.sam_e.checked && !document.mail_form.nature_resource.checked && !document.mail_form.check_none.checked)
			{
				alert("Please select a product.");
				return false;
			}
	
			if (document.mail_form.terms_conditions.checked != true){
				alert("Please read and accept the Terms and Conditions before submitting the form")
				return false;
			}
			if (document.mail_form.privacy_policy.checked != true){
				alert("Please read and accept the Privacy Policy before submitting the form")
				return false;
			}
			
			document.mail_form.email_addr.value = document.mail_form.email_addr_yes.value;
		}
	if (document.mail_form.announcements[1].checked)			
		{
			if ((document.mail_form.email_addr.value_no == "") || (document.mail_form.email_addr_no.value.indexOf('@', 0) == -1) || (document.mail_form.email_addr_no.value.indexOf('.', 0) == -1)) {
			    alert( "Valid email address is a required field. Please fill in before submitting." );
				return false ;
			}
			if (document.mail_form.email_addr_no.value != document.mail_form.confm_email_addr_no.value ) 
			{
			    alert("Your email address entries did not match.");
				return false ;
			}
			document.mail_form.email_addr.value = document.mail_form.email_addr_no.value;
			sendDataNo();
		}
	
//	openTarget(form, 'menubar=0,width=584,height=600,toolbar=0,scrollbars=0,resizable=0'); 
	sendData();
//    displayObject('MailingListLoad', true);
	return true;
}


function checkprodname()
  {
	if (document.mail_form.checkall.value = true)
	 {
	 	 document.mail_form.nature_made.checked = true
		 document.mail_form.sam_e.checked = true
		 document.mail_form.nature_resource.checked = true
		 document.mail_form.check_none.checked = false
		 		 
		 if (document.mail_form.checkall.checked == false)
				{
				     document.mail_form.nature_made.checked = false
					 document.mail_form.sam_e.checked = false
					 document.mail_form.nature_resource.checked = false
					 
				} // end of inner if
	  }	// first if ends here 
   }	//end of function
 
function checknone()
{
	if (document.mail_form.check_none.checked)
	 {
	 	 document.mail_form.nature_made.checked = false
		 document.mail_form.sam_e.checked = false
		 document.mail_form.nature_resource.checked = false
		 document.mail_form.checkall.checked = false
		 		 
	  }	
 }
 
function unchecknone()
{
	document.mail_form.check_none.checked = false
}

function hidediv(divID) 
{
    if (document.getElementById) { // DOM3 = IE5, NS6
    document.getElementById(divID).style.visibility = 'hidden';
    }
    else 
    {
        if (document.layers) { // Netscape 4
        document.hideShow.visibility = 'hidden';
    }
    else { // IE 4
        document.all.hideShow.style.visibility = 'hidden';
    }
    }
}


