function sendFriend(id, title, url){
	oDiv = document.createElement("div");
	oForm = document.createElement("form");
	oForm.setAttribute("style","margin-right:10px");
	oForm.setAttribute("class","float");
	oForm.setAttribute("className","float");
	oForm.setAttribute("onsubmit","return sendFriendSubmit(this)");
	oInput = document.createElement("input");
	oInput.setAttribute("id","xjuewlwekwefniufoweiffwe");
	oInput.setAttribute("type","hidden");
	oInput.setAttribute("value",id);
	oForm.appendChild(oInput);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("Your name:"));
	oInput = document.createElement("input");
	oInput.setAttribute("id","strSendFriendName");
	oInput.setAttribute("type","text");
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("Friends' e-mail:"));
	oInput = document.createElement("input");
	oInput.setAttribute("id","strSendFriendEmail");
	oInput.setAttribute("type","text");
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("Message:"));
	oInput = document.createElement("textarea");
	oInput.setAttribute("id","strSendFriendText");
	oInput.setAttribute("rows","5");
	oInput.setAttribute("cols","50");
	oInput.appendChild(document.createTextNode("Thought you may enjoy this article.\n\n" + title + "\n" + url));
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("When ready:"));
	oInput = document.createElement("input");
	oInput.setAttribute("type","submit");
	oInput.setAttribute("value","Send");
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oDiv.appendChild(oForm);
	oBr = document.createElement("br");
	oBr.setAttribute("style","clear:both");
	oDiv.appendChild(oBr);
	drawSimple(oDiv);	
}
function sendFriendSubmit(oForm){
	_closedraw();
	var http = new XMLHttpObject();
	var params = "xhwul="+(oForm.xjuewlwekwefniufoweiffwe.value)+"&name="+(oForm.strSendFriendName.value)+"&email="+(oForm.strSendFriendEmail.value)+"&message="+escape(oForm.strSendFriendText.value);
	/*document.write(params);
	document.close();*/
	http.open("POST", "/xml/sendemail/index.php", true);
	
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			switch(http.responseText){
				case '1':
					oPara = document.createElement("p");
					oPara.appendChild(document.createTextNode("Your message has been sent."));
					drawSimple(oPara);
					break;
				case '0':
				default:
					oPara = document.createElement("p");
					oPara.appendChild(document.createTextNode("Your message could not be sent."));
					drawSimple(oPara);
					break;
			}
		}
	}
	http.send(params);
	return false;
}
function sendFriendEmail(fid,tid,name){
	oDiv = document.createElement("div");
	oForm = document.createElement("form");
	oForm.setAttribute("style","margin-right:10px");
	oForm.setAttribute("class","float");
	oForm.setAttribute("className","float");
	oForm.setAttribute("onsubmit","return sendFriendEmailSubmit(this)");
	oInput = document.createElement("input");
	oInput.setAttribute("id","xjuewlwekwefniufoweiffwe");
	oInput.setAttribute("type","hidden");
	oInput.setAttribute("value",fid);
	oForm.appendChild(oInput);
	oInput = document.createElement("input");
	oInput.setAttribute("id","xjuewlwedewefwefffwe");
	oInput.setAttribute("type","hidden");
	oInput.setAttribute("value",tid);
	oForm.appendChild(oInput);
	oInput = document.createElement("input");
	oInput.setAttribute("id","hfhifi9f9fo24fm2nj3r");
	oInput.setAttribute("type","hidden");
	oInput.setAttribute("value",name);
	oForm.appendChild(oInput);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("Message:"));
	oInput = document.createElement("textarea");
	oInput.setAttribute("id","strSendFriendText");
	oInput.setAttribute("rows","5");
	oInput.setAttribute("cols","50");
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oLabel = document.createElement("label");
	oLabel.appendChild(document.createTextNode("When ready:"));
	oInput = document.createElement("input");
	oInput.setAttribute("type","submit");
	oInput.setAttribute("value","Send");
	oForm.appendChild(oLabel);
	oForm.appendChild(oInput);
	oBr = document.createElement("br");
	oForm.appendChild(oBr);
	oDiv.appendChild(oForm);
	oBr = document.createElement("br");
	oBr.setAttribute("style","clear:both");
	oDiv.appendChild(oBr);
	drawSimple(oDiv);	
}
function sendFriendEmailSubmit(oForm){
	_closedraw();
	var http = new XMLHttpObject();
	var params = "gjuwk="+(oForm.xjuewlwekwefniufoweiffwe.value)+"&hjwudd="+(oForm.xjuewlwedewefwefffwe.value)+"&njejw="+escape(oForm.hfhifi9f9fo24fm2nj3r.value)+"&dkwmd="+escape(oForm.strSendFriendText.value);
	http.open("POST", "/xml/sendemail/message.php", true);
	
	http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	
	http.onreadystatechange = function() {//Call a function when the state changes.
		if(http.readyState == 4 && http.status == 200) {
			switch(http.responseText){
				case '1':
					oPara = document.createElement("p");
					oPara.appendChild(document.createTextNode("Your message has been sent."));
					drawSimple(oPara);
					break;
				case '0':
				default:
					oPara = document.createElement("p");
					oPara.appendChild(document.createTextNode("Your message could not be sent."));
					drawSimple(oPara);
					break;
			}
		}
	}
	http.send(params);
	return false;
}
