﻿
var userAgent = navigator.userAgent.toLowerCase();
var is_opera = userAgent.indexOf('opera') != -1 && opera.version();
var is_moz = (navigator.product == 'Gecko') && userAgent.substr(userAgent.indexOf('firefox') + 8, 3);
var is_ie = (userAgent.indexOf('msie') != -1 && !is_opera) && userAgent.substr(userAgent.indexOf('msie') + 5, 3);
function $(s)			{return document.getElementById(s);}
function trim(s)		{return s.replace(/(^[ |　]*)|([ |　]*$)/g, '');}
function bug(s)			{alert(s);}
function hide(s)		{$(s).style.display = $(s).style.display == 'none' ? '' : 'none';}//隐藏切换
var MiniSite=new Object();
MiniSite.Browser={
	ie:/msie/.test(window.navigator.userAgent.toLowerCase()),
	moz:/gecko/.test(window.navigator.userAgent.toLowerCase()),
	opera:/opera/.test(window.navigator.userAgent.toLowerCase()),
	safari:/safari/.test(window.navigator.userAgent.toLowerCase())
};
MiniSite.$=function(s){
	return(typeof s=='object')?s:document.getElementById(s);
};
MiniSite.JsLoader={
	load:function(sUrl,fCallback){
		var _script=document.createElement('script');
		_script.setAttribute('charset','utf-8');
		_script.setAttribute('type','text/javascript');
		_script.setAttribute('src',sUrl);
		document.getElementsByTagName('head')[0].appendChild(_script);
		if(MiniSite.Browser.ie){
			_script.onreadystatechange=function(){
				if(this.readyState=='loaded'||this.readyState=='complete'){
					fCallback();
				}
			};
		}else if(MiniSite.Browser.moz){
			_script.onload=function(){
				fCallback();
			};
		}else{
			fCallback();
		}
	}
};
MiniSite.Cookie={
	set:function(name,value,expires,path,domain){
		if(typeof expires=="undefined"){
			expires=new Date(new Date().getTime()+10*24*3600*1000);
		}
		document.cookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"; path=/")+((domain)?";domain="+domain:"");
	},
	get:function(name){
		var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
		if(arr!=null){
			return unescape(arr[2]);
		}
		return null;
	},
	clear:function(name,path,domain){
		if(this.get(name)){
			document.cookie=name+"="+((path)?"; path="+path:"; path=/")+((domain)?"; domain="+domain:"")+";expires=Fri, 02-Jan-1970 00:00:00 GMT";
		}
	}
};

MiniSite.Home={
	defaultprovince:4,
	timelapse:null,
	_print:function(province){
		try{setdef();}catch(e){}
	},
	print:function(){
		var ok=function(){
			MiniSite.Home._print();
		}
		if(!MiniSite.Cookie.get("My_Site")){
			MiniSite.Home.timelapse=setTimeout(ok,20000);
			MiniSite.JsLoader.load("",function(){
				if(MiniSite.Home.timelapse!=null){
					clearTimeout(MiniSite.Home.timelapse);
				};
				if(typeof IPData!="undefined"){
					MiniSite.Cookie.set('My_Site',IPData[2]+','+IPData[3]);
					MiniSite.Home._print(IPData[2]);
				}else{
					MiniSite.Home._print();
				}
			});
		}else{
			var ipAddress=MiniSite.Cookie.get("My_Site");
			var ipAddressArr=ipAddress.split(",");
			return MiniSite.Home._print(ipAddressArr[0]);
		}
	}
}
if(!MiniSite.Cookie.get("My_Site")){MiniSite.Home.print();}
	window.onerror = function()
	{
		return true;
	}
 
	if (!window._sT)
	{window._sT = window.setTimeout;window.setTimeout = function(fCallback, nDelay, oObject){if (typeof fCallback == 'function'){if (!oObject){oObject = window;}var argu = Array.prototype.slice.call(arguments, 3);var newFunc = (function(){ fCallback.apply(oObject, argu); });	return window._sT(newFunc, nDelay);	}return window._sT(fCallback, nDelay);};}
 
	var marTime = new Array();
	var marWay = new Array();
	var moveTime = new Array();
	moveTime[0] = 0;
	moveTime[1] = 0;
	var speed = 30;
	var fodTime = 0;
	var proFlog = 0;
	var proTime = 0;
 
	var gh=window.location.host;
	function $(o){ return (typeof o == "object")?o:document.getElementById(o);}
	
	function swTabs(e){if(typeof e=="string"){e=$(e);}var isAjax,gPath,sobject;var cls="s";if(e.id!="defTail"&&e.id!="tailorxxx"){var tmp=e.id.split("_");var sid=tmp[0];var snum=tmp[1];gPath=gu+gp[sid][snum-1];sobject=$(sid+"_"+snum+"_Info");}else if(e.id=="defTail"){sid=e.id;snum=1;sobject=$("defTailInfo");}else if(e.id=="tailorxxx"){sid=e.id;snum=2;gPath=gu+gp["News"][snum-1];sobject=$("tailorInfo");if(e.className=="s0"||e.className=="s1"){cls="s1";}}e.className=cls;if(snum!=1){if(sobject.innerHTML==""){CreatAjax(gPath,parseInfo,{obj:sobject,sid:sid,snum:snum});isAjax=true;}}if(!isAjax){swLabs(sobject,sid,snum)}tmp=gPath=sobject=isAjax=maxItemNum=null;}
	function swLabs(sobject,sid,snum){var maxItemNum;var tailorxxx=$("tailorxxx");var cls="";try{var i=1;maxItemNum=(sid=="defTail"||sid=="tailorxxx")?gp["News"][0]:gp[sid][0];while(i<=maxItemNum){if(i!=snum){var tmp1,tmp2;if(sid=="defTail"){tmp1=tailorxxx;tmp2=$("tailorInfo");if(tailorxxx.className=="s0"||tailorxxx.className=="s1"){cls="s0";}}else if(sid=="tailorxxx"){tmp1=$("defTail");tmp2=$("defTailInfo");if(tailorxxx.className=="s0"||tailorxxx.className=="s1"){tailorxxx.className="s1";}}else{tmp1=$(sid+"_"+i);tmp2=$(sid+"_"+i+"_Info");}tmp1.className=cls;tmp2.className="undis";}i++}}catch(e){}sobject.className="dis";}
	function tagOver(a){clearTimeout(fodTime);fodTime=0;fodTime = setTimeout(function(){swTabs(a)},100);if(a.id=="defTail"){$("map").className="undis";}if(a.id=="tailorxxx"&&$("map").innerHTML==""){setTimeout(function(){loadNewsMap();},300);}}
	function tagOut(a){clearTimeout(fodTime);fodTime=0;}
 
	function getNames(obj,name,tij){var plist = $(obj).getElementsByTagName(tij);var rlist = new Array();for(i=0;i<plist.length;i++){if(plist[i].getAttribute("name") == name){rlist[rlist.length] = plist[i];}}return rlist;}
 
	function send_request(url)
	{http_request = false;if(window.XMLHttpRequest)	{http_request = new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/xml');}		}else if (window.ActiveXObject)	{try{ http_request = new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }catch (e)	{}}}if (!http_request){window.alert("不能创建XMLHttpRequest对象实例.");return false; }http_request.onreadystatechange = loadPage;	http_request.open("GET", url, true);	http_request.send(null);}
	function setdefSkin()
	{var n =  MiniSite.Cookie.get("My_Skin");if(n!=null){call_0410("UNKNOWN","skin",n);setSkin(n);}else{call_0410("UNKNOWN","skin",0);}}

	var cssList = new Array("skin1.css","skin2.css","skin3.css","skin4.css","skin5.css")
 
	function setSkin(n)
	{var css = $("cssChange");var cssurl = "/DQSite/main/images/";cssurl +=cssList[n];css.href=cssurl;MiniSite.Cookie.set("My_Skin",n);}
 
	function formatSkin()
	{var p = $("SkinList").getElementsByTagName("li");var s = $("sar");for(i=0;i<p.length;i++){p[i].num = i;p[i].onclick = function(){setSkin(this.num);}}s.onclick = function() { openSkin("sar","SkinList",140,56,2,0); };}
 
	function _openSkin(o1,o2,max,min,speed,n)
	{ return openSkin(o1,o2,max,min,speed,n);}
 
	function _closeSkin(o1,o2,max,min,speed,n)
	{ return closeSkin(o1,o2,max,min,speed,n);}
 
	//n=0 skin n=1 pro
	function openSkin(o1,o2,max,min,speed,n)
	{var a = $(o1);	var s = $(o2);var w = s.offsetWidth;var move=function(){w+=speed;if(w>=max){w = max;s.style.width = w+"px";				if(moveTime[n]){window.clearInterval(moveTime[n]);}if(n){$("pro_arrow").className = "al";$("pro_arrow").onclick = function() {closeSkin(o1,o2,max,min,speed,n);}				}else{a.innerHTML = "<div class='s'><img src='/DQSite/main/images/9471252.gif' alt='收缩' /></div>";a.onclick = function() {closeSkin(o1,o2,max,min,speed,n);}}}else{s.style.width = w + "px";if(n){}else{s.style.display = "block";};}};moveTime[n] = window.setInterval(move,5);}
 
	function closeSkin(o1,o2,max,min,speed,n)
	{var a = $(o1);var s = $(o2);var w = s.offsetWidth;var move = function(){w-=speed;if(w<=min){w = min;s.style.width = w + "px";if(n){				$("pro_arrow").className = "ar";$("pro_arrow").onclick = function() {openSkin(o1,o2,max,min,speed,n);};}else{a.innerHTML = "<div><img src='/DQSite/main/images/9471252.gif' alt='更多皮肤' /></div>";a.onclick = function() { openSkin(o1,o2,max,min,speed,n);}	};		if(moveTime[n]){window.clearInterval(moveTime[n]);}}else{s.style.display = "block";s.style.width = w + "px";};};moveTime[n] = window.setInterval(move,5);}


function call_0410(type,item,page)
{try{var purl='';if (type == "A"){purl = window.event.srcElement.href;}else if (type == "IMG"){purl = window.event.srcElement.parentNode.href;};var iurl = ''+Math.random();var img  = new Image(1,1);img.onerror = function (){};img.src	 = iurl;	} catch (e) {}}
 
function register0410(item,page) 
{try{var type = window.event.srcElement.tagName;if (type == "A" || type == "IMG" ) {call_0410(type,item, page);}return true;}catch(e){}}

/*更换选项卡*/
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=i==cursel?"hover":"";
con.style.display=i==cursel?"block":"none";
}
}

//双击鼠标滚动屏幕的代码
var currentpos,timer;
function initialize(){timer=setInterval ("scrollwindow ()",20);}
function sc(){clearInterval(timer);}
function scrollwindow(){var currentpos;
if (typeof window.pageYOffset != 'undefined') {   currentpos = window.pageYOffset;}
else if (typeof document.compatMode != 'undefined' &&  document.compatMode != 'BackCompat') { currentpos= document.documentElement.scrollTop;}
else if (typeof document.body != 'undefined') {  currentpos= document.body.scrollTop;}
window.scroll(0,++currentpos);if (currentpos !=currentpos)sc();}
document.onmousedown=sc;
document.ondblclick=initialize;
//更改字体大小
var status0='';
var curfontsize=10;
var curlineheight=18;
function ZFA(fontid){if(curfontsize>8){$(fontid).style.fontSize=(--curfontsize)+'pt';}}
function ZFB(fontid){if(curfontsize<64){$(fontid).style.fontSize=(++curfontsize)+'pt';}}

