<!--

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
  var popWin = window.open(theURL,winName,features);
  popWin.focus();
}

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

function block(e) {
alert("Downloading of this image is not allowed");
return false;
}
function trap() {
if(document.images) {
document.images.logo.onmousedown = block;
}
}

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;
	}
}

function checkAlert() {
if (document.mailer.FirstName.value.length <= 0 || document.mailer.FirstName.value.substring(0,1) == " ")
{ alert ("Please input First Name");
document.mailer.FirstName.value = "";
document.mailer.FirstName.focus();
return false;}
if (document.mailer.FamilyName.value.length <= 0 || document.mailer.FamilyName.value.substring(0,1) == " ")
{ alert ("Please input Family Name");
document.mailer.FamilyName.value = "";
document.mailer.FamilyName.focus();
return false;}
if (document.mailer.EmailAddress.value.length <= 0 || document.mailer.EmailAddress.value.substring(0,1) == " ")
{
 alert ("Please input Email Address");
document.mailer.EmailAddress.value = "";
document.mailer.EmailAddress.focus();
return false;}
if (document.mailer.EmailAddress.value.indexOf("@") <= 0 || document.mailer.EmailAddress.value.indexOf(".") <= 0)
{
 alert ("Please input correct Email Address");
document.mailer.EmailAddress.value = "";
document.mailer.EmailAddress.focus();
return false;}
if (document.mailer.Category.value == "" ){
 alert ("Please select Category");
document.mailer.Category.value = "";
document.mailer.Category.focus();
return false;}
document.mailer.action = "mailto:";
mailtoandsubject = ((document.mailer.SubmitTo.value) + "?subject=" + document.mailer.subject.value);
document.mailer.action += mailtoandsubject;
setTimeout("alertmessage()", 5000);
return true;
}

function changeLanguage(newLanguage) {
   var curLoc = parent.location.href;
   
   var arrlen = 2;
   var arr = new Array(arrlen);
   arr[0] = "eng";
   arr[1] = "big5";
   
   // 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 navHighlight() { 
	if (mainSection == "energy") {
	   document.getElementById(mainSection).className = "energyMainSelected";
	}

	else if (mainSection == "retail") {
	   document.getElementById(mainSection).className = "retailMainSelected";
	}

	else if (mainSection == "property") {
	   document.getElementById(mainSection).className = "propertyMainSelected";
	}

	else if (mainSection == "telecom") {
	   document.getElementById(mainSection).className = "telecomMainSelected";
	}

	else if (mainSection == "ports") {
	   document.getElementById(mainSection).className = "portsMainSelected";
	}

	else if ((mainSection == "corpinfo") || (mainSection == "ir") || (mainSection == "media")){
	   document.getElementById(mainSection).className = "corporateMainDownArrow";
	}

	else {
	   document.getElementById(mainSection).className = "corporateMainSelected";
	}
}

function subNavHighlight() { 
	if (subSection != "") {
	   document.getElementById(subSection).className = "corporateSubSelected";
	}
}

function mouseOutCorpMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "corporateMain";
   } else {
      document.getElementById(sectionName).className = "corporateMainSelected";
   }
}

function mouseOutCorpMainDownArrow(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "corporateMain";
   } else {
      document.getElementById(sectionName).className = "corporateMainDownArrow";
   }
}

function mouseOutCorpSub(sectionName) {
   if (sectionName != subSection) {
      document.getElementById(sectionName).className = "corporateSub";
   } else {
      document.getElementById(sectionName).className = "corporateSubSelected";
   }
}

function mouseOutPortsMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "portsMain";
   } else {
      document.getElementById(sectionName).className = "portsMainSelected";
   }
}

function mouseOutTelecomMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "telecomMain";
   } else {
      document.getElementById(sectionName).className = "telecomMainSelected";
   }
}

function mouseOutPropertyMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "propertyMain";
   } else {
      document.getElementById(sectionName).className = "propertyMainSelected";
   }
}

function mouseOutRetailMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "retailMain";
   } else {
      document.getElementById(sectionName).className = "retailMainSelected";
   }
}

function mouseOutEnergyMain(sectionName) {
   if (sectionName != mainSection) {
      document.getElementById(sectionName).className = "energyMain";
   } else {
      document.getElementById(sectionName).className = "energyMainSelected";
   }
}

function printFriendlyEng()
{
	var curLoc = unescape(parent.location.href);	

	curLoc = curLoc.replace(/&/g, "%26");

	// Get the root location without "http://"
	var firstarr = curLoc.split("//");
	var nohttp = firstarr[1];

	// *************** live site ********************
	// Get the folder without "www.xxx.com"
   var linkarr = nohttp.split("/europe/");
   
   	var link = "";
	var bar = "";

   for (i = 1; i < linkarr.length; i++) {
	   if (i != 1) {
		   link = link + "/" + linkarr[i];
	   }
	   else {
		   link = link + linkarr[i];
	   }
   }

	if (mainSection == "ports") {
		bar = 2;
	} else if (mainSection == "telecom") {
		bar = 3;
	} else if (mainSection == "property") {
		bar = 4;
	} else if (mainSection == "retail") {
		bar = 5;
	} else if (mainSection == "energy") {
		bar = 6;
	} else {
		bar = 1;
	}

	window.open("http://www.hutchison-whampoa.com/NewsDIR/Print_europe?link=" + link + "&bar=" + bar, "friendly", "location=0,scrollbars=1,resizable=0,toolbar=0,status=0,menubar=1,directories=0,width=600,height=540,left=158,top=12");
	
}

function Launch(page) { 
	LeftPos=(screen.width)?(screen.width-590)/2:100;
	TopPos=(screen.height)?(screen.height-389)/2:100;
	OpenWin = this.open(page, "KS", "toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=590,height=389,left="+LeftPos+",top="+TopPos); 
}

function displayHomeBtn() {
   if (mainSection != "home") {
      document.write('<a href=../global/home.htm><img src=../images/global/global_home.gif alt=Home border=0 align=absmiddle></a><IMG src=../images/global/spacer.gif width=6 height=1>');
   }
}

function newWindow(strurl)
{
    window.open(strurl);
}
//-->