$(document).ready(function() {

	// preload images
	var imageList = ["/images/tabs/16Red.gif",
		"/images/tabs/17Red.gif",
		"/images/tabs/18Red.gif",
		"/images/tabs/19Red.gif",
		"/images/tabs/20Red.gif",
		"/images/tabs/21Red.gif",
		"/images/tabs/43Red.gif"];
		
	for(var i = 0; i < imageList.length; i++) {
		$("<img />").attr("src", imageList[i]);
	}

	// set active tab
	var bodyID = $("body").attr("id");
	switch(bodyID) {
		case "home":
			$("#tab16").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "about":
			$("#tab17").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "services":
			$("#tab18").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "news":
			$("#tab19").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "events":
			$("#tab20").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "links":
			$("#tab21").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
		case "reports":
			$("#tab43").attr("src", function() { var theSrc = this.src; return theSrc.replace(/White/, "Red"); });
			break
	}

	$("#menuTabs li a").hover(function() {
		// mouseover
		currentSrc = $(this).children("img").attr("src");
		$(this).children("img").attr("src", currentSrc.replace(/White/, "Red"));
	}, function() {
		// mouseout
		$(this).children("img").attr("src", currentSrc);
	});

});