var currentmenu;
var currentmainmenuitem;
var currentsubmenuitem;
var	currentsubmenu;
var currentsubsub;
var insubsub;
var insub;
var check;


var ns = (navigator.appName.charAt(0)=='N') ? true : false;
var evnt;
function onmove(e)
{
	evnt=e;
}

document.onmousemove=onmove;

function pageon(id)
{
	if(id != currentMainMenuPage)
	{
		var obj=document.getElementById(currentMainMenuPage);
		obj.style.color="#d4d7dc";
	}
}
function pageoff(id)
{
	if(id != currentMainMenuPage)
	{
		var obj=document.getElementById(currentMainMenuPage);
		obj.style.color="#ffffff";
	}
}

function mainon(id) {
	
	var obj=document.getElementById(id);
	obj.style.color="#ffffff";
	obj.style.cursor="hand";
	

	
}
function mainoff(id) {

	var obj=document.getElementById(id);
	obj.style.color="#d4d7dc";
	
	
}
function opensub(id1,id) {
	mainon(id1);
	document.getElementById(id).style.display="block";
	
	if(id!="submenu1")closesub("submenu1");
	if(id!="submenu5")closesub("submenu5");
}
function tryclosesub(id1,id) {
	setTimeout("checkSub()",140);
	currentmainmenuitem=id1;
	currentmenu=id;
	
}
function checkSub(){
	if(currentmenu==null)return;
	closesub(currentmenu);
}
function tryclosesub2(objid,id) {
	check=objid;
	setTimeout("checkSub2()",140);
}
function checkSub2()
{
	if(check=='submenu1')
	{
		if(insub=='bd' ||
			insub=='pr' ||
			insub=='hr' ||
			insub=='vr' ||
			insub=='dm' ||
			insub=='m' ||
			insub=='cs' ||
			insub=='cd' ||
			insub=='sr') return;	
		closesub('submenu1');
		check='submenu2';
		closesub('submenu2');
		check='submenu3';
		closesub('submenu2');
		check=null;
	}
	if(check=='submenu2')
	{
		if(insub=='dm' ||
			insub=='m') return;	
		closesub('submenu2');
		
		if(insub=='bd' ||
			insub=='pr' ||
			insub=='hr' ||
			insub=='vr' ) return;	
		closesub('submenu1');
	}
	if(check=='submenu3')
	{
		if(insub=='cs' ||
			insub=='cd' ||
			insub=='sr') return;	
		closesub('submenu3');
		
		if(insub=='bd' ||
			insub=='pr' ||
			insub=='hr' ||
			insub=='vr' ) return;	
		closesub('submenu1');
	} 
	if(check=='submenu5')
	{
		if(insub=='co' ||
			insub=='ba' ||
			insub=='mt' ||
			insub=='loc' ) return;	
		closesub('submenu5');
		check=null;
	}
	
}

function closesub(id)
{
	
	document.getElementById(id).style.display="none";
	if(id=='submenu1')mainoff('services');
	if(id=='submenu5')mainoff('about');
}


function tryclosesub3(id) {
	checksubsub=id;
	setTimeout("checkSub3()",140);
}
function checkSub3()
{
	if(checksubsub=='submenu2')
	{
		if(insub=='dm' ||
			insub=='m') return;	
		closesub('submenu2');
	}
	if(checksubsub=='submenu3')
	{
		if(insub=='cs' ||
			insub=='cd' ||
			insub=='sr') return;	
		closesub('submenu3');
	} 

	

	
}

function subon(id) {
	var obj=document.getElementById(id);
	obj.style.color="#ffffff";
	obj.style.cursor="hand";
	obj.style.MozOpacity=1.0;
	obj.style.filter="Alpha(opacity=100)";
	insub=id;
}
function suboff(id) {
	var obj=document.getElementById(id);
	obj.style.color="#c5d9fc";
	obj.style.MozOpacity=.80;
	obj.style.filter="Alpha(opacity=80)";
	insub=null;
}
function opensubsub(objid,id) {
	subon(objid);
	document.getElementById(id).style.display="block";
	insubsub=true;
}

function menuenter()
{
	currentmenu=null;
}

function subpagemenuon(id)
{
	var obj=document.getElementById(id);
	obj.style.color="#E5B23A";
	
	if(id!=currentBottomMenuPage && currentBottomMenuPage!="")
	{
		obj=document.getElementById(currentBottomMenuPage);
		obj.style.color="#808080";
	}
}

function subpagemenuoff(id)
{
	var obj=document.getElementById(id);
	obj.style.color="#808080";
	
	if(id!=currentBottomMenuPage && currentBottomMenuPage!="")
	{
		obj=document.getElementById(currentBottomMenuPage);
		obj.style.color="#E5B23A";
	}
}

function swapcolor(obj,color)
{
	obj.style.cursor="hand";
	obj.style.backgroundColor=color;
	obj.style.color="#ffffff";
}
function unswapcolor(obj)
{
	obj.style.backgroundColor="#595D6A";
	obj.style.color="#d4d7dc";
}