/* IE 6 cache background-image bug */
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}

/* Hover - change image opacity and swap content */
function mouseOver(id_num, this_one, section)
{
	var content_id="content_" + id_num
	var section_id="content_" + section
	var to_show = document.getElementById(content_id)
	var to_hide = document.getElementById(section_id)
	to_hide.style.display="none"
	to_show.style.display="inline"

	var pic_show_id="left_"+id_num+"a"
	var pic_hide_id="left_"+id_num+"b"
	var pic_show=document.getElementById(pic_show_id)
	var pic_hide=document.getElementById(pic_hide_id)
	pic_hide.style.display="none"
	pic_show.style.display="inline"
	$f().unload();
}

function mouseOverAndHide(id_num, this_one, section)
{
	var content_id="content_" + id_num
	var section_id="content_" + section
	var to_show = document.getElementById(content_id)
	var to_hide = document.getElementById(section_id)
	to_hide.style.display="none"
	to_show.style.display="inline"

	var pic_show_id="left_"+id_num+"a"
	var pic_hide_id="left_"+id_num+"b"
	var pic_show=document.getElementById(pic_show_id)
	var pic_hide=document.getElementById(pic_hide_id)
	pic_hide.style.display="none"
	pic_show.style.display="inline"
	
	var bg = document.getElementById("page_wrapper")
	bg.style.backgroundImage="none"
	$f().unload();
}

function mouseOut(id_num, this_one, section)
{
	var content_id="content_" + id_num
	var section_id="content_" + section
	var to_hide = document.getElementById(content_id)
	var to_show = document.getElementById(section_id)
    to_hide.style.display="none"
	to_show.style.display="inline"
	
	if (id_num != section) {
        var pic_show_id="left_"+id_num+"b"
    	var pic_hide_id="left_"+id_num+"a"
    	var pic_show=document.getElementById(pic_show_id)
        var pic_hide=document.getElementById(pic_hide_id)
    	pic_hide.style.display="none"
    	pic_show.style.display="inline"
	}
	$f().unload();
}

function mouseOutAndShow(id_num, this_one, section)
{
	var content_id="content_" + id_num
	var section_id="content_" + section
	var to_hide = document.getElementById(content_id)
	var to_show = document.getElementById(section_id)
    to_hide.style.display="none"
	to_show.style.display="inline"
	
	if (id_num != section) {
        var pic_show_id="left_"+id_num+"b"
    	var pic_hide_id="left_"+id_num+"a"
    	var pic_show=document.getElementById(pic_show_id)
        var pic_hide=document.getElementById(pic_hide_id)
    	pic_hide.style.display="none"
    	pic_show.style.display="inline"
	}
	
	if (section == 0 || section == 4)
	var bg = document.getElementById("page_wrapper")
	bg.style.background="url('../images/logos.gif') no-repeat bottom center;"
	$f().unload();
}

/* DOM script for IE drop-down menus */
startList = function () {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("topnav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover = function() {
					this.className += " over";
				}
				node.onmouseout = function() {
					this.className=this.className.replace(" over", "");
				}
				for (j=0; j<node.childNodes.length; j++) {
					node2 = node.childNodes[j];
					if (node2.nodeName=="UL") {
						for (k=0; k<node2.childNodes.length; k++) {
							node3 = node2.childNodes[k];
							if (node3.nodeName=="LI") {
								node3.onmouseover = function() {
									this.className += " over";
								}
								node3.onmouseout = function() {
									this.className=this.className.replace(" over", "");
								}
							}
						}
					}
				}
			}
		}
	}
}
window.onload = startList;

/* Set active section */
function landing_page(section)
{
	landing_id = "content_" + section
	landing_content = document.getElementById(landing_id)
	landing_content.className += " landing"
	if (section!=0) {
		show_id = "left_" + section + "a"
		hide_id = "left_" + section + "b"
		pic_hide = document.getElementById(hide_id)
		pic_show = document.getElementById(show_id)
		pic_hide.style.display = "none"
		pic_show.style.display = "inline"
	}
}

/* Set active page */
function set_active(page) {
	var nav_id = "nav_" + page
	var nav = document.getElementById(nav_id)
	nav.className += " active"
}

/* Map window */
function showMap() {
	window.open("map.html", "Map", 
	"status = 1, height = 350, width = 400, resizable = 0")
}

function timedCount() {
	hideId = "right_pic_" + c%4
	hide = document.getElementById(hideId)
	hide.style.display = "none"
	c=c+1
	showId = "right_pic_" + c%4
	show = document.getElementById(showId)
	show.style.display = "inline"
	t=setTimeout('timedCount()', 5000)
}

// JAF

$(document).ready(function(){
	$("#features h3").hover(function() {
		$(this).siblings().fadeIn("fast");
	},
	function() {
		$(this).siblings().fadeOut("fast");
	});
});