<!--
jQuery.noConflict();
jQuery(document).ready(function(){
  jQuery("#submitSignup").click(function(){
    if(validateEmail()){
      jQuery("#emailForm").submit();
    }
  });
  
  jQuery("#emailForm").submit(function(){      // add parseUri to check for http:// and http://www 
        jQuery.post("http://"+location.hostname+"/service/process_signup.php", jQuery("#emailForm").serialize(),
        function(data){
            if(data.email_check == 'invalid'){

                jQuery("#message_post").html("<div class='errorMessage'>Sorry, " + data.email + " is NOT a valid e-mail address. Try again.</div>");
            }
            else {
            	jQuery("#signUp").hide();
               
               	var brontoImg = '<img src="http://app.bronto.com/public/?q=direct_add&fn=Public_DirectAddForm&id=abeqwepfjgrcfpcjkrzfizrpphcjbng&email='+data.email+'&list1=0bbf03ec0000000000000000000000037182&field2=addToEmailList,set,true&field3=state,set,'+data.state+'&field4=website_source,set,'+data.website_source+'" width="0" height="0" border="0" alt=""/>';
                jQuery("#message_post").html("<div class='successMessage'><p>" + data.successMessage1 + "</p>"+brontoImg+"</div>");
                
                // Load dialog on click
                jQuery('#signupThanks').modal({position: [250,156], overlayClose:true});
            }
        }, "json");
       return false;
  });


  jQuery('input[type=text]').focus(function() {
    if ((jQuery(this).val() == 'email address') || (jQuery(this).val() == 'confirm your email address')){
      jQuery(this).val('');
    }
  });
  
});

var formSubmitted  = false;         // submission detection

function validateEmail() {
var msg = "";
var confirmMsg = "";
re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if(jQuery('#EmailAddress').val() !=''){
        msg += "Please do not autofill this page. Refresh page and try again without autofilling.\n";
}
if(jQuery('#emailSignup').val() ==''){
        msg += "Please provide an email address.\n";
}
else if(re.test(jQuery('#emailSignup').val()) == false) {
        msg += "Please enter a valid email address.\n";
}      
if(msg) {
        alert(msg);
        return false;
}
if(confirmMsg) {
        confirmMsg += "Are you sure you want to continue?\n";
        if(!confirm(confirmMsg)) {
                return false;
        }
}
return true;
}
  
function email_link_click() {
	u=location.href;
	window.open('http://www.simplehuman.co.uk/pop-email-friend.php?url='+encodeURIComponent(u),'sharer','toolbar=0,status=0,width=700,height=680');
	return false;
}
// -->
