//-- start code to include tce survey js file
document.write('<script src="http://welcome.hp-ww.com/cma/metrics/survey/ap_hho.js"><\/script>');
//-- end code to include TCE survey js file


function printerfriendly()
{
	document.write ("<img src=\"http://welcome.hp-ww.com/img/hpweb_1-2_prnt_icn.gif\" width=\"19\" height=\"13\" alt=\"\" border=\"0\"><a href=\"http://www.hp.com/cgi-bin/pf-new.cgi?IN=" + location.href + "\" class=\"udrlinebold\">可打印版本</a>");
}

function compaq_printerfriendly()
{
	document.write ("<img src=\"http://welcome.hp-ww.com/img/cpq_topnav_print_icon.gif\" width=\"14\" height=\"13\" alt=\"printable version\" border=\"0\"><img src=\"http://welcome.hp-ww.com/img/s.gif\" width=\"3\" height=\"1\" border=\"0\" alt=\"\"><a href=\"http://www.hp.com/cgi-bin/pf-new.cgi?in=" + location.href + "\" class=\"cpqUdrlinebold\">printable version</a>");
}

function popup(url,wh,ht) {
	win = open (url, 'popup', 'height='+ht+',width='+wh+',scrollbars=yes,toolbars=no,left=0,top=0');
	win.focus();
}

function outofsite(url,cty)
{
	window.location.href="outofsite.asp?url=" + url + "&cty=" + cty;
}


// Randomiser Advertisement on right nav

var rnd_general = new Array();

rnd_general[1] = "http://welcome.hp-ww.com/img/s.gif; ; ";
rnd_general[2] = "http://welcome.hp-ww.com/img/s.gif; ; ";
rnd_general[3] = "http://welcome.hp-ww.com/img/s.gif; ; ";
rnd_general[4] = "http://welcome.hp-ww.com/img/s.gif; ; ";

function randomizer(category) {
	rndimagenum = Math.ceil(Math.random() * (eval("rnd_" + category + ".length") - 1));
	eval ("items = rnd_" + category + "[" + rndimagenum + "].split(';');");
	rndimage = items[0];
	imgalttext = items[1];
	imglink = items[2];
	document.write("<a href='" + imglink + "'><img src='" + rndimage + "' alt='" + imgalttext + "' border=0></a>");
}

// ROTATING HOME PROMOTION GRAPHICS

var totalpics = 1; // ALWAYS total number of pics - 1
var ct1 = 0;  // column 1 counter to start at 0

var ad1 = new Array(); // array of images for column 1
ad1[0]="/images_oov/chiclet_australia.jpg";
ad1[1]="/images_oov/chiclet_promo.jpg";

var ad1url = new Array(); // array of urls for column1, the url order follows ada order
ad1url[0]="/bigbang/luckydraw.asp"
ad1url[1]="/promotions.asp"

var url1 = ad1url[0];

// Start Rotating Images in each column

// Rotating Column 1 graphics
function cyclec1() {
/*
	if (document.images) {
		if (document.promo1.complete) {
			
			document.promo1.src=ad1[ct1];
			url1 = ad1url[ct1];
			if (ct1==totalpics) {
				ct1=0;
			}
			else {
				ct1++;
			}
		}
		setTimeout("cyclec1()", 5000);
	}
*/
}

// Putting Column 1 graphics url
function geturl1() {
	if (!url1.indexOf("http://")) {
		if(url1==ad1url[1])
		window.open(url1);
		else
		{
		parent.location.href=url1;
		}
	}
	else {
		parent.location.href = url1;
	}
}


function jump() 
{
//	var index = document.dropdown.language.selectedIndex;
//	url = eval("document.dropdown.language.options[" + index + "].value");
//	window.location.href=(url);

	var index = document.dropdown.language.selectedIndex;
	var path = location.pathname;
	var url = "";

	if (path.search(/en/) == -1)
		url = path.replace("/zh/","/en/");
	else
		url = path.replace("/en/","/zh/");
				
	window.location.href=(url);
}


function openWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

var rnd_browsebuy = new Array();
rnd_browsebuy[1] = "<a href='http://h50055.www5.hp.com/ipg/supplies/hk/eng/print_efficiency.asp'><img src='/index/images_oov/hk/en/print_eff_chiclet_01.gif' width='148' height='110' border='0' alt='See how HP&acute;s competitive edge in efficiency can save you ink and money'></a>";
rnd_browsebuy[2] = "<a href='http://h50055.www5.hp.com/ipg/supplies/hk/eng/print_efficiency.asp'><img src='/index/images_oov/hk/en/print_eff_chiclet_02.gif' width='148' height='110' border='0' alt='Find out how efficient HP printing systems can save you ink and money'></a>";

function randomizer2(category) {
	rndimagenum = Math.ceil(Math.random() * (eval("rnd_" + category + ".length") - 1));
	eval ("items = rnd_" + category + "[" + rndimagenum + "];");
	rndswf = items;
	
	document.write(rndswf);
}


// functions for stripping title.
// used for dynamic tagging
function stripTitle() {
	var strToStrip = "HP香港家庭及個人辦公室 - 首頁";
	var title = document.title;
	
	var stripped = title.substring(strToStrip.length);
	
	if (stripped.indexOf("#")!=-1) {
		var temp = stripped.split("#");
		stripped = temp[0];
	}
	
	return stripped;
}


function retrieveLang() {
	if (document.getElementsByTagName){
		return window.document.documentElement.lang;
	}
}


function retrieveCty() {
	if (document.getElementsByTagName) {
		var metaTags=document.getElementsByTagName("META");
		var meta;

		for (var i=0; i<metaTags.length; i++) {
			if (metaTags[i].tagName == "META") {	
				meta = metaTags[i];
				if (meta.name == "target_country") {
					return meta.content.toLowerCase();
					}
			}
		}
	}
}


function mapFolderNumToName(folderNum) {
	var folderName = "";
	var url = document.URL.split('://');
	var temp = url[1].split('/');
	
	for (x=0; x<temp.length; ++x)
	{
		if(x==parseInt(folderNum)) {
			folderName = returnfoldervalue(temp[x]);
		}
	}
	
	if(!(folderName.length>0)) {
		folderName = "*";
	}
	
	return folderName;
}


function returnfoldervalue(valfolder)
{
	var pos_val=valfolder.indexOf('.');
	
	if(pos_val>0) {
		return(valfolder.substring(0, pos_val));
	} else {
		return(valfolder);
	}
}