var inmenu = false;
var lastmenu = 0;


function Menu(current)
{
	if (!document.getElementById)
	{
		return;
	}

	inmenu = true;
	var oldmenu = lastmenu;
	lastmenu = current;

	if (oldmenu)
	{
		Erase(oldmenu);
	}


	//m = document.getElementById("menu-" + current);
	//m.style.backgroundImage = "url(images/nav_down.gif)";
	//m.style.cursor = 'hand';

	box = document.getElementById(current);
	box.style.visibility = "visible";

	//box.style.backgroundImage = "url(images/nav2_down.gif)";
	//box.style.cursor = 'hand';
	//box.style.left="155";
	//box.style.top= m.offsetTop + m.offsetHeight + 98;
}


function Erase(current)
{
	if (!document.getElementById)
	{
		return;
	}

	if (inmenu && lastmenu == current)
	{
		return;
	}

	//m = document.getElementById("menu-" + current);
	//m.style.backgroundImage = "url(images/nav_up.gif)";

	box = document.getElementById(current);
	box.style.visibility="hidden";
}

function Timeout(current)
{
	inmenu = false;
	window.setTimeout("Erase('" + current + "');", 500);
}


function Highlight(menu, item)
{
	if (!document.getElementById)
	{
		return;
	}

	inmenu = true;
	lastmenu = menu;

	//obj = document.getElementById(item);
	//obj.style.backgroundImage = "url(images/nav2_down.gif)";
	//obj.style.cursor = 'hand';

	//box.style.cursor = 'hand';
	//m.style.cursor = 'hand';
}


function UnHighlight(menu, item)
{
	if (!document.getElementById)
	{
		return;
	}

	Timeout(menu);

	//obj = document.getElementById(item);
	//obj.style.backgroundImage = "url(images/nav2_up.gif)";
}


function logon(which)
{
	//log = document.getElementById(which);
	//log.style.backgroundImage = "url(images/nav_down.gif)";
	//log.style.cursor = 'hand';
}

function logout(which)
{
	//log = document.getElementById(which);
	//log.style.backgroundImage = "url(images/nav_up.gif)";
}

function preload()
{
	var d = document;
	if(d.images)
	{
		if(!d.p)
		{
			d.p=new Array();
		}

		var i;
		var j = d.p.length;
		var a = preload.arguments;

		for(i = 0; i < a.length; i++)
		{
			if (a[i].indexOf("#") != 0)
			{
				d.p[j] = new Image; d.p[j++].src = a[i];
			}
		}
	}
}

function butOver(which,extension,myNumber)
{
if (document.images)
	if (myNumber == null)
	{
		myNumber = "";
	}
	document.images[which.toString() + myNumber].src = 'images/' + which.toString() + '_hi.' + extension.toString();
}

function butOut(which,extension,myNumber)
{
if (document.images)
	if (myNumber == null)
	{
		myNumber = "";
	}
	document.images[which.toString() + myNumber].src = 'images/' + which.toString() + '.' + extension.toString();
}





	function setColor(el, bg) {

	  if (el.style) el.style.backgroundColor = bg;

	}



	function checkInput(form)
	{

		var MaxElements = form.length;

		var bgBad = "#FF7777";

		var bgGood = "#FFFFFF";

		var valid = true;

		for (i=0;i<MaxElements;i++)
		{

			if ( form.elements[i].name == "fullname" || form.elements[i].name == "address" || form.elements[i].name == "telephone" || form.elements[i].name == "email" )
			{

				if (form.elements[i].value == "")
				{

					valid = false;

					setColor(form.elements[i], bgBad);

				}
				else
				{

					setColor(form.elements[i], bgGood);

				}

			}

		}

		if (!valid) alert("There Were input errors in the form, Please Ensure that the RED indicated fields are filled before resubmitting the form.");

		return valid;

	}

	function get_hex_color(r, g, b){var hexstring=
	"0123456789abcdef";var hex_color=hexstring.charAt(Math.floor(
	r/16))+hexstring.charAt(r%16)+hexstring.charAt(
	Math.floor(g/16))+hexstring.charAt(g%16)+
	hexstring.charAt(Math.floor(b/16))+hexstring.charAt(b%
	16); return hex_color;}

	function pulsar(inc, delay){if(this.fade==undefined)this.fade=
	true; if(this.i==undefined) this.i=0; this.fade=(this.fade)?
	((i+=inc)>=156)?!this.fade:this.fade:((i-=inc)<=1)?!this.fade:
	this.fade;document.getElementById("news_headline").style.backgroundColor=
	get_hex_color(255, i, i); setTimeout("pulsar("+inc+", "+delay+");", delay);}
	
	

function validate(form1) {
	if (form1.AreaofBusiness[5].checked) {
		if(form1.OtherAreaofBusiness.value.length == 0) {
			alert ('Please use the box provided to specify your area of business.');
			return false;
		} else {
			return true;
		}
	} else { 	
		return true;
	}
}