var xh=false;
function d(o,p){return $(o).style.display=p;}
Event.observe(window, 'load', initxh, false);



function initxh() {
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {xh = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) {try {xh = new ActiveXObject("Microsoft.XMLHTTP");} catch (E) {xh = false;}}
	@end @*/
	if (!xh && typeof XMLHttpRequest!='undefined') {try {xh = new XMLHttpRequest();} catch (e) {xh=false;}}
	if (!xh && window.createRequest) {try {xh = window.createRequest();} catch (e) {xh=false;}}
}


function joinlist() {
	xh.open("GET", "subsribe-to-mailinglist.aspx?inputEmail="+$('myEmail').value,true);
	xh.onreadystatechange=function() {
		if (xh.readyState==4) {
    		if (xh.responseText.match(/(ok)/)) {thankyou();}
    		if (xh.responseText.match(/(err)/)) {createError();}
 			}
 		}
	xh.send(null)
}
function thankyou()
{
	$('myEmail').value='Thank you.';
	$('emailCheck').innerHTML='';

}

function createError()
{ 
	$('emailCheck').innerHTML='Please check your e-mail';

}

function tBlur(a)
{
	if (a.value=='') {a.value="your e-mail";}
}

function tFocus(a)
{
	if (a.value=="your e-mail") {a.value='';}
	
}

function livecheck(field)
{
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (filter.test(field.value)) {field.style.color='#CCCCCC';}
	else {field.style.color='#FF0000';}
}
