// JavaScript Document
var viewportwidth;
var viewportheight;

// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
if (typeof window.innerWidth != 'undefined')
{
	viewportwidth = window.innerWidth,
	viewportheight = window.innerHeight
}

// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
else if (typeof document.documentElement != 'undefined'
	&& typeof document.documentElement.clientWidth !=
	'undefined' && document.documentElement.clientWidth != 0)
{
	viewportwidth = document.documentElement.clientWidth,
	viewportheight = document.documentElement.clientHeight
}

// older versions of IE
else
{
	viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
	viewportheight = document.getElementsByTagName('body')[0].clientHeight
}

function genCenterWindows() {
	var mainDiv = document.getElementById('wrap');
	var findHeight = Math.ceil((viewportheight - 660) / 2);
	findHeight = (findHeight < 0) ? (findHeight * -1) : findHeight;
	
}

function hoverImage(id) {
	var old_src = document.getElementById(id).src;
	if(old_src.indexOf('_hover.png') == -1) {
		var new_src = old_src.substr(0, old_src.length - 4) +'_hover.gif';
		document.getElementById(id).src = new_src;
	}
}

function unHoverImage(id) {
	var old_src = document.getElementById(id).src;
	if(old_src.indexOf('_hover.gif') != -1) {
		var new_src = old_src.substr(0, old_src.length - 10) +'.gif';
		document.getElementById(id).src = new_src;
	}
}

var oldId;
var timeInterVal;
function showSubMenu(id) {
	if(oldId) {
		if(oldId != id) {
			document.getElementById(oldId).style.display = 'none';
			
			oldId = id;
			document.getElementById(id).style.display = 'inline';
		}
	} else {
		oldId = id;
		document.getElementById(id).style.display = 'inline';
	}
	
	//setInterval('shutDownMenu()', 5000);
	//setTimeout('shutDownMenu()', 10000);
}

function countDown(id) {
	//oldId = id;
	//timeInterVal = setInterval('shutDownMenu()', 5000);
}

function shutDownMenu() {
	document.getElementById('menu_sub_item_1').style.display = 'none';
	document.getElementById('menu_sub_item_2').style.display = 'none';
	document.getElementById('menu_sub_item_3').style.display = 'none';
	document.getElementById('menu_sub_item_4').style.display = 'none';
	document.getElementById('menu_sub_item_5').style.display = 'none';
	document.getElementById('menu_sub_item_6').style.display = 'none';
	clearInterval(timeInterVal);
}
