	
var ETFform
//var rememberlinkbtn //holds the innerHTML of the link button while it's processing
function processquest(frmname)
{
	createRequest()
	
	var theForm = eval('document.'+frmname)
	rememberlinkbtn=gebid('toolboxemailtofriendlinkbutton').innerHTML
	gebid('toolboxemailtofriendlinkbutton').innerHTML='<span style="color:red;">processing...</span>'
	var url=''
	url = '/rpc/mailtofriend/mailtofriend.asp'
	var sel=''
	
	for(var h=0;h<theForm.elements.length;h++)
	{
		sel+=theForm.elements[h].name+'='+theForm.elements[h].value+'&'
	}
	sel=sel.substr(0,sel.length-1)
	//alert(sel)

	request.open("POST",url,true)

	request.onreadystatechange = updateETFPage
	request.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
	request.send(sel)
}

function updateETFPage()
{

	if(request.readyState==4)
	{

		//document.getElementById(ETFform).style.visibility='hidden'
		var resp=request.responseText
		//alert(resp)
		if (request.status==200)
		{
			gebid('toolboxemailtofriendlinkbutton').innerHTML='<span style="color:#FF0000">'+resp+'</span>'
		}
		else
		{
			//alert("The server said: "+request.status+'\n'+resp)
			gebid('toolboxemailtofriendlinkbutton').innerHTML='<span style="color:#FF0000">There was an error processing your message</span>'
		}
	}
	//document.getElementById(ETFform+'linkbutton').innerHTML=rememberlinkbtn
}
/*
VIC_Question_00026 - Friend's e-mail
VIC_Question_00025 - Friend's name
VIC_Question_00418 - Your e-mail
VIC_Question_00419 - Your name
VIC_Question_00421 - page to send
VIC_ID
ETF_Form_Action*/

function VF_ETFForm(frmname)
{
	var formerrflg=false
	var siv=''

	var theForm = eval('document.'+frmname)
	var errMsg = "";
	var setfocus = "";
	var REEMAIL = /^\w+((\.?)([\w+\!\#\$\%\&\'\*\+\-\/\=\?\^\_\`\{\|\}\~]))+\@[a-zA-Z0-9-]+((\.?)([a-zA-Z0-9-]+))+$/;

	if(gebid('VIC_Question_00025').value == '')
	{
		gebid('VIC_Question_00025').value = "Friend"
	}

	
	if(gebid('VIC_Question_00419').value == '')
	{
		setformerror('VIC_Question_00419',1)
	}
	else
	{
		setformerror('VIC_Question_00419',0)
	}

	if (!REEMAIL.test(theForm['VIC_Question_00418'].value))
	{
		setformerror('VIC_Question_00418',1)
	}
	else
	{
		setformerror('VIC_Question_00418',0)
	}

	
	if (!REEMAIL.test(theForm['VIC_Question_00026'].value))
	{
		setformerror('VIC_Question_00026',1)
	}
	else
	{
		setformerror('VIC_Question_00026',0)
	}
	


	if (formerrflg==false)
	{
		processquest(frmname);
	}
	else
	{
		gebid('etfFormResp').innerHTML='<span style="color:red;">Please correct the errors in red below</span>'
	}
}

function printableArticle()
{
	var printWindow
	var ih=document.getElementById('content').innerHTML
	//strip out toolbox for printable version
	//alert(ih)
	//alert(ih.substr(0,ih.indexOf('<!--begin toolbox-->')-1))
	//ih=ih.substr(0,ih.indexOf('<!--begin toolbox-->')-1)+ih.substring(ih.indexOf('<!--end toolbox-->')+18,ih.length)
	
	printWindow = window.open('','printableArticle','width=800px, height=600px, resizable,menubar,scrollbars');
	printWindow.document.write('<html><head><title>Billy Graham Evangelistic Association</title>')
	printWindow.document.write('<link rel="stylesheet" type="text/css" href="/includes/Hurricane_General.css">')
	printWindow.document.write('<link rel="stylesheet" type="text/css" href="/includes/dmagstyles.css">')
	printWindow.document.write('</head>')
	printWindow.document.write('<body onload="document.getElementById(\'articletools\').style.visibility=\'hidden\';document.getElementById(\'articletools\').style.display=\'none\';document.getElementById(\'emailtofriendlink\').style.visibility=\'hidden\'">')
	printWindow.document.write(ih)
	printWindow.document.write('</body></html>')
	printWindow.document.close()
	//alert(printWindow.document.getElementById('emailtofriend').style.visibility)
}

