//var PIURL = "http://www.pacnet.com";
//var PIURL = "/";
var PIURL = "http://www.pacific.net.sg";
if(typeof ETHostURL == "undefined")
{
	var ETHostURL="";
}else{
	if(PIURL.toUpperCase()=="PI_URL")
	{
		var PIURL=ETHostURL;
	}
}
if(PIURL.toUpperCase() == "PI_URL")
{
	var PIURL="";
}
var FlashVers="";
var flash5Installed =false;
var flash6Installed =false;
var range,styleObj;
var a="a";
var NavArrow1=new Image();
var NavArrow2=new Image();
NavArrow1.src = PIURL+"articles/images/042004/attachments/IMAGEb6oAt_.gif";
NavArrow2.src = PIURL+"articles/images/042004/attachments/IMAGEb6oAt_.gif";
var backprop=".bgColor";
var docObj="document.layers.";
var docImg="document.images.";
var styleObj="";
var Nav4 = eval(document.layers);
var isIE40r5 = eval(document.all);
var ns6 = ((document.getElementById)&&(!document.all))?true:false;
var agt=navigator.userAgent.toLowerCase();
var isMac=(agt.indexOf("mac")!=-1);
var dtime,utime,vmid,oMid,oIid = null;
var PNV = false;
// to delay the mouseout for mainmenu
var dhid = 2500;
var dbhid = 300;
var dbsm = 100;
var currDat = new Date();
function init()
{
	setTimeout("window.onresize = redo", 1000);
}
if(ns6)
{
	docImg="document.images.";
	docObj="document.getElementById('";styleObj="').style";
}

if(isIE40r5)
{
	docObj="document.all.";
	range=".all";
	styleObj=".style";
	backprop=".background";
	docImg="";
	var is_ie5=(agt.indexOf("msie 5.0")!=-1);
}


function rsiz()
{
	if(Nav4)
	{
		var iw=window.innerWidth ;
		var ih = window.innerHeight;
		if(iw!=window.innerWidth||ih!=window.innerHeight)
		{
			if(isMac){
				window.setInterval(redo, 1000 );
			}else{
				redo();
			}
		}
	}
}
function redo(){window.location.reload();}

function GetScreenSize()
{
	if(!isIE40r5)
	{
		var widt = new String();
		if(window.innerWidth)
		{
			widt = eval(window.innerWidth);
		}else{
			eval(document.body.clientWidth);
		}
	return widt;
	}
}

function SetDivWidth()
{
	var realwidth = GetScreenSize();
	if(!isIE40r5)
	{
		eval(docObj + "buttonMenuRow" + styleObj + ".width ='" + realwidth + "'");
	}
}

function LayerReference(layer)
{
	var ref;
	while(layer.parentLayer)
	{
		var layerref ="document.layers." + layer.name;
		if(ref != null)
		{
			ref = layerref + "." + ref;
		}else{
			ref = layerref;
		}
		layer = layer.parentLayer;
	}
	return ref;
}

function MouseOverMenu(obj,type,bgcolor,menuId,color,left)
{
	if (menuId == 1)
	{
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE40ayFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
	}
	else if (menuId == 2)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEVpaiFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/

    }
	else if (menuId == 3)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE60ayFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
    }
	else if (menuId == 4)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGETpaiFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
    }
	else if (menuId == 5)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEWpaiFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
    }
	else if (menuId == 6)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGELpaiFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
    }
	else if (menuId == 7)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGESpaiFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
    }
	else if (menuId == 8)
    {
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEXpaiFR.gif',1);  /*sitemap*/
    }

	if(ns6 && (type == 'layer'))
	{
		return;
	}
	if(dtime != null)
	{
		clearTimeout(dtime);
		dtime = null;
	}
	oMid=menuId;
	if((vmid == null) && PNV)
	{
		ShowMenu(obj,type,bgcolor,menuId,color,left);
	}else{
		if(utime != null)
		{
			clearTimeout(utime);
			utime = null;
		}
		var objref;
		if(type == 'cell')
		{
			if(ns6)
			{
				objref = 'document.getElementById("cell' + menuId + '")';
			}else{
				objref = "document.all[" + obj.sourceIndex + "]";
			}
		}else{
			objref = LayerReference(obj);
		}
		var expr = "ShowMenuDelayed('" + objref + "','" + type + "','" + bgcolor + "'," + menuId + ",'" + color + "'," + left + ")";
		var delay;
		if(vmid == null)
		{
			delay = dbsm;
		}else{
			delay = dbhid;
		}
		utime = setTimeout(expr, delay);
		}
}

function ShowMenuDelayed(objref,type,bgcolor,menuId,color,left)
{
	var obj = eval(objref);
	ShowMenu(obj,type,bgcolor,menuId,color,left);
}

function ShowMenu(obj,type,bgcolor,menuId,color,left)
{
	if (type == 'cell')
	{
		obj.style.backgroundColor = bgcolor;
	}else{
		obj.bgColor = bgcolor;
	}
	ShowSubMenu('visible',menuId,color,left);
	MakeDIV(menuId,bgcolor)
}

function MouseOutMenu(obj,type,menuId,color)
{
	MM_swapImgRestore();
	if(ns6 && (type == 'layer'))
	{
		return;
	}
	oMid=null;
	dtime=setTimeout("HideAllMenus()", dhid);
	if(utime != null)
	{
		clearTimeout(utime);
		utime = null;
	}
}

function MouseOverItem(obj,bgcolor,menuId,itemId)
{
	obj.bgColor = bgcolor;
	oMid = menuId;
	oIid = itemId;
	if(dtime != null)
	{
		clearTimeout(dtime);
		dtime = null;
	}
}

function MouseOut()
{
		MM_swapImage('a','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGE.UaqFR.gif',1);  /*aboutus*/
		MM_swapImage('b','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEmVaqFR.gif',1);	/*products & services*/
		MM_swapImage('c','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEaVaqFR.gif',1);  /*business*/
	    MM_swapImage('d','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEdVaqFR.gif',1);  /*customer service*/
        MM_swapImage('e','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEnVaqFR.gif',1);  /*rewards*/
        MM_swapImage('f','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEbVaqFR.gif',1);  /*community*/
        MM_swapImage('g','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEcVaqFR.gif',1);  /*contact us*/
        MM_swapImage('h','','http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEoVaqFR.gif',1);  /*sitemap*/
}

function MouseOutItem(obj,bgcolor,menuId,itemId)
{
    //MouseOut();

	obj.bgColor = bgcolor;
	oMid = null;
	oIid = null;
	if(dtime == null)
	{
		dtime = setTimeout("HideAllMenus()",dhid);
	}
}

function ShowSubMenu(status,menuId,color,left)
{
	if(status == "visible")
	{
		var leftPos = left;
		var loCat = FindImageTop('enav');
		if(!isIE40r5)
		{
			loCat = eval(loCat-4);
			var realwidth = GetScreenSize();
			eval(docObj + "buttonMenuRow" + styleObj + ".width='" + realwidth + "'");
		}
		eval(docObj + "buttonMenuRow" + styleObj + ".top ='" + loCat + "'");
		eval(docObj + "buttonMenuRow" + styleObj + ".left =0");
		eval(docObj + "buttonMenuRow" + styleObj + ".visibility ='" + status + "'");
		eval(docObj + "menu" + menuId + styleObj + ".top ='" + loCat + "'");
		eval(docObj + "menu" + menuId + styleObj + ".left ='" + leftPos + "'");
		eval(docObj + "menu" + menuId + styleObj + ".visibility ='" + status + "'");
		if(!Nav4)
		{
			//eval(docImg + "e" + menuId + ".src='" + NavArrow2.src +"'");
		}
	}
	HideOtherMenus(menuId,color);
	if(status == "visible")
	{
		vmid = menuId;
	}
}

function HideAllMenus()
{
	MouseOut();
	HideOtherMenus(0,color);
	eval(docObj + "buttonMenuRow" + styleObj + ".visibility ='hidden'");
}

function HideOtherMenus(menuId,color)
{
	if((vmid != null) && (vmid != menuId))
	{
		var p = vmid;
		eval(docObj + "menu" + p + styleObj + ".visibility ='hidden'");
		if(Nav4)
		{
			eval("document.ILA" + p + ".document.la" + p + ".bgColor='" + color + "'");
		}else{
			//eval("document.images.e" + p + ".src='" + NavArrow1.src + "'");	
			eval(docObj + "cell" + p + styleObj + ".backgroundColor='" + color + "'");
		}
		vmid = null;
	}
}

function FindImageTop(imageID)
{
	var ImagePosition = document.images[imageID].width;
	var imageHeight=document.images[imageID].height;
	imgobj=document.images[imageID];
	var imageTopCoord = docjslib_getImageYfromTop(imgobj);
	var thiscord = eval(imageTopCoord + imageHeight);
	var realCoord = eval(thiscord + 0);
	return realCoord;
}

function docjslib_getImageYfromTop(imgID)
{
	if (document.layers)
	{
		return eval(imgID).y
	}else{
		return docjslib_getRealTop(imgID);
	}
}

function docjslib_getRealTop(imgElem)
{
	var yPos = eval(imgElem).offsetTop;
	var tempEl = eval(imgElem).offsetParent;
	var oldTempEl;
	while(tempEl != null)
	{
		yPos+=tempEl.offsetTop;
		oldTempEl = tempEl;
		tempEl = tempEl.offsetParent;
	}
	var topMargin = oldTempEl.topMargin;
	if(isIE40r5 & isMac)
	{
		yPos += 1 * topMargin;
	}
	return (yPos);
}

function elem(url,title)
{
	this.url = url;
	this.title = title;
}

function MakeDIV(id,colr)
{
	var q = eval(a+id+".length");
	q++;
	var url = eval(a+id+"[0].url");
	var desc = eval(a+id+"[0].title");
	var e = 2;	
	var d = 1;
	var clr = colr.slice(1);
	var str ="<table border=0 cellspacing=0 cellpadding=0>";
	str +="<tr bgcolor='"+"#"+clr+"'>";
	str += "<td nowrap>";
	str += "<table width=100% border=0 cellspacing=0 cellpadding=0>";
	//str += "<tr bgcolor='"+"#"+clr+"'>";
	str += "<tr bgcolor='"+"#"+"B1B1B1"+"'>";	
	//str += "<td width=1></td>";
	str += "<td height=15 class=submenu valign='top' NOWRAP onMouseOut=\"MouseOutItem(this,'" + "#"+clr+"',"+id+",1);\" onMouseOver=\"MouseOverItem(this,'" + "#" + "B1B1B1',"+id+",1);\">";
	str += "<ilayer ID='dd1'>";
	str += "<layer ID='ldd1' valign='bottom' onMouseOver=\"MouseOverItem(this,'#" + "FF0000',"+id+",1);\" onMouseOut=\"MouseOutItem(this,'#"+clr+"',"+id+",1);\">";

// for first red arrow - hanafi
if (desc.length > 2)
{
if(url.indexOf("pacific")==-1) 
	{
		str+="&nbsp;&nbsp;<img src='http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEpUaqFR.gif' hspace=1>&nbsp;<a href="+url+" target='_blank' CLASS=submenu>";		
    }


    else if(url.indexOf("#")==1){
		str += " <a href='javascript:GoToURL("+url+");' CLASS='submenu'>";
	}
	else {
		str += "&nbsp;&nbsp;<img src='http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEpUaqFR.gif' hspace=1>&nbsp;<a href='javascript:GoToURL("+url+");' CLASS='submenu'>";
	}	
}
	
	str += desc+"</a>  ";
	str += "</layer>";
	str += "</ilayer>";
	str += "</td>";
	while(e < q)
	{
		var url = eval(a+id+"["+d+"].url");
		var desc = eval(a+id+"["+d+"].title");
		str += "<td height=15 class=submenu valign=top NOWRAP onMouseOut=\"MouseOutItem(this,'#" +clr+ "'," +id+ "," +e+ ");\" onMouseOver=\"MouseOverItem(this,'"+"#"+"B1B1B1',"+id+","+e+");\">";
		str += "<ilayer ID='dd"+e+"'>";
		str+="<layer ID='ldd" + e + "' valign='bottom' onMouseOver=\"MouseOverItem(this,'#B1B1B1'," + id + "," + e + ");\" onMouseOut=\"MouseOutItem(this,'#" + clr + "'," + id + "," +e+ ");\">";

// subsequent arrow
	if(url.indexOf("pacific")==-1)
	{
		str+="&nbsp;&nbsp;<img src='http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEpUaqFR.gif' hspace=1>&nbsp;<a href="+url+" target='_blank' CLASS=submenu>";		
    }
    else if(url.indexOf("#")==1){
		str += " <a href='javascript:GoToURL("+url+");' CLASS='submenu'>";
	}
	else {
		str += "&nbsp;&nbsp;<img src='http://www.pacific.net.sg/articles/images/082004/attachments/IMAGEpUaqFR.gif' hspace=1>&nbsp;<a href='javascript:GoToURL("+url+");' CLASS='submenu'>";
	}	

		str += desc+"</a>  ";
		str += "</layer>";
		str += "</ilayer>";
		str += "</td>";
		e++;
		d++;
		}
		str += "</tr>";
		str += "</table>";
		str += "</td>";
		str += "</tr>";
		str += "</table>";
		var mydoc = eval(docObj + "menu" + id + styleObj);
		if(Nav4)
		{
			mydoc.document.open();
			mydoc.document.write(str);
			mydoc.document.close();
		}else{
			if(document.getElementById)
			{
				mydoc=document.getElementById('menu' +id);
			}
			mydoc.innerHTML=str + "\n";
		}
}

function GoToURL(urlPath,thirdParty) //Open Window
{
  eval("top.location.href='"+urlPath+"'");
}	

