
function ChangeCity()
{
	document.forms[0].submit();
}

function ChangeCounty()
{
	document.forms[0].submit();
}

function UpdatePageDisplayType()
{
	document.forms[0].submit();
}

function subMenuSubmit(page)
{
   document.forms[0].action = page;
   document.forms[0].submit();
}

function FeedbackMailIt() 
{
    var combo = document.getElementById("Subject");
    var email = document.getElementById("Email");
	var message = document.getElementById("msgbody");
	
	if( combo.options[combo.selectedIndex].text == "Please Select:" )
	{
	    alert("Please select the type of feedback you are submitting.");
	    return;
	}
	else if( message.value == "" )
	{
	    alert("Please fill in the message field.");
	    return;
	}
	else if(email.value != "" && !isValidEmail(email.value))
	{
	   alert("Please enter a valid email address for yourself (or leave it blank if you do not wish to provide one).");
	   return;
	}
	else
	{
		combo.options[combo.selectedIndex].text = combo.options[combo.selectedIndex].text;
	}
	
	document.forms[0].action = "../asp/createfeedback.aspx";
	document.forms[0].submit();
}

function TellAFriendMailIt() 
{
	var yourName = document.getElementById("yourName");
	var yourEmail = document.getElementById("yourEmail");
	var friendName = document.getElementById("friendName");
	var friendEmail = document.getElementById("friendEmail");
	
	var combo = document.getElementById("Subject");
	var message = document.getElementById("msgbody");
	if(yourName.value == "")
	{
	   alert("Please fill in the \"Your Name\" field.");
	   return;
	}
	else if(yourEmail.value == "")
	{
	   alert("Please fill in the \"Your Email\" field.");
	   return;
	}
	else if(!isValidEmail(yourEmail.value))
	{
	   alert("Please enter a valid email address for yourself.");
	   return;
	}
	else if(friendName.value == "")
	{
	   alert("Please fill in the \"Your Friend's Name\" field.");
	   return;
	}
	else if(friendEmail.value == "")
	{
	   alert("Please fill in the \"Your Friend's Email\" field.");
	   return;
	}
	else if(!isValidEmail(friendEmail.value))
	{
	   alert("Please enter a valid email address for your friend.");
	   return;
	}
	else if(message.value == "")
	{
	   alert("Please fill in the \"Message\" field.");
	   return;
	}
	
	document.forms[0].action = "../asp/tellafriend.aspx";
	document.forms[0].submit();
}

function GoogleSearch() 
{
    window.open("http://www.google.com/search?q=" + document.getElementById('q').value);	
	//document.forms[0].action = "http://www.google.com/search"; //?q=" + document.getElementById('q').value;
	//document.forms[0].target = "_new";
	//document.forms[0].method = "get";
	//document.forms[0].submit();
}

function AdvertiseWithUsBusinessBox(border)
{
	var str;
	
	str = "<table border=" + border + " cellspacing=0 cellpadding=0 class='advertisementBox' align='center'>\n" +
		  "<tr>\n" +
		  "<td class='advertisementBox'>\n" +
		  "<center><b>BUSINESSES:</b></center>\n" +
		  "<br>\n" +
		  "Learn how you can promote your events, classes or advertise your family friendly business. " +
		  "<a href='../asp/kids.aspx?fileName=advertise.asp'>Click Here</a>\n" +
		  "</td>\n" +
		  "</tr>\n" +
		  "</table>\n";

	document.write(str);
}

function AdvertiseWithUsBox(border)
{
	var str;
	
	str = "<table border=" + border + " cellspacing=0 cellpadding=0 class='advertisementBox' align='center'>\n" +
		  "<tr>\n" +
		  "<td class='advertisementBox'>\n" +
		  "<a href='../asp/kids.aspx?fileName=advertise.asp'>Click Here</a> " +
		  "if you would like to advertise your family-friendly business with us." +
		  "</td>\n" +
		  "</tr>\n" +
		  "</table>\n";
		  
	document.write(str);
}

function ListWithUsBox(border)
{
	var str;
	
	str = "<table border=" + border + " cellspacing=0 cellpadding=0 class='advertisementBox' align='center'>\n" +
		  "<tr>\n" +
		  "<td class='advertisementBox'>\n" +
		  "Did we miss something?  Please <a href='../asp/kids.aspx?fileName=advertise.asp'>" +
		  "let us know</a> if you would like something added.\n" +
		  "</td>\n" +
		  "</tr>\n" +
		  "</table>\n";
		  
	document.write(str);
}

function EventsCalenderSuggestionBox(border)
{
	var str;
	
	str = "<table border=" + border + " cellspacing=0 cellpadding=0 class='advertisementBox' align='center'>\n" +
		  "<tr>\n" +
		  "<td class='advertisementBox'>\n" +
		  "Did we miss an event?  Please <a href='mailto:info@morgantownkids.com?Subject=Upcoming Event Addition Request&" +
		  "Body=Please add the following events to the MorgantownKids.com Events Calendar:'>let us know</a> if you would like an event added.\n" +
		  "</td>\n" +
		  "</tr>\n" +
		  "</table>\n";
		  
	document.write(str);
}

function BulletinBoardBox(border)
{
	var str;
	
	str = "<table border=" + border + " cellspacing=0 cellpadding=0 class='advertisementBox' align='center'>\n" +
		  "<tr>\n" +
		  "<td class='advertisementBox'>\n" +
		  "Please <a href='mailto:info@morgantownkids.com?Subject=Bulletin Board Addition Request&" +
		  "Body=Please add the following items to the MorgantownKids.com Bulletin Board:%0D%0AItem:" +
		  "%0D%0AItem Description:%0D%0AContact Info: (phone, email, etc):%0D%0AAdditional Info:'>Click Here</a> " +
		  "if you would like to add an item to this site that you would like to sell.<br><br>" +
		  "This service is free of charge!<br><br>" +
		  "We do not handle these items and are not responsible for any items, we only list the items for our users " +
		  "convenience.<br><br>" +
		  "So please add the following information so that the interested parties may be able to get ahold of you " +
		  "to purchase the items.<br>" +
		  " 1) Item<br>" +
		  " 2) Description of Item<br>" +
		  " 3) How you may be contacted (phone, email, etc)<br>" +
		  " 4) Any other relavent information<br><br>" +
		  " Also, please send us an email if you purchase an item from someone in this list (or your item gets " +
		  " purchased) so that we know to remove if from our list!<br><br>" +
		  " Thanks, and enjoy!" +
		  "</td>\n" +
		  "</tr>\n" +
		  "</table>\n";
		  
	document.write(str);
}

// Disables the return key for submitting forms.
function disableEnterKey(e)
{
	var key;

	if(window.event)
	{
		// IE
		key = window.event.keyCode;
	}
	else
	{
		// Firefox
		key = e.which;
	}
	     
	if(key == 13)
	{
		return false;
	}
	else
	{
		return true;
	}
}
