var juncanoo = function(){
    var self = {
	initcontactform: function()
	{
	    jQuery("#submit").click(self.contactus);
	    jQuery("#contactusform").validate({ errorClass: "err" });
	},
	contactus: function()
	{
	    if(jQuery("#contactusform").validate().form()){
		var seq = jQuery("#contactusform").serialize();
		jQuery("#submit").hide();
		jQuery.post("/service/mailing/contactus", seq,
			    function(data, textStatus){
				if(data.success){
				    alert("Thank you for your comments!");
				}else{
				    alert("We were unable to successfully process your contact request [ " + data.error + "]. Please enter a first and last name and a valid email address and try again.");
				    jQuery("#submit").show();
				    
				}
			    }, "json");
	    }
	},
	logintoexhibit: function()
	{
	    document.loginform.submit();
	},
	inithomepage: function()
	{
	    jQuery("#signup").click(self.mailingListSignup);
	    jQuery("#submit1").click(self.logintoexhibit);
	},
	mailingListSignup: function()
	{
	    var v1 = jQuery.trim(jQuery("#signupname").val());
	    var v2 = jQuery.trim(jQuery("#emailaddress").val());
	    if(v1 == "" || v2 == ""){
		alert("Please enter a name and a valid email address.");
		return;
	    }
	    jQuery("#updates").hide();
	    jQuery.post("/service/mailing/signup", 
			jQuery("#email_form").serialize(),
			function(data, textStatus){
			    if(data.success){
				alert("Thanks for signing up! You will be hearing from us soon.");
			    }else{
				alert("We were unable to successfully process your signup request. Please enter a name and a valid email address and try again later.");
				jQuery("#updates").show();
			    }
			}, 
			"json");
	}
    };
    return self;
}();
