
window.onload = loadScreen;
window.onresize = resizeScreen;
		
function loadScreen() {
	//initTree();
	initConfigPanes();
	initPanes();
	if(document.getElementById('chooser-main'))
	{
		window.onresize = resizeChooserScreen;
		resizeChooserScreen();
	}

	var i = 1;
	while(document.getElementById('datatable' + i))
	{
		addTableRolloverEffect('datatable' + i,'hover'); 
		i++;
	}
	registerShowHideButton();
	registerToggleOptions();
	registerSelectAllNoneDelete();
	registerToggleFormButtons();
	turnOffAutoComplete();
	if(document.getElementById('menu')) {
		menu = DynarchMenu.setup('menu', { lazy: true });
	}
	if(document.getElementById('global-nav')) {
		document.getElementById('global-nav').onmouseover = getAJAXMenu;
	}
	loadHelpNewWindow();
	setMiddleHeight();
	setMainWrapperWidth();
	registerObjectFrame();
	if(document.getElementById('side-bar') && !BrowserDetect.browser.toLowerCase().match("netscape"))
	{ 
		//Don't display with Netscape 7.2 due to flickering
		new Resizeable('side-bar', {top: 0, bottom: 0, left: 0, right: 2, resize: afterLeftnavResize} );
	}
	//Last	
	registerSetFocus();
}
var menu = null;


function resizeScreen() {
	setMiddleHeight();
	setMainWrapperWidth();
}

function resizeChooserScreen() {
	var windowHeight = getWindowHeight();
	setChooserHeights();
}

function setChooserHeights() {
	var windowHeight = getWindowHeight();
	//alert('window height is: ' + windowHeight);
	var mainWrapperHeight = windowHeight - 2;
	var mainHeight = mainWrapperHeight - 19;
	var centerStageHeight = mainHeight - 84;
	var sideBarHeight = centerStageHeight - 8;
	var chooserMainHeight = centerStageHeight - 13;
	document.getElementById('main-wrapper').style.height = mainWrapperHeight + 'px';
	document.getElementById('main').style.height = mainHeight + 'px';
	document.getElementById('center-stage').style.height = centerStageHeight + 'px';
	document.getElementById('side-bar').style.height = sideBarHeight + 'px';
	document.getElementById('chooser-main').style.height = chooserMainHeight + 'px';
}

function registerObjectFrame () {	
	if(document.getElementById('content-render')) {
		var contentRender = document.getElementById('content-render');
		var link = contentRender.getElementsByTagName('A')[0];
		var data = link.href;
		
		var mainWrapper = document.getElementById("main-wrapper");
		var mainWrapperChildren = mainWrapper.childNodes;
		var mainWrapperOffset = 0;
		
		for(var j = 0; j < mainWrapperChildren.length; j++){
			if(mainWrapperChildren[j].nodeType == 1){
				if(mainWrapperChildren[j].getAttribute("id") != "show-hide" && mainWrapperChildren[j].getAttribute("id") != "main"){
					mainWrapperOffset = mainWrapperOffset + mainWrapperChildren[j].offsetHeight;
				}
			}
		}
		var main = document.getElementById("main");
		var children = main.childNodes;
		var offset = mainWrapperOffset;
		
		for(var i = 0; i < children.length; i++){
			if(children[i].nodeType == 1){
				offset = offset + children[i].offsetHeight;			
			}
		}
		divOutputsOffset = 18;
		marginsFudgeFactor = 55;
		offset += divOutputsOffset + marginsFudgeFactor;

		var middleHeight = getElemHeight("middle");		
		var adjustedHeight = middleHeight - offset;

		//Do an iframe for IE
		if (BrowserDetect.browser.toLowerCase().match("explorer"))
		{
			if(mainWrapperOffset == 0)
				adjustedHeight += 36;
			contentRender.innerHTML = '<iframe id="page-render" src="' + data + '" type="text/html" name="page-render" declare="declare" standby="Please wait while the screen loads" style="width: 100%">Content Render</iframe>';
			if(adjustedHeight < 250) //Give it a minimum value for the chooser preview
				adjustedHeight = 250;
			contentRender.getElementsByTagName("IFRAME")[0].style.height = adjustedHeight + 'px';
		}
		else {
			if(mainWrapperOffset == 0)
				adjustedHeight += 15;
			contentRender.innerHTML = '<object id="page-render" data="' + data + '" type="text/html" name="page-render" declare="declare" standby="Please wait while the screen loads">Content Render</object>';
			if(adjustedHeight < 250) //Give it a minimum value for the chooser preview
				adjustedHeight = 250;
			contentRender.getElementsByTagName("OBJECT")[0].style.height = adjustedHeight + 'px';
		}
	}
}

function renderContentPreview2 () {	
	if(document.getElementById('content-render2')) {
		var contentRender = document.getElementById('content-render2');
		var link = contentRender.getElementsByTagName('A')[0];
		var data = link.href;	
		var mainWrapper = document.getElementById("main-wrapper");
		var mainWrapperChildren = mainWrapper.childNodes;
		var mainWrapperOffset = 0;
		
		for(var j = 0; j < mainWrapperChildren.length; j++){
			if(mainWrapperChildren[j].nodeType == 1){
				if(mainWrapperChildren[j].getAttribute("id") != "show-hide" && mainWrapperChildren[j].getAttribute("id") != "main"){
					mainWrapperOffset = mainWrapperOffset + mainWrapperChildren[j].offsetHeight;
				}
			}
		}
		var main = document.getElementById("main");
		var children = main.childNodes;
		var offset = mainWrapperOffset;
		
		for(var i = 0; i < children.length; i++){
			if(children[i].nodeType == 1){
				offset = offset + children[i].offsetHeight;			
			}
		}
		
		divOutputsOffset = 18;
		marginsFudgeFactor = 55;
		offset += divOutputsOffset + marginsFudgeFactor;
		var middleHeight = getElemHeight("middle");		
		var adjustedHeight = middleHeight - offset;
		//Do an iframe for IE 
		if (BrowserDetect.browser.toLowerCase().match("explorer"))
		{
			if(mainWrapperOffset == 0)
				adjustedHeight += 27;
			contentRender.innerHTML = '<iframe id="page-render2" src="' + data + '" type="text/html" name="page-render2" declare="declare" standby="Please wait while the screen loads" style="width: 100%">Content Render</iframe>';
			contentRender.getElementsByTagName("IFRAME")[0].style.height = adjustedHeight + 'px';
		}
		else {
			if(mainWrapperOffset == 0)
				adjustedHeight -= 3;

			contentRender.innerHTML = '<object id="page-render2" data="' + data + '" type="text/html" name="page-render2" declare="declare" standby="Please wait while the screen loads">Content Render</object>';
			contentRender.getElementsByTagName("OBJECT")[0].style.height = adjustedHeight + 'px';
		}
	}
}

function getWindowHeight() { //courtesy of http://www.alistapart.com/articles/footers
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth = 0;
	if (typeof(window.innerWidth) == 'number') {
		windowWidth = window.innerWidth;
	}
	else {
		if (document.documentElement && document.documentElement.clientWidth) {
			windowWidth = document.documentElement.clientWidth;
		}
		else {
			if (document.body && document.body.clientWidth) {
				windowWidth = document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}

//returns the offset height of a given element
//using its id attribute
function getElemHeight(id) {
	var elem = document.getElementById(id);
	var height = elem.offsetHeight;
	return height;
}

//returns the offset width of a given element
//using its id attribute
function getElemWidth(id) {
	var elem = document.getElementById(id);
	var width = 0;
	if(elem)
		width = elem.offsetWidth;
	return width;
}

//set the height of the CMS viewport
function setMiddleHeight() {	
	var windowHeight = getWindowHeight();
	if (windowHeight > 0) {			
		//explicitly reference the heights of all major divs
		if(document.getElementById('header')) {
			var header = document.getElementById('header').offsetHeight;
			var toolbar = document.getElementById('sub-header').offsetHeight;
			var footer = document.getElementById('footer').offsetHeight;
			var main = document.getElementById('middle');
			//set the height of #main (aka CMS viewport)
			newHeight = windowHeight - header - toolbar - footer;
			main.style.height = newHeight + 'px';	
		}
	}
}

//fix the width of the right-hand #main-wrapper
function setMainWrapperWidth() {
	if(document.getElementById('header')) {

		var windowWidth = getWindowWidth();
		var cookieSideBarWidth = Get_Cookie('leftnav_size');
		var curSideBarWidth = getElemWidth('side-bar');
		var show = Get_Cookie('showHideSideBar');
		var showSimple = Get_Cookie('showHideSideBarSimple');
		var mainWrapper = document.getElementById('main-wrapper');		
		var eSideBar = document.getElementById('side-bar');
		var sideBarBorderWidth = 2;
		
		if(eSideBar && cookieSideBarWidth != null && cookieSideBarWidth != curSideBarWidth)
		{
			//alert('got width from cookie, side bar will be resized to width: ' + cookieSideBarWidth + " : " + getElemWidth('main-wrapper'));
			eSideBar.style.width = cookieSideBarWidth + 'px';
			curSideBarWidth = cookieSideBarWidth;
			sideBarBorderWidth = 5; //Give extra padding when a special width is set for the side-bar
		}
		if(eSideBar && eSideBar.style.display == 'none') {
			curSideBarWidth = 0;
			sideBarBorderWidth = 0;
		}
			
		var newWidth = windowWidth - curSideBarWidth - sideBarBorderWidth;
	
		if(mainWrapper)
			mainWrapper.style.width = newWidth + 'px';
		
		return newWidth;
	}
	else if(document.getElementById('chooser-main'))
	{
		//remember side bar width for chooser too.
		var sideBarWidth = Get_Cookie('leftnav_chooser_size');
		if(sideBarWidth != null)
		{
			var paddingWidth = parseInt(sideBarWidth) + 10;
			//alert('got chooser size cookie, width is: ' + sideBarWidth + ', padding width is: ' + paddingWidth);
			document.getElementById('side-bar').style.width = sideBarWidth + 'px';
			document.getElementById('chooser-main').style.paddingLeft = paddingWidth + 'px';
		}
	}
}

function turnOffAutoComplete() {
	if (document.getElementsByTagName) {
		var formElements = document.getElementsByTagName('FORM');
		for (i=0; i < formElements.length; i++)
			formElements[i].setAttribute('autocomplete','off');

	}
}

//Disable submit buttons once they are clicked
function registerToggleFormButtons() {
    aInput = document.getElementsByTagName("input");
    for(i = 0; i < aInput.length; i++) {
        if(aInput[i].type == "button" || aInput[i].type == "submit") {
        	try {
				if(aInput[i].onclick == null || typeof aInput[i].onclick == "undefined")
			    	aInput[i].onclick = toggleFormButtonsOff;
		    }
		    catch(e) {
		    }
        }
    }
}

function registerToggleOptions() {

	if(document.getElementById('toggle-options')) {
		
		var link = document.getElementById('toggle-options').getElementsByTagName('A');
		link[0].onclick = toggleOptions;
				
		var show = Get_Cookie('toggleOptions');

		if(show == 'true') { //Off by default
			toggleOptions();
		}
	}
}

function registerShowHideButton() {
	//Register an onclick event for the show-hide side bar button
	if(document.getElementById('show-hide')) {
		document.getElementById('show-hide').onclick = showHideSideBar;
		var show = Get_Cookie('showHideSideBar');
		if(show == 'false') {
			showHideSideBar();
		}
	}
	//Register an onclick event for the show-hide side bar button
	if(document.getElementById('show-hide-simple')) {
		document.getElementById('show-hide-simple').onclick = showHideSideBar;
		var show = Get_Cookie('showHideSideBarSimple');
		if(show != 'true') { //Make it off by default for the simple UI
			showHideSideBar();
		}
	}
}

function registerSetFocus() {	
	var toFocus = document.getElementById('highlight');
	if(toFocus) {
		window.location.hash = "#highlight";
	}
	var toFocusDiv = document.getElementById('focus');
	if(toFocusDiv) {
		window.location.hash = "#focus";
	}
	else {		
		var centerStage = document.getElementById('center-stage');
		if(centerStage) {
			var firstInput = centerStage.getElementsByTagName('INPUT')[0];
			if(firstInput && firstInput.type == "text") {
				try {
					//We have to try/catch this in the event the field is in a pane that isn't visible
					firstInput.focus();
				}
				catch(e) {}
			}
		}
		var logIn = document.getElementById('log-in'); //Set the focus on the log in screen
		if(logIn) {
			var firstInput = logIn.getElementsByTagName('INPUT')[0];
			if(firstInput && firstInput.type == "text") {
				firstInput.focus();
			}
		}
	}
}

/***** BEGIN SELECT ALL NONE FORM INPUTS *****/

var selectAllBoxes = false;
var disableDeleteTab = false;

function registerSelectAllNoneDelete() {
	if(document.getElementById('select-all-checkbox')) {
		document.getElementById('select-all-checkbox').onclick = selectAllNoneCheckbox;
	}
	if(document.getElementById('select-all-link')) {
		document.getElementById('select-all-link').onclick = checkAllBoxes;
	}
	if(document.getElementById('select-none')) {
		document.getElementById('select-none').onclick = checkNoBoxes;
	}
	if(document.getElementById('checkbox-disabled')) {
		document.getElementById('checkbox-disabled').disabled = true;
	}
	
	var datatable = document.getElementById('datatable1');
	if(datatable) {
		inputElements = datatable.getElementsByTagName('INPUT');
		for (i = 0; i < inputElements.length; i++) {
			if (inputElements[i].type == "checkbox") {
				if((inputElements[i].id != 'select-all-checkbox') && (!inputElements[i].onclick)) { // only add test function if an "onclick" handler does not already exist
					inputElements[i].onclick = testForDeleteTab;
				}
			}
		}
	}
}

/**
 * The delete tab should not be shown if any of the assets are checked in order to prevent someone from deleting the folder when they meant to delete an asset and just couldn't find the delete button.
 * NOTE: this is a hack to fix an overall usability problem.  Please fix in 6.0 re-design
 **/
function testForDeleteTab() {
	// go through all checkboxes and see if tab should be enabled or not (simplified since if any of the boxes are checked we can drop out and assume it should not be shown)
	var datatable = document.getElementById('datatable1');
	if(datatable) {
		var foundChecked = false;
		inputElements = datatable.getElementsByTagName('INPUT');
		// iterate through the checkboxes and if any of them are checked, disable the delete tab
		for (i = 0; i < inputElements.length; i++) {
			if (inputElements[i].type == "checkbox") {
				if(inputElements[i].checked) {
					foundChecked = true;
					break;
				}
			}
		}
		// if none of the boxes were checked, foundChecked will be false
		// compare current state to what it "should be" and if it doesn't match, update the view accordingly (assuming the element exists)
		if ((disableDeleteTab != foundChecked) && (document.getElementById('tab-delete'))) {
			// update the view accordingly
			if (foundChecked) {
				document.getElementById('tab-delete').style.display = 'none';
			} else {
				document.getElementById('tab-delete').style.display = 'block';
			}
		}
		disableDeleteTab = foundChecked;
	}
}

function selectAllNoneCheckbox() {
	if(selectAllBoxes)
		checkNoBoxes();
	else {
		checkAllBoxes();
	}
	//Disable/enable the Delete tab
	testForDeleteTab();
}

// TODO: clean up the following two functions into one function that takes a boolean parameter for the state that the checked should be set to
function checkAllBoxes() {
	var datatable = document.getElementById('datatable1');
	if(datatable) {
		inputElements = datatable.getElementsByTagName('INPUT');
		for (i = 0; i < inputElements.length; i++) {
			if (inputElements[i].type == "checkbox") {
				if(inputElements[i].checked == false) {
					inputElements[i].checked = true;
				}
			}
		}
	}
	selectAllBoxes = true;
}

function checkNoBoxes() {
	var datatable = document.getElementById('datatable1');
	if(datatable) {
		inputElements = datatable.getElementsByTagName('INPUT');
		for (i = 0; i < inputElements.length; i++) {
			if (inputElements[i].type == "checkbox") {
				if(inputElements[i].checked == true) {
					inputElements[i].checked = false;
				}
			}
		}
	}
	selectAllBoxes = false;
}

/***** END SELECT ALL NONE FORM INPUTS *****/

/***** BEGIN HELP LINK NEW WINDOW *****/

function loadHelpNewWindow() {
	var helpObj = document.getElementById('help');
	if(helpObj) {
		var helpAnchorTag = helpObj.getElementsByTagName('A')[0];
		helpAnchorTag.target = "_blank";
	}
	var helpObj2 = document.getElementById('help2');
	if(helpObj2) {
		helpObj2.target = "_blank";
	}
	var helpObj3 = document.getElementById('help3');
	if(helpObj3) {
		helpObj3.target = "_blank";
	}
}

/***** END HELP LINK NEW WINDOW *****/

/***** BEGIN SHOW/HIDE SIDE BAR *****/

function showHideSideBar(){
	//If it is already hidden, show it
	if(document.getElementById('show-hide')) {
		if(document.getElementById('side-bar').style.display=='none') {
			document.getElementById('side-bar').style.display='inline';
			Set_Cookie('showHideSideBar','true',30,'/','','');
			setMainWrapperWidth();
			document.getElementById('show-hide').style.background='url(/cms/css/images/hide.gif)';
		}
		else{
			document.getElementById('side-bar').style.display='none';
			Set_Cookie('showHideSideBar','false',30,'/','','');
			setMainWrapperWidth();
			document.getElementById('show-hide').style.background='url(/cms/css/images/show.gif)';
		}
	}
	else if(document.getElementById('show-hide-simple')) {
		//If it is already hidden, show it
		if(document.getElementById('side-bar').style.display=='none') {
			document.getElementById('side-bar').style.display='inline';
			Set_Cookie('showHideSideBarSimple','true',30,'/','','');
			setMainWrapperWidth();
			document.getElementById('show-hide-simple').style.background='url(/cms/css/images/hide.gif)';
		}
		else{
			document.getElementById('side-bar').style.display='none';
			Set_Cookie('showHideSideBarSimple','false',30,'/','','');
			setMainWrapperWidth();
			document.getElementById('show-hide-simple').style.background='url(/cms/css/images/show.gif)';
		}
	}
}

/***** END SHOW/HIDE SIDE BAR *****/


/***** BEGIN UNORDERED LIST TREE *****/

	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005

	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	************************************************************************************************************/
		
	var idOfFolderTrees = ['tree']; //,'tree2']; //ids of trees on the screen
	
	var imageFolder = '/cms/css/icons/';	// Path to images
	var folderImage = 'folder.gif';
	var plusImage = 'plus.gif';
	var minusImage = 'minus.gif';
	var initExpandedNodes = '';	// Cookie - initially expanded nodes;
	var useAjaxToLoadNodesDynamically = false;
	var ajaxRequestFile = '';
	
	var ajaxObjectArray = new Array();
	var treeUlCounter = 0;
	var nodeId = 1;
	
	/*
	These cookie functions are downloaded from 
	http://www.mach5.com/support/analyzer/manual/html/General/CookiesJavaScript.htm
	*/
	function Get_Cookie(name) { 
	   var start = document.cookie.indexOf(name+"="); 
	   var len = start+name.length+1; 
	   if ((!start) && (name != document.cookie.substring(0,name.length))) return null; 
	   if (start == -1) return null; 
	   var end = document.cookie.indexOf(";",len); 
	   if (end == -1) end = document.cookie.length; 
	   return unescape(document.cookie.substring(len,end)); 
	} 
	// This function has been slightly modified
	function Set_Cookie(name,value,expires,path,domain,secure) { 
		expires = expires * 60*60*24*1000;
		var today = new Date();
		var expires_date = new Date( today.getTime() + (expires) );
	    var cookieString = name + "=" +escape(value) + 
	       ( (expires) ? ";expires=" + expires_date.toGMTString() : "") + 
	       ( (path) ? ";path=" + path : "") + 
	       ( (domain) ? ";domain=" + domain : "") + 
	       ( (secure) ? ";secure" : ""); 
	    document.cookie = cookieString; 
	} 
			
	function showHideNode(e,inputId) {
		if(inputId){
			if(!document.getElementById('dhtmlgoodies_treeNode'+inputId))return;
			thisNode = document.getElementById('dhtmlgoodies_treeNode'+inputId).getElementsByTagName('IMG')[0]; 
		}else {
			thisNode = this;
			if(this.tagName=='A')thisNode = this.parentNode.getElementsByTagName('IMG')[0];	
			
		}
		if(thisNode.style.visibility=='hidden')return;
		var parentNode = thisNode.parentNode;
		inputId = parentNode.id.replace(/[^0-9]/g,'');
		if(thisNode.src.indexOf(plusImage)>=0){
			thisNode.src = thisNode.src.replace(plusImage,minusImage);
			var ul = parentNode.getElementsByTagName('UL')[0];
			ul.style.display='block';
			if(!initExpandedNodes)initExpandedNodes = ',';
			if(initExpandedNodes.indexOf(',' + inputId + ',')<0) initExpandedNodes = initExpandedNodes + inputId + ',';
			
		}else{
			thisNode.src = thisNode.src.replace(minusImage,plusImage);
			parentNode.getElementsByTagName('UL')[0].style.display='none';
			initExpandedNodes = initExpandedNodes.replace(',' + inputId,'');
		}	
		Set_Cookie('dhtmlgoodies_expandedNodes',initExpandedNodes,500);
		
		return false;
	}
	
	function initTree()	{	
		if(document.getElementById('tree')) {
			var iconRegEx = new RegExp ('icon-', 'gi');
			var containerRegEx = new RegExp ('container', 'gi');
			for(var treeCounter=0;treeCounter<idOfFolderTrees.length;treeCounter++){
				var dhtmlgoodies_tree = document.getElementById(idOfFolderTrees[treeCounter]);
				var menuItems = dhtmlgoodies_tree.getElementsByTagName('LI');	
				for(var no=0;no<menuItems.length;no++){
					nodeId++;

					var subItems = menuItems[no].getElementsByTagName('UL');
					var img = document.createElement('IMG');
					img.src = imageFolder + minusImage;
					
					var aTag = menuItems[no].getElementsByTagName('A')[0];
					
					//If there are no children, set the plus sign to be hidden
					if(subItems.length==0) {
						img.style.visibility='hidden';
						img.src = imageFolder + plusImage;
						setEvent(img, "onclick", "location.href='" + aTag.href + "'");
					}
					else{
						img.onclick = showHideNode;
						subItems[0].id = 'tree_ul_' + treeUlCounter;
						treeUlCounter++;
					}

					if(aTag.id == "highlight")
						img.src = imageFolder + minusImage;
					menuItems[no].insertBefore(img,aTag);
					menuItems[no].id = 'dhtmlgoodies_treeNode' + nodeId;
					var folderImg = document.createElement('IMG');
					folderImg.border = 0;
					var icon = new String(aTag.className);
            		icon = icon.replace(iconRegEx, '')
            		
					results = icon.search(containerRegEx);

					if(icon != "folder" && icon != "target" && results == -1){
						folderImg.src = imageFolder + icon + ".gif";
					}else{
						img.style.visibility='visible';

						if(results != -1) {
							folderImg.src = imageFolder + icon + ".gif";
						}
						else {
							folderImg.src = imageFolder + icon + ".gif";
						}
					}
					menuItems[no].className = "node";
					aTag.className = "node";
					setEvent(folderImg, "onclick", "location.href='" + aTag.href + "'");
					menuItems[no].insertBefore(folderImg, aTag);
				}
			}			
		}
	}
	
// Help code to register an event handler for an element
function setEvent(xmlNode, strName, strFunction) {
    strName = strName.substr(0, 2) == "on" ? strName.substr(2, strName.length) : strName;

    // w3c compatible style, not supported by internet explorer yet
    if(document.addEventListener)
        xmlNode.addEventListener(strName, new Function("event", "event.preventDefault( ); " + strFunction), true);
    // Internet Explorer
    else if(document.attachEvent)
        xmlNode.attachEvent("on" + strName, new Function("event", strFunction));
    // old style (tag.onclick)
    else
        xmlNode["on" + strName ] = new Function("event", strFunction);
}
	
/***** END UNORDERED LIST TREE *****/

/***** BEGIN DYNAMIC PANES *****/
/************************************************************************************************************
	(C) www.dhtmlgoodies.com, October 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.

	
	************************************************************************************************************/
	var activePaneIndex = -1;
	var renderPreviewDone = false;
	
	function showPane(paneIndex) {
		
		if(activePaneIndex>=0) {
			if(activePaneIndex==paneIndex)
				return; //Do nothing as we're the same pane
			else {
				document.getElementById('paneView' + activePaneIndex).style.display='none'; //Hide the previously opened pane
				document.getElementById('paneButton' + activePaneIndex).className='';
			}
		}
		//Check for the render preview
		if(!renderPreviewDone && paneIndex == '1') {
			renderContentPreview2();
			renderPreviewDone = true;
		}
		activePaneIndex = paneIndex;		
		document.getElementById('paneView' + activePaneIndex).style.display='block'; //Show the new pane
		document.getElementById('paneButton' + activePaneIndex).className='selected';
			
		return;
	}
	
	function highlightErrPane(index){
		var errBtn = document.getElementById("paneButton" + index);
		if(errBtn)
			errBtn.style.background = "#8B0000";
	}
	
	function paneClick() {
		//Show the pane based on the ID of the LI which is the parent of the A tag
		showPane(this.parentNode.id.replace(/[^\d]/g,''));
	}

	function initPanes() {
		if(document.getElementById('panes')) {
			var activePane = 0;
			var errorPane = -1;

			var buttonsObj = document.getElementById('panes');
			var buttons = buttonsObj.getElementsByTagName('LI');
			var counter = 0;
					
			for(var no=0;no<buttons.length;no++){
				if(buttons[no].id == 'initialize')
					activePane = no;
				buttons[no].id = 'paneButton' + counter; //Create an id dynamically for each pane button
				var buttonObj = document.getElementById('paneButton' + counter);
				var link = buttonObj.getElementsByTagName('A');
				link[0].onclick = paneClick;
				counter++;
			}
			if(errorPane == -1)
				buttons[activePane].className='selected';
			
			var panesObj = document.getElementById('center-stage');
	
			var panes = panesObj.getElementsByTagName('DIV');
			var divCounter = 0;
	
			for(var i = 0; i < panes.length; i++){
				if(panes[i].className=='pane'){
					panes[i].id = 'paneView' + divCounter; //Create an id dynamically for each pane view
					var spans = panes[i].getElementsByTagName("SPAN");
					for(var j = 0; j < spans.length; j++){
						if(spans[j].className == "paneError"){
							highlightErrPane(divCounter);
							if(errorPane < 0) {
								errorPane = divCounter;
								for(var k = 0; k < i; k++){
									if(panes[k].className=='pane'){
										panes[k].style.display='none';
									}
								}
							}
						}
					}
					divCounter++;
				}			
			}
			if(errorPane > -1) {
				showPane(errorPane);
			}
			else
				showPane(activePane);
		}
	}	
/***** END DYNAMIC PANES *****/

/***** BEGIN CONFIGURATION SET SUBPANES (CONFIGURATIONS) *****/
/*
	(C) www.dhtmlgoodies.com, October 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
*/
	var configObj;
	var activeConfigPaneIndex = -1;
	
	function showConfigPane(paneIndex) {
		
		if(activeConfigPaneIndex>=0) {
			if(activeConfigPaneIndex==paneIndex)
				return; //Do nothing as we're the same pane
			else {
				document.getElementById('configView' + activeConfigPaneIndex).style.display='none'; //Hide the previously opened pane
				document.getElementById('configButton' + activeConfigPaneIndex).className='';
			}
		}
		activeConfigPaneIndex = paneIndex;
		if(document.getElementById('configView' + activeConfigPaneIndex))
		{		
			document.getElementById('configView' + activeConfigPaneIndex).style.display='block'; //Show the new pane
		}
		if(document.getElementById('configButton' + activeConfigPaneIndex))
		{
			document.getElementById('configButton' + activeConfigPaneIndex).className='selected';
		}
			
		return;
	}
	
	function paneConfigClick() {
		//Show the pane based on the ID of the LI which is the parent of the A tag
		showConfigPane(this.parentNode.id.replace(/[^\d]/g,''));
	}

	function initConfigPanes() {
		if(document.getElementById('configSubPanes')) {
			var activePane = 0;

			//Dynamically number each paneButton
			var buttonsObj = document.getElementById('outputs');
			var buttons = buttonsObj.getElementsByTagName('LI');
			var counter = 0;
					
			for(var no=0;no<buttons.length;no++){
				if(buttons[no].id == 'configInitialize')
					activePane = no;
				buttons[no].id = 'configButton' + counter; //Create an id dynamically for each pane button
				var buttonObj = document.getElementById('configButton' + counter);
				var link = buttonObj.getElementsByTagName('A');
				link[0].onclick = paneConfigClick;
				counter++;
			}
			
			if(buttons[activePane])
			{
				buttons[activePane].className='selected';
			}

			//Dynamically number each paneView
			var panesObj = document.getElementById('configSubPanes');
	
			var panes = panesObj.getElementsByTagName('DIV');
			var divCounter = 0;
	
			for(var i=0;i<panes.length;i++){
				if(panes[i].className=='configuration'){
					panes[i].style.display='none';
					panes[i].id = 'configView' + divCounter; //Create an id dynamically for each pane view
					divCounter++;
				}			
			}
			showConfigPane(activePane);
		}
	}	
/***** END DYNAMIC PANES *****/


/***** BEGIN ALTERNATE TABLE ROW COLORS *****/
	/*
	(C) www.dhtmlgoodies.com, November 2005
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
*/	
	var arrayOfRolloverClasses = new Array();
	var activeRow = false;
	
	function highlightTableRow() {
		var tableObj = this.parentNode;
		if(tableObj.tagName != 'TABLE')
			tableObj = tableObj.parentNode;

		if(this != activeRow){
			this.setAttribute('origCl',this.className);
			this.origCl = this.className;
		}
		this.className = arrayOfRolloverClasses[tableObj.id];
		
		activeRow = this;
	}
	
	function onClickTableCell() {
		var inputs = this.parentNode.getElementsByTagName('INPUT');

		for (i = 0; i < inputs.length; i++) {
			if (inputs[i].type == "checkbox" && !inputs[i].disabled) {
				//Check or uncheck the box appropriately (only if the checkbox is enabled)
				if(inputs[i].checked == true) {
					inputs[i].checked = false;
				} else {
					inputs[i].checked = true;
				}
				inputs[i].onclick();
			}
		}
	}
	
	function resetRowStyle() {
		var origCl = this.getAttribute('origCl');
		if(!origCl)
			origCl = this.origCl;
		this.className=origCl;
	}
		
	function addTableRolloverEffect(tableId,whichClass) {
		if(document.getElementById(tableId)) {
			arrayOfRolloverClasses[tableId] = whichClass;
			
			var tableObj = document.getElementById(tableId);
			var tBody = tableObj.getElementsByTagName('TBODY');
			if(tBody){
				if(tBody[0])
					var rows = tBody[0].getElementsByTagName('TR');
			}else{
				if(tableObj)
					var rows = tableObj.getElementsByTagName('TR');
			}
			if(rows) 
			{
				var newClass = '';
				for(var no=0;no<rows.length;no++)
				{
					var row = rows[no];
					if(row.className != 'noColor')
					{
						//Alternate the row colors
						row.className = newClass;
						//Now set the hover
						row.onmouseover = highlightTableRow;
						row.onmouseout = resetRowStyle;
						var cells = row.getElementsByTagName('TD');
				
						for (i = 0; i < cells.length; i++) 
						{
							var cell = cells[i];
							if (!cell.getElementsByTagName('A')[0] && !cell.getElementsByTagName('INPUT')[0]) {
								cell.onclick = onClickTableCell;
							}
						}
						if(newClass == '')
						{
							newClass = 'even';
						}
						else if(newClass == 'even')
						{
							newClass = '';
						}
					}
				}
			}
		}
	}

//Browser detection code
	
	var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();

/***** END ALTERNATE TABLE ROW COLORS *****/


/**
 *  Dynarch Horizontal Menu, hmenu-2.8.1
 *  Copyright Dynarch.com, 2003-2006.  All Rights Reserved.
 *  http://www.dynarch.com/products/dhtml-menu/
 *
 *  THIS NOTICE MUST REMAIN INTACT!
 *
 *      Registration key: 75cd10937b2457c6c045851b5af5a607
 *		Dynarch.com user: hannonhill
 
 */
(function(){var UA=navigator.userAgent,w=window;_dynarch_top=window.parent;try{_dynarch_top._dynarch_menu_test=null;}catch(ex){_dynarch_top=w;}w.is_gecko=/gecko/i.test(UA);w.is_opera=/opera/i.test(UA);w.is_ie=/msie/i.test(UA)&&!is_opera&&!(/mac_powerpc/i.test(UA));w.is_ie5=is_ie&&/msie 5\.[^5]/i.test(UA);w.is_mac_ie=/msie.*mac/i.test(UA);w.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);if(typeof _dynarch_top._dynarch_menu_url=="undefined")_dynarch_top._dynarch_menu_url="/hmenu/";else{_dynarch_top._dynarch_menu_url=_dynarch_top._dynarch_menu_url.replace(/\x2f*$/,'/');if(!/^(https?:|\x2f)/.test(_dynarch_top._dynarch_menu_url)&&_dynarch_top!=window)_dynarch_top._dynarch_menu_url=_dynarch_top.document.URL.replace(/\x2f?[^\x2f]*$/,"/")+_dynarch_top._dynarch_menu_url;}w._dynarch_menu_shadow=new Image();w._dynarch_menu_shadow.src="/cms/css/images/shadow.png";w._dynarch_menu_ediv="<div unselectable='on'>&nbsp;</div>";})();function DynarchMenu(el,config){var T1,a,i;if(config.d_profile){DynarchMenu.profile={item:0,tree:0};T1=(new Date()).getTime();}this._baseMenuInfo=null;this._popupMenus=[];this._activeKeymap=null;this._globalKeymap=null;this._activePopup=null;this._fixed=false;this.items={};this.target=null;this.config=config;try{this._df=config.frames.popups.document.createDocumentFragment();}catch(e){this._df=null;this._ca=[];}el.parentNode.insertBefore(this.createMenuTree(el,!config.vertical),el);if(this._df){config.container.appendChild(this._df);this._df=null;}else{a=this._ca;for(i=a.length;--i>=0;)config.container.appendChild(a[i]);}if(config.d_profile)alert("DynarchMenu: generated in "+(((new Date()).getTime()-T1)/1000)+" sec.\n"+"containing "+DynarchMenu.profile.item+" items in "+DynarchMenu.profile.tree+" (sub)menus.");if(config.setFocus)config.frames.popups.focus();};DynarchMenu._hiderID=0;DynarchMenu._createHider=function(win){var f=null;if(is_ie&&!is_ie5){var filter='filter:progid:DXImageTransform.Microsoft.alpha(style=0,opacity=0);';var id='dynarch-menu-hider-'+(++this._hiderID);win.document.body.insertAdjacentHTML('beforeEnd','<iframe id="'+id+'" scroll="no" frameborder="0" '+'style="position:absolute;visibility:hidden;'+filter+'border:0;top:0;left:0;width:0;height:0;" '+'src="javascript:false;"></iframe>');f=win.document.getElementById(id);}return f;};DynarchMenu._setupHider=function(f,x,y,w,h){if(f){var s=f.style;s.left=x+"px";s.top=y+"px";s.width=w+"px";s.height=h+"px";s.visibility="visible";}};DynarchMenu._closeHider=function(f){if(f)f.style.visibility="hidden";};DynarchMenu._C=null;DynarchMenu._T=null;DynarchMenu._OT=null;DynarchMenu._RE_PR=/(^|\s+)pressed(\s+|$)/ig;DynarchMenu._RE_AH=/(^|\s+)active|hover(\s+|$)/ig;DynarchMenu._RE_DS=/(^|\s+)disabled(\s+|$)/ig;DynarchMenu._RE_CP=/clones-popup-(.*)/;DynarchMenu._RE_OPL=/(^|\s+)open-left(\s+|$)/;DynarchMenu._RE_CTX_ID=/context-for-(.*)/;DynarchMenu._RE_CTX_CL=/context-class-([^-\s]+)-([^\s]+)/;DynarchMenu._RE_CTX_AL=/context-align-([a-z]+)/;DynarchMenu._activeItem=null;DynarchMenu._menus=null;DynarchMenu._nop=function(){};DynarchMenu.setup=function(el,args){if(typeof args=="undefined")args={};var config={},tmp;function PD(name,value){var v=args[name];config[name]=(typeof v=="undefined")?value:v;};PD("className",null);PD("tooltips",false);PD("shadows",[4,4]);PD("smoothShadow",true);PD("dx",0);PD("dy",0);PD("basedx",0);PD("basedy",0);PD("timeout",150);PD("baseTimeout",50);PD("context",false);PD("vertical",false);PD("electric",config.vertical?250:false);PD("blink",false);PD("lazy",false);PD("d_profile",false);PD("toolbar",false);PD("ctxbutton",2);PD("frames",{main:window,popups:window});tmp=config.frames;if(typeof tmp.main=="string")tmp.main=_dynarch_top.frames[tmp.main];if(typeof tmp.popups=="string")tmp.popups=_dynarch_top.frames[tmp.popups];PD("crossFrames",tmp.main!==tmp.popups);PD("container",config.frames.popups.document.body);PD("clone",false);PD("onPopup",DynarchMenu._nop);PD("setFocus",true);if(config.blink===true)config.blink=5;if(typeof el=="string")el=tmp.main.document.getElementById(el);if(is_mac_ie)return null;if(is_ie5)config.smoothShadow=false;if(config.context)config.vertical=true;if(!el){alert("Error: menu element not found.");return false;}el.style.display="none";var i,els,a=DynarchMenu._menus,tmp2;if(!a||a.length==0){a=DynarchMenu._menus=[];els=[config.frames.main,config.frames.main.document];if(config.frames.popups!==config.frames.main){els[els.length]=config.frames.popups;els[els.length]=config.frames.popups.document;}for(i=els.length;--i>=0;){tmp=els[i];DynarchMenu.watchFrame(tmp,tmp);}DynarchMenu._eventElements=els;}return a[a.length]=new DynarchMenu(el,config);};document.DynarchMenu=DynarchMenu;_dynarch_top.DynarchMenu=DynarchMenu;DynarchMenu.watchFrame=function(f,w){if(typeof w=="undefined")w=window;try{DynarchMenu._addEvent(f,(is_ie||is_opera)?"keydown":"keypress",w.DynarchMenu._documentKeyPress);DynarchMenu._addEvent(f,"mousedown",w.DynarchMenu._documentMouseDown);DynarchMenu._addEvent(f,"mouseup",w.DynarchMenu._documentMouseUp);DynarchMenu._addEvent(f,"mouseover",w.DynarchMenu._documentMouseOver);}catch(e){};};DynarchMenu._clearTimeout=function(){if(_dynarch_top.DynarchMenu._T){_dynarch_top.clearTimeout(_dynarch_top.DynarchMenu._T);_dynarch_top.DynarchMenu._T=null;}};DynarchMenu._forAllMenus=function(callback){for(var i=_dynarch_top.DynarchMenu._menus.length;--i>=0&&!callback(_dynarch_top.DynarchMenu._menus[i]););};DynarchMenu._closeOtherMenus=function(menu){DynarchMenu._forAllMenus(function(tmp){if(tmp!=menu){var a=tmp._popupMenus,i;for(i=a.length;--i>=0;)a[i].close(false,true);tmp._baseMenuInfo.close();window.status="";}});};DynarchMenu.prototype.cloneEl=function(el,doc){if(this.config.clone){if(el.ownerDocument!=doc){if(is_ie){var div=doc.createElement("div");div.innerHTML=el.outerHTML;el=div.removeChild(div.firstChild);}else el=doc.importNode(el,true);}else el=el.cloneNode(true);}return el;};DynarchMenu.prototype.addIcon=function(info,item,icon){var doc=info.parent.base?this.config.frames.main.document:this.config.frames.popups.document;var CE=DynarchMenu._createElement,t,l=item.firstChild.firstChild,r=CE("tr",CE("tbody",t=CE("table",null,doc))),td1=CE("td",r),td2=CE("td",r);icon.unselectable="on";td1.appendChild(r=this.cloneEl(icon,doc));td1.className="icon";td2.className="label";while(l){td1=l.nextSibling;td2.appendChild(l);l=td1;}t.cellSpacing=t.cellPadding=0;t.style.borderCollapse="collapse";item.firstChild.appendChild(t);return r;};DynarchMenu.prototype.createMenuItem=function(li,parent,horiz,arrow){var tmp,ctx=null,cfg=this.config,licl=li.className,icon=null,label,html_popup=true,tooltip,action=null,item,info,self=this,key=null,disabled=/(^|\s+)disabled(\s+|$)/i.test(licl),nohover=DynarchMenu.getCA(li,"nohover"),win=parent.base?cfg.frames.main:cfg.frames.popups,doc=win.document,CE=DynarchMenu._createElement;if(cfg.d_profile)++DynarchMenu.profile.item;tmp=DynarchMenu._getChildrenByTagName(li,"a");tmp=tmp.length>0?tmp[0]:li;label=DynarchMenu._getLabel(tmp);if(typeof label=="string"){label=label.replace(/(^\s+|\s+$)/g,'');if(/^a$/i.test(tmp.tagName)&&tmp.accessKey){key=tmp.accessKey;tmp.accessKey="";}else if(!/^<img/i.test(label)){label=label.replace(/_([a-zA-Z0-9])/,"<u unselectable='on'>$1</u>");key=RegExp.$1;label=label.replace(/__/,"_");}html_popup=false;}tooltip=/^\s*$/.test(tmp.title)?"":tmp.title;if(tmp.href&&/\S/.test(tmp.href)){if(/^javascript:(.*)$/i.test(tmp.href))action=new DynarchMenu.JSAction(RegExp.$1);else action=new DynarchMenu.LinkAction(tmp.href,tmp.target);action.className="explicit-action";action.explicit=true;}else action=new DynarchMenu.DefaultAction(li);tmp=DynarchMenu._getChildrenByTagName(li,"img");if(tmp.length>0)icon=tmp[0];info=new DynarchMenu.MenuItem({html_popup:html_popup,separator:html_popup||!/\S/.test(label)&&!icon,icon:icon,label:label,parent:parent,submenu:null,tooltip:tooltip,action:action,menu:this,disabled:disabled,nohover:nohover,align:licl?(DynarchMenu._RE_CTX_AL.test(licl)?RegExp.$1:"mouse"):"mouse"});if(li.id)this.items[info.id=li.id]=info;if(action)action.info=info;if(horiz){item=CE("td",null,doc);info.labelTD=item;if(info.separator)item.innerHTML="<div unselectable='on'></div>";else{item.innerHTML="<div unselectable='on'>"+label+"</div>";if(icon)info.icon=this.addIcon(info,item,icon);}}else{item=CE("tr",null,doc);tmp=CE("td",item);if(info.separator&&!html_popup){tmp.innerHTML=_dynarch_menu_ediv;tmp.colSpan=3;}else{tmp.className="icon";if(icon)tmp.appendChild(info.icon=this.cloneEl(icon,doc));else tmp.innerHTML=_dynarch_menu_ediv;tmp=CE("td",item);tmp.className="label";info.labelTD=tmp;if(html_popup)tmp.appendChild(this.cloneEl(label,doc));else tmp.innerHTML=label;tmp=CE("td",item);tmp.className="end";tmp.innerHTML=_dynarch_menu_ediv;if(arrow)tmp.className+=" arrow";}}if(is_ie&&key&&parent.base){tmp=CE("a",item);tmp.href="#";tmp.accessKey=key;}info.element=item;item.className=(info.separator&&!html_popup)?"separator":"item";if(action.className)item.className+=" "+action.className;if(disabled)info.disabled=true;if(cfg.tooltips)item.title=info.tooltip;DynarchMenu.addInfo(item,"__msh_info",info);if(DynarchMenu._RE_CTX_ID.test(licl)){ctx=document.getElementById(RegExp.$1);if(ctx)DynarchMenu.setupContext(ctx,info);}else if(DynarchMenu._RE_CTX_CL.test(licl)){ctx=document.getElementsByTagName(RegExp.$1);tmp=new RegExp('(^|\\s)'+RegExp.$2+'(\\s|$)');for(i=ctx.length;--i>=0;)if(tmp.test(ctx[i].className))DynarchMenu.setupContext(ctx[i],info);}else if(licl)item.className+=" "+licl;if(!nohover){if(html_popup)item.onmouseover=win.DynarchMenu.EventHandlers.popup_resetActive;if(key)parent.keymap[key.toLowerCase()]=info;item.onmouseover=win.DynarchMenu.EventHandlers.item_onMouseOver;if(!info.separator){item.onmouseout=win.DynarchMenu.EventHandlers.item_onMouseOut;item.onmousedown=win.DynarchMenu.EventHandlers.item_onMouseDown;}}return item;};DynarchMenu._documentMouseDown=function(ev){ev||(ev=window.event);var el=is_ie?ev.srcElement:ev.target,j;for(j=el;j&&!j.__msh_info;j=j.parentNode);if(!j||j.__msh_info.base)_dynarch_top.DynarchMenu._closeOtherMenus(j&&j.__msh_info.menu);};DynarchMenu._msupTimeout=null;DynarchMenu._documentMouseUp=function(ev){ev||(ev=window.event);if(DynarchMenu._msupTimeout)return false;var menu=_dynarch_top.DynarchMenu._C,el,info;if(menu){el=is_ie?ev.srcElement:ev.target;for(;el&&!(el.__msh_is_dynarch_menu&&(info=el.__msh_info));el=el.parentNode);if(!el)_dynarch_top.DynarchMenu._closeOtherMenus(null);else if(info&&info.exec)info.exec();}_dynarch_top.DynarchMenu._C=null;_dynarch_top.DynarchMenu._activeItem=null;};DynarchMenu._documentMouseOver=function(ev){var menu=_dynarch_top.DynarchMenu._C,el,tmout;if(menu&&menu.config.electric){ev||(ev=window.event);el=is_ie?ev.srcElement:ev.target;for(;el&&!el.__msh_is_dynarch_menu;el=el.parentNode);if(!el||el===document.body){tmout=menu.config.electric;if(tmout===true)tmout=1;if(!_dynarch_top.DynarchMenu._T)_dynarch_top.DynarchMenu._T=_dynarch_top.setTimeout('_dynarch_top.DynarchMenu._closeOtherMenus(null); _dynarch_top.DynarchMenu._T = null;',tmout);}else _dynarch_top.DynarchMenu._clearTimeout();}};DynarchMenu._documentKeyPress=function(ev){ev||(ev=window.event);DynarchMenu._forAllMenus(function(menu){var tmp=menu._activePopup,item=tmp?tmp.active_item:null,kmap;function do_27(){if(tmp){tmp.close(true,true);if(item)item.mouseout();if(tmp.base||(tmp.parent.base&&tmp.config.context)){tmp.resetActive();tmp.active_submenu=null;_dynarch_top.DynarchMenu._activeItem=null;_dynarch_top.DynarchMenu._closeOtherMenus(null);}DynarchMenu._stopEvent(ev);}};function do_13(){if(!item)return;item.activate(true,true);if(item.action&&!item.submenu)item.exec();DynarchMenu._stopEvent(ev);};function do_ud(up){if(tmp){if(!item)item=up?tmp.getFirstItem(item):tmp.getLastItem(item);else item=up?tmp.getNextItem(item):tmp.getPrevItem(item);item.hover(false,true);tmp.active_item=item;DynarchMenu._stopEvent(ev);}};function serveKeymap(keymap){var key=String.fromCharCode((is_ie||is_opera)?ev.keyCode:ev.charCode).toLowerCase();item=keymap[key];if(typeof item!="undefined"){item.hover(true,true);if(!item.submenu)item.exec();tmp=item.submenu;item=null;do_ud(true);DynarchMenu._stopEvent(ev);}};switch(ev.keyCode){case 27:do_27();break;case 13:do_13();if(item){tmp=item.submenu;item=null;do_ud(true);}break;case 37:if(!menu._activeKeymap)break;if(tmp.parent&&!tmp.parent.horiz)do_27();else{if(tmp.parent){tmp=tmp.parent;item=tmp.active_item;}do_ud(false);item.activate(false,true);}break;case 39:if(!menu._activeKeymap)break;if(item&&!item.parent.horiz&&item.submenu){do_13();tmp=item.submenu;item=null;do_ud(true);}else{while(tmp.parent){tmp=tmp.parent;item=tmp.active_item;}do_ud(true);item.activate(false,true);}break;case 40:case 38:if(!menu._activeKeymap)break;do_ud(ev.keyCode==40);break;default:kmap=ev.altKey?menu._globalKeymap:menu._activeKeymap;if(kmap)serveKeymap(kmap);}});};DynarchMenu.prototype.createMenuTree=function(ul,horiz){var base=!this._baseMenuInfo,a_li,div,table,i,info,li,item,tmp,ret=null,self=this,cfg=this.config,ctx=cfg.context,submenu,CE=DynarchMenu._createElement,win=base?cfg.frames.main:cfg.frames.popups,doc=win.document;if(cfg.d_profile)++DynarchMenu.profile.tree;a_li=DynarchMenu._getChildrenByTagName(ul,"li");if(a_li.length==0)return;ret=div=CE("div",null,doc);div.className=(base&&horiz)?"dynarch-horiz-menu":"dynarch-popup-menu";if(base&&horiz&&cfg.toolbar)div.className+=" dynarch-menu-toolbar";if(base&&!horiz&&!ctx)div.className+=" dynarch-popup-base-menu";if(ul.className)div.className+=" "+ul.className;tmp=["a","b","c","d"];for(i=tmp.length;--i>=0;(div=CE("div",div)).className=tmp[i]);info=new DynarchMenu.MenuTree({menu:this,base:base,horiz:horiz,element:ret,active_submenu:null,active_item:null,visible:false,keymap:{},config:cfg,_T_close:null,open_left:DynarchMenu._RE_OPL.test(ul.className)});if(ul.id)info.id=ul.id;DynarchMenu.addInfo(ret,"__msh_info",info);info.table=table=CE("table",div);table.cellSpacing=0;table.cellPadding=0;tmp=CE("tbody",table);DynarchMenu._class(ret,null,cfg.className);if(base){this._globalKeymap=info.keymap;this._baseMenuInfo=info;if(ctx)ret.style.display="none";}else{ret.style.display="none";if(this.config.lazy)this.config.container.appendChild(ret);else if(this._df)this._df.appendChild(ret);else this._ca[this._ca.length]=ret;}if(horiz){info.parent=null;div=CE("tr",tmp);}else div=tmp;ret.onmouseover=win.DynarchMenu.EventHandlers.tree_onMouseOver;ret.onmouseout=win.DynarchMenu.EventHandlers.tree_onMouseOut;for(i=0;i<a_li.length;++i){li=a_li[i];if(DynarchMenu._RE_CP.test(li.className)){tmp=document.getElementById(RegExp.$1);}else{tmp=DynarchMenu._getChildrenByTagName(li,"ul");tmp=(tmp.length>0)?tmp[0]:null;}item=this.createMenuItem(li,info,horiz,!!tmp);div.appendChild(item);if(tmp){item.className+=" has-submenu";item.__msh_info.ul=ul=tmp;item.__msh_info.submenu=function(){var menu=this.menu;submenu=this.submenu=menu.createMenuTree(this.ul,false).__msh_info;submenu.parent=info;submenu.parent_item=this;menu._popupMenus[menu._popupMenus.length]=submenu;};if(!this.config.lazy)item.__msh_info.submenu();}}return ret;};DynarchMenu.prototype.destroy=function(){var a=this._baseMenuInfo.element,i,el;try{a.parentNode.removeChild(a);a=this._popupMenus;for(i=a.length;--i>=0;)try{el=a[i].element;el.parentNode.removeChild(el);el=a[i]._shadow;if(el)el.parentNode.removeChild(el);}catch(e){};a=_dynarch_top.DynarchMenu._menus;for(i=a.length;--i>=0;)if(a[i]==this)a.splice(i,1);if(a.length==0){a=DynarchMenu._eventElements;for(i=a.length;--i>=0;){el=a[i];if(el)try{DynarchMenu._removeEvent(el,(is_ie||is_opera)?"keydown":"keypress",el.DynarchMenu._documentKeyPress);DynarchMenu._removeEvent(el,"mousedown",el.DynarchMenu._documentMouseDown);DynarchMenu._removeEvent(el,"mouseup",el.DynarchMenu._documentMouseUp);DynarchMenu._removeEvent(el,"mouseover",el.DynarchMenu._documentMouseOver);}catch(e){};}}}catch(ex){};};DynarchMenu._stopEvent=function(ev){if(is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}};DynarchMenu._removeEvent=function(el,evname,func){if(el.removeEventListener)el.removeEventListener(evname,func,true);else if(el.detachEvent)el.detachEvent("on"+evname,func);else el["on"+evname]=null;};DynarchMenu._addEvent=function(el,evname,func){if(el.addEventListener)el.addEventListener(evname,func,true);else if(el.attachEvent)el.attachEvent("on"+evname,func);else el["on"+evname]=func;};DynarchMenu._getChildrenByTagName=function(el,tag){var i,a=[];if(tag)tag=tag.toLowerCase();for(i=el.firstChild;i;i=i.nextSibling){if(i.nodeType!=1)continue;if(!tag||tag==i.tagName.toLowerCase())a[a.length]=i;}return a;};DynarchMenu._createElement=function(tagName,parent,doc){if(!doc){if(parent)doc=parent.ownerDocument;if(!doc)doc=document;}var el=doc.createElement(tagName);if(is_ie)el.unselectable="on";else if(is_gecko)el.style.setProperty("-moz-user-select","none","");if(parent)parent.appendChild(el);return el;};DynarchMenu._getLabel=function(el){var i,c,txt;if(el.tagName.toLowerCase()=="a"){if(is_ie){c=DynarchMenu._getChildrenByTagName(el,null);for(i=c.length;--i>=0;c[i].unselectable="on");}return el.innerHTML;}c=DynarchMenu._getChildrenByTagName(el,'div');if(c.length)return c[0];txt="";for(i=el.firstChild;i;i=i.nextSibling)if(i.nodeType==3)txt+=i.data;return txt;};DynarchMenu._getPos=function(el){if(/^body$/i.test(el.tagName))return{x:0,y:0};var SL=0,ST=0,is_div=/^div$/i.test(el.tagName),r,tmp;if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){tmp=this._getPos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};DynarchMenu._class=function(el,del,add){if(!el)return;if(el.element)el=el.element;if(del)el.className=el.className.replace(del,' ');if(add)el.className+=" "+add;};DynarchMenu._related=function(element,ev){var related,type;if(is_ie){type=ev.type;if(type=="mouseover")related=ev.fromElement;else if(type=="mouseout")related=ev.toElement;}else related=ev.relatedTarget;for(;related;related=related.parentNode)if(related===element)return true;return false;};DynarchMenu.psLeft=function(){var d=document;return d.documentElement.scrollLeft||d.body.scrollLeft;};DynarchMenu.psTop=function(){var d=document;return d.documentElement.scrollTop||d.body.scrollTop;};DynarchMenu.preloadImages=function(filter){if(is_ie){var ai=[],hi={},i;function f(s,p){var i,t,pp=s.href;if(filter&&s.readOnly&&!filter.test(p+pp))return;if(pp)p+=pp.replace(/(\x2f?)[^\x2f]+$/,"$1");for(i=s.rules.length;--i>=0;){t=s.rules(i).style.backgroundImage;if(/url\((.*?)\)/.test(t)){t=p+RegExp.$1;if(!hi[t]){ai.push(t);hi[t]=1;}}}for(i=s.imports.length;--i>=0;)f(s.imports(i),p);};for(i=document.styleSheets.length;--i>=0;)f(document.styleSheets[i],"");document.write("<div style='display:none'>");for(i=ai.length;--i>=0;)document.write("<img src='"+ai[i]+"' />");document.write("</div>");}};DynarchMenu._infoMap=null;DynarchMenu._cleanUp=function(){var a=_dynarch_top.DynarchMenu._infoMap,i,o,p;for(i=a.length;--i>=0;){o=a[i][0];p=a[i][1];try{o[p]=null;}catch(e){};a.splice(i,1);}_dynarch_top.DynarchMenu._infoMap=null;};DynarchMenu.addInfo=function(el,name,value){el.__msh_is_dynarch_menu=true;el[name]=value;if(is_ie){var a=_dynarch_top.DynarchMenu._infoMap;if(!a){a=_dynarch_top.DynarchMenu._infoMap=[];DynarchMenu._addEvent(_dynarch_top,"unload",_dynarch_top.DynarchMenu._cleanUp);}a[a.length]=[el,name];}};DynarchMenu.setupContext=function(ctx,tree){this.addInfo(ctx,"__msh_info2",tree);var buttons=2,b;if(tree&&tree.menu&&tree.menu.config&&tree.menu.config.ctxbutton)buttons=tree.menu.config.ctxbutton;if(/dynarch-menu-ctxbutton-([a-z]+)/.test(ctx.className)){b=RegExp.$1;buttons=((b=="left")?1:((b=="both")?3:buttons));}if(buttons&1)ctx.onclick=DynarchMenu.EventHandlers.ctx_onContextMenu;if(buttons&2)ctx[is_opera?"onmousedown":"oncontextmenu"]=DynarchMenu.EventHandlers.ctx_onContextMenu;};DynarchMenu.JSAction=function(code){this.js=code.replace(/%20/g,' ');};DynarchMenu.JSAction.prototype.exec=function(){var retval=false;eval(this.js);return retval;};DynarchMenu.LinkAction=function(url,target){if(!(target&&/\S/.test(target)))target=null;if(is_ie)url=url.replace(/^about:blank(.+)$/,"$1");this.url=url;this.target=target;};DynarchMenu.LinkAction.prototype.exec=function(){if(this.target){var tmp=document.getElementById(this.target);if(!tmp&&document.getElementsByName){tmp=document.getElementsByName(this.target);tmp=tmp.length?tmp[0]:null;}if(tmp){tmp=is_opera?tmp:tmp.contentWindow;tmp.location=this.url;}else window.open(this.url,this.target);}else window.location=this.url;return false;};DynarchMenu.DefaultAction=function(li){this.params=li;while(li&&/^([uo]l|li)$/i.test(li.tagName)){if(li.onclick){this.action=li.onclick;break;}li=li.parentNode;}};DynarchMenu.DefaultAction.prototype.exec=function(){if(!this.info.submenu){if(typeof this.action=="function")return this.action(this.info);else try{var retval=false;eval(this.action);return retval;}catch(e){};}return true;};DynarchMenu.EventHandlers={popup_resetActive:function(ev){this.__msh_info.parent.resetActive();return false;},item_onMouseOver:function(ev){ev||(ev=window.event);if(DynarchMenu._related(this,ev))return false;var item=this.__msh_info;if(!item.separator)return item.hover();else if(item.html_popup){item.parent.clearTimeout();return item.parent.resetActive(item);}},item_onMouseOut:function(ev){ev||(ev=window.event);if(DynarchMenu._related(this,ev))return false;return this.__msh_info.mouseout();},item_onMouseDown:function(ev){ev||(ev=window.event);var info=this.__msh_info,ret;_dynarch_top.DynarchMenu._C=info.menu;DynarchMenu._stopEvent(ev);_dynarch_top.DynarchMenu._activeItem=info;if(info.parent&&!info.parent.base)info.parent.closePopups();ret=info.activate(false,true);return ret;},tree_onMouseOver:function(ev){ev||(ev=window.event);if(!DynarchMenu._related(this,ev)){var info=this.__msh_info;if(info.parent){info.parent.resetActive(info.parent_item,"active");info.parent.active_submenu=info;}}return false;},tree_onMouseOut:function(ev){ev||(ev=window.event);if(!DynarchMenu._related(this,ev)){var info=this.__msh_info;if(!info.active_submenu)this.__msh_info.resetActive();}return false;},ctx_onContextMenu:function(ev){ev||(ev=window.event);if(!is_opera||ev.button==2){if(DynarchMenu._msupTimeout)clearTimeout(DynarchMenu._msupTimeout);DynarchMenu._msupTimeout=setTimeout(function(){DynarchMenu._msupTimeout=null;},150);var info=this.__msh_info2;if(typeof info.submenu=="function")info.submenu();info.submenu.openContext(ev,this);setTimeout(function(){_dynarch_top.DynarchMenu._C=info.menu;},info.menu.config.timeout);DynarchMenu._stopEvent(ev);return false;}}};DynarchMenu.populateObject=function(o,props){for(var i in props)o[i]=props[i];};DynarchMenu.MenuItem=function(props){this.visible=true;this.pressed=false;DynarchMenu.populateObject(this,props);};DynarchMenu.MenuItem.prototype.disable=function(dis){if(typeof dis=="undefined")dis=true;this.disabled=dis;DynarchMenu._class(this.element,DynarchMenu._RE_DS,dis?"disabled":null);};DynarchMenu.MenuItem.prototype.display=function(dis){if(typeof dis=="undefined")dis=!this.visible;this.visible=dis;this.element.style.display=dis?"":"none";};DynarchMenu.MenuItem.prototype._exec=function(){if(!this.disabled&&!this.separator&&this.action&&!this.action.exec()){DynarchMenu._class(this.element,DynarchMenu._RE_AH);var a=this.menu._popupMenus,i;for(i=a.length;--i>=0;)a[i].close(false,true);this.menu._baseMenuInfo.close();window.status="";}};DynarchMenu.MenuItem.prototype.exec=function(){var step=this.menu.config.blink;if((this.submenu&&!this.action.explicit)||this.html_popup||!step)return this._exec();var self=this;var timer=setInterval(function(){DynarchMenu._class(self.element,DynarchMenu._RE_AH,--step&1?'active':null);if(!step){clearInterval(timer);self._exec();}},60);};DynarchMenu.MenuItem.prototype.setLabel=function(text){this.labelTD.innerHTML="<div unselectable='on'>"+text+"</div>";this.label=text;};DynarchMenu.MenuItem.prototype.hover=function(activate,instant){var menu=this.parent,el=this.element;if(this.disabled&&menu.base){menu.clearPopups(this);menu.resetActive();return;}if(menu.active_item==this)return false;menu.clearTimeout();window.status=this.tooltip;el.title=menu.config.tooltips?this.tooltip:"";if(typeof activate=="undefined")activate=this.submenu&&(menu.config.electric||!menu.base||menu.active_submenu);menu.clearPopups(this);if(menu.resetActive(this))DynarchMenu._clearTimeout();if(activate)this.activate(true,instant);return false;};DynarchMenu.MenuItem.prototype.activate=function(noclose,instant){if(!this.disabled){var menu=this.parent,submenu=this.submenu,el=this.element;menu.resetActive(this);if(submenu){if(typeof submenu=="function"){this.submenu();submenu=this.submenu;}if(!noclose&&!menu.config.electric&&menu.base&&submenu==menu.active_submenu){submenu.close(false,true);_dynarch_top.DynarchMenu._activeItem=null;menu.resetActive(this,"hover");}else submenu.open(el,this,instant);}}return false;};DynarchMenu.MenuItem.prototype.setClass=function(del,add){DynarchMenu._class(this.element,del,add);};DynarchMenu.MenuItem.prototype.setPressed=function(state){if(typeof state=="undefined")state=!this.pressed;this.pressed=state;this.setClass(DynarchMenu._RE_PR,state?"pressed":null);};DynarchMenu.MenuItem.prototype.mouseout=function(){var p=this.parent,s=this.submenu;if(s&&DynarchMenu._OT)clearTimeout(DynarchMenu._OT);DynarchMenu._clearTimeout();if(!s||!s.visible)p.resetActive();window.status="";return false;};DynarchMenu.MenuTree=function(props){DynarchMenu.populateObject(this,props);if(!this.base)this.hider=DynarchMenu._createHider(this.menu.config.frames.popups);};DynarchMenu.MenuTree.prototype.getNextItem=function(item){var i=item.element.nextSibling;while(i&&i.__msh_info.separator)i=i.nextSibling;if(!i)i=item.element.parentNode.firstChild;return i.__msh_info;};DynarchMenu.MenuTree.prototype.getPrevItem=function(item){var i=item.element.previousSibling;while(i&&i.__msh_info.separator)i=i.previousSibling;if(!i)i=item.element.parentNode.lastChild;return i.__msh_info;};DynarchMenu.MenuTree.prototype.resetActive=function(item,cls){item||(item=null);if(!cls)(!item||!item.html_popup)?(cls="hover"):(cls="");DynarchMenu._class(this.active_item,DynarchMenu._RE_AH);DynarchMenu._class(item,DynarchMenu._RE_AH,_dynarch_top.DynarchMenu._activeItem==item?"active":cls);var tmp=this.active_item!=item;this.active_item=item;return tmp;};DynarchMenu.MenuTree.prototype.clearPopups=function(item){var m=this.active_submenu;if(m&&m!=item.submenu)m.close();};DynarchMenu.MenuTree.prototype.closePopups=function(){var i,m;for(i=this.getFirstItem().element;i;i=i.nextSibling){m=i.__msh_info.submenu;if(m&&typeof m!="function")m.closePopups().close(false,true);}return this;};DynarchMenu.MenuTree.prototype.clearTimeout=function(){if(this._T_close){clearTimeout(this._T_close);this._T_close=null;}};DynarchMenu.MenuTree.prototype.close=function(by_key,instant){var self=this.menu;if(this.base){self._activeKeymap=null;self._activePopup=null;}else{if(!this.visible||(this._T_close&&!instant))return false;var info=this;tmp=this.closePopups().parent;tmp.resetActive(by_key?tmp.active_item:null);DynarchMenu._class(this.active_item,DynarchMenu._RE_AH);if(!by_key)tmp.active_item=null;tmp.active_submenu=null;this.active_item=this.active_submenu=null;if(instant||this.parent.base)this._close();else this._T_close=setTimeout(function(){info._close();info._T_close=null;},self.config.timeout);}};DynarchMenu.MenuTree.prototype.getFirstItem=function(){return this.horiz?this.element.firstChild.__msh_info:this.table.firstChild.firstChild.__msh_info;};DynarchMenu.MenuTree.prototype.getLastItem=function(){return this.horiz?this.element.lastChild.__msh_info:this.table.lastChild.lastChild.__msh_info;};DynarchMenu.MenuTree.prototype.openContext=function(ev,trigger){var el=ev.srcElement||ev.target,p,align=this.parent_item.align;if(!trigger)trigger=null;this.menu.target=trigger;if(el.className&&DynarchMenu._RE_CTX_AL.test(el.className))align=RegExp.$1;switch(align){case "bottom":p=DynarchMenu._getPos(el);p.y+=el.offsetHeight;break;case "right":p=DynarchMenu._getPos(el);p.x+=el.offsetWidth;break;default:p={x:ev.clientX+DynarchMenu.psLeft(),y:ev.clientY+DynarchMenu.psTop()};break;}this.open(null,null,true,p);};DynarchMenu.MenuTree.prototype.open=function(el,item,instant,pos){this.clearTimeout();DynarchMenu._clearTimeout();if(DynarchMenu._OT)clearTimeout(DynarchMenu._OT);var info=this;if(instant)this._open(el,item,pos);else DynarchMenu._OT=setTimeout(function(){info._open(el,item,pos);DynarchMenu._OT=null;},this.menu.config[this.parent.base?"baseTimeout":"timeout"]);};DynarchMenu.MenuTree.prototype._close=function(){this.element.style.display="none";this.visible=false;this.menu._activePopup=this.parent;this.menu._activeKeymap=this.parent.keymap;if(this._shadow)this._shadow.style.display="none";for(var i=this.getFirstItem().element;i;i=i.nextSibling)DynarchMenu._class(i,DynarchMenu._RE_AH);DynarchMenu._closeHider(this.hider);};DynarchMenu.MenuTree.prototype._open=function(el,item,pos){this.menu.config.onPopup.call(this,this.menu.target,item,pos);var m=this.element,self=this.menu,cfg=self.config,win=cfg.frames.popups,p=el?win.DynarchMenu._getPos(el):pos,pe,base=this.parent?this.parent.base:false,dx=base?cfg.basedx:cfg.dx,dy=base?cfg.basedy:cfg.dy,horiz=this.parent?this.parent.horiz:false,tmp,s,vw,sw;if(!el)el={offsetHeight:0,offsetWidth:0};if(base&&cfg.crossFrames){if(cfg.vertical){p.x=win.DynarchMenu.psLeft();p.y+=win.DynarchMenu.psTop();}else p.y=win.DynarchMenu.psTop();}else if(self._fixed&&!is_ie&&base){p.x+=win.DynarchMenu.psLeft();p.y+=win.DynarchMenu.psTop();}pe={x:p.x,y:p.y};_dynarch_top.DynarchMenu._C=self;DynarchMenu._closeOtherMenus(self);if(!base&&item)item.parent.closePopups();if(!(base&&cfg.crossFrames)){if(horiz)p.y+=el.offsetHeight;else{if(!is_khtml){p.x+=el.offsetWidth;}else if(el){p=win.DynarchMenu._getPos(el.lastChild);p.x+=el.lastChild.offsetWidth;p.y-=1;}}}vw=win.DynarchMenu.getWinSize();vw.x+=win.DynarchMenu.psLeft();vw.y+=win.DynarchMenu.psTop();sw=cfg.shadows||[0,0];s=m.style;if(is_ie)s.position="absolute";s.visibility="hidden";s.display="block";if(this.open_left||p.x+m.offsetWidth>vw.x){p.x=pe.x-m.offsetWidth+(horiz?el.offsetWidth:2);dx=-dx;}if(p.y+m.offsetHeight>vw.y&&pe.y>m.offsetHeight){p.y=pe.y-m.offsetHeight+(horiz?0:(win.DynarchMenu._getPos(m).y+m.offsetHeight-win.DynarchMenu._getPos(this.getLastItem().element).y));dy=-dy;}else if(!horiz)p.y-=win.DynarchMenu._getPos(this.getFirstItem().element).y-win.DynarchMenu._getPos(m).y;if(p.x+m.offsetWidth+sw[0]>vw.x)p.x-=sw[0];p.x+=dx;p.y+=dy;s.left=p.x+"px";s.top=p.y+"px";DynarchMenu._setupHider(this.hider,p.x,p.y,m.offsetWidth+sw[0],m.offsetHeight+sw[1]);if(this.parent){this.parent.active_submenu=this;this.parent.resetActive(item,"active");}self._activePopup=this;self._activeKeymap=this.keymap;tmp=this._shadow;if(cfg.shadows){if(!tmp){var SS=cfg.smoothShadow;this._shadow=tmp=DynarchMenu._createElement((SS&&!is_ie)?"img":"div",null,cfg.container.ownerDocument);if(SS)tmp.src=_dynarch_menu_shadow.src;tmp.className="dynarch-menu-shadow";DynarchMenu.addInfo(tmp,'__msh_info',this);if(is_ie)tmp.style.position="absolute";if(SS&&is_ie&&!is_ie5){tmp.className="dynarch-IE6-shadow";tmp.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+_dynarch_menu_shadow.src+"',sizingMethod='scale')";}tmp.style.width="2px";tmp.style.height="2px";cfg.container.appendChild(tmp);}s=tmp.style;if(sw.length>2){s.left=p.x+sw[0]+"px";s.top=p.y+sw[1]+"px";s.width=m.offsetWidth+sw[2]+"px";s.height=m.offsetHeight+sw[3]+"px";}else{s.left=p.x+sw[0]+"px";s.top=p.y+sw[1]+"px";s.width=m.offsetWidth+"px";s.height=m.offsetHeight+"px";}s.display="block";}this.visible=true;m.style.visibility="visible";};DynarchMenu.getWinSize=function(){if(is_gecko){if(document.documentElement.clientWidth)return{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight};else return{x:window.innerWidth,y:window.innerHeight};}if(is_opera)return{x:window.innerWidth,y:window.innerHeight};if(is_ie){if(!document.compatMode||document.compatMode=="BackCompat")return{x:document.body.clientWidth,y:document.body.clientHeight};else return{x:document.documentElement.clientWidth,y:document.documentElement.clientHeight};}var div=document.createElement("div"),s=div.style;s.position="absolute";s.bottom=s.right="0px";document.body.appendChild(div);s={x:div.offsetLeft,y:div.offsetTop};document.body.removeChild(div);return s;};DynarchMenu.getCA=function(el,name){return el.getAttribute("DynarchMenu:"+name);};DynarchMenu._nfo={product:"hmenu-2.8.1",licensee:"Dynarch.com user: hannonhill",license_key:"linkware-3299833",purchase_date:"Tue Feb 28 03:51:06 2006 GMT",license_type:"linkware"};
