function showEmailForm(tag) {
	var text = "";
	text = text + "<div class=\"pageBody\">"
	text = text + "<table align=\"center\" width=\"200\">"
	text = text + "	<tr><td width=\"75\">To:</td><td><input class=\"txtZipSmall\" type=\"text\" value=\"\" name=\"to\" id=\"to\" /></td></tr>"
	text = text + "	<tr><td width=\"75\">From:</td><td><input class=\"txtZipSmall\" type=\"text\" value=\"\" name=\"from\" id=\"from\" /></td></tr>"
	text = text + "	<tr><td width=\"75\">Subject:</td><td><input class=\"txtZipSmall\" type=\"text\" value=\"The Recycling Center\" name=\"subject\" id=\"subject\" /></td></tr>"
	text = text + "	<tr><td width=\"75\">Message:</td><td>"
	text = text + "		<textarea rows=\"10\" cols=\"40\" id=\"message\" class=\"txtZipSmall\">\n\r\n\r<br /><br />Check out <a href=www.therecyclingcenter.info>The Recycling Center</a><br />You can Find recycling centers and learn how to recycle from the comfort of your own home"
	text = text + "		</textarea>"
	text = text + "	</td></tr>"
	text = text + " 	<tr align=\"right\"><td colspan=\"2\"><div id=\"emailResult\"></div>"
	text = text + "		<button class=\"txtZipBig\" name=\"emailFriend\" onclick=\"sendEmail(document.getElementById('to').value, document.getElementById('from').value, document.getElementById('subject').value, document.getElementById('message').value, 'emailResult')\">Send</button>"
	text = text + "	</td></tr>"
	text = text + "</table>"
	text = text + "</div>"
	document.getElementById(tag).innerHTML = text;
}

// Initiates the HTTPrequest to call email.php
resultID;
function sendEmail(to, from, subject, message, id) {
		resultID = id
		document.getElementById(resultID).innerHTML = "<img src='../images/waitCircle.gif' \>"
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)	{
			alert ("Oh No! Your browser does not support AJAX!");
			return;
		}
		var url="../php/email.php5";
		url=url+"?to="+to;
		url=url+"&from="+from;
		url=url+"&subject="+subject;
		url=url+"&message="+message;		
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=stateChangedEmail;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
}

// When email.php is done, this function is called
function stateChangedEmail() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById(resultID).innerHTML = xmlHttp.responseText
			//setTimeout("document.getElementById('ErrorCreatingAccount').innerHTML = ''", 1000);
		}
}

// Gets the xml http object for use in xmlhttprequest operations
function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
