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 bodyOnLoad() {
	document.getElementById("navCell"+sectionNum).className = "navCellSelected";
	if (subSectionNum!="") {
		document.getElementById("navCell"+subSectionNum).className = "navSubCellSelected";
		document.getElementById("sideNav"+subSectionNum).className = "lv2Selected";
	}
	if (subsubSectionNum!="") {
		document.getElementById("navCell"+subsubSectionNum).className = "navSubCellSelected";
		document.getElementById("sideNav"+subsubSectionNum).className = "lv3Selected";
	}
	if (subsubsubSectionNum!="") {
		document.getElementById("navCell"+subsubsubSectionNum).className = "navSubCellSelected";
		document.getElementById("sideNav"+subsubsubSectionNum).className = "lv4Selected";
	}
}

function winpopup(url) {
	popwin=window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600, height=600');
}

function navRolling(navNum, rollingOver){
	if (navNum!=sectionNum && navNum!=subSectionNum && navNum!=subsubSectionNum && navNum!=subsubsubSectionNum) {
		if (rollingOver) {
			document.getElementById("navCell"+navNum).style.backgroundColor = "#4a96aa";
			document.getElementById("navCell"+navNum).style.color = "#FFFFFF";
			if (navNum.length == 1) {
				document.getElementById("navCell"+navNum).style.backgroundImage = "url(images/main_nav_bullet_o.gif)";
			}
		} else {
			document.getElementById("navCell"+navNum).style.backgroundColor = "";
			document.getElementById("navCell"+navNum).style.color = "#3d3e41";
			if (navNum.length == 1) {
				document.getElementById("navCell"+navNum).style.backgroundImage = "url(images/main_nav_bullet.gif)";
			}
		}
	}
}


function mainHighlightRolling(tableNum, rollingOver){
	if (rollingOver) {
		document.getElementById("mainHighlight"+tableNum).style.backgroundPosition = "-500px 0px";
		document.getElementById("mainHighlight"+tableNum).style.cursor = "pointer";
		document.getElementById("mainHighlightTxt"+tableNum).style.color = "#48494d";
	} else {
		document.getElementById("mainHighlight"+tableNum).style.backgroundPosition = "0px 0px";
		document.getElementById("mainHighlight"+tableNum).style.cursor = "default";
		document.getElementById("mainHighlightTxt"+tableNum).style.color = "#FFFFFF";
	}
}


function hideAllSnav(menuLevel) {
	if (menuLevel <= 2){
		document.getElementById("snav1").style.visibility = "hidden";
		document.getElementById("snav2").style.visibility = "hidden";		
		document.getElementById("snav3").style.visibility = "hidden";
//		document.getElementById("navOutAreaTop").style.visibility = "hidden";
//		document.getElementById("navOutAreaBottom").style.visibility = "hidden";
//		document.getElementById("navOutAreaClick").style.visibility = "hidden";
	}
	if (menuLevel <= 3){
		document.getElementById("snav1_1").style.visibility = "hidden";
		document.getElementById("snav1_2").style.visibility = "hidden";
		document.getElementById("snav1_3").style.visibility = "hidden";
		document.getElementById("snav1_6").style.visibility = "hidden";

		document.getElementById("snav3_2").style.visibility = "hidden";
	}
	if (menuLevel <= 4){
		document.getElementById("snav1_1_4").style.visibility = "hidden";
	}
}

function showSnav(snavNum, hideMenuLevel) {
	hideAllSnav(hideMenuLevel);
	document.getElementById("snav"+snavNum).style.visibility = "visible";
//	document.getElementById("navOutAreaTop").style.visibility = "visible";
//	document.getElementById("navOutAreaBottom").style.visibility = "visible";
//	document.getElementById("navOutAreaClick").style.visibility = "visible";
}

function gen2x2List(theList) {
	document.writeln('<div class="table4">');
	document.writeln('<table width="100%" border="0" cellpadding="0" cellspacing="0">');
	
	for (i = 0; i < theList.length; i++) {
		if (i % 2 == 0) {
			document.writeln('<tr>');
		}
		document.writeln('<td align="left" valign="top"><table width="340" border="0" cellpadding="0" cellspacing="0"><tr>');
		document.writeln('<th align="left" valign="middle"><a href="' + theList[i][2] + '"><img src="images/icon_pdf.gif" border="0">&nbsp;&nbsp;' + theList[i][0] + '</a><br>');
		document.writeln('<span style="font-weight:normal">' + theList[i][1] + '</span></th>');
		document.writeln('</tr></table></td>');
		if (i % 2 == 1) {
			document.writeln('</tr>');
		}
	}
	document.writeln('</table>');
	document.writeln('</div>');
}

function genIndexNews(theList, numOfBlock) {
	for (i = 0; i < numOfBlock; i++) {
		document.writeln('<table border="0" cellspacing="0" cellpadding="1"><tr>');
		document.writeln('<td align="center" valign="middle"><img src="../images/blue_doubco_bullet.gif" width="5" height="5"></td>');
        document.writeln('<td class="mainNewsHeader"><a href="' + theList[i][2] + '">' + theList[i][0] + '</a></td>');
        document.writeln('</tr><tr><td>&nbsp;</td>');
        document.writeln('<td>' + theList[i][1] + '</td>');
        document.writeln('</tr></table>');
		document.writeln('<div class="hLine"><img src="images/spacer.gif" width="1" height="1"></div>');
	}
}

function changeLang(newLang) {
	newLang = '/' + newLang + '/';
	theUrl = new String(location.href);
	theUrl = theUrl.replace(/\/eng\//gi, newLang);
	theUrl = theUrl.replace(/\/tchi\//gi, newLang);
	theUrl = theUrl.replace(/\/schi\//gi, newLang);
	location.href = theUrl;
}