/*====================================================================================================*/
function setHighlights() {
	xInputs=document.getElementsByTagName("input");
	for (i=0;i<xInputs.length;i++) {
		if (xInputs[i].type=="text") {
			xInputs[i].onfocus=function() {
					if (this.defaultValue==this.value) {
						this.select();
					}//end if ()
				}//end function
			xInputs[i].onmouseup=function(){return false};//because safari is special
		}//end if (xInputs[i].type=="text")
	}//next i<xInputs.length
	xTextAreas=document.getElementsByTagName("textarea");
	for (i=0;i<xTextAreas.length;i++) {
		xTextAreas[i].onfocus=function() {
				if (this.defaultValue==this.value) {
					this.select();
				}//end if ()
			}//end function
		xTextAreas[i].onmouseup=function(){return false};//because safari is special
	}//next i<xTextAreas.length
}//end function
/*====================================================================================================*/
var xmlhttp;
var xmlResponse;
var strPredictions;
var xs;
/*====================================================================================================*/
function LoadFile(url) {
	xmlhttp=null;
	if (window.XMLHttpRequest) {// Firefox, Opera, IE7
		xmlhttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {// IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}//end if (window.XMLHttpRequest)
	if (xmlhttp!=null) {
		xmlhttp.open("GET",url,true);
		xmlhttp.send(null);
	}//end if (xmlhttp!=null)
	return xmlResponse;
}//end function
/*====================================================================================================*/
function ProcessSignup() {
	xERRORcount=0;
	xERRORstring="Sign up failed, please check your details";
	FormSignup=document.getElementById("signup");
	if (FormSignup) {
		xSIGNUPname=document.getElementById("xSIGNUPname");
		xSIGNUPsurname=document.getElementById("xSIGNUPsurname");
		xSIGNUPemail=document.getElementById("xSIGNUPemail");
		xSIGNUPname.className="";
		xSIGNUPsurname.className="";
		xSIGNUPemail.className="";
		if (xSIGNUPname.defaultValue==xSIGNUPname.value||xSIGNUPname.value=="") {
			xSIGNUPname.className="error";
			xERRORcount=xERRORcount+1;
		}//end if (xSIGNUPname.defaultValue==xSIGNUPname.value||xSIGNUPname.value=="")
		if (xSIGNUPsurname.defaultValue==xSIGNUPsurname.value||xSIGNUPsurname.value=="") {
			xSIGNUPsurname.className="error";
			xERRORcount=xERRORcount+1;
		}//end if (xSIGNUPsurname.defaultValue==xSIGNUPsurname.value||xSIGNUPsurname.value=="")
		if (xSIGNUPemail.defaultValue==xSIGNUPemail.value||xSIGNUPemail.value=="") {
			xSIGNUPemail.className="error";
			xERRORcount=xERRORcount+1;
		}//end if (xSIGNUPemail.defaultValue==xSIGNUPemail.value||xSIGNUPemail.value=="")
		if (xERRORcount==0) {
			vxSIGNUPname=xSIGNUPname.value;
			vxSIGNUPsurname=xSIGNUPsurname.value;
			vxSIGNUPemail=xSIGNUPemail.value;
			xQueryString="xSIGNUPname="+vxSIGNUPname+"&xSIGNUPsurname="+vxSIGNUPsurname+"&xSIGNUPemail="+vxSIGNUPemail;
			LoadFile("http://domain3006645.sites.thomascole.net/components/site_signup.asp?"+xQueryString);
			xmlhttp.onreadystatechange=function() {
				if (xmlhttp.readyState==4) {// 4 = "loaded"
					if (xmlhttp.status==200) {// 200 = "OK"
						xmlResponse=xmlhttp.responseText;
						if (xmlResponse.indexOf("success")>-1) {
							FormSignup.innerHTML="<h1>Sign up successful</h1><p>Thank You</p>";
						} else {
							FormSignup.getElementsByTagName("p")[0].innerHTML=xERRORstring;
							FormSignup.getElementsByTagName("p")[0].className="error";
						} //end if (xmlResponse.indexOf("success")>-1)
					}//end if (xmlhttp.status==200)
				}//end if (xmlhttp.readyState==4)
			}//end function
		} else {
			FormSignup.getElementsByTagName("p")[0].innerHTML=xERRORstring;
			FormSignup.getElementsByTagName("p")[0].className="error";
		}//end if (xERRORcount==0)
	}//end if (FormSignup)
	return false;
}//end function
/*====================================================================================================*/
window.onload=function() {
	setHighlights();
	setInterval("SwapImages()", 5000);
}//end function
/*====================================================================================================*/
