function MM_openBrWindow(theURL, winName, features) { //v2.0
    window.open(theURL, winName, features);
}

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_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];}
}

// navigation
var layerName="";
function showLayer(layerN){
	var layer=MM_findObj(layerN);
	if(layerName!=layerN && layerName!="")hiddingLayer();
	if(window.hidding)clearTimeout(window.hidding);
	layerName=layerN;
	layer.style.visibility="";
}

function hideLayer(){
	window.hidding=setTimeout("hiddingLayer()",500);
}

function hiddingLayer(){
	if(window.hidding)clearTimeout(window.hidding);
	if(layerName=="")return;
	var layer=MM_findObj(layerName);
	if(layer==null)return;
	layer.style.visibility="hidden";
	layerName="";
}

/*
function out_link(url){
	var link_disc="您巳離開中國聯合網絡通信（香港）股份有限公司的網站，並將進入不由本公司維護的另一網站，此鏈接僅為您提供方便而設置，中國聯合網絡通信（香港）股份有限公司不對該鏈接網站的內容是否準確全面負責。"
	if (confirm(link_disc)) {
		window.open(url);
	}
}
*/
function out_link(url){
	var link_disc="You are now leaving the web site of China Unicom (Hong Kong) Limited and will be entering into a different web site not maintained by our Company.  The inclusion of this hyperlink is for your convenience only and China Unicom (Hong Kong) Limited assumes no responsibility for the accuracy or completeness of the content of that web site."
	if (confirm(link_disc)) {
		window.open(url);
	}
}

function open_win_pdf(url, pdf_n){
	Window2=open("", pdf_n, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=600');
	if (Window2 != null) {
		if (Window2.opener == null) {
			Window2.opener = self;
		}
		Window2.location.href=url;
		if (Window2.focus) Window2.focus();
	}
}

// Ads
function onClickAds(posn)
{
	var url = document.all["_ads"+posn].CmsLink;
//	alert(posn);
//	alert(document.all["_ads"+posn].CmsLink);
	window.open(url, "_self");
}

// date
function showDate()
{
	var theDate = new Date();
	var theDay = new Array();
	theDay[0] = "Sunday";
	theDay[1] = "Monday";
	theDay[2] = "Tuesday";
	theDay[3] = "Wednesday";
	theDay[4] = "Thursday";
	theDay[5] = "Friday";
	theDay[6] = "Saturday";
		
	var dstr = theDay[theDate.getDay()] + " "
			+ theDate.getFullYear() + "/" + (theDate.getMonth()+1) + "/" + theDate.getDate();
	
	document.write(dstr);
}

function open_win(url,width,height) {
	open_window(url, "ContentWin", width, height); 
}

function open_window(url, wname, width, height) 
{
	win=open("", wname, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height)

	if (win != null) 
	{
		if (win.opener == null) 
		{
			win.opener = self;
		}
		win.location.href=url;
 		if (win.focus) win.focus();
   }

}

function goEn() {
	var loc = document.location + "";
	var startpos = loc.indexOf("/", 8);
	//alert(loc);
	loc = "/en/" + loc.substring(startpos + 4);
	///alert(loc);
	window.open(loc, "_self");
}

function goTc() {
	var loc = document.location + "";
	var startpos = loc.indexOf("/", 8);
	//alert(loc);
	loc = "/tc/" + loc.substring(startpos +4 );
	//alert(loc);
	window.open(loc, "_self");
}

function goSc() {
	var loc = document.location + "";
	var startpos = loc.indexOf("/", 8);
	//alert(loc);
	loc = "/sc/" + loc.substring(startpos + 4);
	//alert(loc); 
	window.open(loc, "_self");
}
