	function startUp() {
		updateLinks();
		if (isInternetExplorer && !isPrinterFriendly()) {
			setContentWidth();
		}
	}
	
	window.onload = startUp;
	if (isInternetExplorer && !isPrinterFriendly()) {
		window.onresize = setContentWidth;
	}

	/** Standard popup window open
	 * The first parameter will be the new URL.
	 * Subsequent parameters will be (if supplied) the width and height.
	 * If not specified the width and height will be 500 and 200 respectively.
	 */
	function openWin()
	{
		var url, width=500, height=200, menu=""; args = arguments;
		url = args[0];
		if (args.length>1)
		{
			width=args[1];
		}
		if (args.length>2)
		{
			height=args[2];
		}
		if (args.length>3)
		{
			if (args[3])
			{
				menu=",menubar=yes,toolbar=yes";
			}
		}
		var newwin = window.open(url, 'newWin'+Math.floor(Math.random()*1000), 'width='+width+',height='+height+',scrollbars,resizable' + menu);
	}

    /** Standard popup window open
	 * The first parameter will be the new URL.
	 * Subsequent parameters will be (if supplied) the width and height.
	 * If not specified the width and height will be 500 and 200 respectively.
     'toolbar=no, directories=no, location=no,
  status=yes, menubar=no, resizable=no, scrollbars=no,
  width=300, height=200');
	 */
	function openCustomWin()
	{
		var url, width=500, height=200, toolbar=""; args = arguments; menubar="";scrollbars="";resizable="";screenX=200;screenY=200;
		url = args[0];
		if (args.length>1)
		{
			width=args[1];
		}
		if (args.length>2)
		{
			height=args[2];
		}
		if (args.length>3)
		{
			if (args[3])
			{
				toolbar="toolbar=yes";
			}
		}
        if (args.length>4)
		{
			if (args[4])
			{
				menubar="menubar=yes";
			}
		}
        if (args.length>5)
		{
			if (args[5])
			{
				scrollbars="scrollbars";
			}
		}
        if (args.length>6)
		{
			if (args[6])
			{
				resizable="resizable";
			}
		}
         if (args.length>7)
		{
			if (args[7])
			{
				screenX=args[7];
			}
		}
         if (args.length>8)
		{
			if (args[8])
			{
				screenY=args[8];
			}
		}

		var newwin = window.open(url, 'newWin', 'width='+width+',height='+height+','+toolbar+','+menubar+','+scrollbars+','+resizable+','+status+',screenX='+screenX+',screenY='+screenY);
	}

	function openNonEncodedUrlWin()
	{
		var url, width=500, height=200, menu=""; args = arguments;
		url = args[0];
		if (args.length>1)
		{
			width=args[1];
		}
		if (args.length>2)
		{
			height=args[2];
		}
		if (args.length>3)
		{
			if (args[3])
			{
				menu=",menubar=yes,toolbar=yes";
			}
		}

		var newwin = window.open(url, 'newWin', 'width='+width+',height='+height+',scrollbars,resizable' + menu);
	}
	
	function printPage() {
if (window.print)
    window.print()
	else
	alert( "Sorry, your browser doesn't support this feature. Please use the Print menu option of this browser to print the page. " );
	}
	
/*-- Back to Webpage --*/
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

/* Disable right-click */
function clickIE4(){
if (event.button==2){
//alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
//alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("return false")

	function isInternetExplorer() {
		return navigator.appName.indexOf("Microsoft") > -1;
	}
	
	function isPrinterFriendly() {
		var printFriendlyRegExp = /\/url\/printerFriendly\/[^\/]+\/on/;
		var url = window.location.href;
		
		return printFriendlyRegExp.test(url);
	}
	
	function setContentWidth() {
        	// Additional check to make sure we're in MSIE
		if (!isInternetExplorer) {
			return;
		}
		
		var winWidth = document.body.offsetWidth;
		
		if (winWidth < 790) {
			document.getElementById("header").style.width = "770px";
			document.getElementById("allSiteContent").style.width = "770px";
		} else {
			//document.getElementById("header").style.width = "100%";
			//document.getElementById("allSiteContent").style.width = "100%";
		}
	}


/*******************************************************************/
/*******************************************************************/

//*** navmenu ***//
ns6_index=0

function change(e){

if(!document.all&&!document.getElementById)
return

if (!document.all&&document.getElementById)
ns6_index=1

var source=document.getElementById&&!document.all? e.target:event.srcElement
if (source.className=="folding"){
var source2=document.getElementById&&!document.all? source.parentNode.childNodes:source.parentElement.all
if (source2[2+ns6_index].style.display=="none"){
source2[0].src="../images/leftnav_arrow_blue.gif"
source2[2+ns6_index].style.display=''
}
else{
source2[0].src="../images/shim.gif"
source2[2+ns6_index].style.display="none"
}
}
}
document.onclick=change

<!--
function openBox(url,w,h) {
		var thatWindow;
		if (thatWindow == null){
		thatWindow = window.open(url,thatWindow,'width='+w+',height='+h+',left=10,top=10,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
		}
		else if (thatWindow.closed){
		thatWindow = window.open(url,thatWindow,'width='+w+',height='+h+',left=10,top=10,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
		}
		thatWindow.focus();
}
function openWindow(url,w,h) {
		var thatWindow;
		if (thatWindow == null){
		thatWindow = window.open(url,thatWindow,'width='+w+',height='+h+',left=10,top=10,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		}
		else if (thatWindow.closed){
		thatWindow = window.open(url,thatWindow,'width='+w+',height='+h+',left=10,top=10,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no');
		}
		thatWindow.focus();
}

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 isNumeric(str) {
  var re = /^[\d\.]+$/;
  if (re.test(str)) {
  	return true;
  }
  return false;
}

function calculateBMI(formObj) {
	var weight;
	var height;
	var kg = formObj.kg.value;
	var lb = formObj.lb.value;
	var meter = formObj.meter.value;
	var feet = formObj.feet.value;
	var inch = formObj.inch.value;
	var error = 0;
	var result = 0;
	
	// Check value isNumeric
	if (formObj.weight[0].checked && formObj.height[0].checked) {
		if (!isNumeric(kg) || !isNumeric(meter)) {
			error = 1;
		}
	} else if (formObj.weight[0].checked && formObj.height[1].checked) {
		if (!isNumeric(kg) || !isNumeric(feet) || !isNumeric(inch)) {
			error = 1;
		}
	} else if (formObj.weight[1].checked && formObj.height[0].checked) {
		if (!isNumeric(lb) || !isNumeric(meter)) {
			error = 1;
		}
	} else if (formObj.weight[1].checked && formObj.height[1].checked) {
		if (inch.length == 0) {
			if (!isNumeric(lb) || !isNumeric(feet)) {
				error = 1;
			}
		} else {
			if (!isNumeric(lb) || !isNumeric(feet) || !isNumeric(inch)) {
				error = 1;
			}
		}
	}
	
	if (error == 1) {
		alert("你填上的體重及身高不正確");
	} else {
		if (formObj.weight[0].checked) {
			weight = parseFloat(formObj.kg.value);
		}
		if (formObj.weight[1].checked) {
			weight = parseFloat(formObj.lb.value);
//			weight = weight * 0.4536;   // Convert 1lb = 0.4536kg
			weight = weight / 2.2;	// Convert 1kg = 2.2lbs
		}
		if (formObj.height[0].checked) {
			height = parseFloat(formObj.meter.value);
		}
		if (formObj.height[1].checked) {
			height = (parseFloat(formObj.feet.value)*12) + parseFloat(formObj.inch.value);
			height = height / 0.394;   // Convert 1cm = 0.394 inch
			height = height / 100; // Convert from cm to meter
		}
		if (weight != "" && height != "") {
			result = weight / (height * height);
			result = Math.round(result * 10) / 10;  // Convert to decimal 1
			formObj.result.value = result;
		}
	}
}

function resetField (selectBox, field) {
	var selectObj = eval("document.form1." + selectBox);
	var j = selectObj.length;
	var textObj = eval("document.form1." + field);

	for (var i=0; i<j; i++) {
		if (selectObj[i].selected) {
			selectObj[i].selected = false;
		}
	}
	textObj.value = "";
}

function calculateCalorie (selectBox, field) {
	var selectObj = eval("document.form1." + selectBox);
	var result = 0;
	var textObj = eval("document.form1." + field);

	var j = selectObj.length;
	for (var i=0; i<j; i++) {
		if (selectObj[i].selected) {
			result += parseInt(selectObj[i].value);
		}
	}
	if (result) {
		textObj.value = result;
	}
}

function calculateTotalCalorie () {
	var total = 0;
	var subTotal = 0;

	for (i=1; i<=12; i++) {
		if (eval("document.form1.text" + i + ".value") != "") {
			subTotal = parseInt(eval("document.form1.text" + i + ".value"));
			total += subTotal;
		}
	}
	if (total) {
		document.form1.result.value = total;
	}
}
//-->