var preloads = new Array("images/shadows/left.png", "images/shadows/right.png", "images/shadows/bottom_left.png", "images/shadows/bottom.png", "images/shadows/bottom_right.png")var images = new Array();var ajax = {connection: null, mode: "", queue: {mode: new Array(), data: new Array()}};var couponFader = null;var eListFader = null;var popupId = 0;for (var i = 0; i < preloads.length; i++) {	images[i] = new Image();	images[i].src = preloads[i];}function onLoad() {	couponFader = new Fader(document.getElementById("coupon"), null, false, couponCancelled, 500);	eListFader = new Fader(document.getElementById("elist"), null, false, eListCancelled, 500);}function createRequest() {	var request = null;	if (window.XMLHttpRequest)		request = new XMLHttpRequest();	else if (window.ActiveXObject) {		try {			request = new ActiveXObject("Msxml2.XMLHTTP");		}		catch(event) {			try {				request = new ActiveXObject("Microsoft.XMLHTTP");			}			catch(event) {				return null;			}		}	}	else		return null;	return request;}function sendRequest(mode, data) {	if (ajax.connection == null) {		ajax.connection = createRequest();		if (ajax.connection != null) {			ajax.mode = mode;			ajax.connection.onreadystatechange = dataReceived;			ajax.connection.open("POST", "ajax.php");			ajax.connection.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");			ajax.connection.send("md=" + mode + "&" + data);		}	}	else {		ajax.queue.mode[ajax.queue.mode.length] = mode;		ajax.queue.data[ajax.queue.data.length] = data;	}}function dataReceived() {	if (ajax.connection.readyState == 4) {		if (ajax.connection.responseText != null && ajax.connection.responseText != "") {			switch (ajax.mode) {				case "coupon":					if (ajax.connection.responseText != "INVALID")						location.href = ajax.connection.responseText;					else						document.getElementById("invalid").style.display = "inline";					break;				case "elist":					if (ajax.connection.responseText == "INVALID_EMAIL")						alert("Invalid email address.");					else {						if (ajax.connection.responseText == "SUBSCRIBE")							alert("You have been sent a confirmation email, to complete subscription follow the instructions.");						else if (ajax.connection.responseText == "UNSUBSCRIBE")							alert("You have been sent a confirmation email, to complete unsubscription follow the instructions.");						else if (ajax.connection.responseText == "PROCESSING")							alert("You are already in the process of subscribing or unsubcribing.");						else							alert("Error");						document.getElementById("elist").style.display = "none";						document.getElementById("email").value = "";						document.getElementById("email_ok").disabled = true;					}			}		}		ajax.connection = null;		if (ajax.queue.mode.length > 0) {			sendRequest(ajax.queue.mode[0], ajax.queue.data[0]);			ajax.queue.mode.splice(0, 1);			ajax.queue.data.splice(0, 1);		}	}}function fieldEmpty(field) {	var node = document.getElementById(field);	if (field == "code") {		if (node.value == "")			document.getElementById("invalid").style.display = "none";	}	document.getElementById(field + "_ok").disabled = (node.value == "");}function fieldKey(event, field) {	if (!event.metaKey && (event.keyCode == 3 || event.keyCode == 13)) {		if (field == "code")			checkCode();		else			eList();	}}function checkCode() {	sendRequest("coupon", "code=" + document.getElementById("code").value);}function eList() {	sendRequest("elist", "email=" + document.getElementById("email").value);}function couponCancelled() {	var node = document.getElementById("coupon");	if (node != null) {		node.style.display = "none";		node.style.opacity = 1;		couponFader.now = 1;	}}function eListCancelled() {	var node = document.getElementById("elist");	if (node != null) {		node.style.display = "none";		node.style.opacity = 1;		eListFader.now = 1;	}}function showPopup(url, width, height) {	popupId += 1;	eval("page" + popupId + " = window.open(url, '" + popupId + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + "');");}