var siteRoot='.com/';
var curPg;
checkPageLoc();

//----- get current location -----
function checkPageLoc() {
	var pgSrc = document.location.href;
	var pgLoc = pgSrc.substring(pgSrc.indexOf(siteRoot)+siteRoot.length);
	if (pgLoc.indexOf('/') >= 0) { top.setMenuLoc(pgLoc) }
	else { activeBtns = 'top' }
}

//----- setup activeBtns -----
function setMenuLoc(loc){
	if (window.activeBtns == null) { window.activeBtns = '' }
	var bi = [0];
	for ( i=0; i<2; i++ ) {
		bi[i+1] = loc.indexOf('/',bi[i])+1;
		if (bi[i+1] > bi[i]) {
			if (activeBtns != '') { activeBtns += ',' }
			activeBtns += loc.substring(bi[i],bi[i+1]-1);
		}
	}
}
//----- new window methods -----
function openSubWindow(winName,link){
	var w,h,p1,p2,params;
	if (link == null) { link = '' }
	switch (winName) {
		case 'map' : w = 580; h = 640; p1 = 'scrollbars,resizable,status=1'; break;
		case 'toi3' : w = 780; h = 600; p1 = 'scrollbars,resizable,status,toolbar=1'; break;
		default : w = 0; h = 0; p = ''; p1=''; if (winName == null) { winName ='new' }
	}
	winName += '_win';
	if (w > 0 && h > 0) {
		var x = (screen.width - w) / 2;
		var y = (screen.height - h) / 2;
		if (browserIs('ie')) { y -= 32 }
		p2 = ',height=' + h + ',width=' + w + ',top=' + y + ',left=' + x;
	}
	if (window[winName] != null) {
		window[winName].focus();
	} else { w = window.open(link,winName,p1+p2); w.focus() }
}

function openInOpener(link){
	if(window.opener != null) {
		opener.location.href = link;
		opener.focus();
		return true;
	} else { return false }
}
//----- display methods -----
function toggleDisplay(who) {
	if (typeof who == "string") {
		who = getById(who);
	} else {
		who = who.nextSibling;
		while (who.tagName == null) { who = who.nextSibling }
	}
	who.style.display = (who.style.display == 'none') ? '' : 'none';
}
//----- misc methods -----
function checkLocationPD(who) {
	if (who.value == "-") { who.selectedIndex = 0 }
}


