/*
(function(jq) {
        
    SignUp = {

        SERVICE: pathToRoot + '_WebServices/ContentService.svc/RegisterForNewsletter',
        THANKSMSG: '<p class="msg">Thank you for registering</p>',
        ERRXHR: '<p class="msg">Sorry there appears to have been an error, please try again later</p>',
        ERRINVALID: '<p class="msg">The following doesn\'t appear to be a valid email address</p>',
        
        target: null,
        
        init: function() {
            this.target = jq('#signUp');
        },
        
        makeConnection: function(value) {
            var self = this;
            jq.ajax({
		        type: "POST",
		        url: this.SERVICE,
		        contentType: "application/json; charset=utf-8",
		        dataType: "json",
		        data: jq.toJSON(value),
		        success: function(){
			        SignUp.success.apply(SignUp, arguments);
		        },
		        error: function(){
			        SignUp.error.apply(SignUp, arguments);
		        },
		        beforeSend: function() {
		            SignUp.before.apply(SignUp);
		        }
	        });
        },
        
        
        before: function() {
            return this.addMsg('<p class="msg">Processing...</p>');
        },
        
        
        getMsg: function() {
            var msg = this.target.children('.msg');
            return msg.length > 0 ? msg : null;
        },
        
        
        deleteMsg: function() {
            var msg = this.getMsg();
            if (msg) {
                msg.remove();
            };
        }, 
        
        addMsg: function(message) {
            var msg = this.getMsg();
            if (msg) {
                msg.replaceWith(message)
            } else {
                this.target.children('h3').after(message);
            };
            return message;
        }, 
        
        
        success: function(response) {
            if (response === true) {
                this.deleteMsg();
                this.target.children('fieldset').replaceWith(this.THANKSMSG)
            } else {
                this.addMsg(this.ERRINVALID);
            };
            return; 
        },
        
        
        error: function(response) {
            return this.target.children('.msg').replaceWith(this.ERRXHR);
        }
    };
    
})(jQuery);
*/
