// JavaScript include file for Northtown MUD pages

var menu1on = new Image();  // preload the active image
var menu1off = new Image();  // preload the inactive image
var menu2on = new Image();  // preload the active image
var menu2off = new Image();  // preload the inactive image
var menu3on = new Image();  // preload the active image
var menu3off = new Image();  // preload the inactive image
var menu4on = new Image();  // preload the active image
var menu4off = new Image();  // preload the inactive image
var menu5on = new Image();  // preload the active image
var menu5off = new Image();  // preload the inactive image
var menu6on = new Image();  // preload the active image
var menu6off = new Image();  // preload the inactive image
var menu7on = new Image();  // preload the active image
var menu7off = new Image();  // preload the inactive image
var menu8on = new Image();  // preload the active image
var menu8off = new Image();  // preload the inactive image
var menu9on = new Image();  // preload the active image
var menu9off = new Image();  // preload the inactive image

menu1on.src = "images/menu_home_on.gif";
menu1off.src = "images/menu_home.gif";
menu2on.src = "images/menu_board_on.gif";
menu2off.src = "images/menu_board.gif";
menu3on.src = "images/menu_utilities_on.gif";
menu3off.src = "images/menu_utilities.gif";
menu4on.src = "images/menu_parks_on.gif";
menu4off.src = "images/menu_parks.gif";
menu5on.src = "images/menu_maps_on.gif";
menu5off.src = "images/menu_maps.gif";
menu6on.src = "images/menu_faqs_on.gif";
menu6off.src = "images/menu_faqs.gif";
menu7on.src = "images/menu_documents_on.gif";
menu7off.src = "images/menu_documents.gif";
menu8on.src = "images/menu_pictures_on.gif";
menu8off.src = "images/menu_pictures.gif";
menu9on.src = "images/menu_links_on.gif";
menu9off.src = "images/menu_links.gif";

function button_on(whichButtonon,msgTexton)
{
	setMsg(msgTexton);
	eval("document.images."+whichButtonon+".src = "+whichButtonon+"on.src");
}

function button_off(whichButtonoff) 
{
	setMsg('');
	eval("document.images."+whichButtonoff+".src = "+whichButtonoff+"off.src");
}

function setMsg(msgText)
{
	window.setTimeout('window.status=\"'+msgText+'\"', 1);
    return true;
}

function sendComments(strRecipient) // sends contents of comments or questions form
{
	var strDomain, nCharNum, strDiddleDivider, strMessage, strSubject, strBody, strCC;
	var strName, strAddress, strCity, strState, strZIP, strEmail, strPhone, strTemp;
	strDomain = escape('northtownmud.org');
	nCharNum = 32 + 32;
	strDiddleDivider = "";
	strMessage = "";
	strSubject = escape('Message to Northtown MUD');
	strBody = document.forms.dataText1.comments.value;
	strName = document.forms.dataText1.fullname.value;
	strAddress = document.forms.dataText1.address.value;
	strCity = document.forms.dataText1.city.value;
	strState = document.forms.dataText1.state.value;
	strZIP = document.forms.dataText1.zipcode.value;
	strEmail = document.forms.dataText1.email.value;
	strPhone = document.forms.dataText1.phone.value;
	strCC = "";
	strTemp = "";
	
	if (document.forms.dataText1.subject.value != "")
	{
		strSubject = escape(document.forms.dataText1.subject.value) ;
	}	
	
	if (strName == "")
	{
		strTemp = strTemp + "\nFull name";
	}	
	if (strAddress == "" || strCity == "" || strState == "" || strZIP == "")
	{
		strTemp = strTemp + "\nComplete address";
	}	
	if (strPhone == "" && strEmail == "")
	{
		strTemp = strTemp + "\nEmail address or telephone number";
	}	
	if (strBody == "")
	{
		strTemp = strTemp + "\nComment or question";
	}	

	if (strTemp != "")
	{
		window.alert('It will be hard to respond to your inquiry if you don\'t include your '+strTemp);
		return;
	}	
	
	if (strEmail != "")
	{
		strCC = "&cc="+escape(strEmail);
	}
		
	strTemp = "Name:  "+strName + 
		"\nAddress:  "+strAddress+", "+strCity+", "+strState+"  "+strZIP +
		"\nTelephone: "+strPhone +
		"\nemail: "+strEmail +
		"\n\nMessage:\n\n"+strBody;

	strMessage = "mail"+strDiddleDivider+"to:"+escape(strRecipient) + 
		String.fromCharCode(nCharNum)+strDomain + 
		"?subject="+strSubject+"&body="+escape(strTemp)+strCC;
	window.location = strMessage;
	return true;
}


function sendEmail(strRecipient) // obscures email address (spam preventer)
{
	var strDomain, nCharNum, strDiddleDivider, strMessage ;
	strDomain = escape('northtownmud.org');
	nCharNum = 32 + 32;
	strDiddleDivider = "";
	strMessage = "";

	if (strRecipient == "keith")
	{
		strRecipient = "keith.kinnard";
		strDomain = escape('co.travis.tx.us');
	}
	
	strMessage = "mail"+strDiddleDivider+"to:"+escape(strRecipient) + 
		String.fromCharCode(nCharNum)+strDomain;
	window.location = strMessage;
//	return true;
}


