﻿// -------------------------------------------------------------    Variable for Common Function for Left Menu -----------------------------------------

var leftMenuSectionImageOut = ".gif";
var leftMenuSectionImageOver = "_over.gif";
var leftMenuName = "Menu";
var leftMenuImageName = "icon";
var layerCommonName = "Popup";
var leftMenuFlag = false;
var firstLayerFlag = false;
var firstLayerTimerID;
var activeLeftMenuID = "";
var mainTopicNo;
var mainTopic = selectedSection;

var arLayer = new Array()
var arLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for Left Menu -----------------------------------------
// -------------------------------------------------------------    Variable for Common Function for First Level Layers-----------------------------------------

var firstLayerImagesFlag = false;
var secondLayerFlag = false;
var activeFirstLayerImageID = "";
var activeSecondLayerID = "";
var secondLayerTimerID;
var subTopic = "";

var arSecondLayer = new Array()
var arSecondLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for First Level Layers -----------------------------------------

// -------------------------------------------------------------    Variable for Common Function for Second Level Layers-----------------------------------------

var secondLayerImagesFlag = false;
var thirdLayerFlag = false;
var activeSecondLayerImageID = "";
var activeThirdLayerID = "";
var thirdLayerTimerID;
var subSubTopic = "";

var arThirdLayer = new Array()
var arThirdLayer2 = new Array()

// -------------------------------------------------------------    End of Variable for Common Function for Second Level Layers -----------------------------------------
// -------------------------------------------------------------    Common Function for Left Menu -----------------------------------------

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 moveDivs(layerObj, inObjTop, inObjLeft){
layerObj.top  = inObjTop - 1;
//alert (typeOf());
layerObj.left  = inObjLeft;
}

var arLayerPos = new Array()
//arLayerPos[5] = 130;

function setLayerPosition()
{
/*		alert (arLayer);
	for (var i in arLayer)
	{
			 if(arLayerPos[arLayer2[i]]!=null)
			 {
	alert ("Inside the setLayerPosition -> arLayerPos[arLayer2[i]]");
				 if (document.all){moveDivs(document.all[arLayer[i]].style, arLayerPos[arLayer2[i]]);}
				 if (document.layers){moveDivs(document.layers[arLayer[i]], arLayerPos[arLayer2[i]]);}
				 if (!document.all && document.getElementById) {moveDivs(document.getElementById(arLayer[i]).style, arLayerPos[arLayer2[i]]);}
			}
			else
			{
				alert (leftMenuName);
				alert (arLayer2[i]);
				 if (document.all){moveDivs(document.all[arLayer[i]].style, getDim(document.images[leftMenuName+arLayer2[i]]).y+40, getDim(document.images[leftMenuName+arLayer2[i]]).x+9);}
				 if (document.layers){moveDivs(document.layers[arLayer[i]], document.images[leftMenuName+arLayer2[i]].y);}
				 if (!document.all && document.getElementById) {moveDivs(document.getElementById(arLayer[i]).style, document.images[leftMenuName+arLayer2[i]].y);}
			}
	}*/
	for (var i=0; i<8; i++)
	{
		 if (document.all){moveDivs(document.all['Popup0'+i].style, getDim(document.images['Menu'+i]).y+40, getDim(document.images['Menu'+i]).x);}
		 if (document.layers){moveDivs(document.layers['Popup0'+i], document.images['Menu'+i].y+40, document.images['Menu'+i].x);}
		 if (!document.all && document.getElementById) {moveDivs(document.getElementById('Popup0'+i).style, document.images['Menu'+i].y+40, document.images['Menu'+i].x);}
	}

} 

function doShowMenu(imgName)
{
	var iconNo = parseInt(imgName);
	(iconNo<8)?iconNo='0'+iconNo:iconNo=iconNo;
	if(mainTopic != imgName && !leftMenuFlag)
	//if(!leftMenuFlag)
	{
		document.images[leftMenuName+imgName].src=document.images[leftMenuName+imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		leftMenuFlag = true;
	}
	if (!firstLayerFlag)
	{
		MM_showHideLayers(layerCommonName+iconNo,'','show');
		firstLayerFlag=true;
	}
	activeLeftMenuID = imgName
}

function leftMenuMouseOver(imgName) 
{
	if (activeLeftMenuID == imgName)
	{
		if (firstLayerTimerID) clearTimeout(firstLayerTimerID);
		firstLayerTimerID = null;
	}
	else
	{
		if (firstLayerTimerID) clearTimeout(firstLayerTimerID);
		firstLayerTimerID = null;
		if (activeLeftMenuID!=""){doHideMenu(activeLeftMenuID);}
		doShowMenu(imgName)	
	}
}

function doHideMenu(imgName)
{
	var iconNo = parseInt(imgName);
	(iconNo<8)?iconNo='0'+iconNo:iconNo=iconNo;
	//if(true)
	if(mainTopic != imgName)
	{
		document.images[leftMenuName+imgName].src=document.images[leftMenuName+imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		leftMenuFlag = false;
	}
	if (firstLayerFlag)
	{
		MM_showHideLayers(layerCommonName+iconNo,'','hide')
		firstLayerFlag=false;
	}
	activeLeftMenuID = "";
}

function leftMenuMouseOut(imgName) {
	
	if (activeLeftMenuID == imgName)
	{
		firstLayerTimerID = setTimeout("doHideMenu('"+imgName+"')", 200);
	}
	else
	{
		doHideMenu(imgName);
	}
}

// -------------------------------------------------------------   End of Common Function for Left Menu -----------------------------------------

// -------------------------------------------------------------    Common Function for First Level Layers -----------------------------------------
function findHeightForLayer(layerObj, obj)
{
	var height = 0;
	var flag = true;
	for (i=0;i<layerObj.images.length;i++)
	{
		if (obj==layerObj.images[i].name)
		{flag = false;}
		if (flag)
		{height+=parseInt(layerObj.images[i].height);}
	}
	return height;
}

var arSecondLayerPos = new Array();

function setSecondLayerPosition()
{
	var tempwidth=157;
	var tempString='';
	for (var i in arSecondLayer)
	{
			 var tempLayer = arSecondLayer[i].substring(0, arSecondLayer[i].length-2)
			 var tempImage = leftMenuName+arSecondLayer2[i];
			 var tempImagePos = tempImage.indexOf("_")
			 tempImage = tempImage.substring(0, tempImagePos)
			 
			 var tempFirstNo = parseFloat(arSecondLayer[i].substring(arSecondLayer[i].length-4, arSecondLayer[i].length-2));
			 var tempSecondNo = parseFloat(arSecondLayer[i].substring(arSecondLayer[i].length-2, arSecondLayer[i].length));
			 if (arLayerPos[parseInt(tempFirstNo)] != null)
			 {
				if (arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)] != null)
				{
					if (document.all){moveDivs(document.all[arSecondLayer[i]].style, arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}
				 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}
				 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, arSecondLayerPos[parseInt(tempFirstNo)][parseInt(tempSecondNo)]);}	
				}
				else
				{
			 	if (langNo == 2 ){
					tempString = arSecondLayer2[i].substring(0,1);
					if (tempString=="0"){
						tempwidth = 150;
					} else if (tempString=="1"){
						tempwidth = 247;
					} else if (tempString=="2"){
						tempwidth = 329;
					} else if (tempString=="3"){
						tempwidth = 418;
					} else if (tempString=="4"){
						tempwidth = 523;
					} else if (tempString=="5"){
						tempwidth = 300;
					} else if (tempString=="6"){
						tempwidth = 380;
					}
				} else {
					tempString = arSecondLayer2[i].substring(0,1);
					if (tempString=="0"){
						tempwidth = 150;
					} else if (tempString=="1"){
						tempwidth = 242;
					} else if (tempString=="2"){
						tempwidth = 332;
					} else if (tempString=="3"){
						tempwidth = 423;
					} else if (tempString=="4"){
						tempwidth = 513;
					} else if (tempString=="5"){
						tempwidth = 283;
					} else if (tempString=="6"){
						tempwidth = 374;
					}
				}
					if (tempString =="6" || tempString == "5"){
						if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y-2, getDim(document.images[leftMenuName+arSecondLayer2[i]]).x-160);}
					} else {
						if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y-2, getDim(document.images[leftMenuName+arSecondLayer2[i]]).x+150);}
					}
				 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], arLayerPos[parseInt(tempFirstNo+150)] + findHeightForLayer(document.layers[tempLayer].document, leftMenuName+arSecondLayer2[i])+150);}
				 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, document.images[leftMenuName+arSecondLayer2[i]].y+113, document.images[leftMenuName+arSecondLayer2[i]].x+tempwidth);}	
				}
			 }
			 else
			 {
			 	if (langNo == 2 ){
					tempString = arSecondLayer2[i].substring(0,1);
					if (tempString=="0"){
						tempwidth = 150;
					} else if (tempString=="1"){
						tempwidth = 247;
					} else if (tempString=="2"){
						tempwidth = 329;
					} else if (tempString=="3"){
						tempwidth = 418;
					} else if (tempString=="4"){
						tempwidth = 523;
					} else if (tempString=="5"){
						tempwidth = 300;
					} else if (tempString=="6"){
						tempwidth = 380;
					}
				} else {
					tempString = arSecondLayer2[i].substring(0,1);
					if (tempString=="0"){
						tempwidth = 150;
					} else if (tempString=="1"){
						tempwidth = 242;
					} else if (tempString=="2"){
						tempwidth = 332;
					} else if (tempString=="3"){
						tempwidth = 423;
					} else if (tempString=="4"){
						tempwidth = 513;
					} else if (tempString=="5"){
						tempwidth = 283;
					} else if (tempString=="6"){
						tempwidth = 374;
					}
				}
				if (tempString == "6" || tempString == "5"){
				 	if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y-2, getDim(document.images[leftMenuName+arSecondLayer2[i]]).x-170);}
				} else {
				 	if (document.all){moveDivs(document.all[arSecondLayer[i]].style, getDim(document.images[leftMenuName+arSecondLayer2[i]]).y-2, getDim(document.images[leftMenuName+arSecondLayer2[i]]).x+150);}
				}
			 	if (document.layers){moveDivs(document.layers[arSecondLayer[i]], document.images[tempImage].y + findHeightForLayer(document.layers[tempLayer].document, leftMenuName+arSecondLayer2[i])+150);}
			 	if (!document.all && document.getElementById) {moveDivs(document.getElementById(arSecondLayer[i]).style, document.images[leftMenuName+arSecondLayer2[i]].y+113, document.images[leftMenuName+arSecondLayer2[i]].x+tempwidth);}	
			 }
	}
} 

function doShowLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, (layerName.length-2))
	var tempLayer = "";
	var tempImage = "";
	var tempPath = "";
	if(subTopic != imgName && !firstLayerImagesFlag)
	//if(!leftMenuFlag)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
			tempImage.src=tempImage.src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
		}
		else
//		alert (imgName);
		{document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)}
		
		firstLayerImagesFlag = true;
	}
	if (!secondLayerFlag )
	{
		MM_showHideLayers(layerName,'','show');
		secondLayerFlag =true;
	}
	activeFirstLayerImageID = imgName
	activeSecondLayerID = layerName
}

function firstLayerMouseOver(imgName, layerName) 
{
	if (activeFirstLayerImageID == imgName && activeSecondLayerID == layerName)
	{
		if (secondLayerTimerID) clearTimeout(secondLayerTimerID);
		secondLayerTimerID = null;
	}
	else
	{
		if (secondLayerTimerID) clearTimeout(secondLayerTimerID);
		secondLayerTimerID = null;
		if (activeFirstLayerImageID!=""){doHideLayer(activeFirstLayerImageID, activeSecondLayerID);}
		doShowLayer(imgName, layerName)	
	}
}

function doHideLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, layerName.length-2)
	var tempLayer = "";
	var tempImage = "";
	//if(true)
	if(subTopic != imgName)
	{
		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
			tempImage.src=tempImage.src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		else
		{document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)}
		
		firstLayerImagesFlag = false;
	}
	if (secondLayerFlag )
	{
		MM_showHideLayers(layerName,'','hide')
		secondLayerFlag =false;
	}
	activeFirstLayerImageID = "";
	activeSecondLayerID = "";
}

function firstLayerMouseOut(imgName, layerName) {
	
	if (activeFirstLayerImageID == imgName && activeSecondLayerID == layerName)
	{
		secondLayerTimerID = setTimeout("doHideLayer('"+imgName+"', '"+layerName+"')", 200);
	}
	else
	{
		doHideLayer(imgName, layerName);
	}
}

// -------------------------------------------------------------   End of Common Function for First Level Layers -----------------------------------------

// -------------------------------------------------------------    Common Function for Second Level Layers -----------------------------------------
function doShowSecondLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, (layerName.length-2))
	var tempLayer = "";
	var tempImage = "";
	var tempPath = "";
	if(subSubTopic != imgName && !secondLayerImagesFlag)
	//if(!leftMenuFlag)
	{
//		if(document.layers) //netscape 4.x version
//		{
//			tempLayer = document.layers[tempLayerName].document;
//			tempImage = tempLayer.images[imgName];
//			tempImage.src=tempImage.src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)
//		}
//		else
//		{document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOut, leftMenuSectionImageOver)}
		
		secondLayerImagesFlag = true;
	}
	if (!thirdLayerFlag )
	{
		MM_showHideLayers(layerName,'','show');
		thirdLayerFlag =true;
	}
	activeSecondLayerImageID = imgName
	activeThirdLayerID = layerName
}


function secondLayerMouseOver(imgName, layerName) 
{
	if (activeSecondLayerImageID == imgName && activeThirdLayerID == layerName)
	{
		if (thirdLayerTimerID) clearTimeout(thirdLayerTimerID);
		thirdLayerTimerID = null;
	}
	else
	{
		if (thirdLayerTimerID) clearTimeout(thirdLayerTimerID);
		thirdLayerTimerID = null;
		if (activeSecondLayerImageID!=""){doHideSecondLayer(activeSecondLayerImageID, activeThirdLayerID);}
		doShowSecondLayer(imgName, layerName)	
	}
}

function doHideSecondLayer(imgName, layerName)
{
	var tempLayerName = layerName.substring(0, layerName.length-2)
	var tempLayer = "";
	var tempImage = "";
	//if(true)
	if(subSubTopic != imgName)
	{
/*		if(document.layers) //netscape 4.x version
		{
			tempLayer = document.layers[tempLayerName].document;
			tempImage = tempLayer.images[imgName];
			tempImage.src=tempImage.src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)
		}
		else
		{document.images[imgName].src=document.images[imgName].src.replace(leftMenuSectionImageOver, leftMenuSectionImageOut)}
*/		
		secondLayerImagesFlag = false;
	}
	if (thirdLayerFlag )
	{
		MM_showHideLayers(layerName,'','hide')
		thirdLayerFlag =false;
	}
	activeSecondLayerImageID = "";
	activeThirdLayerID = "";
}

function secondLayerMouseOut(imgName, layerName) {
	
	if (activeSecondLayerImageID == imgName && activeThirdLayerID == layerName)
	{
		thirdLayerTimerID = setTimeout("doHideSecondLayer('"+imgName+"', '"+layerName+"')", 200);
	}
	else
	{
		doHideSecondLayer(imgName, layerName);
	}
}

// -------------------------------------------------------------   End of Common Function for Second Level Layers -----------------------------------------

//var left_menu_img_path='/file_manager/tc/../whp_images/whp_pl_template/left_menu/';
var topOffSet=163+8; //position + icon top
var leftOffSet=0;

function getHeadMenu(){
	document.writeln('<tr>');
	document.writeln('	<td>');
	document.writeln('		<table cellpadding="0" cellspacing="0" width="100%" border="0">');
	document.writeln('			<tr>');
	for (var i=0; i<MainSection[langNo].length; i++){
		var tempSelectedSection = i;
		(tempSelectedSection==parseInt(selectedSection))?isOver='_over':isOver='';
//		alert (selectedSection);
//		alert (i);
			//var j=i+1;
			document.writeln('				<td><a href="'+MainSection[langNo][i]+'" onMouseOut="leftMenuMouseOut(\''+i+'\')" onMouseOver="leftMenuMouseOver(\''+i+'\')"><img name="Menu'+i+'" border="0" src="../whp_images/whp_pl_template/c_nav_main_0'+i+isOver+'.gif" alt="'+MainTitle[langNo][i]+'"></a></td>');
	}
	if (langNo==2){
		document.writeln('				<td><IMG SRC="../whp_images/whp_pl_template/c_nav_main_08.gif" WIDTH=28 HEIGHT=40 ALT="" border="0"></td>');
	} else {
		document.writeln('				<td><IMG SRC="../whp_images/whp_pl_template/c_nav_main_08.gif" WIDTH=28 HEIGHT=40 ALT="" border="0"></td>');
	}
	document.writeln('			</tr>');
	document.writeln('		</table>');
	document.writeln('	</td>');
	document.writeln('</tr>');
}

function changeColor(td, font){
//	document.all[td].style.background = "#E50039";
	document.all[font].style.color = "#E50039";
}

function restoreColor(td, font){
//	document.all[td].style.background = "#E8E8E8";
	document.all[font].style.color = "#545454";
}

function getLayer()
{
	var scriptBuffer='';
	var isOver='';
	var iconNo = '';
	var subIconNo = '';
	
	for (var i=0; i<MainSection[langNo].length; i++){
	iconNo = parseInt(i);
//	iconNo = parseInt(j) + 1;
	(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
	arLayer[arLayer.length] = layerCommonName+iconNo;
	arLayer2[arLayer2.length] = j;
		if (document.layers)
			{document.writeln('<layer name="Popup0'+i+'" top=0 left=0 width=160 height=60 visibility="hide" onMouseOver="leftMenuMouseOver(\''+i+'\')" onMouseOut="leftMenuMouseOut(\''+i+'\')">');}
		else
			{document.writeln('<div id="Popup0'+i+'" style="position:absolute; left:0; top:0; width:160; height:60; z-index:2; visibility: hidden;">');}
		document.writeln('<table width="160" border="0" alt="" cellspacing="1" cellpadding="0" onMouseOver="leftMenuMouseOver(\''+i+'\')" onMouseOut="leftMenuMouseOut(\''+i+'\')" bgcolor="#9E9E9E">');
		for (var j=1; j< SubSection[langNo][i].length; j++) {
			subIconNo = parseInt(j);
			//(selectedSection==i && selectedSubSection==j)?isOver='layer_on':isOver='layer';
			(subIconNo<10)?subIconNo='0'+subIconNo:subIconNo=subIconNo;
			document.writeln('<tr><td><table cellpadding="2" cellspacing="0" border="0" width="100%">');
			document.writeln('<tr valign="top">');
			document.writeln('<td width="3" bgcolor="#E8E8E8"><img src="../whp_images/whp_pl_template/spacer.gif" width="3" height="1" border="0"></td>');
//alert (layerCommonName+iconNo+subIconNo);
			if (selectedSection==i && selectedSubSection==j){
				document.writeln('<td width="100%" class="layer_on" bgcolor="#E8E8E8"><a href="'+SubSection[langNo][i][j]+'" onmouseout="firstLayerMouseOut(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onmouseover="firstLayerMouseOver(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');"><img src="../whp_images/whp_pl_template/spacer.gif" width="100%" height="1" name="'+leftMenuName+i+'_'+j+'" border="0"><br><font color="#E50039">'+SubSectionTitle[langNo][i][j]+'</a></font></td>');
				if (SecondSubSection[langNo][i][j].length !=0){
					document.writeln('<td width="100%" class="layer_on" bgcolor="#E8E8E8" valign="middle"><a href="'+SubSection[langNo][i][j]+'" onmouseout="firstLayerMouseOut(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onmouseover="firstLayerMouseOver(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');"><img src="../whp_images/whp_pl_template/layer_dot.gif" hspace="2" alt="&gt;&gt;" border="0"></a></td>');
				}
			} else {
				document.writeln('<td width="100%" class="layer" id="td'+i+j+'" bgcolor="#E8E8E8"><a href="'+SubSection[langNo][i][j]+'" onmouseout="restoreColor(\'td'+i+j+'\', \'font'+i+j+'\'); firstLayerMouseOut(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onmouseover="changeColor(\'td'+i+j+'\', \'font'+i+j+'\');firstLayerMouseOver(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');"><img src="../whp_images/whp_pl_template/spacer.gif" width="100%" height="1" name="'+leftMenuName+i+'_'+j+'" border="0"><br><font id="font'+i+j+'" color="#545454">'+SubSectionTitle[langNo][i][j]+'<!-- <img src="../whp_images/whp_pl_template/spacer.gif" width="1" height="1" align="right" name="'+leftMenuName+i+'_'+j+'" border="0"> --></font></a></td>');
				if (SecondSubSection[langNo][i][j].length !=0){
//					alert ('langNo=' + langNo +', i=' + i + ', j=' + j);
					document.writeln('<td width="100%" class="layer_on" bgcolor="#E8E8E8" valign="middle"><a href="'+SubSection[langNo][i][j]+'" onmouseout="restoreColor(\'td'+i+j+'\', \'font'+i+j+'\'); firstLayerMouseOut(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onmouseover="changeColor(\'td'+i+j+'\', \'font'+i+j+'\');firstLayerMouseOver(\''+leftMenuName+i+'_'+j+'\', \''+layerCommonName+iconNo+subIconNo+'\');"><img src="../whp_images/whp_pl_template/layer_dot.gif" hspace="2" alt="&gt;&gt;" border="0"></a></td>');
				}
			}
			document.writeln('</tr>');
			document.writeln('</table></td></tr>');
		}
		document.writeln('</table>');
		if (document.layers)
			{document.writeln('</layer>');}
		else
		{document.writeln('</div>');}
	}	
}

function getSecondLayer()
{
	var scriptBuffer='';
	var isOver='';
	var iconNo = '';
	var subIconNo = '';
	var subSubIconNo = '';
	for (var j=0; j<MainSection[langNo].length; j++)
	{
		if (SubSection[langNo][j]!=null)
		{
			iconNo = parseInt(j);
			(iconNo<10)?iconNo='0'+iconNo:iconNo=iconNo;
			for (var k=0; k< SubSection[langNo][j].length; k++)
			{
				if (SecondSubSection[langNo][j][k]!=null)
				{
					subIconNo = parseInt(k);
					(subIconNo<10)?subIconNo='0'+subIconNo:subIconNo=subIconNo;
					arSecondLayer[arSecondLayer.length] = layerCommonName+iconNo+subIconNo;
					arSecondLayer2[arSecondLayer2.length] = j+'_'+k;
					if (document.layers)
					{document.writeln('<layer name='+layerCommonName+iconNo+subIconNo+' top=0 left='+(leftOffSet+160)+' width=160 height=58 visibility="hide" onMouseOver="leftMenuMouseOver(\''+j+'\');firstLayerMouseOver(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onMouseOut="leftMenuMouseOut(\''+j+'\');firstLayerMouseOut(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');">');}
					else
					{document.writeln('<div id="'+layerCommonName+iconNo+subIconNo+'" style="position:absolute; left:'+(leftOffSet+160)+'; top:0; width:160; height:58; z-index:2; visibility: hidden"> ');}
					document.writeln('<table width="160" border="0" cellspacing="1" cellpadding="0" bgcolor="#9E9E9E" onMouseOver="leftMenuMouseOver(\''+j+'\');firstLayerMouseOver(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');" onMouseOut="leftMenuMouseOut(\''+j+'\');firstLayerMouseOut(\''+leftMenuName+j+'_'+k+'\', \''+layerCommonName+iconNo+subIconNo+'\');">');
					for (var l in SecondSubSection[langNo][j][k])
					{
						subSubIconNo = parseInt(l);
						document.writeln('<tr><td><table cellpadding="2" cellspacing="0" border="0" width="100%">');
						document.writeln('<tr valign="top"><td width="3" bgcolor="#E8E8E8"><img src="../whp_images/whp_pl_template/spacer.gif" width="3" height="1" border="0"></td>');
						if (selectedSection==j && selectedSubSection==k&&selectedSecondSubSection==l) {
						document.writeln('<td width="150" class="layer_on" id="td'+j+k+l+'" bgcolor="#E8E8E8"><img src="../whp_images/whp_pl_template/spacer.gif" width="100%" height="1" name="-" border="0"><br><font color="#E50039">'+SecondSubSectionTitle[langNo][j][k][l]+'</font></td>');
						} else {
						document.writeln('<td width="150" class="layer" id="td'+j+k+l+'" bgcolor="#E8E8E8"><a href="'+SecondSubSection[langNo][j][k][l]+'" onmouseout="restoreColor(\'td'+j+k+l+'\', \'font'+j+k+l+'\'); secondLayerMouseOut(\''+leftMenuName+j+'_'+k+'_'+l+'\', \''+layerCommonName+iconNo+subIconNo+subSubIconNo+'\');" onmouseover="changeColor(\'td'+j+k+l+'\', \'font'+j+k+l+'\');secondLayerMouseOver(\''+leftMenuName+j+'_'+k+'_'+l+'\', \''+layerCommonName+iconNo+subIconNo+subSubIconNo+'\');"><img src="../whp_images/whp_pl_template/spacer.gif" width="100%" height="1" name="-" border="0"><br><font id="font'+j+k+l+'" color="#545454">'+SecondSubSectionTitle[langNo][j][k][l]+'</font></a></td>');
						}
						document.writeln('</tr>');
						document.writeln('</table></td></tr>');
					}
					
					document.writeln('</table>');		
			
					//Close Layer
					if (document.layers)
					{document.writeln('</layer>');}
					else
					{document.writeln('</div>');}
				}
			}
		}
	}
	
//	return scriptBuffer;
}

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; }
}

