//////////////////////////////////////////////////////
//
//	The purpose of this file is to
//	apply a hover class on mouseover
//	on the <li> elements in the nav.
//	This is because IE doesn't put
//	the pseudo class :hover on <li> elements
//
//	This is code that uses the
//	jquery javascript library (http://jquery.com/)
//
//////////////////////////////////////////////////////
$(window).load(function() {
	if (document.all&&document.getElementById) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".navtop li").hover(function () {
			$(this).addClass("hover");
		},function () {
			$(this).removeClass("hover");
		});
	} else {
		// this is need for safari when nav covers flash
		$(".navtop li ul").hover(function () {
			$(this).addClass("redraw");
		},function () {
			$(this).removeClass("redraw");
		});
	}
});

// check required form fields
function CheckRequired() {
	if($('#cform #cname')[0].value == null || $('#cform #cname')[0].value.length == 0)  {
		alert("Your Name is required");
		$('#cform #cname')[0].focus();
		return false;
	}
	if($('#cform #cemail')[0].value == null || $('#cform #cemail')[0].value.length == 0) {
		alert("Email Address is required");
		$('#cform #cemail')[0].focus();
		return false;
	}
	if($('#cform #cphone')[0].value == null || $('#cform #cphone')[0].value.length == 0) {
		alert("Phone Number is required");
		$('#cform #cphone')[0].focus();
		return false;
	}
	return true;
}

// return value from key in URL query string
function getQueryKey(searchKey)
{
	var url = location.href;
	var query = url.split("?");
	var split, key, val, found = false;

	if ( query[1] != undefined )
	{
		var pairs = query[1].split("&");

		for ( var i = 0; i < pairs.length; i++ )
		{
			split = pairs[i].split("=");
			key = split[0];
			val = split[1];

			if ( key == searchKey )
			{
				found = val;
				found = unescape(found);
				found.replace(/\+/g, " ");
				found.replace(/\%20/g, " ");
				return found;
			}
		}
	}

	if ( found == false )
	{
		return "";
	}
}
