// Hanweb domain and path name on UAT server, must add / at last like "sc.westcomzivo.com/" or "common.westcomzivo.com/gb/"
var uat_hanweb_domain="192.168.28.64/gb/";
// Hanweb domain and path name on Production server, must add / at last like "sc.westcomzivo.com/" or "common.westcomzivo.com/gb/"
var production_hanweb_domain="production.westcomzivo.com/gb/";

// http link function
function http(big5link,gblink){
	link_convertion(big5link,gblink);
}

// popup http link function
function http_popup(big5link,gblink){
	link_convertion(big5link,gblink,true);
}

// http link with alert message function
function http_alert(big5link,message){
	link_convertion(big5link,message,false,false,true);
}

// popup http link with alert message function
function http_popup_alert(big5link,message){
	link_convertion(big5link,message,true,false,true);
}

// https link function
function https(big5link,gblink){
	link_convertion(big5link,gblink,false,true);
}

// popup https with link function
function https_popup(big5link,gblink){
	link_convertion(big5link,gblink,true,true);
}

// https link alert message function
function https_alert(big5link,message){
	link_convertion(big5link,message,false,true,true);
}

// https link alert message function
function https_popup_alert(big5link,message){
	link_convertion(big5link,message,true,true,true);
}

function link_convertion(big5link,gblink,popup,https,message){
	
	var prefix;
	var redirect_link;
	
	// trim prefix character
	var regex=/^[https|http]+:\/\//gi;
	
	// https protocol prefix
	if(https===true){
		prefix="https://";
	
	// http protocol prefix
	}else{
		prefix="http"+"://";
	}
	
	// remove big5 link http or https
	big5link=big5link.replace(regex,"");
	
	// show alert message
	if(message===true && !(document.URL.toString().toLowerCase().search(uat_hanweb_domain) == -1 && document.URL.toString().toLowerCase().search(production_hanweb_domain) == -1)){
		alert(gblink);
		gblink=big5link;
	}
	
	if(gblink==undefined){
		gblink=big5link;
	}
	
	// remove gb link http or https
	gblink=gblink.replace(regex,"");
	
	
	if(document.URL.toString().toLowerCase().search('/wcms/') == -1){
		// if TC version then link to xxxxx
		if(document.URL.toString().toLowerCase().search(uat_hanweb_domain) == -1 && document.URL.toString().toLowerCase().search(production_hanweb_domain) == -1){
			redirect_link=big5link;
			
		// if SC version then link to xxxxx
		}else{
			redirect_link=gblink;
			
		}
		
		// internal link replacement
		if(redirect_link.indexOf("/",0)==0){
			// Domain name on UAT server
			if(document.URL.toString().toLowerCase().search(uat_hanweb_domain) !== -1){
				
				new_location=String(window.location);
				new_location=new_location.replace(regex,"").replace(uat_hanweb_domain,"");
				
				split_array=new_location.split("/");
				
				if(message===true){
					redirect_link=split_array[0]+redirect_link;
				}else{
					redirect_link=uat_hanweb_domain+split_array[0]+redirect_link;
				}
				
			// Domain name on Production server
			}else if(document.URL.toString().toLowerCase().search(production_hanweb_domain) !== -1){
				new_location=String(window.location);
				new_location=new_location.replace(regex,"").replace(production_hanweb_domain,"");
				
				split_array=new_location.split("/");
				
				if(message===true){
					redirect_link=split_array[0]+redirect_link;
				}else{
					redirect_link=production_hanweb_domain+split_array[0]+redirect_link;
				}
			
			// TC version
			}else{
				new_location=String(window.location);
				new_location=new_location.replace(regex,"");
				split_array=new_location.split("/");
				redirect_link=split_array[0]+redirect_link;
			}
			
		}
		
		// open link in new popup
		if(popup===true){
			window.open(prefix+redirect_link);
			
		// open link in new current window
		}else{
			location.href=prefix+redirect_link;
		}
	}
}

var contentLayerFlag = true;

// class for generating text layers
function MenuItemTD( oInParent, nInNodeID, nInLevel, nInOrder, sInName, sInHRef, sInTarget, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
	this.Parent = oInParent;
	this.NodeID = nInNodeID;
	this.Level = nInLevel;
	this.Order = nInOrder;
	this.Name = sInName;
	this.HRef = sInHRef;
	this.Target = sInTarget;
	this.ClassNameBGMouseOver = sInClassNameBGMouseOver;
	this.ClassNameBGMouseOut = sInClassNameBGMouseOut;
	this.ClassNameFGMouseOver = sInClassNameFGMouseOver;
	this.ClassNameFGMouseOut = sInClassNameFGMouseOut;
}

// class for displaying text layers
function VisItemTD( sInSuffix, nInIndex, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
	this.Suffix = sInSuffix;
	this.Index = nInIndex;
	this.ClassNameBGMouseOver = sInClassNameBGMouseOver;
	this.ClassNameBGMouseOut = sInClassNameBGMouseOut;
	this.ClassNameFGMouseOver = sInClassNameFGMouseOver;
	this.ClassNameFGMouseOut = sInClassNameFGMouseOut;
}

// class for generating image layers
function MenuItemID( oInParent, nInNodeID, nInLevel, nInOrder, sInName, sInHRef, sInTarget, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn ){

	this.Parent = oInParent;
	this.NodeID = nInNodeID;
	this.Level = nInLevel;
	this.Order = nInOrder;
	this.Name = sInName;
	this.HRef = sInHRef;
	this.Target = sInTarget;
	this.ImageFilePathMouseOver = sInImageFilePathMouseOver;
	this.ImageFilePathMouseOut = sInImageFilePathMouseOut;
	this.ImageFilePathMouseOn = sInImageFilePathMouseOn;
}

// class for displaying image layers
function VisItemID( sInSuffix, nInIndex, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
	this.Suffix = sInSuffix;
	this.Index = nInIndex;
	this.ImageFilePathMouseOver = sInImageFilePathMouseOver;
	this.ImageFilePathMouseOut = sInImageFilePathMouseOut;
	this.ImageFilePathMouseOn = sInImageFilePathMouseOn;

	this.ClassNameBGMouseOver = sInClassNameBGMouseOver;
	this.ClassNameBGMouseOut = sInClassNameBGMouseOut;
	this.ClassNameFGMouseOver = sInClassNameFGMouseOver;
	this.ClassNameFGMouseOut = sInClassNameFGMouseOut;

}

function DynamicMenu( sInID, oInPageVar ){

	this.ID = sInID;
	this.PageVar = oInPageVar;
	this.LayerNamePrefix = "MENU_" + this.ID;
	this.LayerSpacerPrefix = "SPACER_" + this.ID;
	this.ImageNamePrefix = "IMG_" + this.ID;
	this.AnchorNamePrefix = "ANCHOR_" + this.ID;
	this.CellLayerNamePrefix = "CELL_" + this.ID;

	this.MenuTimerID = null;
	this.MenuItemArr = new Array();
	this.SubMenuLayers = new Array();
	this.VisItems = new Array();

	this.SetItemSelectedTD = function SetItemSelectedTD( oInItem ){

		if( oInItem.NodeID == this.PageVar.NodeInfo.NodeID ){

			oInItem.ClassNameBGMouseOut = oInItem.ClassNameBGMouseOver;
			oInItem.ClassNameFGMouseOut = oInItem.ClassNameFGMouseOver;
			return;
		}
		if( this.PageVar.IsParent(oInItem.NodeID) ){

			oInItem.ClassNameBGMouseOut = oInItem.ClassNameBGMouseOver;
			oInItem.ClassNameFGMouseOut = oInItem.ClassNameFGMouseOver;
			return;
		}
	}

	this.SetItemSelectedID = function SetItemSelectedID( oInItem ){

		if( oInItem.NodeID == this.PageVar.NodeInfo.NodeID ){

			oInItem.ImageFilePathMouseOut = oInItem.ImageFilePathMouseOn;
			return;
		}
		if( this.PageVar.IsParent(oInItem.NodeID) ){
			oInItem.ImageFilePathMouseOut = oInItem.ImageFilePathMouseOn;
			return;
		}
	}

	this.NewMenuItemTD = function NewMenuItemTD( aInItemArr, iInNodeID, sInName, sInHRef, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
		var nLevel;
		var nOrder;
		if( aInItemArr[0] == null ) nLevel = 1; else nLevel = aInItemArr[0].Level + 1;
		if( aInItemArr.length > 1 ) nOrder = aInItemArr[aInItemArr.length - 1][0].Order + 1; else nOrder = 1;
		aInItemArr[nOrder] = new Array();
		aInItemArr[nOrder][0] = new MenuItemTD( aInItemArr[0], iInNodeID, nLevel, nOrder, sInName, sInHRef, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut );
		this.SetItemSelectedTD(aInItemArr[nOrder][0]);
	}

	this.NewMenuItemID = function NewMenuItemID( aInItemArr, iInNodeID, sInName, sInHRef, sInTarget, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
		var nLevel;
		var nOrder;

		if( aInItemArr[0] == null ) nLevel = 1; else nLevel = aInItemArr[0].Level + 1;
		if( aInItemArr.length > 1 ) nOrder = aInItemArr[aInItemArr.length - 1][0].Order + 1; else nOrder = 1;
		aInItemArr[nOrder] = new Array();
		if( nLevel == 1){
			aInItemArr[nOrder][0] = new MenuItemID( aInItemArr[0], iInNodeID, nLevel, nOrder, sInName, sInHRef, sInTarget, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn );
			this.SetItemSelectedID(aInItemArr[nOrder][0]);
		}else{
			aInItemArr[nOrder][0] = new MenuItemTD( aInItemArr[0], iInNodeID, nLevel, nOrder, sInName, sInHRef, sInTarget, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut );
			this.SetItemSelectedTD(aInItemArr[nOrder][0]);
		}
	}

	this.GetMainMenuTDV = function GetMainMenuTDV( sImgDir, nItemWidth ){
		var sOut = "";
		sOut += "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">";
		for( var i in this.MenuItemArr ){
			if( i != 0 &&
				this.MenuItemArr[i][0] != null ){
				sOut += "<TR>";
				sOut += "<TD WIDTH=\"" + nItemWidth + "\">";
				if( document.layers ){
					sOut += "<ILAYER NAME=\"" + this.CellLayerNamePrefix + "_" + i + "\"><LAYER WIDTH=\"" + nItemWidth + "\"";
				} else {
					sOut += "<DIV ID=\"" + this.CellLayerNamePrefix + "_" + i + "\" STYLE=\"width:" + nItemWidth + "px;\"";
				}
				sOut += " onMouseOver=\"" + this.ID + ".OnItemTD(" + this.MenuItemArr[i][0].Level + ", '', " + i + ", '" + this.MenuItemArr[i][0].ClassNameBGMouseOver + "', '" + this.MenuItemArr[i][0].ClassNameBGMouseOut + "', '" + this.MenuItemArr[i][0].ClassNameFGMouseOver + "', '" + this.MenuItemArr[i][0].ClassNameFGMouseOut + "');\"";
				sOut += " onMouseOut=\"" + this.ID + ".OffItemTD(" + this.MenuItemArr[i][0].Level + ", '', " + i + ");\"";
				sOut += " CLASS=\"" + this.MenuItemArr[i][0].ClassNameBGMouseOut + "\">";
				sOut += "<A NAME=\"" + this.AnchorNamePrefix + "_" + i + "\"";
				sOut += " CLASS=\"" + this.MenuItemArr[i][0].ClassNameFGMouseOut + "\"";
				sOut += " HREF=\"" + this.MenuItemArr[i][0].HRef + "\">" + this.MenuItemArr[i][0].Name + "</A>";
				if( document.layers ){
					sOut += "</LAYER></ILAYER>";
				} else {
					sOut += "</DIV>";
				}
				sOut += "</TD>";
				sOut += "<TD vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
				sOut += "</TR>";
			}
		}
		sOut += "</TABLE>";
		document.writeln( sOut );
	}

	this.GetMainMenuIDV = function GetMainMenuIDV( sImgDir ){
		var sOut = "";
		var kanhan = false;

		//if(sImgDir.search("/SC/")!=-1){
		if(location.href.toString().search('/gb/')!=-1){
			kanhan = true;
		}


		sOut += "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">";
		for( var i in this.MenuItemArr ){
			if( i != 0 &&
				this.MenuItemArr[i][0] != null ){
				if(kanhan){
					this.MenuItemArr[i][0].ImageFilePathMouseOut = this.MenuItemArr[i][0].ImageFilePathMouseOut.replace('/TC/', '/SC/');
					this.MenuItemArr[i][0].ImageFilePathMouseOver = this.MenuItemArr[i][0].ImageFilePathMouseOver.replace('/TC/', '/SC/');
					this.MenuItemArr[i][0].ImageFilePathMouseOn = this.MenuItemArr[i][0].ImageFilePathMouseOn.replace('/TC/', '/SC/');
				}
				sOut += "<TR>";
				sOut += "<TD>";
				sOut += "<A NAME=\"" + this.AnchorNamePrefix + "_" + i + "\"";
				if(this.MenuItemArr[i][0].Target=='1'){
					sOut += " target=\"_blank\"";
				}
				sOut += " HREF=\"" + this.MenuItemArr[i][0].HRef + "\"";
				sOut += " onMouseOver=\"" + this.ID + ".OnItemIDV(" + this.MenuItemArr[i][0].Level + ", '', " + i + ", '" + this.MenuItemArr[i][0].ImageFilePathMouseOver + "', '" + this.MenuItemArr[i][0].ImageFilePathMouseOut + "', '" + this.MenuItemArr[i][0].ImageFilePathMouseOn + "');\"";
				sOut += " onMouseOut=\"" + this.ID + ".OffItemID(" + this.MenuItemArr[i][0].Level + ", '', " + i + ");\">";
				sOut += "<IMG";
				sOut += " NAME=\"" + this.ImageNamePrefix + "_" + i + "\"";
				sOut += " SRC=\"" + this.MenuItemArr[i][0].ImageFilePathMouseOut + "\" BORDER=\"0\"";
				sOut += " ALT=\"" + this.MenuItemArr[i][0].Name  + "\">";
				sOut += "</A>";
				sOut += "</TD>";
				//sOut += "<TD vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
				sOut += "</TR>";
			}
		}
		sOut += "</TABLE>"
		document.writeln( sOut );
	}

	this.GetMainMenuTDH = function GetMainMenuTDH( sImgDir, nItemWidth ){
		var sOut = "";
		sOut += "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">";
		sOut += "<TR>";
		for( var i in this.MenuItemArr ){
			if( i != 0 &&
				this.MenuItemArr[i][0] != null ){
				sOut += "<TD WIDTH=\"" + nItemWidth + "\">";
				if( document.layers ){
					sOut += "<ILAYER NAME=\"" + this.CellLayerNamePrefix + "_" + i + "\"><LAYER WIDTH=\"" + nItemWidth + "\"";
				} else {
					sOut += "<DIV ID=\"" + this.CellLayerNamePrefix + "_" + i + "\" STYLE=\"width:" + nItemWidth + "px;\"";
				}
				sOut += " onMouseOver=\"" + this.ID + ".OnItemTD(" + this.MenuItemArr[i][0].Level + ", '', " + i + ", '" + this.MenuItemArr[i][0].ClassNameBGMouseOver + "', '" + this.MenuItemArr[i][0].ClassNameBGMouseOut + "', '" + this.MenuItemArr[i][0].ClassNameFGMouseOver + "', '" + this.MenuItemArr[i][0].ClassNameFGMouseOut + "');\"";
				sOut += " onMouseOut=\"" + this.ID + ".OffItemTD(" + this.MenuItemArr[i][0].Level + ", '', " + i + ");\"";
				sOut += " CLASS=\"" + this.MenuItemArr[i][0].ClassNameBGMouseOut + "\">";
				sOut += "<A NAME=\"" + this.AnchorNamePrefix + "_" + i + "\"";
				sOut += " CLASS=\"" + this.MenuItemArr[i][0].ClassNameFGMouseOut + "\"";
				sOut += " HREF=\"" + this.MenuItemArr[i][0].HRef + "\">" + this.MenuItemArr[i][0].Name + "</A>";
				if( document.layers ){
					sOut += "</LAYER></ILAYER>";
				} else {
					sOut += "</DIV>";
				}
				sOut += "</TD>";
			}
		}
		sOut += "</TR>";
		sOut += "<TR>";
		for( var i in this.MenuItemArr ){
			if( i != 0 &&
				this.MenuItemArr[i][0] != null ){
				sOut += "<TD Ailign=\"left\" vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
			}
		}
		sOut += "</TR>";
		sOut += "</TABLE>";
		document.writeln( sOut );
	}

	this.GetMainMenuIDH = function GetMainMenuIDH( sImgDir ){
		var sOut = "";
		sOut += "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">";
		sOut += "<TR>";
		for( var i in this.MenuItemArr ){
			if( i != 0 &&
				this.MenuItemArr[i][0] != null ){
				sOut += "<TD>";
				sOut += "<A NAME=\"" + this.AnchorNamePrefix + "_" + i + "\"";
				sOut += " HREF=\"" + this.MenuItemArr[i][0].HRef + "\"";
				sOut += " onMouseOver=\"" + this.ID + ".OnItemIDH(" + this.MenuItemArr[i][0].Level + ", '', " + i + ", '" + this.MenuItemArr[i][0].ImageFilePathMouseOver + "', '" + this.MenuItemArr[i][0].ImageFilePathMouseOut + "', '" + this.MenuItemArr[i][0].ImageFilePathMouseOn + "');\"";
				sOut += " onMouseOut=\"" + this.ID + ".OffItemID(" + this.MenuItemArr[i][0].Level + ", '', " + i + ");\">";
				sOut += "<IMG";
				sOut += " NAME=\"" + this.ImageNamePrefix + "_" + i + "\"";
				sOut += " SRC=\"" + this.MenuItemArr[i][0].ImageFilePathMouseOut + "\" BORDER=\"0\"";
				sOut += " ALT=\"" + this.MenuItemArr[i][0].Name  + "\">";
				sOut += "</A>";
				sOut += "</TD>";
			}
		}
		sOut += "</TR>";
		//sOut += "<TR>";
		//for( var i in this.MenuItemArr ){
			//if( i != 0 &&
				//this.MenuItemArr[i][0] != null ){
				//sOut += "<TD Ailign=\"left\" vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
			//}
		//}
		//sOut += "</TR>";
		sOut += "</TABLE>";
		document.writeln( sOut );
	}

	this.GetSubMenuTD = function GetSubMenu( sImgDir, nItemWidth ){
		this.GetSubMenuLayersTD( sImgDir, "", this.MenuItemArr, this.SubMenuLayers, nItemWidth);
		this.GenSubMenuLayers( sImgDir, "", this.SubMenuLayers );
	}

	this.GetSubMenuID = function GetSubMenu( sImgDir ){
		this.GetSubMenuLayersID( sImgDir, "", this.MenuItemArr, this.SubMenuLayers );
		this.GenSubMenuLayers( sImgDir, "", this.SubMenuLayers );
	}

	// get layers' HTML
	this.GetSubMenuLayersTD = function GetSubMenuLayersTD( sImgDir, sInSuffix, aInItemArr, aInLayerArr, nItemWidth ){
		var sLayer = "";
		for( var i in aInItemArr ){
			if( i != 0 && aInItemArr[i][0] != null ){
				if(aInItemArr[i][0].Name != ''){

					sLayer += "<TR>";
					sLayer += "<TD  class =\"TopSubMenu\"  WIDTH=\"" + nItemWidth + "\" bgcolor=\"#E8E8E8\" >";
					if( document.layers ){
						sLayer += "<ILAYER NAME=\"" + this.CellLayerNamePrefix + sInSuffix + "_" + i + "\"><LAYER  WIDTH=\"" + nItemWidth + "\"";
					} else {
						sLayer += "<DIV ID=\"" + this.CellLayerNamePrefix + sInSuffix + "_" + i + "\" STYLE=\" width:" + nItemWidth + "px;\"";
					}
					sLayer += " onMouseOver=\"" + this.ID + ".OnItemTD(" + aInItemArr[i][0].Level + ", '" + sInSuffix + "', " + i + ", '" + aInItemArr[i][0].ClassNameBGMouseOver + "', '" + aInItemArr[i][0].ClassNameBGMouseOut + "', '" + aInItemArr[i][0].ClassNameFGMouseOver + "', '" + aInItemArr[i][0].ClassNameFGMouseOut + "');\"";
					sLayer += " onMouseOut=\"" + this.ID + ".OffItemTD(" + aInItemArr[i][0].Level + ", '" + sInSuffix + "', " + i + ");\"";
					sLayer += " CLASS=\"" + aInItemArr[i][0].ClassNameBGMouseOut + "\">";

					sLayer += "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" WIDTH=\"100%\">";
					sLayer += "<TR>";
					sLayer += "<TD vAlign=\"top\" colspan=\"2\"><IMG NAME=\"" + this.LayerSpacerPrefix + sInSuffix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"2\" HEIGHT=\"3\"></TD>";
					sLayer += "</TR>";
					sLayer += "<TR>";
					sLayer += "<TD vAlign=\"top\"width=\"10\"><IMG NAME=\"" + this.LayerSpacerPrefix + sInSuffix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"10\" HEIGHT=\"3\"></TD>";
					sLayer += "<TD >";


					if ( aInItemArr[i].length >1 )
					{
						sLayer += "<A NAME=\"" + this.AnchorNamePrefix + sInSuffix + "_" + i + "\"";
						sLayer += " CLASS=\"" + aInItemArr[i][0].ClassNameFGMouseOut + "\"";
						if(aInItemArr[i][0].Target=='1'){
							sLayer += " target=\"_blank\"";
						}
						sLayer += " HREF=#>" + aInItemArr[i][0].Name + "</A>";
						sLayer += "</TD>";
						sLayer += "<TD width ='10' align=\"left\" valign=\"center\"><img SRC=\"" + sImgDir + "/layer_dot.gif\" border =0></TD>";
					}
					else
					{
						sLayer += "<A NAME=\"" + this.AnchorNamePrefix + sInSuffix + "_" + i + "\"";
						sLayer += " CLASS=\"" + aInItemArr[i][0].ClassNameFGMouseOut + "\"";
						if(aInItemArr[i][0].Target=='1'){
							sLayer += " target=\"_blank\"";
						}
						sLayer += " HREF=\"" + aInItemArr[i][0].HRef + "\">" + aInItemArr[i][0].Name + "</A>";
						sLayer += "</TD>";
					}

					sLayer += "</TR>";
					sLayer += "<TR>";
					sLayer += "<TD vAlign=\"top\"width=\"10\"><IMG NAME=\"" + this.LayerSpacerPrefix + sInSuffix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"10\" HEIGHT=\"3\"></TD>";

					sLayer += "</TABLE>";


					if( document.layers ){
						sLayer += "</LAYER></ILAYER>";
					} else {
						sLayer += "</DIV>";
					}
					sLayer += "</TD>";
					sLayer += "<TD vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + sInSuffix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"0\" HEIGHT=\"0\"></TD>";
					sLayer += "</TR>";
					// menu layers of sub items
					aInLayerArr[i] = new Array();
					this.GetSubMenuLayersTD( sImgDir, sInSuffix + "_" + i, aInItemArr[i], aInLayerArr[i], nItemWidth );
				}
			}
		}
		if( sLayer != "" ) aInLayerArr[0] = "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">" + sLayer + "</TABLE>";
	}

	// get layers' HTML
	this.GetSubMenuLayersID = function GetSubMenuLayersID( sImgDir, sInSuffix, aInItemArr, aInLayerArr ){
		var sLayer = "";
		for( var i in aInItemArr ){
			if( i != 0 &&
				aInItemArr[i][0] != null ){
				sLayer += "<TR>";
				sLayer += "<TD>";
				sLayer += "<A NAME=\"" + this.AnchorNamePrefix + sInSuffix + "_" + i + "\"";
				sLayer += " HREF=\"" + aInItemArr[i][0].HRef + "\"";
				sLayer += " onMouseOver=\"" + this.ID + ".OnItemIDV(" + aInItemArr[i][0].Level + ", '" + sInSuffix + "', " + i + ", '" + aInItemArr[i][0].ImageFilePathMouseOver + "', '" + aInItemArr[i][0].ImageFilePathMouseOut + "');\"";
				sLayer += " onMouseOut=\"" + this.ID + ".OffItemID(" + aInItemArr[i][0].Level + ", '" + sInSuffix + "', " + i + ");\">";
				sLayer += "<IMG";
				sLayer += " NAME=\"" + this.ImageNamePrefix + sInSuffix + "_" + i + "\"";
				sLayer += " SRC=\"" + aInItemArr[i][0].ImageFilePathMouseOut + "\" BORDER=\"0\"";
				sLayer += " ALT=\"" + aInItemArr[i][0].Name  + "\">";
				sLayer += "</A>";
				sLayer += "</TD>";
				sLayer += "<TD vAlign=\"top\"><IMG NAME=\"" + this.LayerSpacerPrefix + sInSuffix + "_" + i + "\" SRC=\"" + sImgDir + "/spacer.gif\" WIDTH=\"1\" HEIGHT=\"1\"></TD>";
				sLayer += "</TR>";
				// menu layers of sub items
				aInLayerArr[i] = new Array();
				this.GetSubMenuLayersID( sImgDir, sInSuffix + "_" + i, aInItemArr[i], aInLayerArr[i] );
			}
		}
		if( sLayer != "" ) aInLayerArr[0] = "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">" + sLayer + "</TABLE>";
	}

	// generate layers
	this.GenSubMenuLayers = function GenSubMenuLayers( sImgDir, sInSuffix, aInLayerArr ){
		for( var i in aInLayerArr ){
			if( i != 0 &&
				aInLayerArr[i][0] != null ){
				if( document.layers ){
					document.writeln("<LAYER NAME=\"" + this.LayerNamePrefix + sInSuffix + "_" + i + "\" VISIBILITY=\"hide\" Z-INDEX=\"2\">" +
						aInLayerArr[i][0] + "</LAYER>");
				} else {
					document.writeln("<DIV ID=\"" + this.LayerNamePrefix + sInSuffix + "_" + i + "\" STYLE=\"position:absolute; z-index:3; visibility: hidden; left: 0; top: 0\">" +
						aInLayerArr[i][0] + "</DIV>");
				}
				this.GenSubMenuLayers( sImgDir, sInSuffix + "_" + i, aInLayerArr[i] );
			}
		}
	}

	// onmouseover event handler
	this.OnItemTD = function OnItemTD( nInLevel, sInSuffix, nInIndex, sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut ){
		clearTimeout(this.MenuTimerID);
		if( this.VisItems[nInLevel] == null || (this.VisItems[nInLevel].Suffix != sInSuffix || this.VisItems[nInLevel].Index != nInIndex) ){
			for( var i in this.VisItems ){
				if( i >= nInLevel && this.VisItems[i] != null ){
					this.HideSubMenuLayer( this.VisItems[i] );
					AssignCSSClass(this.GetLinkObject(this.VisItems[i]), this.VisItems[i].ClassNameFGMouseOut);
					AssignCSSClass(this.GetCellLayerObject(this.VisItems[i]), this.VisItems[i].ClassNameBGMouseOut);
					this.VisItems[i] = null;
				}
			}
			this.VisItems[nInLevel] = new VisItemID( sInSuffix, nInIndex, '', '', '',sInClassNameBGMouseOver, sInClassNameBGMouseOut, sInClassNameFGMouseOver, sInClassNameFGMouseOut );
			this.ShowSubMenuLayerTD( this.VisItems[nInLevel] );
			AssignCSSClass(this.GetLinkObject(this.VisItems[nInLevel]), this.VisItems[nInLevel].ClassNameFGMouseOver);
			AssignCSSClass(this.GetCellLayerObject(this.VisItems[nInLevel]), this.VisItems[nInLevel].ClassNameBGMouseOver);
		}
	}

	// onmouseout event handler
	this.OffItemTD = function OffItemTD( nInLevel, sInSuffix, nInIndex ){
		this.MenuTimerID = setTimeout(this.ID + ".HideAllSubMenuItemsT()", 1000);
	}

	// onmouseover event handler
	this.OnItemIDV = function OnItemIDV( nInLevel, sInSuffix, nInIndex, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn ){
		clearTimeout(this.MenuTimerID);
		if( this.VisItems[nInLevel] == null || (this.VisItems[nInLevel].Suffix != sInSuffix || this.VisItems[nInLevel].Index != nInIndex) ){
			for( var i in this.VisItems ){
				if( i >= nInLevel && this.VisItems[i] != null ){
					this.HideSubMenuLayer( this.VisItems[i] );
					if ( i == 1 ){
						this.GetImgObject(this.VisItems[i]).src = this.VisItems[i].ImageFilePathMouseOut;
					}else{
						AssignCSSClass(this.GetLinkObject(this.VisItems[i]), this.VisItems[i].ClassNameFGMouseOut);
						AssignCSSClass(this.GetCellLayerObject(this.VisItems[i]), this.VisItems[i].ClassNameBGMouseOut);
					}
					this.VisItems[i] = null;
				}
			}
			this.VisItems[nInLevel] = new VisItemID(sInSuffix, nInIndex, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn, '', '', '', '' );
			this.ShowSubMenuLayerIDV( this.VisItems[nInLevel] );
			this.GetImgObject(this.VisItems[nInLevel]).src = this.VisItems[nInLevel].ImageFilePathMouseOver;

			if(contentLayerFlag){
				hide_content();
			}
		}
	}

	this.OnItemIDH = function OnItemIDH( nInLevel, sInSuffix, nInIndex, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn ){
		clearTimeout(this.MenuTimerID);
		if( this.VisItems[nInLevel] == null || (this.VisItems[nInLevel].Suffix != sInSuffix || this.VisItems[nInLevel].Index != nInIndex) ){
			for( var i in this.VisItems ){
//				if( i >= nInLevel && this.VisItems[i] != null && this.VisItems[i].ImageFilePathMouseOut != ""){
//					this.HideSubMenuLayer( this.VisItems[i] );
//					this.GetImgObject(this.VisItems[i]).src = this.VisItems[i].ImageFilePathMouseOut;
//					this.VisItems[i] = null;
//				}
				if( i >= nInLevel && this.VisItems[i] != null ){
					this.HideSubMenuLayer( this.VisItems[i] );
					if ( i == 1 ){
						this.GetImgObject(this.VisItems[i]).src = this.VisItems[i].ImageFilePathMouseOut;
					}else{
						AssignCSSClass(this.GetLinkObject(this.VisItems[i]), this.VisItems[i].ClassNameFGMouseOut);
						AssignCSSClass(this.GetCellLayerObject(this.VisItems[i]), this.VisItems[i].ClassNameBGMouseOut);
					}
					this.VisItems[i] = null;
				}
			}
			this.VisItems[nInLevel] = new VisItemID(sInSuffix, nInIndex, sInImageFilePathMouseOver, sInImageFilePathMouseOut, sInImageFilePathMouseOn );
			this.ShowSubMenuLayerIDH( this.VisItems[nInLevel] );
			this.GetImgObject(this.VisItems[nInLevel]).src = this.VisItems[nInLevel].ImageFilePathMouseOver;
		}
	}

	// onmouseout event handler
	this.OffItemID = function OffItemID( nInLevel, sInSuffix, nInIndex ){
		this.MenuTimerID = setTimeout(this.ID + ".HideAllSubMenuItemsI()", 1000);
	}

	// set layer position when shown
	this.ShowSubMenuLayerIDV = function ShowSubMenuLayerID( viInItem ){
		var oWinDim;
		var sLayerName;
		var oLayer;
		var sLayerParentName;
		var oLayerParent;
		var oStyle;
		var sItemName;
		var oItemImg;
		var oItemDim;
		var x, y;
		oWinDim = GetWindowSize();
		sLayerName = this.LayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		sLayerParentName = this.LayerNamePrefix + viInItem.Suffix;
		sItemName = this.ImageNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			oItemImg = document.images[sItemName];
			oLayer = document.all[sLayerName];
			oItemDim = GetDim( oItemImg );
			if( oLayer ) oStyle = oLayer.style;
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			oItemImg = document.layers[sLayerParentName].document.images[sItemName];
			oLayer = document.layers[sLayerName];
			oLayerParent = document.layers[sLayerParentName];
			if( oLayerParent ) oItemDim = {x:oItemImg.x + oLayerParent.left, y:oItemImg.y + oLayerParent.top};
			else oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			oItemImg = document.images[sItemName];
			oLayer = document.layers[sLayerName];
			oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( !document.all && document.getElementById && viInItem.Suffix != "" ){
			// ns6
			oItemImg = document.images[sItemName];
			oLayer = document.getElementById(sLayerName);
			oLayerParent = document.getElementById(sLayerParentName);
			if( oLayerParent ) oItemDim = {x:oItemImg.x + parseInt(oLayerParent.style.left), y:oItemImg.y + parseInt(oLayerParent.style.top)};
			else oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer.style;
		} else if( !document.all && document.getElementById && viInItem.Suffix == "" ){
			// ns6
			oItemImg = document.images[sItemName];
			oLayer = document.getElementById(sLayerName);
			oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer.style;
		}
		if( oLayer ){
			//if( y + oLayer.height > oWinDim.h ) y = oWinDim.h - oLayer.height;
			x = oItemDim.x + oItemImg.width;
			y = oItemDim.y;
			MoveDivs(oStyle, x , y);
			MM_showHideLayers( sLayerName, '', 'show' );
		}
	}

	this.ShowSubMenuLayerIDH = function ShowSubMenuLayerID( viInItem ){
		var sLayerName;
		var oLayer;
		var sLayerParentName;
		var oLayerParent;
		var oStyle;
		var sItemName;
		var oItemImg;
		var oItemDim;
		var x, y;
		sLayerName = this.LayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		sLayerParentName = this.LayerNamePrefix + viInItem.Suffix;
		sItemName = this.ImageNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			oItemImg = document.images[sItemName];
			oLayer = document.all[sLayerName];
			oItemDim = GetDim( oItemImg );
			if( oLayer ) oStyle = oLayer.style;
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			oItemImg = document.layers[sLayerParentName].document.images[sItemName];
			oLayer = document.layers[sLayerName];
			oLayerParent = document.layers[sLayerParentName];
			if( oLayerParent ) oItemDim = {x:oItemImg.x + oLayerParent.left, y:oItemImg.y + oLayerParent.top};
			else oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			oItemImg = document.images[sItemName];
			oLayer = document.layers[sLayerName];
			oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( !document.all && document.getElementById && viInItem.Suffix != "" ){
			// ns6
			oItemImg = document.images[sItemName];
			oLayer = document.getElementById(sLayerName);
			oLayerParent = document.getElementById(sLayerParentName);
			if( oLayerParent ) oItemDim = {x:oItemImg.x + parseInt(oLayerParent.style.left), y:oItemImg.y + parseInt(oLayerParent.style.top)};
			else oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer.style;
		} else if( !document.all && document.getElementById && viInItem.Suffix == "" ){
			// ns6
			oItemImg = document.images[sItemName];
			oLayer = document.getElementById(sLayerName);
			oItemDim = {x:oItemImg.x, y:oItemImg.y};
			if( oLayer ) oStyle = oLayer.style;
		}
		if( oLayer ){
			x = oItemDim.x;
			y = oItemDim.y + oItemImg.height;
			MoveDivs(oStyle, x , y);
			MM_showHideLayers( sLayerName, '', 'show' );
		}
	}

	// set layer position when shown
	this.ShowSubMenuLayerTD = function ShowSubMenuLayerTD( viInItem ){
		var sLayerName;
		var oLayer;
		var sLayerParentName;
		var oLayerParent;
		var oStyle;
		var sSpacerName;
		var oSpacerImg;
		var oSpacerDim;
		var x, y;
		sLayerName = this.LayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		sLayerParentName = this.LayerNamePrefix + viInItem.Suffix;
		sSpacerName = this.LayerSpacerPrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			oSpacerImg = document.images[sSpacerName];
			oLayer = document.all[sLayerName];
			oSpacerDim = GetDim( oSpacerImg );
			if( oLayer ) oStyle = oLayer.style;
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			oSpacerImg = document.layers[sLayerParentName].document.images[sSpacerName];
			oLayer = document.layers[sLayerName];
			oLayerParent = document.layers[sLayerParentName];
			if( oLayerParent ) oSpacerDim = {x:oSpacerImg.x + oLayerParent.left, y:oSpacerImg.y + oLayerParent.top};
			else oSpacerDim = {x:oSpacerImg.x, y:oSpacerImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			oSpacerImg = document.images[sSpacerName];
			oLayer = document.layers[sLayerName];
			oSpacerDim = {x:oSpacerImg.x, y:oSpacerImg.y};
			if( oLayer ) oStyle = oLayer;
		} else if( !document.all && document.getElementById && viInItem.Suffix != "" ){
			// ns6
			oSpacerImg = document.images[sSpacerName];
			oLayer = document.getElementById(sLayerName);
			oLayerParent = document.getElementById(sLayerParentName);
			if( oLayerParent ) oSpacerDim = {x:oSpacerImg.x + parseInt(oLayerParent.offsetWidth) + parseInt(oLayerParent.offsetLeft) - 2, y:oSpacerImg.y + parseInt(oLayerParent.offsetTop)};
			else oSpacerDim = {x:oSpacerImg.x, y:oSpacerImg.y};
			if( oLayer ) oStyle = oLayer.style;
		} else if( !document.all && document.getElementById && viInItem.Suffix == "" ){
			// ns6
			oSpacerImg = document.images[sSpacerName];
			oLayer = document.getElementById(sLayerName);
			oSpacerDim = {x:oSpacerImg.x, y:oSpacerImg.y};
			if( oLayer ) oStyle = oLayer.style;
		}
		if( oLayer ){
			x = oSpacerDim.x;
			y = oSpacerDim.y;
			MoveDivs(oStyle, x , y);
			MM_showHideLayers( sLayerName, '', 'show' );
		}

		if(contentLayerFlag){
			hide_content();
		}
	}

	this.HideSubMenuLayer = function HideSubMenuLayer( viInItem ){
		MM_showHideLayers( this.LayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index, '', 'hide' );

		if(contentLayerFlag){
			show_content();
		}
	}

	this.HideAllSubMenuItemsT = function HideAllSubMenuItemsT(){
		for( var i in this.VisItems ){
			if( this.VisItems[i] != null ){
				if( i == 1 ){
					this.GetImgObject(this.VisItems[i]).src = this.VisItems[i].ImageFilePathMouseOut;
				}else{
					AssignCSSClass(this.GetLinkObject(this.VisItems[i]), this.VisItems[i].ClassNameFGMouseOut);
					AssignCSSClass(this.GetCellLayerObject(this.VisItems[i]), this.VisItems[i].ClassNameBGMouseOut);
				}

				this.HideSubMenuLayer( this.VisItems[i] );
				this.VisItems[i] = null;

			}
		}

	}

	this.HideAllSubMenuItemsI = function HideAllSubMenuItemsI(){
		for( var i in this.VisItems ){
			if( this.VisItems[i] != null && this.VisItems[i].ImageFilePathMouseOut !="" ){
				this.GetImgObject(this.VisItems[i]).src = this.VisItems[i].ImageFilePathMouseOut;
				this.HideSubMenuLayer( this.VisItems[i] );
				this.VisItems[i] = null;
			}
		}
		if(contentLayerFlag){
			show_content();
		}
	}

	this.GetImgObject = function GetImgObject(viInItem){
		var sImgName = this.ImageNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			return document.images[sImgName];
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			return document.layers[this.LayerNamePrefix + viInItem.Suffix].document.images[sImgName];
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			return document.images[sImgName];
		} else if( !document.all && document.getElementById ){
			// ns6
			return document.images[sImgName];
		}
	}

	this.GetCellLayerObject = function GetCellLayerObject(viInItem){
		var sCellLayerName = this.CellLayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			return document.all[sCellLayerName];
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			return document.layers[this.LayerNamePrefix + viInItem.Suffix].document.layers[sCellLayerName].document.layers[0];
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			return document.layers[sCellLayerName].document.layers[0];
		} else if( !document.all && document.getElementById ){
			// ns6
			return document.getElementById(sCellLayerName);
		}
	}

	this.GetLinkObject = function GetLinkObject(viInItem){
		var sAnchorName = this.AnchorNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		var sCellLayerName = this.CellLayerNamePrefix + viInItem.Suffix + "_" + viInItem.Index;
		if( document.all ){
			// ie
			var oAnchors = document.anchors;
			for( var i in oAnchors ){
				if(oAnchors[i].name == sAnchorName ){
					return oAnchors[i];
				}
			}
		} else if( document.layers && viInItem.Suffix != "" ) {
			// ns4
			var oAnchors = document.layers[this.LayerNamePrefix + viInItem.Suffix].document.layers[sCellLayerName].document.layers[0].document.anchors;
			return oAnchors[sAnchorName];
		} else if( document.layers && viInItem.Suffix == "" ) {
			// ns4
			var oAnchors = document.layers[sCellLayerName].document.layers[0].document.anchors;
			return oAnchors[sAnchorName];
		} else if( !document.all && document.getElementById ){
			// ns6
			return document.anchors[sAnchorName];
		}
	}

}

function AssignCSSClass(el, c){
	if( document.all ){
		// ie
		el.className = c;
	} else if( document.layers ) {
		// ns4
		for(var i in document.classes[c].all){
			NS4CSSAssign(el,i,document.classes[c].all[i]);
		}
	} else if( !document.all && document.getElementById ){
		// ns6
		el.className = c;
	}
}

function NS4CSSAssign(el, c, s){
	if( c == "backgroundColor"){
		el.bgColor = s;
	} else if( c == "fontSize"){
		el.fontSize = s;
	} else if( c == "color"){
		el.color = s;
	}
}

function GetDim(el){
	for (var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx,y:ly}
}

function GetWindowSize(){
	var lx = 0, lh = 0;
	if( window.innerWidth && window.innerHeight ) {
		// ns4, opera6, ns6+, etc
		lx = window.innerWidth;
		lh = window.innerHeight;
	} else if( document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight ) {
		// ie6+ in 'standards compliant mode'
		lx = document.documentElement.clientWidth;
		lh = document.documentElement.clientHeight;
	} else if( document.body && document.body.clientWidth && document.body.clientHeight ) {
		// ie4 compatible
		lx = document.body.clientWidth;
		lh = document.body.clientHeight;
	}
	return {x:lx,h:lh}
}

function MoveDivs(el, l, t){
	el.left = l;
	el.top = t;
}

// ----- ^ Dreamweaver Func ^ -----

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function hide_content(){
	if (document.all){
	 	if (document.all["content_layer"]!=null)
		{
			document.all["content_layer"].style.visibility = "hidden"
		}
	}

	if (document.layers){
		if (document.layers["content_layer"])
		{
			document.layers["content_layer"].visibility = "hide"
		}
	}

	if (!document.all && document.getElementById){
		if (document.getElementById("content_layer")!=null)
		{
			document.getElementById("content_layer").style.visibility = "hidden"
		}
	}
}

function show_content(){
	if (document.all){
		if (document.all["content_layer"]!=null)
		{
			document.all["content_layer"].style.visibility = "visible"
		}
	}
	if (document.layers){
		if (document.layers["content_layer"])
		{
			document.layers["content_layer"].visibility = "show"
		}
	}

	if (!document.all && document.getElementById){
		if (document.getElementById("content_layer")!=null)
		{
			document.getElementById("content_layer").style.visibility = "visible"
		}
	}
}

// ----- v Dreamweaver Func v -----
