function js(){
	this.agt        = navigator.userAgent.toLowerCase(); //浏览器版本数据
	this.is_ie      = ((this.agt.indexOf("msie") != -1) && (this.agt.indexOf("opera") == -1));
	this.is_opera   = (this.agt.indexOf("opera") != -1);
	this.is_mac     = (this.agt.indexOf("mac") != -1);
	this.is_mac_ie  = (this.is_ie && this.is_mac);
	this.is_win_ie  = (this.is_ie && !this.is_mac);
	this.is_gecko   = (navigator.product == "Gecko");

	this.baseURL = document.baseURI || document.URL;
	if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]+)/))
		this.baseURL = RegExp.$1 + "/";
}
var js = new js();

//此函数用来寻找对象
function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

//打开窗口
function openWin(theUrl,winName,winW,winH,scrollbars){
	if (!scrollbars)scrollbars='auto';
	var leftPos = (screen.availWidth-winW) / 2
	var topPos = (screen.availHeight-winH) / 2
	var newWin = window.open(theUrl,winName,'width='+winW+',height='+winH+',scrollbars='+scrollbars+',resizable=no,titlebar=0,top=' + topPos + ',left=' + leftPos)
	newWin.focus();
}
function switchlang() {
  if(big5()) {
     //繁体转换成简体
     var matchexp = new RegExp ("http://gate.tycool.com:82/gate/big5/([^/]+)([^?]*)([?]?[^?]*)", "i");
     var domain = window.location.href.replace(matchexp, "$1");
     var pathname = window.location.href.replace(matchexp, "$2");
     var search = window.location.href.replace(matchexp, "$3");
    location.href="ht"+"tp://"+domain+pathname+search;
    return false;
  } else {
    //简体转换成繁体
    location.href="ht"+"tp://gate.tycool.com:82/gate/big5/"+location.hostname+location.pathname+location.search;
    return false;
  }
}

function big5() {
  var matchexp = new RegExp ("http:\/\/gate\.tycool\.com:82\/gate\/big5\/(.+)", "i");
  if(matchexp.test(window.location.href)){
    return true;
  } else {
    return false;
  }
}
//-->