<!--

// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;

var currentYear = 2007;

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_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_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_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_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_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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function emailCheck(field) {
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@&_-.0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	hasAt = 0;
	hasDot = false;
	for (var i=0; i<field.value.length-1; i++) {
			if ((i >= 1) && (field.value.substring(i, i+1) == '@') && (field.value.substring(i+1, i+2) != '.')) // return true if it contains @ but not @.
				{
					hasAt = hasAt + 1;
				}
			if ((hasAt == 1) && (field.value.substring(i, i+1) == '.') && (i != field.value.length-1) && (field.value.substring(i+1, i+2) != '.') && (field.value.substring(i-1, i) != '.')) // return true if the pattern contains . after @ but not ..
				{
				hasDot = true;
				}
	}
	if ((hasAt == 1) && (hasDot) && (field.value.substring(field.value.length-1, field.value.length) != '.')) // return true if the pattern is *@*.*
	{
	}
	else 
	{
		ok = "no";
	}
	if (ok == "no") {
		/*alert("Sorry! Your email address is not valid!");
		field.focus();
		field.select();*/
		return false;
	}
	
	else
		return true;
}

function emailCheckBig5(field) {
	var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@&_-.0123456789";
	var ok = "yes";
	var temp;
	for (var i=0; i<field.value.length; i++) {
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") ok = "no";
	}
	hasAt = 0;
	hasDot = false;
	for (var i=0; i<field.value.length-1; i++) {
			if ((i >= 1) && (field.value.substring(i, i+1) == '@') && (field.value.substring(i+1, i+2) != '.')) // return true if it contains @ but not @.
				{
					hasAt = hasAt + 1;
				}
			if ((hasAt == 1) && (field.value.substring(i, i+1) == '.') && (i != field.value.length-1) && (field.value.substring(i+1, i+2) != '.') && (field.value.substring(i-1, i) != '.')) // return true if the pattern contains . after @ but not ..
				{
				hasDot = true;
				}
	}
	if ((hasAt == 1) && (hasDot) && (field.value.substring(field.value.length-1, field.value.length) != '.')) // return true if the pattern is *@*.*
	{
	}
	else 
	{
		ok = "no";
	}
	if (ok == "no") {
		alert("¹q¶l¦a§}¿ù»~¡I");
		field.focus();
		field.select();
		return false;
	}
}

function changeLanguage(newLanguage) {
   var curLoc = parent.location.href;
   
   var arrlen = 3;
   var arr = new Array(arrlen);
   arr[0] = "eng";
   arr[1] = "big5";
   arr[2] = "gb";

   // Get the new language index in the array first
   var newpos = -1;
   for (i = 0; i < arrlen; i++)
   {
   	if (arr[i] == newLanguage)
   	{
   		newpos = i;
   		break;	
   	}
   }
   
   // Get the old language index second
   var oldpos = -1;
   for (i = 0; i < arr.length; i++)
   {
   	tmplanguage = "/" + arr[i];
   	if (curLoc.indexOf(tmplanguage) > 0)
   	{
   		oldpos = i;
   		break;	
   	}
   }
   
   var tmplen = 0;
   if (oldpos != newpos)
   {
   	tmplanguage = "/" + arr[oldpos];
   	tmplen = tmplanguage.length;
   	var docPos = curLoc.indexOf(tmplanguage);
   }
   
   var pathPart = curLoc.substring(0, docPos+1);
   var docPart = curLoc.substring(docPos+tmplen);
   eval("parent.location='" + pathPart + newLanguage + docPart + "'");
}

function sectionhighlight() { 
	if (mainSection != "") {
	   document.getElementById("img" + mainSection).src = "../images/menu/" + mainSection + "_selected.gif";
	} 
}

function swapIM_onmouseout(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById("img" + sectionName).src = "../images/menu/" + sectionName + "_off.gif";
   } else {
	document.getElementById("img" + sectionName).src = "../images/menu/" + sectionName + "_selected.gif";
   }
}

function out_link(url){
	if (url != "") {
		window.open(url);
	}
}

function printFriendly() 
{
	var winLink = window.location.href;
	winLink = winLink.substring(7);
	var url = "../global/printVersion.php?file=" + winLink;
	window.open(url, 'printing', 'width=805,height=515,left=50,top=50,scrollbars=yes, menubar=yes');
}

var management_array = new Array;
var citizenship_overview_array = new Array;
var sfm_array = new Array;
var community_array = new Array;
var environment_array = new Array;
var people_array = new Array;
var cg_array = new Array;

management_array[0] = "directors";
management_array[1] = "senior";

citizenship_overview_array[0] = "policy";

sfm_array[0] = "shnr";
sfm_array[1] = "certification";
sfm_array[2] = "reforestation";

community_array[0] = "dialogue";
community_array[1] = "assistance";
community_array[2] = "infrastructure";
community_array[3] = "programs";
community_array[4] = "scholarship";

environment_array[0] = "woodresidue";
environment_array[1] = "responsibleproducts";
environment_array[2] = "wildlife";
environment_array[3] = "research";
//environment_array[4] = "water";

people_array[0] = "training";
people_array[1] = "healthsafety";

cg_array[0] = "codeconduct";
cg_array[1] = "committees";

function showlayer(txt)
{
	e = eval(txt + "_array");
	
	for (k=0; k<e.length; k++)
	{
		document.getElementById(e[k]).style.display = "block";
	}
}

function hidelayer(txt)
{

}

function display_milestone(no)
{
	for (k=1; k<=5; k++)
	{
		e = eval("document.getElementById('milestone_" + k + "')");
		
		if (k==no)
			e.style.display = "block";
		else
			e.style.display = "none";
	}
}

function winopen(url)
{
	window.open(url, 'newwin', 'width=700,height=500,left=50,top=50,scrollbars=yes, menubar=yes');	
}

function winopen2(url)
{
	window.open(url, 'newwin', 'width=700,height=600,left=50,top=50,scrollbars=yes, menubar=yes');	
}

function winopen_report(url)
{
	window.open(url, 'report', 'width=700,height=500,left=50,top=50,scrollbars=yes, menubar=no');	
}


function showmap(no)
{
	if (no==1)	
		document.getElementById("worldMap").src= "../images/aboutus/guyana.jpg";
	if (no==2)
		document.getElementById("worldMap").src= "../images/aboutus/china.jpg";
	if (no==3)
		document.getElementById("worldMap").src= "../images/aboutus/malaysia.jpg";
	if (no==4)
		document.getElementById("worldMap").src= "../images/aboutus/newzealand.jpg";
}

function showmap2(no)
{
	if (no==1)	
		document.getElementById("worldMap").src= "../images/business/guyana.jpg";
	if (no==2)
		document.getElementById("worldMap").src= "../images/business/china.jpg";
	if (no==3)
		document.getElementById("worldMap").src= "../images/business/malaysia.jpg";
	if (no==4)
		document.getElementById("worldMap").src= "../images/business/newzealand.jpg";
}

function changeyr(yr)
{
	for (k=2005; k<=currentYear; k++)
	{
		e = eval("document.getElementById('yearid_" + k + "')");
		
		if (k==yr)
			e.style.display = "block";
		else
			e.style.display = "none";
	}
}

function centerMenu() 
{
    //alert("load ... ");

	if (parseInt(navigator.appVersion) > 3) 
	{
		if (navigator.appName == "Netscape") 
		{
			//winW = (window.innerWidth/2)-225;
			winW =  (window.innerWidth - 770 ) / 2 ;
		}

		if (navigator.appName.indexOf("Microsoft") != -1) 
		{
			//winW = (document.body.offsetWidth/2)-229;
			winW =  ( document.body.offsetWidth - 770 ) / 2 ;
		}
		
        //winW -= 10;
        if ( winW <= 0 ) { winW = 0 ;  }

		var arr_subMenu = new Array
		var arr_subMenu2 = new Array
		var arr_subMenuWidth = 0
		//var arr_subMenuHeight = 0

        var curLoc = parent.location.href;
		
		if (curLoc.indexOf('/eng/') > 0 ) 
		{ 
		   //alert("eng") ;
		   if (curLoc.indexOf('/eng/index.htm') > 0)
		   {
			   	if (winW <= 0)
			   	{
					arr_subMenuWidth = 363
				}
				
				else
				{
					arr_subMenuWidth = 167			
				}
		   }
		   else
		   {
			   if (winW <= 0)
			   	{
					arr_subMenuWidth = 132		
				}
				
				else
				{
				   arr_subMenuWidth = winW+122
				}
		   }
		} 
		else 
		{ 
		  if ((curLoc.indexOf('/big5/index.htm') > 0) || (curLoc.indexOf('/gb/index.htm') > 0))
		   {
			   if (winW <= 0)
			   	{
					arr_subMenuWidth = 153			
				}
				
				else
				{
					arr_subMenuWidth = 167				
				}
		   }
		   else
		   {
			   if (winW <= 0)
			   	{
					arr_subMenuWidth = 153				
				}
				
				else
				{
				   arr_subMenuWidth = 157
				}
		   }
		}
	}
	
	else
		arr_subMenuWidth = 363;
	
	return arr_subMenuWidth;
}

function menu_centre()
{
	alert(centerMenu());
	document.getElementById("datacontainer").style.left = 0;
	document.getElementById("staticbuttons").style.left = 0;
}

function showhistory(no)
{
	document.getElementById("phase").src = "../images/about/phase" + no + ".gif";
	
	for (k=1; k<=5; k++)
	{
		e = eval("document.getElementById('div_phase_" + k + "')");
		
		if (k==no)
			e.style.display = "block";
		else
			e.style.display = "none";
	}
}

function change_businessmenu(sec, subsec)
{
	e = eval("document.getElementById('menu_" + sec + "')");	
	f = eval("document.getElementById('stroke_" + subsec + "')");
	g = eval("document.getElementById('a_" + subsec + "')");
	
	e.className = "business_menu_a2";
	f.src = "../images/business/brown_stroke.gif";
	g.className = "business_submenu_a2";
}

function showcsr(no)
{
	for (k=1; k<=3; k++)
	{
		e = eval("document.getElementById('csr_content_" + k + "')");
		f = eval("document.getElementById('csr_nav')");
		
		if (k==no)
		{
			e.style.display = "block";	
			f.src = "../images/csr/nav_" + k + ".gif";
		}
		else
		{
			e.style.display = "none";
		}
	}
}

function showactivity(no)
{
	act = new Array();
	act[0] = "sportsclub";
	act[1] = "dragonboat";
	act[2] = "annualdinner";
	act[3] = "corpchallenge";	
	act[4] = "basketballcompetition";
	act[5] = "bowlingfunday";
	act[6] = "midautumnfestival";
	act[7] = "footballcompetition";
	
	for (k=0; k<act.length; k++)
	{
		e = eval("document.getElementById('div_" + act[k] + "')");
		f = eval("document.getElementById('" + act[k] + "')");

		if (k==no)	
		{
			e.style.display = "block";
			f.src = "../images/careers/" + act[k] + "_on.gif";
		}
		else
		{
			e.style.display = "none";
			f.src = "../images/careers/" + act[k] + "_off.gif";
		}
	}
}

function showvalues(no)
{
	act = new Array();
	act[0] = "talent";
	act[1] = "uniqueness";
	act[2] = "nuturing";
	act[3] = "growth";
	act[4] = "teamspirit";
	act[5] = "empowerment";
	act[6] = "xylophone";
	act[7] = "appraisal";
	act[8] = "reward";
	act[9] = "motivation";
	act[10] = "success";
	
	for (k=0; k<act.length; k++)
	{
		e = eval("document.getElementById('div_" + act[k] + "')");
		f = eval("document.getElementById('" + act[k] + "')");

		if (k==no)	
		{
			e.style.display = "block";
			f.src = "../images/careers/" + act[k] + "_on.gif";
		}
		else
		{
			e.style.display = "none";
			f.src = "../images/careers/" + act[k] + "_off.gif";
		}
	}
}
//-->
