/******************************************************************************
  common javascript
*******************************************************************************/
//Current Menu Style
//取文件名
var a = document.URL;
var b = a.split("/");
var c = b.slice(b.length-1, b.length);
//alert("取得的文件名（含查询字符串）:" + c); //bug c仍带字符串

//取变量值
var URLParams = new Array();
var aParams = document.location.search.substr(1).split('&');
for (i=0; i < aParams.length ; i++){
   var aParam = aParams[i].split('=');
   URLParams[aParam[0]] = aParam[1];
}

m = URLParams["m"];

tid = URLParams["tid"];

if (typeof(tid)=="undefined") { tid = URLParams["typeid"]; } //资讯翻页URL内的变量名

//document.write(tid);

if (c=="index.html" || c=="" || c=="index.php") { tid = 0; }

if (c=="search.php") { m = 's'; }

if (tid!='2' && tid!='3' && URLParams["x"]=='s') { m = 's'; } //资讯翻页

if (m=="s") { tid = 5; }

if (m=="page_support") { tid = 'page_support'; }

if (m=="page_aboutus") { tid = 'page_aboutus'; }

document.write ("<style>.ss_" + tid + " {background: transparent url(/templets/cimg/menu_onbg.gif) no-repeat;}</style>");

//----------

function setCV() {

document.getElementById('ss_' + tid).className='m_on';

}

//区块切换
function setX(v1,v2,vn) {

document.getElementById(v1).style.display="none";

document.getElementById(v2).style.display="none";

document.getElementById(vn).style.display="";

}

//title弹出提示
var sPop = null;
var postSubmited = false;
function $(id) {
	return document.getElementById(id);
}
document.write("<style type='text/css'id='defaultPopStyle'>");
document.write(".cPopText { font-family: Tahoma, Verdana; background-color: #FFFFCC; border: 1px #000000 solid; font-size: 12px; padding-right: 4px; padding-left: 4px; line-height: 18px; padding-top: 2px; padding-bottom: 2px; visibility: hidden; filter: Alpha(Opacity=80)}");
document.write("</style>");
document.write("<div id='popLayer' style='position:absolute;z-index:1000' class='cPopText'></div>");
function showPopupText(event) {
	if(event.srcElement) o = event.srcElement; else o = event.target;
	if(!o) {
		return;
	}
	MouseX = event.clientX;
	MouseY = event.clientY;
	if(o.alt != null && o.alt != '') {
		o.pop = o.alt;
		o.alt = '';
	}
	if(o.title != null && o.title != '') {
		o.pop = o.title;
		o.title = '';
	}
	if(o.pop != sPop) {
		sPop = o.pop;
		if(sPop == null || sPop == '') {
			$('popLayer').style.visibility = "hidden";
		} else {
			popStyle = o.dyclass != null ? o.dyclass : 'cPopText';
			$('popLayer').style.visibility = "visible";
			showIt();
		}
	}
}
function showIt() {
	$('popLayer').className = popStyle;
	$('popLayer').innerHTML = sPop.replace(/<(.*)>/g,"&lt;$1&gt;").replace(/\n/g,"<br>");
	var popWidth = $('popLayer').clientWidth;
	var popHeight = $('popLayer').clientHeight;
	var popLeftAdjust = MouseX + 12 + popWidth > document.body.clientWidth ? -popWidth - 24 : 0;
	var popTopAdjust = MouseY + 12 + popHeight > document.body.clientHeight ? -popHeight - 24 : 0;
	$('popLayer').style.left = (MouseX + 12 + document.body.scrollLeft + popLeftAdjust) + 'px';
	$('popLayer').style.top = (MouseY + 12 + document.body.scrollTop + popTopAdjust) + 'px';
}
if(!document.onmouseover) {
	document.onmouseover = function(e) {
		var event = e ? e : window.event;
		showPopupText(event);
	};
}