
var ShowOrHideIds = [];
var load_YN = 0;

try{PageInit()}catch(e){};

var ThisUrl=window.location.toString(); 
var ThisDomain=window.location.hostname.toString();//端口号: port,带端口号:window.location.host,
var ThisUrl2=window.location.pathname.toString()+window.location.search.toString();//域名后面的


window.onload = function (){
	load_YN=1;
	try{initMap()}catch(e){};
}
window.onerror = function(){ return true; };

//页面结束时要执行的函数
function PageEnd(){
	menuFix();
    ShowOrHideIds_do();
}

function menuFix(nav,oli) {
	if(!nav)nav="nav";if(!oli)oli="li";
	var sfEls = document.getElementById(nav).getElementsByTagName(oli);
	for (var i = 0; i < sfEls.length; i++) {
		sfEls[i].onmouseover = function() {
			this.className += (this.className.length > 0 ? " ": "") + "sfhover";
		}
		sfEls[i].onMouseDown = function() {
			this.className += (this.className.length > 0 ? " ": "") + "sfhover";
		}
		sfEls[i].onMouseUp = function() {
			this.className += (this.className.length > 0 ? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout = function() {
			this.className = this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}

//var u=window.location.toString().Url_GetValue("SubPage");
//var PlayType=(u)?u.Url_GetValue("PlayType"):'';
String.prototype.Url_GetValue= function(para) {  
    var reg = new RegExp("(^|&)"+ para +"=([^&]*)(&|$)");  
    var r = this.substr(this.indexOf("\?")+1).match(reg);  
    if (r!=null) return unescape(r[2]); return null;  
}
//url=url.Url_ReplaceParamToNull("classid,rootid")
String.prototype.Url_ReplaceParamToNull= function(para) {
	var p=para.split(","),re="";
	for (var i=0;i<p.length; i++){
		if (i>0) re+="|";
		re+="[&\?]"+p[i]+"\=([^&]*)";//去除url中的某些参数
	}
	re = new RegExp(re,"gi");
	return this.replace(re,"")
}

function moveSub(sub) { 
    switch(sub) {
		case "A00" :	url="/";break;
		case "B00" :	url="/Page.Show.asp?id=7";break;
		case "C00" :	url="/news/Article.List.asp";break;
		case "D00" :	url="/Page.Show.asp?id=8";break;
		case "E00" :	url="/Page.Show.asp?id=9";break;
		case "F00" :	url="/khfw/khfk.asp";break;
		case "G00" :	url="/Page.Show.asp?id=14";break;


		case "TOP01" :	url="/";break;
		case "jrsc" :	url="javascript:window.external.AddFavorite('http://'+wz_url+'',wz_name)";break;
		case "swsy" :	url="javascript:void(document.links[0].style.behavior='url(#default#homepage)');void(document.links[0].setHomePage('http://'+wz_url+''));";break;

	}
    if(url !="") { 
        this.location.href=url;
	}
}
//javascript:moveSub(\'F00\')//javascript:void(0);


function SetCookieLang(lang){
	if (lang==null){return;};
    document.cookie="lang="+lang;
	window.location.reload();
}


//自动调整图片大小
function DrawImage(ImgD, FitWidth, FitHeight) {
    if (FitWidth==null||FitWidth=='undefined') FitWidth = 121; //设置图片宽度界限
    if (FitHeight==null||FitHeight=='undefined') FitHeight = 82; //设置图片高度界限
    ImgD.style.display = "";
    var image = new Image();
    image.src = ImgD.src;
    if (image.width > 0 && image.height > 0) {
        if (image.width / image.height >= FitWidth / FitHeight) {
            if (image.width > FitWidth) {
                ImgD.width = FitWidth;
                ImgD.height = (image.height * FitWidth) / image.width;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
            //ImgD.alt = "原图片大小(" + image.width + "×" + image.height + ")";
        }
        else {
            if (image.height > FitHeight) {
                ImgD.height = FitHeight;
                ImgD.width = (image.width * FitHeight) / image.height;
            } else {
                ImgD.width = image.width;
                ImgD.height = image.height;
            }
            //ImgD.alt = "原图片大小(" + image.width + "×" + image.height + ")";
        }
    }
}


/*
检查指定对象(如#TipStr_ul)是否有内容，有内容则对象(#TipStr)显示出来, 无内容则不显示
ShowOrHideIds是全局数组,必须在页面头部声明，文中使用ShowOrHideIds.push("TipStr_ul");
*/
function ShowOrHideIds_do(){
	try{var ids=ShowOrHideIds;}catch(e){return};
	for (var i=0; i<ids.length; i++){
		try{
			var o=document.getElementById(ids[i]);
			var oid=ids[i].substr(0,ids[i].lastIndexOf("_"));
			try{var o2=document.getElementById(oid);}catch(e){var o2=o.parentNode}
			if (o2.style.display==""){
				if (o.innerHTML.replace(/\s+/g,"")=="") {
					o2.style.display="none";
				}
			}else{
				if (o.innerHTML.replace(/\s+/g,"")!="") {
					o2.style.display="";
				}
			}
		}catch(e){}
	}
}

/*document.write(ShowOrHide("{=afrom}","来源：{=afrom}"))*/
function ShowOrHide(s,str){
	if (s!=""&&s.substr(0,2)!="{=") return str;
	else return "";
}
