jQuery.preloadImages = function() {
  for(var i = 0; i<arguments.length; i++) {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

function navOver() {
	$(this).attr("src", $(this).attr("src").replace(".gif", "_o.gif"));
}

function navOut(i) {
	$(this).attr("src", $(this).attr("src").replace("_o.gif", ".gif"));
}

function navClick() {
	$(this).children(".navElement").each(function() {	
		$(this).unbind("mouseover");
		$(this).unbind("mouseout");
	});
}


$(document).ready(function() {

	$(".navClick").each(function() {
		$(this).bind("click", navClick);
	});

	$(".navElement").each(function() {
		$(this).bind("mouseover", navOver);
		$(this).bind("mouseout", navOut);
		
		image1 = $(this).attr("src");
		image2 = image1.replace(".gif", "_o.gif");
		
		$.preloadImages(image1, image2);
	});

});

var months = new Array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

function testSelected(rb) {
	for (count=0;count<rb.length;count++) {
		if (rb[count].checked)
			return true;
	}
	return false;
}

// verifies that thee email address provided is correct.

var reEmail = /^.+\@.+\..+$/
var defaultEmptyOK = false


function isEmpty(s) { 
  return ((s == null) || (s.length == 0))
}


function isEmail (s){
  if (isEmpty(s)) 
    if (isEmail.arguments.length == 1) return defaultEmptyOK;
    else return (isEmail.arguments[1] == true);
    
  else {
    return reEmail.test(s)
  }
}

function newWin(url,height,width) {
	var newWindow;
	var top = screen.availHeight/2 - height/2; // center
	var left = screen.availWidth/2 - width/2; // center
	winProps = "height=" + height + ",width=" + width + ",top=" + top + ",left=" + left + ",menubar=no,scrollbars=yes,resizable=no,status=no,toolbar=no";
	window.open(url,"ChildWindow",winProps);
}


