//------------------------------------------------------------------
//  getright.com navigation
//  Copyright Headlight Software, Inc.
//------------------------------------------------------------------

if(document.all && !document.getElementById) {
    document.getElementById = function(id) {
         return document.all[id];
    }
}


var startShowing = false;
var theitem1 = '';
var thesubitemShowing = '';
var showinfointro = 1;

function clickedStart() {
	hideAll();
	document.getElementById('startmenu').className='hidden';
	if (!startShowing) {
	document.getElementById('startmenu').className = 'visible';        
	document.getElementById('StartBtn').className = 'startbuttondown';
	} else {
	document.getElementById('StartBtn').className = 'startbutton';
	}
	startShowing = !startShowing;
	return false;
}

function hideNavigation() {
    startShowing = false;
    document.getElementById('startmenu').className = 'hidden';
    document.getElementById('StartBtn').className = 'startbutton';
    hideAll();
    return false;
}

function needinfointro() {
}

function infointro() {
	if (showinfointro!=0) {
	showinfointro++;
	}
	if (showinfointro>7) {
	showinfointro=0;
	document.getElementById('infointro').className = 'infointro';
	setTimeout("document.getElementById('infointro').className='hidden';",10000);
	}
}

function hideAll() {
//	document.getElementById('menubuy').className = '';
//	document.getElementById('menuget').className = '';
//	document.getElementById('menuinfo').className = '';
//	document.getElementById('menuhelp').className = '';
//	document.getElementById('menuextra').className = '';
//	document.getElementById('menumore').className = '';
//	document.getElementById('menuhome').className = '';
//	document.getElementById('submenuinfo').className = '';
//	document.getElementById('submenuhelp').className = '';	
//	document.getElementById('submenuextra').className = '';
//	document.getElementById('submenumore').className = '';
//	document.getElementById('submenuhome').className = '';
	showinfointro=0;
	document.getElementById('infointro').className = 'hidden';

}

function menuclick(theitem,thesubitem) {
	if (thesubitemShowing==thesubitem) {
		hideAll();
		thesubitemShowing = '';
	} else {
		hideAll();
		document.getElementById(theitem).className = 'itemselected';
		document.getElementById(thesubitem).className = 'selected';
		thesubitemShowing = thesubitem;
		}
	return false; 

}

function doOnLoaded() {
   return true;
}

//------------------------------------------------------------------
// So any errors are absorbed without messages.
//------------------------------------------------------------------
function doOnError() {
   return true;
}
window.onerror = doOnError;


function InElement(elem) {

	CursorX = event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);

	CursorY = event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);



	var E;

	var left, top, height, width;

	if (document.getElementById) {

		E = document.getElementById(elem);

	} else if (document.all) {

		E = document.all[elem];

	}



	width = (E.offsetWidth ? E.offsetWidth : E.style.pixelWidth);

	height = (E.offsetHeight ? E.offsetHeight : E.style.pixelHeight);



	left = E.offsetLeft;

	top = E.offsetTop;

	Etmp = E.offsetParent;

	while (Etmp != null) {

		left += Etmp.offsetLeft;

		top += Etmp.offsetTop

		Etmp = Etmp.offsetParent;

	}

	

	/*Etmp = E.firstChild;

	while (Etmp != null) {

		width += (Etmp.offsetWidth ? Etmp.offsetWidth : Etmp.style.pixelWidth);

    	height += (Etmp.offsetHeight ? Etmp.offsetHeight : Etmp.style.pixelHeight);

		Etmp = Etmp.nextSibling;

	}

	

	alert("X: "+CursorX+" Y: "+CursorY+" -- L: "+left+" T: "+top+" W: "+width+" H: "+height);

	alert("PH: "+E.offsetHeight + " TP: "+E.offsetTop);*/

	

	/*if (E.currentStyle) {

        alert("IE: " + E.currentStyle['height']);

	} else if (document.defaultView.getComputedStyle) {

        alert("CS: " + document.defaultView.getComputedStyle(E, null).height);

    }



	alert(E.style.pixelHeight);*/

	

	if (CursorX>left && CursorX<left+width && CursorY>top && CursorY<top+height) {

	   return true;

	}



	return false;

}

function Clicked() {

    document.getElementById('infointro').className = 'hidden';

    if (!startShowing) return;
    
    if (InElement('StartBtn')) return;
    if (InElement('infoquicklink')) return;
    if (InElement('grtitle')) return;
	if (document.getElementById('startmenu').className=='visible') if (InElement('startmenu')) return;
	//if (document.getElementById('menubuy').className=='selected') if (InElement('menubuy')) return;
	//if (document.getElementById('menuget').className=='selected') if (InElement('menuget')) return;
	//if (document.getElementById('menuinfo').className=='selected') if (InElement('menuinfo')) return;
	//if (document.getElementById('menuhelp').className=='selected') if (InElement('menuhelp')) return;
	//if (document.getElementById('menuextra').className=='selected') if (InElement('menuextra')) return;
	//if (document.getElementById('menumore').className=='selected') if (InElement('menumore')) return;
	//if (document.getElementById('menuhome').className=='selected') if (InElement('menuhome')) return;
	if (document.getElementById('submenuinfo').className=='selected') if (InElement('submenuinfo')) return;
	if (document.getElementById('submenuhelp').className=='selected') if (InElement('submenuhelp')) return;
	if (document.getElementById('submenuextra').className=='selected') if (InElement('submenuextra')) return;
	if (document.getElementById('submenumore').className=='selected') if (InElement('submenumore')) return;
	if (document.getElementById('submenuhome').className=='selected') if (InElement('submenuhome')) return;
	
	hideNavigation();
}

//------------------------------------------------------------------
// To the getting page when clicking a download link
//------------------------------------------------------------------
function doTimeout() {
   window.location.href = "http://www.getright.com/getting.html";
}
function handleClick() {
   setTimeout("doTimeout();", 3000);
}

