// amc_isValidEmail - Checks to see if email format is correct.
// @param email Email address to validate.
// @returns boolean depending on success.
function amc_isValidEmail(email) {
    // See if we have any spaces.
    var space = email.indexOf(" ");
    if (space != -1) { return false; }

    // max length of email
    if (email.length > 75) { return false; }

    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!email.match(re)) { return false; }
    return true;
}

// amc_clearSignupField - Blanks out text field.
// @param oText Text field object.
// @returns none
function amc_clearSignupField(oText) {
    oText.value = "";
}

// amc_validateNewsletterForm - Validates NS submission.
// @param oForm Form object.
// @returns Boolean success value. true = good.
function amc_validateNewsletterForm(oForm) {
    if (oForm.email.value == "") {
        alert("Please enter your Email Address.");
        oForm.email.focus();
        return false;
    } else if (!amc_isValidEmail(oForm.email.value)) {
        alert("Please enter a valid Email Address.");
        oForm.email.focus();
        return false;
    } else {
        return true;
    }
}
function adPixel(){
	var target = document.getElementById('adSpace_footer');
	var newImage = document.createElement('img');
		newImage.rel = 'tracking pixel';
		newImage.src = 'http://view.atdmt.com/AST/view/mcwwmb120200000017ast/direct/01/';
		if(target){target.appendChild(newImage);}
}


//get hash set of url parameters
//Only works for GET method
function URLParamTool(){}
//get entires hash
URLParamTool.getAll = function() {
		var vars = [], hash;
		var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
		for(var i = 0; i < hashes.length; i++) {
			hash = hashes[i].split('=');
			vars.push(hash[0]);
			vars[hash[0]] = hash[1];
		}
		return vars;
}
// retrieve parameter by name
URLParamTool.get = function(name){ return URLParamTool.getAll()[name]; }