var ArrowIcon = new Image();
ArrowIcon.src = 'data/arrow_01.gif';


var StrApplicationVersion = new String();
StrApplicationVersion = window.navigator.appVersion
var IE6 =(StrApplicationVersion.indexOf('MSIE 6.0')!=-1)?true:false;


var g_sOriginalClass= 'NavOnMouseOut';
var g_sOriginalClassOn = 'NavOnMoueOn';
var g_oSource;
var g_sOriginalClassName;

	function fShowMenu(oSource, nMenuID){
		g_bMenuOn = true;
		g_bSubMenuOn = false;
			
		if(g_oSource){
			g_oSource.className = g_sOriginalClassName;
		}
		g_oSource = oSource;
		g_sOriginalClassName = g_oSource.className;

		var oElement = eval('document.all.oMenu');
		oElement.style.visibility = 'hidden';
		oElement.innerHTML = fPopulateMenu(nMenuID, oSource.offsetWidth);
		if(param_dir=='rtl'){
			oElement.style.left = fGetLeft(oSource) + oSource.offsetWidth - oElement.offsetWidth;
		}else{
			oElement.style.left = fGetLeft(oSource)-1;
		}
		oElement.style.top = fGetTop(oSource) + oSource.offsetHeight;
		if(aMenu[nMenuID].length > 0){
			if(IE6){
				oElement.filters[0].Apply();
				oElement.style.visibility = 'visible';
				oElement.filters[0].Play();
			}else{
				oElement.style.visibility = 'visible';
			}
		}
		g_oSource.className = g_sOriginalClassOn;
	}
		
	function fShowSubMenu(oSource, nMenuID, nOptionID){
		g_bMenuOn = true;
		var oElement = eval('document.all.oSubMenu');
		oElement.style.visibility = 'hidden';
		oElement.innerHTML = fPopulateSubMenu(oSource, nMenuID, nOptionID);

		if(param_dir=='rtl'){
			oElement.style.left = fGetLeft(oSource) - oElement.offsetWidth -1;
		}else{
			oElement.style.left = fGetLeft(oSource) + oSource.offsetWidth;
		}
		oElement.style.top = fGetTop(oSource)+1;
		if(aMenu[nMenuID].length > 0){
			if(IE6){
				oElement.filters[0].Apply();
				oElement.style.visibility = 'visible';
				oElement.filters[0].Play();
			}else{
				oElement.style.visibility = 'visible';
			}
		}
	}


	function fPopulateMenu(nMenuID, nSourceWidth){
		fHideMenu();
		var sContent = new String();
		sContent = '<table border=0 cellspacing=0 cellpadding=1 dir="'+param_dir+'" >';
		for(var a = 0; a < aMenu[nMenuID].length; a++){
		
			aMenu[nMenuID][a][0]
		
			sContent += '<tr class="oMenuTd" onmouseout="this.className=\'oMenuTd\'" onmouseover="this.className=\'oMenuTdOnMouseOver\'" > ' +
			'<td href="'+aMenu[nMenuID][a][0]+'" style="padding-top:1px;padding-bottom:1px;padding-right:8px;padding-left:12px;" '
			if(aMenu[nMenuID][a][0].length!=0){
				sContent += ')" '
			}
			if(aMenu[nMenuID][a][2]){
				sContent += 'onmouseover="g_bSubMenuOn = true; fShowSubMenu(this, ' + nMenuID + ', ' + a + ')" ' +
					' ><a class="aMenuItem" href="'+aMenu[nMenuID][a][0]+'">'+aMenu[nMenuID][a][1]+'</a></td>' + 
					'<td style="padding-left:4px;padding-right:4px;"><img SRC="'+ArrowIcon.src+'"></td></tr>\n';
			}else{
				sContent += 'nowrap>' + 
					'<a class="aMenuItem" href="'+aMenu[nMenuID][a][0]+'">'+aMenu[nMenuID][a][1]+'</a></td><td></td></tr>\n';
			}
		}
		sContent += '</table>';
		return sContent;
	}
		
	function fPopulateSubMenu(oSource, nMenuID, nOptionID){
		fHideMenu();
		var sContent = new String();
		sContent = '<table dir="'+param_dir+'" cellpadding=1 cellspacing=0>';
		if(aMenu[nMenuID][nOptionID][2]){
			for(var a = 0; a < aMenu[nMenuID][nOptionID][2].length; a++){
				sContent += '<tr><td  style="padding-right:8px;padding-left:8px;" class="oMenuTd" '
					if(aMenu[nMenuID][nOptionID][2][a][1].length!=0){
						sContent += ' onmouseover="this.className=\'oMenuTdOnMouseOver\'" ' +
									' onmouseout="this.className=\'oMenuTd\'"'							
					}
					sContent +=' >' + 
					'<a class="aMenuItem" href="'+aMenu[nMenuID][nOptionID][2][a][1]+'">'+aMenu[nMenuID][nOptionID][2][a][0]+'</a></td></tr>\n';
			}
		}
		sContent += '</table>';
		return sContent;
	}
		
	function fHideMenu(){
		if(!g_bMenuOn){
			g_oSource.className = g_sOriginalClassName;
			var oElement = eval('document.all.oMenu');
			if(IE6){
				oElement.filters[0].Apply();
				oElement.style.visibility = 'hidden';
				oElement.filters[0].Play();
			}else{
				oElement.style.visibility = 'hidden';
			}
			oElement.innerHtml = '';
		}
			
		if(!g_bSubMenuOn){
			var oElement = eval('document.all.oSubMenu');
			if(IE6){
				oElement.filters[0].Apply();
				oElement.style.visibility = 'hidden';
				oElement.filters[0].Play();
			}else{
				oElement.style.visibility = 'hidden';
			}
			oElement.innerHtml = '';
		}
	}
		
	function fDelayedHide(){
		setTimeout('fHideMenu()', 1000);
	}
		
	function fGetLeft(obj){
	   return(obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+fGetLeft(obj.offsetParent));
	}

	function fGetTop(obj){
	   return(obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+fGetTop(obj.offsetParent));
	}


document.write('<div id="oMenu" class="oMenuStyle" style="z-index:100;VISIBILITY: hidden; POSITION: absolute;filter:progid:DXImageTransform.Microsoft.Fade(duration=0.4);" onmouseover="g_bMenuOn = true;" onmouseout="g_bMenuOn = false; g_bSubMenuOn = false; fDelayedHide();"></div>')
document.write('<div id="oSubMenu" class="oMenuStyle" style="z-index:100;VISIBILITY: hidden; POSITION: absolute;filter:progid:DXImageTransform.Microsoft.Fade(duration=0.4);" onmouseover="g_bMenuOn = true; g_bSubMenuOn = true;" onmouseout="g_bMenuOn = false; g_bSubMenuOn = false; fDelayedHide();"></div>')

function OpenURLOnClick(StrURL){
	var blnOpenInNewWind = false;
	var StrMediaFolder = 'media';
	var StrHrefURL = new String();
	StrHrefURL = StrURL;
	if(StrHrefURL.indexOf(StrSiteURL)==-1){
		blnOpenInNewWind = true
		
	}
	if(StrHrefURL.indexOf('?')==-1){
		var StrLinkExt = new String();
		StrLinkExt = StrHrefURL.substring(StrHrefURL.lastIndexOf('.'),StrHrefURL.length);
		StrLinkExt = StrLinkExt.toLowerCase();
		if((StrLinkExt.indexOf('.asp')==-1)&&(StrLinkExt.indexOf('.html')==-1)&&(StrLinkExt.indexOf('.htm')==-1)){
			blnOpenInNewWind = true
		}
	}
	if(blnOpenInNewWind){
		return '_blank';
		//window.open(StrURL)
	}else{
		return '_top'
		//window.location.href=StrURL
	}
}

