
// Swap Image

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_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_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];}
}


// open Broswer Window

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//popwin

function popwin(url,nam,w,h,resizable,scrollbars,toolbar,locationbar,directories,status,menubar){
	var attr="";
	if(w>0){
		attr=(attr=="") ? "" : attr+",";
		attr+="width="+w;
	}
	if(h<=0&&window.screen.availHeight&&window.screen.height&&window.screen.availHeight!=window.screen.height){
		h=(window.screen.availHeight>window.screen.height) ? window.screen.height : ((window.screen.availHeight<window.screen.height) ? window.screen.availHeight : 680);
	}
	if(document.documentElement&&document.documentElement.clientWidth){h-=60};
	if(BrowserDetect.browser=="Safari"){h+=2;}else if(BrowserDetect.browser=="Firefox"&&BrowserDetect.version>=2){h-=1};
	attr=(attr=="") ? "" : attr+",";
	attr+="height="+h;
	if(resizable!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="resizable="+resizable;
	}
	if(scrollbars!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="scrollbars="+scrollbars;
	}
	if(toolbar!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="toolbar="+toolbar;
	}
	if(locationbar!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="location="+locationbar;
	}
	if(directories!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="directories="+directories;
	}
	if(status!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="status="+status+",statusbar="+status;
	}
	if(menubar!=""){
		attr=(attr=="") ? "" : attr+",";
		attr+="menubar="+menubar;
	}
	if(window.screen&&w>0&&h>0){
		var x=(screen.width-w)/2;
		var y=(screen.height-h)/2;
		if(BrowserDetect.browser=="Explorer"){y-=24};
		attr+=",top="+y+",left="+x;
	}
	var _wc=window.open(url,nam,attr);
	if(_wc){
		_wc.opener=this;
		if(window.focus){_wc.focus()};
	}
	return _wc;
}

//-->



/*  Swap div  */
function HideDIV(d) { document.getElementById(d).style.display = "none"; }
function DisplayDIV(d) { document.getElementById(d).style.display = "block"; }



/*	Show Hide Layers	
Need to put back inside the page for better performance and to avoid IE6 error message */



/* For FireFox Flash Menu Optimisation	*/
function resizeSWF(nHeight) {
	if (nHeight==35)
		nHeight = 30;
	nHeight += "px";
	document.getElementById("mainnav").style.height = nHeight;
	
}

function loadstyle()
{
	document.getElementById("mainnav").style.height = "30px";
}



/*  Swap Language  */
function ChangeVersion()
{
//window.event.returnValue = false;
	var url = location.href; 
	if(url.indexOf("/en/")>0) window.location = url.replace("/en/", "/cn/");
	if(url.indexOf("/cn/")>0) window.location = url.replace("/cn/", "/en/");
}


//flash sports and entertainment jumps to specific content
	function getParameter(param)
	{
		var query = window.location.search;
		var iLen = param.length;
		var iStart = query.indexOf(param);
		if (iStart == -1)
		   return "";
		iStart += iLen + 1;
		var iEnd = query.indexOf("&", iStart);
		if (iEnd == -1)
		   return query.substring(iStart);
		
		return query.substring(iStart, iEnd);
	}

    var nowaction = getParameter("nowaction");

