	function getHTTP() {
		var r;
		/*@cc_on @*/
		/*@if (@_jscript_version >= 5)
			try {
				r=new ActiveXObject("Msxml2.XMLHTTP")
			} catch (e) {
				try {
					r=new ActiveXObject("Microsoft.XMLHTTP")
				} catch (E) {
					r=false
				}
			}
		@else
			r=false
		@end @*/
		if (!r) {
			try {
				r = new XMLHttpRequest();
			} catch (e) {
				r = false
			}
		}
		return r;
	}


	function LoadDiv(target, url) {
		var http = getHTTP();
		var objTarget = document.getElementById(target);

		// create a mask and place it into body
		var objTargetMask = document.createElement("div");
		var objMaskHouse = document.getElementById("masks");
		objMaskHouse.appendChild(objTargetMask);

		// set the location to the same place and size as the target
		objTargetMask.pos = fetch_offset( target );	
		objTargetMask.style.left = objTargetMask.pos['left'] + "px";
		objTargetMask.style.top = objTargetMask.pos['top'] + "px";
		
		objTargetMask.style.width = objTarget.style.width;
		objTargetMask.style.height = objTarget.style.height;

		// make sure it is ontop of our object to be masked
		objTargetMask.style.zindex = 99;	// always on top of all other elements 
											// except pull down object on IE
		
		// style the loading mask
		objTargetMask.style.backgroundColor = '#000';
		objTargetMask.style.filter = 'Alpha(opacity="30")';
		objTargetMask.style.MozOpacity = '0.3';
		objTargetMask.style.opacity = '0.3';

		objTargetMask.innerHTML = "<p style='position:relative; top:50%; left:50%; text-align:center;'><img src='images/loading.gif' alt='Loading' />Fetching information from server, please wait...</p>";
		http.open("GET", url);
		http.onreadystatechange = function () {
			if (http.readyState==4) {
				var response = http.responseText;
				objMaskHouse.removeChild(objTargetMask);
				objTarget.innerHTML = response;
			}
		}
		http.send(null);
	}

	function newsletter_optin() {
		var ajax_url = 'ajax.php';
		var firstname = document.newsletter_subscribe_form.firstname.value;
		var lastname = document.newsletter_subscribe_form.lastname.value;
		var email = document.newsletter_subscribe_form.email.value;
		var country = document.newsletter_subscribe_form.country.value;
		
		if (country == "") {
			alert("You must select an country so we can contact you when information pertaining to your region becomes available.");
			return(false);
		}

		if ((email == "") || !validateEmail(email,1,0)) {
			alert("We can't list you on a mailing list if you don't give us a valid email address, can we?");
			return(false);
		}

		ajax_url = ajax_url + "?do=subscribe" + "&firstname=" + firstname + "&lastname=" + lastname + "&email=" + btoa(email) + "&country=" + country;
		LoadDiv("newsletter_form", ajax_url);
	}