function gotoTarget(target) {

	var props = target.split(";");

	var winUrl = props[0];

	if (props.length == 1) {
		if( winUrl == null || winUrl == "" ) { return false; }		
		window.location = winUrl;
	} else {
		var target = props[1];
		var attr = props[2];
		
		window.open( winUrl, target, attr );
	}
	return false;
}

function layoutPopup(url, extra) {
	if (extra == null) {
		extra = "";
	}
	var props = extra;
	var win = window.open( url, "documentWindow", props );
	return false;
}

function openLayoutDialog(url, w, h, extra) {
	if (extra == null) {
		extra = "";
	}
	//below should be rounded: safer
	var winL = Math.round((screen.width - w) / 2) - 25;
	var winT = Math.round((screen.height - h) / 2) - 25;
	var props = extra + 'left=' + winL + ',height='+h+',width='+w + ',top=' + winT+', scrollbars=yes';
	var win = window.open( url, "tscversioninfo", props );
}
function openSRBWindow(url, winName, w, h, extra) {
	if (extra == null) {
		extra = "";
	}
	//below should be rounded: safer
	var winL = Math.round((screen.width - w) / 2) - 25;
	var winT = Math.round((screen.height - h) / 2) - 25;
	var props = extra + 'left=' + winL + ',height='+h+',width='+w + ',top=' + winT;
	var win = window.open( url, winName, props );
}

function teCloseDotNet() {
	var cookie = new Cookie("TSCTeCookie", 24*365 );  
	cookie.load();
	cookie.setProperty( "helpState", "closed" );
	cookie.store();
      
	var openedDiv = document.getElementById(teHelpOpenedDivID);
	var closedDiv = document.getElementById(teHelpClosedDivID);
	openedDiv.style.display = "none";
	closedDiv.style.display = "";
	
	var marginDiv = document.getElementById(myLeftMarginDivID);
	
	marginDiv.style.width = "20px";
	
	return false;
}
function teOpenDotNet() {
	var cookie = new Cookie("TSCTeCookie", 24*365 );  
	cookie.load();
	cookie.setProperty( "helpState", "open" );
	cookie.store();
	
	var openedDiv = document.getElementById(teHelpOpenedDivID);
	var closedDiv = document.getElementById(teHelpClosedDivID);
	openedDiv.style.display = "";
	closedDiv.style.display = "none";
	
	var marginDiv = document.getElementById(myLeftMarginDivID);
	
	marginDiv.style.width = "196px";
	
	return false;
}

function teClose() {
	var cookie = new Cookie("TSCTeCookie", 24*365 );  
	cookie.load();
	cookie.setProperty( "helpState", "closed" );
	cookie.store();
      
	var openedDiv = document.getElementById("teHelpOpened");
	var closedDiv = document.getElementById("teHelpClosed");
	openedDiv.style.display = "none";
	closedDiv.style.display = "";
	return false;
}
function teOpen() {
	var cookie = new Cookie("TSCTeCookie", 24*365 );  
	cookie.load();
	cookie.setProperty( "helpState", "open" );
	cookie.store();
	
	var openedDiv = document.getElementById("teHelpOpened");
	var closedDiv = document.getElementById("teHelpClosed");
	openedDiv.style.display = "";
	closedDiv.style.display = "none";
	return false;
}
function clickit() {
	tscMainMenu.menuItemClicked(_itemRef);
}

var currentItem = "";
function isMenuLoaded() {
	currentItem = _itemRef;
	var menuItem = _mi[currentItem];
	var menuName = menuItem[3];
	
	var menuI = getMenuByName(menuName);
	if (menuI != undefined) {
		return true;
	} else {
		return false;
	}
}

function displaySubMenu() {
	mm_createNewMenus();
	_popi(currentItem);
}
function runGui(guiURL,guiProduct,guiMenuId,guiEnvName,guiProgram,guiCommon,guiUniqueId,guiName,guiAbortMessage) {
	try {
//		alert("in runGui, guiURL: "+guiURL);
//		alert("in runGui, guiRunning: "+guiRunning);
//		alert("in runGuI., guiRunning: "+guiRunning+",guiProduct: "+guiProduct+",guiMenuId: "+guiMenuId+",guiEnvName: "+guiEnvName+",guiProgram: "+guiProgram+",guiCommon: "+guiCommon+",guiUniqueId: "+guiUniqueId+",guiName: "+guiName+",guiAbortMessage: "+guiAbortMessage);
		if (guiRunning && guiProgram.toUpperCase().indexOf("XXMU02") < 0) {
			guiInterrupt(guiCommon,guiUniqueId,guiEnvName,guiProduct,guiProgram,guiName,guiMenuId,guiAbortMessage);
		} else {
//			alert("about to re-launch url");
// the below didn't work - it did open the classic in a new window, but also navigated the original menu away to a blank 'false' screen
//			if (guiProgram.toUpperCase().indexOf("XXMU02") >= 0) {
//				window.open(guiURL+"&portal=nomenu_w_banner",'classicMenu');
//			} else {
				window.location = guiURL;
//			}
			return false;
		}
    } catch (Exception) {
// will fall into this block first time cuz guiRunning is undefined
// alert("in catch Exception of launchGui");
//		if (guiProgram.toUpperCase().indexOf("XXMU02") >= 0) {
//			window.open(guiURL+"&portal=none",'classicMenu');
//		} else {
			window.location = guiURL;
//		}
		return false;
    }
}

function toggleHeader(){
	var headerElem = document.getElementById("tblLayout");
	if(headerElem.style.display == 'none'){
		headerElem.style.display = '';
	}else{
		headerElem.style.display = 'none';
	}
}