/*  THIS TICKER SCRIPT REQUIRES THE JQUERY LIBRARY TO RUN  */

//  ---------------------------------------------------------------------------
//	variables
//  ---------------------------------------------------------------------------

//  default value for sign up email address input field
var SignUpValue	= null;



//  onfocus event for email input form element
function setNewsletterSignup(obj) {
    if (obj.value == SignUpValue) {
        //  modify text colour
        obj.style.color = "#444444";
        obj.value = "";
        obj.onblur = function() {
            if (this.value == "") {
		        //  modify text colour
		        this.style.color = "#999999";
		        this.value = SignUpValue;
		    }
        }
    }
}

function submitNewsletterSignup(id) {
    //	store email form field
	var obj = document.getElementById(id);

	if (obj) {
	    //	check if email sign up field is blank, same as SignUpValue or is a valid email address
	    obj.isValid = validateEmail(obj);
	    
	    if (obj.value == "" || obj.value == SignUpValue || obj.isValid == false) {
		    alert("To sign up and receive our latest deals via email, please provide a valid email address.");
		    obj.focus();
		    return false;
        } else {
		    return true;
	    }
	}
}

//  center align sign up popups
$(document).ready(function() {
    SignUpValue	= $("#frmNewsletterSignupEmailAddress1").val();
    
    $(".PopupNewsletter").each(function() {
        getClientInner();
        $(this).left(parseInt((iClientInnerWidth - $(this).width()) / 2) + 'px');
        $(this).fadeIn();
    });
});