var curSubPage = "";
var mydate = new Date();
var year=mydate.getYear()+1900;

// mouseover preloads
var mouseovers = new Array();
if (document.images) {
	var mouseoversList = new Array('why_hire','services','clients','tips','about','contact','home');
	for (var i=0; i<mouseoversList.length; i++) {
		mouseovers[mouseoversList[i]+'Off'] = new Image();
		mouseovers[mouseoversList[i]+'Off'].src = "images/nav/"+mouseoversList[i]+'-off.gif';
		mouseovers[mouseoversList[i]+'On'] = new Image();
		mouseovers[mouseoversList[i]+'On'].src = "images/nav/"+mouseoversList[i]+'-over.gif';
	}
}

// mouseover image functions
function imgOn(obj) {
	// don't turn on current page's nav link
	imgName = obj.firstChild.name;
	if (document.images && (imgName != curPage)) { document[imgName].src = mouseovers[imgName+'On'].src; }
}

function imgOff(obj) {
    // don't turn off current page's nav link
	imgName = obj.firstChild.name;
    if (document.images && (imgName != curPage)) { document[imgName].src = mouseovers[imgName+'Off'].src; }
}

// menu init
var inMenu = 0;
var curLayer = "";
var menuTimeout = null;
//var child = "";

// mouseover image functions for menu item images
function menuItemOn(layerName) {
    clearTimeout(menuTimeout);
    inMenu = 1;
}

function menuItemOff(layerName) {
    inMenu = 0;
    menuTimeout = setTimeout("hideMenu(curLayer)", 50);
}

// show menu
function showMenu(layerName) {
	if (menuTimeout != null) {
		clearTimeout(menuTimeout);
		hideMenu(curLayer);
	}

	if (navigator.appName == "Netscape" && !document.getElementById) { eval('document.layers.'+layerName+'.visibility = "show"');
	} else if (document.getElementById) { eval('document.getElementById("'+layerName+'").style.visibility = "visible"');
	} else { eval('document.all["'+layerName+'"].style.visibility = "visible"'); }
	curLayer = layerName;
}

// hide menu
function hideMenu(layerName) {
	if (inMenu == 0) {
		if (navigator.appName == "Netscape" && !document.getElementById) { eval('document.layers.'+layerName+'.visibility = "hide"');
		} else if (document.getElementById) { eval('document.getElementById("'+layerName+'").style.visibility = "hidden"');
		} else { eval('document.all["'+layerName+'"].style.visibility = "hidden"'); }
    }
}

// mouse out timer
function setTimer() {
    // time after mouse moves away from menu heading before menu is hidden
	menuTimeout = setTimeout("timeUp()",150);
}

// check menu status and see if we should hide the last menu
function timeUp(child) {
	//if (typeof child.firstChild.name != 'undefined') { imgOff(child.firstChild.name); }
    if (inMenu == 0) {
        hideMenu(curLayer);
    }
}

function initiateMenus(menuContainer) {
	var menu = document.getElementById(menuContainer);   
	var menuRows = menu.getElementsByTagName("li");   
	for(i = 0; i < menuRows.length; i++){           
		menuRows[i].onmouseover = function() { 
			this.className='on';
			menuItemOn(this.offsetParent.offsetParent);
		};
		menuRows[i].onmouseout = function() {
			this.className='off';
			menuItemOff(this.offsetParent.offsetParent);
		};
	}
}


function popup(src,w,h) {
	window.open(src,'','width='+w+',height='+h+',scrollbars=no,toolbar=no,menubar=no,top=250,left=250');
}

// throw off email address harvesters
function unscramble(user, domain) {
    var offset = 3;
    var i;
    var unscrambled = "";

    for (i=0; i<user.length; i++) {
        unscrambled += String.fromCharCode(user.charCodeAt(i)+offset);
    }
    unscrambled += String.fromCharCode(64);
    for (i=0; i<domain.length; i++) {
        unscrambled += String.fromCharCode(domain.charCodeAt(i)+offset);
    }

    window.location = String.fromCharCode(109,97,105,108,116,111,58) + unscrambled;
}
