// JavaScript Document

$(document).ready(function(e) {
	$('a[rel*=facebox]').facebox();
});

function rollOn(e) {
	e.style.backgroundColor = "#0E2643";
}

function rollOff(e) {
	e.style.backgroundColor = "#234156";
}

function rollImg(e, image) {
	e.style.backgroundImage = "url("+image+")";
}

function csOn(e) {
	e.style.backgroundColor = "#330000";
	e.style.color = "#FFFFFF";
	e.innerHTML = "&gt; Coming Soon";
}

function csOff(e) {
	e.style.backgroundColor = "#234156";
	e.style.color = "#A28858";
	e.innerHTML = "&gt; Newsletter Signup";
}

function showdiv(id) {
  if (document.getElementById(id).style.display == 'none') {
	document.getElementById(id).style.display = '';
  }
  else {
	document.getElementById(id).style.display = 'none';
  }
}

function rollMenuOn(e, num) {
	if (document.getElementById("menu"+num))
	{
		if (document.getElementById("menu"+num).style.display == "")
		{
			return;
		}	
	}
	e.style.backgroundColor = "#B2B2B2";
}

function rollMenuOff(e, num) {
	if (document.getElementById("menu"+num))
	{
		if (document.getElementById("menu"+num).style.display == "")
		{
			return;
		}	
	}
	e.style.backgroundColor = "";
}

function validate(form) {
	var firstwidget = 0;
	var fail = false;
	dojo.forEach(form.getDescendants(), function(widget){
		if ( widget.isValid && ! widget.isValid() ) {
			if ( ! widget.disabled ) {
				widget.validate(true);
				widget.focus();
				fail = true;
				if ( ! firstwidget ) {
					firstwidget = widget;
				}
			}
		}
	});
	if ( firstwidget ) {
		firstwidget.focus();
	}
	if (!fail)
		form.submit();
}

function redirect(url) {
	window.location = url;
}

function gosearch(id) {
	document.getElementById(id).submit();	
}