function checkphone(e){
	var goodphone="";
	var phone=String(e.value);
	phone=phone.replace(/[^0-9]/g,'');
	var vlen=phone.length;

	if (phone)
		{

		if (vlen=='10' && !isNaN(phone))
			{
			goodphone="("+phone.slice(0,3)+") "+phone.slice(3,6)+"-"+phone.slice(6);
			e.value=goodphone;
			}
		else
			{
			alert("The phone number you have entered is invalid. Please enter only 10 numbers including the area code.");
			globalvar = e;
			setTimeout("globalvar.focus();", 1);
			setTimeout("globalvar.select();", 1);
			}
		}
	else
		{
		e.value=phone;
		}
}

function checkemail(e){
	var email=String(e.value);
	if (email){
		if(!email.match(/^[\w]{1}[\w\.\-_]*@[\w]{1}[\w\-_\.]*\.[\w]{2,6}$/i)) {
			alert("The email address you have entered is invalid.");
			globalvar = e;
			setTimeout("globalvar.focus();", 1);
			setTimeout("globalvar.select();", 1);
		}
	}
}

/*Ajax*/

var xmlhttp = false;

//Check if we are using IE.
try 
	{
	//If the Javascript version is greater than 5.
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} 
catch (e) 
	{
	//If not, then use the older active x object.
	try 
		{
		//If we are using Internet Explorer.
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} 
	catch (E) 
		{
		//Else we must be using a non-IE browser.
		xmlhttp = false;
		}
	}

//If we are using a non-IE browser, create a javascript instance of the object.
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
	{
	xmlhttp = new XMLHttpRequest();
	}

function makerequest(serverPage, objID) {
		
	var date = new Date();
	var timestamp = date.getTime();
	url = serverPage + "?time=" +timestamp;

	var obj = document.getElementById(objID);
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			}
		}
	xmlhttp.send(null);
	}

function getdoc(serverPage, id, objID) {
		
	var date = new Date();
	var timestamp = date.getTime();
	url = serverPage + "?timestamp=" + timestamp +"&id=" + id;

	var obj = document.getElementById(objID);
	xmlhttp.open("GET", url);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
			}
		}
	xmlhttp.send(null);
	}