// JavaScript Document
// to load page in active window
function goHRef(inLoc, inTarget) {
  if (inLoc!="none") {
    if (inTarget==1) {
      window.open(inLoc);
    }
    else {
      location.href=inLoc;
    }
  }
}
// inform user link is external, open in new window
// used in QuickAccess\Group Of Companies + QuickAccess\External Links
function goExternal(inLoc, inName) {
  if (inLoc!="none") {
	usrAccept=confirm("You have selected to view a page that is external to Hong Leong Assurance Berhad's website. This link will be opened in a new browser window.");
    if (usrAccept) {
      window.open(inLoc);
    }
  }
  if (inName!=0) {
    document.getElementById(inName).selectedIndex=0;
  }
}
// inform user application required, open in new window
function goNeedApp(inLoc, inApp) {
  if (inLoc!="none") {
    //if (inApp=="pdf") {
    //  showText="Adobe Acrobat Reader is required to read this file. If this application is not installed on your computer, please download it from the Adobe website (www.adobe.com).";
    //}
	//usrAccept=confirm(showText);
	usrAccept=1;
    if (usrAccept) {
      window.open(inLoc);
    }
  }
}
// to load page in a new window with predefined dimensions
function winpop(inLoc, inWidth, inHeight, inResize) {
  var tmp_scrollbar, tmp_options;
  if (inLoc!="") {
    if (isNaN(parseInt(inWidth))) {
	  inWidth=500;
	}
    if (isNaN(parseInt(inHeight))) {
	  inHeight=500;
	}
    if (inResize==1) {
	  tmp_scrollbar="yes";
	  inResize="yes";
	} else {
	  tmp_scrollbar="no";
	  inResize="no";
	}
	tmp_options = "scrollbars="+tmp_scrollbar+",menubar=no,width="+inWidth+",height="+inHeight+",resizable="+inResize+",toolbar=no,location=no,status=yes";
    window.open(inLoc,'',tmp_options);
  }
}
//-----------------------------------------------------------------------------------------------
// change table.cell colour
function hiliteCell(inObj, inColor) {
  document.getElementById(inObj).bgColor=inColor;
}
//toggle portion of display
function toggleDisplay(inID) {
  var tmp01;
  tmp01=document.getElementById(inID).style.display;
  if (tmp01=="none") {
    document.getElementById(inID).style.display="";
  } else {
    document.getElementById(inID).style.display="none";
  }
}
//hide portion of display
function hideDisplay(inID) {
  document.getElementById(inID).style.display="none";
}
//show portion of display
function showDisplay(inID) {
  document.getElementById(inID).style.display="";
}
//toggle FAQ display
function toggleFAQ(inID, inCell) {
  var tmp01;
  tmp01=document.getElementById(inID).style.display;
  if (tmp01=="none") {
    document.getElementById(inID).style.display="";
	hiliteCell(inCell,'#EEEEEE');
	document.getElementById("ico_"+inID).src="/images/icon_collapse.png";
  } else {
    document.getElementById(inID).style.display="none";
	hiliteCell(inCell, '');
	document.getElementById("ico_"+inID).src="/images/icon_expand.png";
  }
}
//toggle Glossary display
function toggleGlossary(inID, inCell) {
  var tmp01;
  tmp01=document.getElementById(inID).style.display;
  if (tmp01=="none") {
    document.getElementById(inID).style.display="";
	hiliteCell(inCell,'#EEEEEE');
  } else {
    document.getElementById(inID).style.display="none";
	hiliteCell(inCell, '');
  }
}
//-----------------------------------------------------------------------------------------------
// rollover image, with checking for selected image
function swapImg_prod(inID, currHilite) {
  var cellImg;
  if (document.getElementById(currHilite).value!=inID) {
    cellImg=document.getElementById(inID).src;
    if (cellImg.indexOf("00") > -1) {
      document.getElementById(inID).src=cellImg.replace("00","01");
    } else {
      if (cellImg.indexOf("01") > -1) {
        document.getElementById(inID).src=cellImg.replace("01","00");
      }
    }
  }
}
// displays product listing of selected product category
// returns status to Default when selected product category is selected again
// used in Our Products/You & Your Loved Ones section
function selectProduct(inID, currHilite) {
  var cell02, cellImg, cellHilite;
  cellHilite=document.getElementById(currHilite);
  if (cellHilite.value!=inID) {
    if (cellHilite.value!="none") {
      cellImg=document.getElementById(cellHilite.value).src;
	  document.getElementById(cellHilite.value).src=cellImg.replace("01","00");
      document.getElementById(cellHilite.value+"_list").style.display="none";
      document.getElementById(cellHilite.value+"_descript").style.display="none";
      document.getElementById("pcat00_list").style.display="block";
	}
    document.getElementById("pcat00_list").style.display="none";
    document.getElementById(inID+"_descript").style.display="none";
    document.getElementById(inID+"_list").style.display="block";
	cellHilite.value=inID;
  }
  else {
    cellImg=document.getElementById(cellHilite.value).src;
    document.getElementById(cellHilite.value+"_list").style.display="none";
    document.getElementById(cellHilite.value+"_descript").style.display="";
	cellHilite.value="none";
//    document.getElementById(cellHilite.value).src=cellImg.replace("01","00");
  }
}

function dispDescript(inID) {
  var cellHilite;
  cellHilite = document.getElementById("curr_hilite");
  if (cellHilite.value=="none") {
    document.getElementById("pcat00_list").style.display="none";
    document.getElementById(inID+"_descript").style.display="";
  } else {
    if (cellHilite.value!=inID) {
      document.getElementById(cellHilite.value+"_list").style.display="none";
      document.getElementById(inID+"_descript").style.display="";
	}
  }
  document.getElementById("disp").value = cellHilite.value;
}

function dispDescriptDefault() {
  var cellHilite;
  cellHilite = document.getElementById("curr_hilite");
  document.getElementById("pcat01_descript").style.display="none";
  document.getElementById("pcat03_descript").style.display="none";
  document.getElementById("pcat04_descript").style.display="none";
  document.getElementById("pcat05_descript").style.display="none";
  document.getElementById("pcat01_list").style.display="none";
  document.getElementById("pcat03_list").style.display="none";
  document.getElementById("pcat04_list").style.display="none";
  document.getElementById("pcat05_list").style.display="none";
  if (cellHilite.value=="none") {
    document.getElementById("pcat00_list").style.display="";
  } else {
    document.getElementById(cellHilite.value+"_list").style.display="";
  }
  document.getElementById("disp").value = cellHilite.value;
}
//-----------------------------------------------------------------------------------------------
// display selected management-team category
// used in About HLA/corporate profile/management team section
function showTable(in_tID, in_hideAll) {
  if (in_hideAll==1) {
    document.getElementById("bod").style.display="none";
    document.getElementById("corporate_office").style.display="none";
    //document.getElementById("division_life").style.display="none";
    //document.getElementById("division_general").style.display="none";
    //document.getElementById("division_sharedsvc").style.display="none";
  }
  document.getElementById(in_tID).style.display="block";
}
//-----------------------------------------------------------------------------------------------
// toggle display of panel workshops listing : by state
function display_panellisting(inObj) {
	var currToggle;
	currToggle = document.getElementById(inObj).style.display;
	if (currToggle == "none") {
		document.getElementById(inObj).style.display="block";
	} else {
		document.getElementById(inObj).style.display="none";
	}
}
//-----------------------------------------------------------------------------------------------

function showLayer(inObj, inXLoc, inYLoc, inDisplayBox) {
  var inDicator, popBox;
  inDicator=document.getElementById(inObj);
  inDicator.style.left=inXLoc;
  inDicator.style.top=inYLoc;
  inDicator.style.visibility="visible";
  popBox=document.getElementById(inDisplayBox);
  popBox.style.left=inXLoc + 40;
  popBox.style.top=inYLoc - 50;
  popBox.style.visibility="visible";
}

function hideLayer(inObj, inDisplayBox) {
  var inDicator, popBox;
  inDicator=document.getElementById(inObj);
  inDicator.style.visibility="hidden";
  //inDicator.style.left=-10;
  //inDicator.style.top=-10;
  popBox=document.getElementById(inDisplayBox);
  popBox.style.visibility="hidden";
}
//-----------------------------------------------------------------------------------------------
// From Dreamweaver
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_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];}
}