var global_picNews_index=0;
var picNews=[];
var Browser={
	ie:document.all
}

function $(id){
	return document.getElementById(id);
}

function init(){
	showLoading();
	setTimeout(goInit,100);
	//goInit();
}

function initframe(){
	style = xmlHttpGet("getStyle.asp?rdn="+Math.random());
	if (style=="false"){
		style="Default"
	}
	$("Mainstyle").href="template/"+style+"/css.css";
	var header = xmlHttpGet("template/"+style+"/head.asp?rdn="+Math.random());
	var footer = xmlHttpGet("template/"+style+"/foot.asp?rdn="+Math.random());
	initHead(header,style);
	initFoor(footer,style);
	var body = xmlHttpGet("template/"+style+"/frame.asp?rdn="+Math.random());
	$("Mainbody").innerHTML = body;
}

function initWinFrame(){
	style = xmlHttpGet("getStyle.asp?rdn="+Math.random());
	if (style=="false"){
		style="Default"
	}
	$("Mainstyle").href="template/"+style+"/css.css";
	var body = xmlHttpGet("template/"+style+"/winframe.asp?rdn="+Math.random());
	$("Mainbody").innerHTML = body;
}

function initPageFrame(){
	style = xmlHttpGet("getStyle.asp?rdn="+Math.random());
	if (style=="false"){
		style="Default"
	}
	$("Mainstyle").href="template/"+style+"/css.css";
	var header = xmlHttpGet("template/"+style+"/head.asp?rdn="+Math.random());
	var footer = xmlHttpGet("template/"+style+"/foot.asp?rdn="+Math.random());
	initHead(header,style);
	initFoor(footer,style);
	var body = xmlHttpGet("template/"+style+"/pageframe.asp?rdn="+Math.random());
	$("Mainbody").innerHTML = body;

}

function goInit(){
	style = xmlHttpGet("getStyle.asp?rdn="+Math.random());
	if (style=="false"){
		style="Default"
	}
	$("Mainstyle").href="template/"+style+"/css.css";
	var header = xmlHttpGet("template/"+style+"/head.asp?rdn="+Math.random());
	var footer = xmlHttpGet("template/"+style+"/foot.asp?rdn="+Math.random());

	initHead(header,style);
	initFoor(footer,style);

	var body = xmlHttpGet("template/"+style+"/body.asp?rdn="+Math.random());
	initBody(body,style);

	endLoading();
}

function initHead(header,style){
	var head=$("Mainhead");
	var filled = "template/"+style+"/";
	var str = header;
	//str = getPics(str,filled);
	head.innerHTML = str;
}

function initFoor(footer,style){
	var foot=$("Mainfoot");
	var filled = "template/"+style+"/";
	var str = footer;
	//str = getPics(str,filled);
	foot.innerHTML = str;
}




function initBody(bodyCode,style){
	var body=$("Mainbody");
	var filled = "template/"+style+"/";
	var str = bodyCode;
	//str = getPics(str,filled);
	body.innerHTML = str;
	
	aspTags = body.getElementsByTagName("DIV");
	for (var i=0;i<aspTags.length;i++){
		var tag = aspTags[i];
		if (tag.getAttribute("type")=="asp:newslist"){
			tmpstr=[];
			tmpstr.push("getNews.asp?");
			tmpstr.push("sort="+escape(tag.getAttribute("sort")));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&rdn="+Math.random());
			news = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","news"+tag.getAttribute("sort"));
			tag.innerHTML=news;
		}
		if (tag.getAttribute("type")=="asp:userlogin"){
			tmpstr=[];
			tmpstr.push("getLogin.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			login = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","loginTag");
			tag.innerHTML=login;
		}
		if (tag.getAttribute("type")=="asp:practis"){
			tmpstr=[];
			tmpstr.push("getPractis.asp?");
			tmpstr.push("sort="+escape(tag.getAttribute("sort")));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&commend="+tag.getAttribute("commend"));
			tmpstr.push("&showsort="+tag.getAttribute("showsort"));
			tmpstr.push("&rdn="+Math.random());
			practis = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","practis"+tag.getAttribute("sort")+"_"+tag.getAttribute("commend"));
			tag.innerHTML = practis;
		}

		if (tag.getAttribute("type")=="asp:picnews"){
			tmpstr=[];
			tmpstr.push("getPicNews.asp?");
			tmpstr.push("length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&dtl="+tag.getAttribute("dtl"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			practis = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","picNewsTag");
			eval(practis);
			showPicNews(picNews,tag);
			//tag.innerHTML = practis;
			
		}
		if (tag.getAttribute("type")=="asp:libsearchtag"){
			tmpstr=[];
			tmpstr.push("getLibSchTag.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			libstr = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","libschtag");
			tag.innerHTML=libstr;
		}
		if (tag.getAttribute("type")=="asp:newsschtag"){
			tmpstr=[];
			tmpstr.push("getNewsSchTag.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			libstr = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","newsschtag");
			tag.innerHTML=libstr;
		}


		if (tag.getAttribute("type")=="asp:getforumtopic"){
			tmpstr=[];
			tmpstr.push("getForumTopic.asp?");
			tmpstr.push("boardid="+tag.getAttribute("boardid"));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&istop="+tag.getAttribute("istop"));
			tmpstr.push("&isbest="+tag.getAttribute("isbest"));
			tmpstr.push("&rdn="+Math.random());
			forums = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","forumtopic"+tag.getAttribute("boardid"));
			tag.innerHTML=forums;
		}


		if (tag.getAttribute("type")=="asp:linkdrop"){
			tmpstr=[];
			tmpstr.push("getLinkDrop.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&rdn="+Math.random());
			forums = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","linkdrop"+tag.getAttribute("sort"));
			tag.innerHTML=forums;
		}
		if (tag.getAttribute("type")=="asp:linklist"){
			tmpstr=[];
			tmpstr.push("getLinkList.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			linklist = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","linklist"+tag.getAttribute("sort"));
			tag.innerHTML=linklist;
		}
		if (tag.getAttribute("type")=="asp:liblist"){
			tmpstr=[];
			tmpstr.push("getLibListFHP.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&answer="+tag.getAttribute("answer"));
			tmpstr.push("&rdn="+Math.random());
			liblist = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","liblist"+tag.getAttribute("sort"));
			tag.innerHTML=liblist;
		}
	}
}


function refreshLibs(tag,ans,page){
	tmpstr=[];
	tmpstr.push("getLibListFHP.asp?");
	tmpstr.push("sort="+tag.getAttribute("sort"));
	tmpstr.push("&class="+tag.getAttribute("stylename"));
	tmpstr.push("&length="+tag.getAttribute("length"));
	tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
	tmpstr.push("&answer="+ans);
	tmpstr.push("&rdn="+Math.random());
	liblist = xmlHttpGet(tmpstr.join(""));
	//tag.setAttribute("id","liblist"+tag.getAttribute("sort"));
	tag.innerHTML=liblist;
}



function refreshNews(id){
	showLoading();
	var tag=$("news"+id);
	if (tag.getAttribute("type")=="asp:newslist"){
		tmpstr=[];
		tmpstr.push("getNews.asp?sort="+escape(tag.getAttribute("sort")));
		tmpstr.push("&length="+tag.getAttribute("length"));
		tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
		tmpstr.push("&showdate="+tag.getAttribute("showdate"));
		tmpstr.push("&class="+tag.getAttribute("stylename"));
		tmpstr.push("&refresh="+tag.getAttribute("refresh"));
		tmpstr.push("&rdn="+Math.random());
		news = xmlHttpGet(tmpstr.join(""));
		tag.innerHTML=news;
	}
	endLoading();
}


function refreshLogin(){
	showLoading();
	var tag=$("loginTag");
	if (tag.getAttribute("type")=="asp:userlogin"){
		tmpstr=[];
		tmpstr.push("getLogin.asp?class="+tag.getAttribute("stylename"));
		tmpstr.push("&rdn="+Math.random());
		login = xmlHttpGet(tmpstr.join(""));
		tag.innerHTML=login;
	}
	endLoading();
}



function refreshPractis(id){
	showLoading();
	var tag=$("practis"+id);
	if (tag.getAttribute("type")=="asp:practis"){
		tmpstr=[];
		tmpstr.push("getPractis.asp?sort="+escape(tag.getAttribute("sort")));
		tmpstr.push("&length="+tag.getAttribute("length"));
		tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
		tmpstr.push("&showdate="+tag.getAttribute("showdate"));
		tmpstr.push("&class="+tag.getAttribute("stylename"));
		tmpstr.push("&refresh="+tag.getAttribute("refresh"));
		tmpstr.push("&commend="+tag.getAttribute("commend"));
		tmpstr.push("&showsort="+tag.getAttribute("showsort"));
		tmpstr.push("&rdn="+Math.random());
		practis = xmlHttpGet(tmpstr.join(""));
		tag.innerHTML = practis;
	}
	endLoading();
}

function refreshForum(id){
	showLoading();
	var tag=$("forumtopic"+id);
	if (tag.getAttribute("type")=="asp:getforumtopic"){
		tmpstr=[];
		tmpstr.push("getForumTopic.asp?");
		tmpstr.push("boardid="+tag.getAttribute("boardid"));
		tmpstr.push("&length="+tag.getAttribute("length"));
		tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
		tmpstr.push("&showdate="+tag.getAttribute("showdate"));
		tmpstr.push("&class="+tag.getAttribute("stylename"));
		tmpstr.push("&refresh="+tag.getAttribute("refresh"));
		tmpstr.push("&istop="+tag.getAttribute("istop"));
		tmpstr.push("&isbest="+tag.getAttribute("isbest"));
		tmpstr.push("&rdn="+Math.random());
		forums = xmlHttpGet(tmpstr.join(""));
		tag.innerHTML=forums;
	}
	endLoading();
}




function getPics(str,filled){
	if (str.indexOf("src=\"")>=0){
		str = str.replace(/src=\"/g,"src=\""+filled);
	}
	if (str.indexOf("src='")>=0){
		str = str.replace(/src=\'/g,"src='"+filled);
	}
	if (str.indexOf("swf")>=0){
		str = str.replace(/<param name=\"movie\" value=\"/g,"<param name=\"movie\" value=\""+filled);
	}
	return str;
}


function explanTag(tag){
	aspTags = tag.getElementsByTagName("DIV");
	for (var i=0;i<aspTags.length;i++){
		var tag = aspTags[i];
		//alert(tag.innerHTML);
		if (tag.getAttribute("type")=="asp:newslist"){
			tmpstr=[];
			tmpstr.push("getNews.asp?");
			tmpstr.push("sort="+escape(tag.getAttribute("sort")));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&rdn="+Math.random());
			news = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","news"+tag.getAttribute("sort"));
			tag.innerHTML=news;
		}
		if (tag.getAttribute("type")=="asp:userlogin"){
			tmpstr=[];
			tmpstr.push("getLogin.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			login = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","loginTag");
			tag.innerHTML=login;
		}
		if (tag.getAttribute("type")=="asp:practis"){
			tmpstr=[];
			tmpstr.push("getPractis.asp?");
			tmpstr.push("sort="+escape(tag.getAttribute("sort")));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&commend="+tag.getAttribute("commend"));
			tmpstr.push("&showsort="+tag.getAttribute("showsort"));
			tmpstr.push("&rdn="+Math.random());
			practis = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","practis"+tag.getAttribute("sort")+"_"+tag.getAttribute("commend"));
			tag.innerHTML = practis;
		}

		if (tag.getAttribute("type")=="asp:picnews"){
			tmpstr=[];
			tmpstr.push("getPicNews.asp?");
			tmpstr.push("length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			practis = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","picNewsTag");
			eval(practis);
			showPicNews(picNews,tag);
			//tag.innerHTML = practis;
			
		}
		if (tag.getAttribute("type")=="asp:libsearchtag"){
			tmpstr=[];
			tmpstr.push("getLibSchTag.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			libstr = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","libschtag");
			tag.innerHTML=libstr;
		}
		if (tag.getAttribute("type")=="asp:newsschtag"){
			tmpstr=[];
			tmpstr.push("getNewsSchTag.asp?class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			libstr = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","newsschtag");
			tag.innerHTML=libstr;
		}


		if (tag.getAttribute("type")=="asp:getforumtopic"){
			tmpstr=[];
			tmpstr.push("getForumTopic.asp?");
			tmpstr.push("boardid="+tag.getAttribute("boardid"));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&showdate="+tag.getAttribute("showdate"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&refresh="+tag.getAttribute("refresh"));
			tmpstr.push("&istop="+tag.getAttribute("istop"));
			tmpstr.push("&isbest="+tag.getAttribute("isbest"));
			tmpstr.push("&rdn="+Math.random());
			forums = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","forumtopic"+tag.getAttribute("boardid"));
			tag.innerHTML=forums;
		}
		if (tag.getAttribute("type")=="asp:linkdrop"){
			tmpstr=[];
			tmpstr.push("getLinkDrop.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&rdn="+Math.random());
			forums = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","linkdrop"+tag.getAttribute("sort"));
			tag.innerHTML=forums;
		}
		if (tag.getAttribute("type")=="asp:linklist"){
			tmpstr=[];
			tmpstr.push("getLinkList.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&rdn="+Math.random());
			linklist = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","linklist"+tag.getAttribute("sort"));
			tag.innerHTML=linklist;
		}
		if (tag.getAttribute("type")=="asp:liblist"){
			tmpstr=[];
			tmpstr.push("getLibListFHP.asp?");
			tmpstr.push("sort="+tag.getAttribute("sort"));
			tmpstr.push("&class="+tag.getAttribute("stylename"));
			tmpstr.push("&length="+tag.getAttribute("length"));
			tmpstr.push("&maxlength="+tag.getAttribute("maxlength"));
			tmpstr.push("&answer="+tag.getAttribute("answer"));
			tmpstr.push("&rdn="+Math.random());
			liblist = xmlHttpGet(tmpstr.join(""));
			tag.setAttribute("id","liblist"+tag.getAttribute("sort"));
			tag.innerHTML=liblist;
		}
	}

}


function showLoading(){
	var h = document.body.clientHeight;
	$("loadingBar").style.display="block";
	$("loadingBar").style.top = document.body.scrollTop+"px";
	$("loadingBar").style.paddingTop=(h/2-10)+"px";
}

function endLoading(){
	$("loadingBar").style.display="none";
}

function loadingError(){
	$("loadingBar").innerHTML="信息读取错误!请您把报告提交给管理员";
}

xmlHttpGet = function(url){
	if (url==null || url=="")
	{
		return "错误的URL";
	}
	var xmlHttp;
	if(window.ActiveXObject){
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		xmlHttp=new XMLHttpRequest();
	}
	var asynchronous=false;
	var post=false;
	
	if (post){
		alert("error!This method only support GET method.");
	}
	xmlHttp.open("GET",url,asynchronous);
	xmlHttp.send(null);
	var rtn=xmlHttp.responseText;
	xmlHttp=null;
	return rtn;
}

function showPicNews(arr,tag){
	var w = tag.getAttribute("picwidth");
	var h = tag.getAttribute("picheight");
	if (w){
		w=parseInt(w);
	}else{
		w=200;
	}
	if (h){
		h=parseInt(h);
	}else{
		h=148;
	}
	tag.innerHTML += "<div id='_picNewsPic' class='picNewsPic'><img id='picNewsImage' nid='' src='images/empty.gif' style='cursor:pointer;border:1px solid white;height:"+h+"px;width:"+w+"px;margin-left:3px;' onclick=\"viewNewsDetail(this.nid)\"></div>";
	var tmpstr=[];
	for (var i=1;i<=arr.length;i++){
		tmpstr.push("<span onclick=\"jumpPicNews("+i+")\">"+i+"</span>");
	}
	tag.innerHTML += "<div id='_picNewsPicNums' class='picNewsNums'>"+tmpstr.join("");
	tag.innerHTML += "</div>";
	tag.innerHTML += "<div id='_picNewsPicSubject' class='picNewsPicSubject'></div>";
	tag.innerHTML += "<div id='_picNewsDetail' class='picNewsDetail'></div>";

	intervalPicNews(arr);
	setInterval(function(){intervalPicNews(arr)},5000);
}

function intervalPicNews(arr){
	tag=$("picNewsTag");
	spans=tag.getElementsByTagName("span");
	spans[0].style.marginLeft="2px";
	for (var i=0;i<spans.length;i++){
		spans[i].className="picNewsNum";
	}
	spans[global_picNews_index].className="picNewsNumOvr";
	//$('_picNewsPic').innerHTML=arr[global_picNews_index].img;
	if(Browser.ie) $('picNewsImage').filters(0).transition = 25;
	if(Browser.ie) $('picNewsImage').filters(0).apply();
	$('picNewsImage').src=arr[global_picNews_index].img;
	if(Browser.ie) $('picNewsImage').filters(0).play();
	$('picNewsImage').setAttribute("nid",arr[global_picNews_index].id);
	
	$('_picNewsPicSubject').innerHTML="<a href='javascript:viewNewsDetail("+arr[global_picNews_index].id+")'>"+arr[global_picNews_index].subj+"</a>";
	$('_picNewsDetail').innerHTML=arr[global_picNews_index].dt;

	if (global_picNews_index==arr.length-1){
		global_picNews_index=0;
	}else{
		global_picNews_index++;
	}
}

function jumpPicNews(i){
	arr=picNews;
	global_picNews_index=i-1;
	intervalPicNews(arr);
}

function searchgo(a) {
	cc=document.getElementById('cccc').value;
	if (document.getElementById('cccc').value=="" || document.getElementById('cccc').value=="请输入机场四字码"){
		alert("请输入查询码");
		document.getElementById('cccc').focus();
		return;
	}
	if (a=="metar"){
		//mysearch = "http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc="+cc;
		var str = xmlHttpGet("getWeather.asp?type=metar&area="+cc);
		if (str=="error"){
			alert("查询错误!");
		}else{
			alert(str);
		}
	}else{
		//mysearch = "http://weather.noaa.gov/cgi-bin/mgettaf.pl?cccc="+cc;
		var str = xmlHttpGet("getWeather.asp?type=taf&area="+cc);
		if (str=="error"){
			alert("查询错误!");
		}else{
			alert(str);
		}
	}


	/*document.getElementById('skcx').action = mysearch;
	document.getElementById('skcx').submit();

	//var x = xmlHttpGet(mysearch);
	
	//if (a=="metar"){
		//x = x.split("<td height=\"194\">")[1].split("</td>")[0];
	//}else{
		//x = x.split("<td height=\"194\">")[1].split("</td>")[0];
	//}




	//var a=window.open("about:blank","","width=700,height=300,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes");
	//a.document.body.innerHTML = x;
	*/
}















function viewNewsDetail(id,key){
	if(id==0){
		return;
	}
	var w=774;
	var h=650
	var left = (screen.width-w)/2;
	var top = (screen.height-h)/2
	var str="newsDetail.asp?id="+id;
	if (key){
		str += "&key="+key;
	}
	//window.open(str,'','width='+w+',height='+h+',status=no,resizable=yes,toolbar=no,menubar=no,scrollbars=yes,left='+left+',top='+top);
	window.location='newsDetailPage.asp?id='+id;
}

function viewPractisDetail(id){
	//alert(id);
	window.location="practisDetail.asp?id="+id;
}

function viewForumDetail(id,bid){
	window.open('bbs/dispbbs.asp?boardID='+bid+'&ID='+id,'','')
}



function userLogin(evt){
	if(evt.keyCode!=13&&evt.keyCode!=0){
		return;
	};
	var uname=$("_username").value;
	var upwd=$("_userpwd").value;
	var uyzm=$("_useryzm").value;
	var ryzm=$("yzm").innerHTML;
	if (uname.length==0){
		alert("请填写用户名!");
		$("_username").focus();
		return;
	}
	if (upwd.length==0){
		alert("请填写密码!");
		$("_userpwd").focus();
		return;
	}
	if (uyzm==""){
		alert("验证码错误!");
		$("_useryzm").focus();
		return;
	}
	if (uyzm!=ryzm){
		alert("验证码错误!");
		$("_useryzm").focus();
		return;
	}

	showLoading();
	var rtn = xmlHttpGet("sublogin.asp?action=chk&username="+escape(uname)+"&password="+upwd+"&rdn="+Math.random());
	if (rtn=="success"){
		alert("登录成功!")
		refreshLogin();
		endLoading();
		return;
	}else{
		alert("用户名密码错误!请您重新确认");
		$("_username").focus();
		endLoading();
		return;
	}
}


function userLoginToCenter(evt){
	if(evt.keyCode!=13&&evt.keyCode!=0){
		return;
	};
	var uname=$("_username").value;
	var upwd=$("_userpwd").value;
	var uyzm=$("_useryzm").value;
	var ryzm=$("yzm").innerHTML;
	if (uname.length==0){
		alert("请填写用户名!");
		$("_username").focus();
		return;
	}
	if (upwd.length==0){
		alert("请填写密码!");
		$("_userpwd").focus();
		return;
	}

	if (uyzm==""){
		alert("验证码错误!");
		$("_useryzm").focus();
		return;
	}

	if (uyzm!=ryzm){
		alert("验证码错误!");
		$("_useryzm").focus();
		return;
	}

	var rtn = xmlHttpGet("sublogin.asp?action=chk&username="+escape(uname)+"&password="+upwd+"&rdn="+Math.random());
	if (rtn=="success"){
		alert("登录成功!")
		var l="";
		if (window.location.href.indexOf("u=")>=0){
			l = window.location.href.split("u=")[1];
			if (l!=""){
				window.location= l.replace(/\|\|/g,"&");
				return;
			}
		}
		window.location="memberCenter.asp"
		return;
	}else{
		alert("用户名密码错误!请您重新确认");
		$("_username").focus();
		return;
	}
}



function logout(){
	if(!confirm("您要退出登录吗？")){
		return;
	}
	var rtn = xmlHttpGet("sublogout.asp?rdn="+Math.random());
	if (rtn=="success"){
		refreshLogin();
		alert("您已经成功退出登录");
	}else{
		alert("登出失败，请您重试");
		return;
	}
}

function logoutToDefault(){
	if(!confirm("您要退出登录吗？")){
		return;
	}
	var rtn = xmlHttpGet("sublogout.asp?rdn="+Math.random());
	if (rtn=="success"){
		alert("您已经成功退出登录");
		window.location="default.htm";
	}else{
		alert("登出失败，请您重试");
		return;
	}
}

function getLibSch(v){
	if (v.length==0 || v=="请输入您要搜索的内容"){
		alert("请输入搜索内容");
		return;
	}
	window.location="libList.asp?key="+v;
}


function goAsk(){
	window.location='ask.asp';
}

function getNewsSch(v){
	if (v.length==0 || v=="请输入搜索内容"){
		alert("请输入搜索内容");
		return;
	}
	if (v.length<2){
		alert("您输入内容过短，请至少输入两个字");
		return;
	}
	if ($("_newsType")){
		var g=$("_newsType").value;
	}
	if (g=="p"){
		window.location="practisList.asp?key="+v;
		return;
	}
	window.location="newsSearch.asp?key="+v;
}

function getAdvSch(){
	window.location='advsch.asp';
}


function getYZM(){
	var y = "";
	y = xmlHttpGet("getYZM.asp?rdn="+Math.random());
	document.getElementById("yzm").innerHTML = y;
}