﻿//<!--网站参数begin

var site = new Object();
site.Name = '知远战略与防务研究所';
site.Url = 'http://www.knowfar.org.cn';
site.Dir = '/';
site.CookieDomain = '.knowfar.org.cn';
site.Keywords = '诺方知远,知远防务评论,战略,防务,军事,思想库,智库,全球防务,大嘴,大嘴军事,美国军事';
site.Description = '独立 客观 慎思 明辨';
site.Service = '北京诺方知远信息科技有限公司';
site.ForumUrl = '';
site.LoginUrl = '/user/login/index.aspx';
site.LogoutUrl = '/user/logout/index.aspx';
site.RegisterUrl = '/user/register/index.aspx';
site.ICP = '京ICP备09049714号';

//-->网站参数end



var jcms__HintUrl		= "/_style/hint/";
var jcms__DialogUrl		= "/_style/dialog/";
/*------------------------------------------------------------------*/
function __(el)
{
	if(typeof el=='string')
		return document.getElementById(el);
	else if(typeof el=='object')
		return el;
}
var KnowfarCms=new Object();
KnowfarCms.Cookie={//
	set:function(name,value,expires,path,domain){
		if(typeof expires=="undefined"){
			expires=new Date(new Date().getTime()+24*3600*100);
		}
		document.cookie=name+"="+jcms__UrlEncode(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+path:"; path=/")+((domain)?";domain="+domain:"");
	},
	get:function(name, subname){
		//if(!subname){
			//var arr=document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
			//if(arr!=null){
				//return jcms__UrlDecode(arr[2]);
			//}
			//return "";
		//}
		var re = new RegExp((subname ? name + "=(.*?&)*?" + subname + "=(.*?)(&|;)" : name + "=([^;]*)(;|$)"), "i"); 
		return jcms__UrlDecode(re.test(document.cookie) ? (subname ? RegExp["$2"] : RegExp["$1"]) : ""); 
	}, 
	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";
		}
	}
};
//追加/删除事件
KnowfarCms.Event={
	add:function(obj, evType, fn){
		if (obj.addEventListener){obj.addEventListener(evType, fn, false);return true;}
		else if (obj.attachEvent){var r = obj.attachEvent("on"+evType, fn);return r;}
		else {return false;}
	},
	remove:function(obj, evType, fn, useCapture){
		if (obj.removeEventListener){obj.removeEventListener(evType, fn, useCapture);return true;}
		else if (obj.detachEvent){var r = obj.detachEvent("on"+evType, fn);return r;}
		else {alert("Handler could not be removed");}
	}
};
//追加onload事件
KnowfarCms.addOnloadEvent=function(fnc) {
	if ( typeof window.addEventListener != "undefined" )
		window.addEventListener( "load", fnc, false );
	else if ( typeof window.attachEvent != "undefined" )
	{
		window.attachEvent( "onload", fnc );
	}
	else
	{
		if ( window.onload != null )
		{
			var oldOnload = window.onload;
			window.onload = function (e) {
				oldOnload(e);
				window[fnc]();
			};
		} else
			window.onload = fnc;
	}
};
KnowfarCms.isFunction=function(variable) {
	return typeof variable == 'function' ? true : false;
};
KnowfarCms.isUndefined=function(variable) {
	return typeof variable == 'undefined' ? true : false;
};
KnowfarCms.Length=function(variable) {
	var len = 0;
	var val = variable;
	for (var i = 0; i < val.length; i++) 
	{
		if (val.charCodeAt(i) >= 0x4e00 && val.charCodeAt(i) <= 0x9fa5){ 
			len += 2;
		}else {
			len++;
		}
	}
	return len;
};
KnowfarCms.Eval=function(data, closeLoading) {
	if(closeLoading || closeLoading == null)
		KnowfarCms.Loading.hide();
	try {
		eval(data);
	}
	catch(e) {
		alert(data);	
	}
};
/////////////////////////////
//弹出右下框
/////////////////////////////
KnowfarCms.Message=function(errstr, success, returnFunc){
	new jcms__Dialog().reset();
	var MSG = $.message;
	MSG.lays(200, 24);
	MSG.anim('fade', 'slow', '/_libs/jquery.messager/');
	if(returnFunc) MSG.doafter(returnFunc);
	MSG.show(success, errstr, 3000);
};
KnowfarCms.Alert=function(errstr, success, returnFunc){
	var oDialog = new jcms__Dialog('2', '', 360, 180, success, true);
	oDialog.init();
	oDialog.event(errstr,'');
	if (returnFunc == null)
		oDialog.button('dialogSubmit', '');
	else
		oDialog.button('dialogSubmit', returnFunc);
};
/////////////////////////////
//弹出确认框
//例如:
//1、KnowfarCms.Confirm("是否操作", act, null) //函数不加()
//2、KnowfarCms.Confirm("是否操作", "alert('yes')", "alert('no')")
/////////////////////////////
KnowfarCms.Confirm=function(errstr, returnSubmitFunc, returnCancelFunc)
{
	var oDialog = new jcms__Dialog('2', '', 360, 180, "warning", true);
	oDialog.init();
	oDialog.event(errstr,'');
	oDialog.button('dialogSubmit', returnSubmitFunc);
	if (returnCancelFunc == null)
		oDialog.button('dialogCancel', '');
	else
		oDialog.button('dialogCancel', returnCancelFunc);
};
/////////////////////////////
//弹出模拟窗口
/////////////////////////////
KnowfarCms.Popup={
	show:function(url, width, height, showCloseBox, showTitle, returnFunc, anchor)
	{
		if(anchor == null) anchor='';
		new jcms__Dialog().reset();
		if(showTitle==null) showTitle="&nbsp;";
		var oDialog = new jcms__Dialog('2', showTitle, width, height, null, showCloseBox);
		var _left = url.indexOf(">");
		var contentType = "";
		var content = "";
		if(_left == -1 ){
			contentType = "iframe";
			content = url;
		}else{
			contentType = url.substring(0, _left);
			content = url.substring(_left+1, url.length);
		}
		if(contentType == "iframe"){
			if (content.indexOf("?") == -1)
				oDialog.open(content+"?"+(new Date().getTime()), returnFunc, "auto");
			else
				oDialog.open(content+"&zoq="+(new Date().getTime()), returnFunc, "auto");
		}else{
			oDialog.html("<div style='overflow: auto;width:"+width+"px;height:"+height+"px;'>" + __(content).innerHTML + "</div>");
		}
	},
	hide:function(callReturnFunc){
		new jcms__Dialog().reset(callReturnFunc);
	}
};
/////////////////////////////
//弹出加载层
/////////////////////////////
KnowfarCms.Loading={
	show:function(msgstr, width, height)
	{
		var oDialog = new jcms__Dialog('0', '友情提示', width, height, null, false);
		oDialog.init(true);
		oDialog.html("<div style='text-align:center;padding-top:20px;'>"+msgstr+"<br /><br /><img src='" + jcms__DialogUrl + "loading.gif' align='absmiddle'></div>");
	},
	hide:function(callReturnFunc){
		new jcms__Dialog().reset(callReturnFunc);
	}
};
////////////////////////////////////////////////////////////////////////////////////////////
//提示层
////////////////////////////////////////////////////////////////////////////////////////////
KnowfarCms.Hint={
	show:function(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset)
	{
		var oHint = new jcms__Hint(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset);
		oHint.show();
	},
	hide:function(){
		new jcms__Hint().hide();
	}
}
KnowfarCms.Event.add(window,"load",jcms__OperatorPlus);
KnowfarCms.Event.add(window,"scroll",jcms__OperatorPlus);
KnowfarCms.Event.add(window,"resize",jcms__OperatorPlus);
////////////////////////////////////////////////////////////////////////////////////////////

var jcms__HideSelects              = false;
var jcms__DialogIsShown            = false;
var jcms__WindowMask               = null;
////////////////////////////////////////////////////////////////////////////////////////////
//以下为弹出窗口的类
////////////////////////////////////////////////////////////////////////////////////////////
function jcms__Dialog(styletype, title, width, height, iswhat, showCloseBox){
	//半透明边框宽度
	var shadowBorderBoth=0;
	var oWidth = width;
	var oHeight = height;
	if(oWidth==-1 || oWidth>jcms__GetViewportWidth()-15)
	{
		oWidth=jcms__GetViewportWidth()-15;
		shadowBorderBoth = 0;
	}
	if(oWidth<-1)
	{
		oWidth=jcms__GetViewportWidth()+oWidth;
		shadowBorderBoth = 0;
	}
	if(oHeight==-1 || oHeight>jcms__GetViewportHeight()-47)
	{
		oHeight=jcms__GetViewportHeight()-47;
		shadowBorderBoth = 0;
	}
	if(oHeight<-1)
	{
		oHeight=jcms__GetViewportHeight()+oHeight;
		shadowBorderBoth = 0;
	}
	var sTitle = "友情提示";
	if (iswhat == "0")
		sTitle = "错误提示";
	else if (iswhat == "1")
		sTitle = "成功提示";
	else
		if (title!='') sTitle = title;
	var src = "";
	var path = jcms__DialogUrl + styletype + "/";
	var gReturnFunc;
	var gReturnVal = null;
	var sButtonFunc = '<input id="dialogSubmit" class="dialogSubmit' + styletype + '" type="button" value="确 认" onclick="new jcms__Dialog().reset();" /> <input id="dialogCancel" class="dialogCancel' + styletype + '" type="button" value="取 消" onclick="new jcms__Dialog().reset();" />';
	var sClose = '';
	if (showCloseBox == null || showCloseBox == true)
		sClose = '<img alt="关闭" style="cursor:pointer;" id="dialogBoxClose" onclick="new jcms__Dialog().reset();" src="' + path + 'dialogCloseOut.gif" border="0" onmouseover="this.src=\'' + path + 'dialogCloseOver.gif\';" onmouseout="this.src=\'' + path + 'dialogCloseOut.gif\';" align="absmiddle" />';
	var sSuccess = '';
	if (iswhat != null)
		sSuccess = '<td width="80" align="center" valign="middle"><img id="dialogBoxFace" class="dialogBoxFace' + styletype + '" src="' + path + iswhat + '.gif" valign="absmiddle" /></td>';
	else
		sSuccess = '<td width="80" align="center" valign="middle"><img id="dialogBoxFace" class="dialogBoxFace' + styletype + '" src="warning.gif" valign="absmiddle" /></td>';
	var sBody = '\
		<table id="dialogBodyBox" class="dialogBodyBox' + styletype + '" border="0" align="center" cellpadding="0" cellspacing="0" width="100%" height="100%" >\
			<tr height="' + (oHeight - 70) + '">\
				<td width="10"></td>' + sSuccess + '<td id="dialogMsg" class="dialogMsg' + styletype + '"></td>\
				<td width="10"></td>\
			</tr>\
			<tr height="40"><td id="dialogFunc" class="dialogFunc' + styletype + '" colspan="4">' + sButtonFunc + '</td></tr>\
		</table>\
	';
	var sBox = '\
		<div style="display:none;" id="dialogBox" class="dialogBox' + styletype + '">\
			<div id="dialogTitleDiv" class="dialogTitleDiv' + styletype + '" style="width:' + oWidth + 'px;">\
				<span id="dialogBoxTitle" class="dialogBoxTitle' + styletype + '">' + sTitle + '</span>\
				<span id="dialogBoxClose" class="dialogBoxClose' + styletype + '">' + sClose + '</span>\
			</div>\
			<div id="dialogHeight" style="width:' + oWidth + 'px;height:' + oHeight + 'px;">\
				<div id="dialogBody" class="dialogBody' + styletype + '" style="height:' + oHeight + 'px;">' + sBody + '</div>\
			</div>\
		</div>\
		<div id="dialogBoxShadow" style="display:none;"></div>\
	';
	this.init = function(_showTitleBar){
		document.body.oncontextmenu=function(){return false;};
		document.body.onselectstart=function(){return false;};
		document.body.ondragstart=function(){return false;};
		document.body.onsource=function(){return false;};
		__('dialogCase') ? __('dialogCase').parentNode.removeChild(__('dialogCase')) : function(){};
		__('windowMask') ? __('windowMask').parentNode.removeChild(__('windowMask')) : function(){};
		var oDiv = document.createElement('span');
		oDiv.id = "dialogCase";
		oDiv.innerHTML = sBox;
		document.body.appendChild(oDiv);
		var oMask = document.createElement('div');
		oMask.id = 'windowMask';
		document.body.appendChild(oMask);
		jcms__WindowMask = __("windowMask");
		jcms__WindowMask.style.display="block";
		var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10);
		if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) {
			jcms__HideSelects = true;
		}
		if (jcms__HideSelects == true) {
			HideSelectBoxes();
		}
		if (_showTitleBar == true || _showTitleBar == null)
			__("dialogTitleDiv").style.display = "block";
		else
			__("dialogTitleDiv").style.display = "none";
		jcms__OperatorPlus();
	}
	//this.show = function(){__('dialogBox') ? function(){} : this.init();jcms__DialogIsShown=true;this.middle('dialogBox');}
	this.show = function(){__('dialogBox') ? function(){} : this.init();jcms__DialogIsShown=true;this.middle('dialogBox');this.shadow();this.middle('dialogBoxShadow');jcms__OperatorPlus();}
	this.html = function(_sHtml){
		this.show();
		__('dialogBody').innerHTML = _sHtml;
	}
	this.button = function(_sId, _sFuc){
		if(__(_sId)){
			__(_sId).style.display = '';
			if(__(_sId).addEventListener){
				if(__(_sId).act){__(_sId).removeEventListener('click', function(){eval(__(_sId).act);}, false);}
				__(_sId).act = _sFuc;
				__(_sId).addEventListener('click', function(){eval(_sFuc);this.reset();}, false);
			}else{
				if(__(_sId).act){__(_sId).detachEvent('onclick', function(){eval(__(_sId).act);});}
				__(_sId).act = _sFuc;
				__(_sId).attachEvent('onclick', function(){eval(_sFuc);});
			}
		}
	}
	this.shadow = function(){
		if(shadowBorderBoth>0){
			var oShadow = __('dialogBoxShadow');
			var oDialogDiv = __('dialogBox');
			oShadow.style.position = "absolute";
			oShadow.style.background = "#000";
			oShadow.style.display = "";
			oShadow.style.opacity = "0.25";
			oShadow.style.filter = "alpha(opacity=25)";
			oShadow.style.width = (oDialogDiv.offsetWidth + shadowBorderBoth)+"px";
			oShadow.style.height = (oDialogDiv.offsetHeight + shadowBorderBoth)+"px";
		}
	}
	this.open = function(_sUrl, _returnFunc, _sMode){
		this.show();
		gReturnFunc = _returnFunc;
		//if(!_sMode || _sMode == "no" || _sMode == "yes"){
			__("dialogBody").innerHTML = "<iframe id='dialogFrame' name='dialogFrame' src='"+_sUrl+"'  width='" + oWidth + "' height='" + oHeight + "' frameborder='no' border='0' marginwidth='0' marginheight='0' scrolling='" + _sMode + "' style='overflow-x:hidden'></iframe>";
			__("dialogFrame").src = _sUrl;
		//}
	}
	this.reset = function(callReturnFunc){__('dialogCase') ? this.dispose(callReturnFunc) : function(){};}
	this.dispose = function(callReturnFunc){
		jcms__DialogIsShown = false;
		document.body.oncontextmenu=function(){return true;};
		document.body.onselectstart=function(){return true;};
		document.body.ondragstart=function(){return true;};
		document.body.onsource=function(){return true;};
		__('dialogFrame') ? __('dialogFrame').src='' : function(){};//不加这句可能导致焦点丢失
		__('dialogCase').parentNode.removeChild(__('dialogCase'));
		__('windowMask').parentNode.removeChild(__('windowMask'));
		jcms__WindowMask=null;
		if (callReturnFunc == true && gReturnFunc != null) {
			gReturnVal = window.dialogFrame.returnVal;
			window.setTimeout('gReturnFunc(gReturnVal);', 1);
		}
		if (jcms__HideSelects == true) {
			ShowSelectBoxes();
			jcms__HideSelects = false;
		}
		//__('dialogBoxShadow').style.display = "none";
	}
	this.event = function(_sMsg, _sSubmit, _sCancel, _sClose){
		this.show();
		__('dialogFunc').innerHTML = sButtonFunc;
		__('dialogBoxClose').innerHTML = sClose;
		__('dialogBodyBox') == null ? __('dialogBody').innerHTML = sBody : function(){};
		__('dialogMsg') ? __('dialogMsg').innerHTML = _sMsg  : function(){};
		_sSubmit ? this.button('dialogSubmit', _sSubmit) | __('dialogSubmit').focus() : __('dialogSubmit').style.display = "none";
		_sCancel ? this.button('dialogCancel', _sCancel) : __('dialogCancel').style.display = "none";
		_sClose ? this.button('dialogBoxClose', _sClose) : function(){};
	}
	this.set = function(_oAttr, _sVal){
		var oDialogDiv = __('dialogBox');
		var oHeight = __('dialogHeight');
		if(_sVal != ''){
			switch(_oAttr){
				case 'title':
					__('dialogBoxTitle').innerHTML = _sVal;
					title = _sVal;
					break;
				case 'width':
					oDialogDiv.style.width = _sVal;
					width = _sVal;
					this.middle('dialogBox');
					this.shadow();
					this.middle('dialogBoxShadow');
					jcms__OperatorPlus();
					break;
				case 'height':
					oHeight.style.height = _sVal;
					height = _sVal;
					this.middle('dialogBox');
					this.shadow();
					this.middle('dialogBoxShadow');
					jcms__OperatorPlus();
					break;
				case 'src':
					if(parseInt(_sVal) > 0){
						__('dialogBoxFace') ? __('dialogBoxFace').src = path + _sVal + '.png' : function(){};
					}else{
						__('dialogBoxFace') ? __('dialogBoxFace').src = _sVal : function(){};
					}
					src = _sVal;
					break;
				case 'url':
					this.open(_sVal);
					break;
			}
		}
	}
	this.middle = function(_sId){	
		var theWidth;
		var theHeight;
		if (document.documentElement && document.documentElement.clientWidth) { 
			theWidth = document.documentElement.clientWidth+document.documentElement.scrollLeft*2;
			theHeight = document.documentElement.clientHeight+document.documentElement.scrollTop*2; 
		} else if (document.body) { 
			theWidth = document.body.clientWidth;
			theHeight = document.body.clientHeight; 
		}else if(window.innerWidth){
			theWidth = window.innerWidth;
			theHeight = window.innerHeight;
		}
		__(_sId).style.display = '';
		__(_sId).style.position = "absolute";
		__(_sId).style.left = (theWidth / 2) - (__(_sId).offsetWidth / 2)+"px";
		if(document.all||__("user_page_top")){
			__(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - (__(_sId).offsetHeight / 2)+"px";
		}else{
			var sClientHeight = parent ? parent.document.body.clientHeight : document.body.clientHeight;
			var sScrollTop = parent ? parent.document.body.scrollTop : document.body.scrollTop;
			var sTop = -80 + (sClientHeight / 2 + sScrollTop) - (__(_sId).offsetHeight / 2);
			__(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - (__(_sId).offsetHeight / 2)+"px";
		}
	}
	BtnOver=function(obj,path){obj.style.backgroundImage = "url("+path+"button2.gif)";}
	BtnOut=function(obj,path){obj.style.backgroundImage = "url("+path+"button1.gif)";}
	ShowSelectBoxes=function(){var x = document.getElementsByTagName("SELECT");for (i=0;x && i < x.length; i++){x[i].style.visibility = "visible";}}
	HideSelectBoxes=function(){var x = document.getElementsByTagName("SELECT");for (i=0;x && i < x.length; i++) {x[i].style.visibility = "hidden";}}

}
function jcms__Exec(_sFuc){
	if(_sFuc){
		if(typeof(_sFuc)=="function"){
			_sFuc();
		}else{
			eval(_sFuc);
		}
	}
}
///////////////////////////////////////////////////////////////////////////
function jcms__OperatorPlus() {
	if (jcms__DialogIsShown == true) {
		var oDialogDiv = __("dialogBox");
		var oShadow = __("dialogBoxShadow");
		var oWidth = oDialogDiv.offsetWidth;
		var oHeight = oDialogDiv.offsetHeight;
		var theBody = document.getElementsByTagName("BODY")[0];
		var scTop = parseInt(jcms__GetScrollTop(),10);
		var scLeft = parseInt(theBody.scrollLeft,10);
		var fullHeight = jcms__GetViewportHeight();
		var fullWidth = jcms__GetViewportWidth();
		oDialogDiv.style.top = (scTop + ((fullHeight - oHeight) / 2)) + "px";
		oDialogDiv.style.left = (scLeft + ((fullWidth - oWidth) / 2)) + "px";
		oShadow.style.top = (scTop + ((fullHeight - oShadow.offsetHeight) / 2)) + "px";
		oShadow.style.left = (scLeft + ((fullWidth - oShadow.offsetWidth) / 2)) + "px";
		if (jcms__WindowMask != null) {
			var popHeight = theBody.scrollHeight;
			var popWidth = theBody.scrollWidth;
			if (fullHeight > theBody.scrollHeight) popHeight = fullHeight;
			if (fullWidth > theBody.scrollWidth) popWidth = fullWidth;
			jcms__WindowMask.style.height = popHeight + "px";
			jcms__WindowMask.style.width = popWidth + "px";
		}
	}
}
function jcms__GetViewportHeight() {
	if (window.innerHeight!=window.undefined)//FF
	{
		return window.innerHeight;
	}
	if (document.compatMode=='CSS1Compat')//IE
	{
		return document.documentElement.clientHeight;
	}
	if (document.body)//other
	{
		return document.body.clientHeight; 
	}
	return window.undefined; 
}
function jcms__GetViewportWidth() {
	var offset = 17;
	var width = null;
	if (window.innerWidth!=window.undefined)//FF
	{
		//return window.innerWidth-offset; 
		return window.innerWidth; 
	}
	if (document.compatMode=='CSS1Compat')//IE
	{
		return document.documentElement.clientWidth; 
	}
	if (document.body)//other
	{
		return document.body.clientWidth; 
	}
	return window.undefined; 
}
function jcms__GetScrollTop() {
	if (self.pageYOffset){return self.pageYOffset;}
	else if (document.documentElement && document.documentElement.scrollTop){return document.documentElement.scrollTop;}
	else if (document.body){return document.body.scrollTop;}
}
function jcms__GetScrollLeft() {
	if (self.pageXOffset){return self.pageXOffset;}
	else if (document.documentElement && document.documentElement.scrollLeft){return document.documentElement.scrollLeft;}
	else if (document.body){return document.body.scrollLeft;}
}
function jcms__SetDialogTitle(){
	if(window.document.title!=""){
		try {
			__('dialogBoxTitle').innerHTML = window.document.title;
		}
		catch(e) {
			try {
				parent.__('dialogBoxTitle').innerHTML = window.document.title;
			}
			catch(e) {
			}	
		}
	}
}
function jcms__SetDialogSize(w,h){
	try {
		if(w>0) __('dialogBox').style.width = w;
		if(h>0) __('dialogHeight').style.height = h;
		jcms__OperatorPlus();
	}
	catch(e) {
		try {
			if(w>0) parent.__('dialogBox').style.width = w;
			if(h>0) parent.__('dialogHeight').style.height = h;
			parent.jcms__OperatorPlus();
		}
		catch(e) {
		}	
	}	
}
//提示层类
function jcms__Hint(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset)
{
	var path = jcms__HintUrl;
	var imageLeft = path+'commandbg1.gif';
	var imageRight = path+'commandbg2.gif';
	if((showtype==null)||(showtype =="")) 
		showtype = "up";
	if(showtype=="down"){
		imageLeft = path+'commandbg3.gif';
		imageRight = path+'commandbg4.gif';
	}
	this.show = function() {
		this.init();
		var p = getposition(obj);
		__('hintIframe').style.height= objheight + "px";
		__('hintInfo').innerHTML = info;
		__('hintSpan').style.display='block';
		if(objtopfirefoxoffset != null && objtopfirefoxoffset !=0 && !isie())
			__('hintSpan').style.top=p['y']+parseInt(objtopfirefoxoffset)+"px";
		else
		{
			if(objtopoffset == 0)
			{ 
				if(showtype=="up")
				{
				 	__('hintSpan').style.top=(p['y'] - __('hintInfo').offsetHeight - 32)+"px";
				}
				else
				{
				 	__('hintSpan').style.top=(p['y'] + obj.offsetHeight + 1)+"px";
				}
			}
			else
				__('hintSpan').style.top=(p['y']+objtopoffset)+"px";
		}
		__('hintSpan').style.left=(p['x']+objleftoffset)+"px";
	}
	//隐藏提示层
	this.hide = function() {
		__('hintSpan').style.display='none';
	}
	function getposition(obj)
	{
		var r = new Array();
		r['x'] = obj.offsetLeft;
		r['y'] = obj.offsetTop;
		while(obj = obj.offsetParent)
		{
			r['x'] += obj.offsetLeft;
			r['y'] += obj.offsetTop;
		}
		return r;
	}
	this.init = function(){
		__('hintSpan') ? __('hintSpan').parentNode.removeChild(__('hintSpan')) : function(){};
		var hintObj=document.createElement("span");
		hintObj.setAttribute("id","hintSpan");
		hintObj.style.position="absolute";
		hintObj.style.display="none";
		var sBody = '<div id="hintDiv">\
				<p><img src="'+imageLeft+'" /></p>\
				<div class="hintmessagetext"><img id="hintdot" src="'+path+'dot.gif" /><span id="hintInfo" ></span></div>\
				<p><img src="'+imageRight+'" /></p>\
			</div>\
			<iframe id="hintIframe" frameborder="0" scrolling="no"></iframe>\
		';
		hintObj.innerHTML=sBody;
		document.body.appendChild(hintObj);
	}
}
/* Url编码 */ 
var jcms__UrlEncode = function(unzipStr){ 
	var zipstr=""; 
	var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
	var tt= ""; 
	for(var i=0;i<unzipStr.length;i++){ 
		var chr = unzipStr.charAt(i); 
		var c=jcms__StringToAscii(chr); 
		tt += chr+":"+c+"n"; 
		if(parseInt("0x"+c) > 0x7f){ 
			zipstr+=encodeURI(unzipStr.substr(i,1)); 
		}else{ 
		if(chr==" ") 
			zipstr+="+"; 
		else if(strSpecial.indexOf(chr)!=-1) 
			zipstr+="%"+c.toString(16); 
		else 
			zipstr+=chr; 
		} 
	} 
	return zipstr; 
} 
/* Url解码 */ 
var jcms__UrlDecode=function(zipStr){ 
	var uzipStr=""; 
	for(var i=0;i<zipStr.length;i++){ 
		var chr = zipStr.charAt(i); 
		if(chr == "+"){ 
			uzipStr+=" "; 
		}else if(chr=="%"){ 
			var asc = zipStr.substring(i+1,i+3); 
			if(parseInt("0x"+asc)>0x7f){ 
				uzipStr+=decodeURI("%"+asc.toString()+zipStr.substring(i+3,i+9).toString()); 
				i+=8; 
			}else{ 
				uzipStr+=jcms__AsciiToString(parseInt("0x"+asc)); 
				i+=2; 
			} 
		}else{ 
			uzipStr+= chr; 
		} 
	} 
	return uzipStr; 
} 
var jcms__StringToAscii = function(str){
	return str.charCodeAt(0).toString(16);
}
var jcms__AsciiToString = function(asccode){
	return String.fromCharCode(asccode);
}
////////////////////////////////////////////////////////////////////////////////////////////
function jcms__SetUrlRefresh(url)
{
	if(url.indexOf("?") > 0)
    		return url+"&t="+(new Date().getTime());   
	else
    		return url+"?t="+(new Date().getTime());   
}
/*当前网站访问者信息*/
var user = new Object();
if(KnowfarCms.Cookie.get("knowfar_user", "id") == ""){//游客
	user.id = "0";
	user.name = "guest";
	user.adminid = "0";
	user.password = "666666";
	user.userkey = "666666";
	user.groupid = "0";
	user.groupname = "游客组";
	user.setting = "";
	user.cookies = "88888888";
}
else{
	user.id = KnowfarCms.Cookie.get("knowfar_user", "id");
	user.name = KnowfarCms.Cookie.get("knowfar_user", "name");
	user.adminid = KnowfarCms.Cookie.get("knowfar_user", "adminid");
	user.password = KnowfarCms.Cookie.get("knowfar_user", "password");
	user.userkey = KnowfarCms.Cookie.get("knowfar_user", "password").substring(4,12);
	user.groupid = KnowfarCms.Cookie.get("knowfar_user", "groupid");
	user.groupname = KnowfarCms.Cookie.get("knowfar_user", "groupname");
	user.setting = KnowfarCms.Cookie.get("knowfar_user", "setting");
	user.cookies = KnowfarCms.Cookie.get("knowfar_user", "cookies");
}
/*获取文件后缀名*/
function GetFileExt(FileName)
{
	return FileName.substring(FileName.lastIndexOf('.')+1, FileName.length).toLowerCase();;
}

/*获取指定字符串的长度*/
function GetLength(id)
{
	var srcjo = $("#"+id);
	sType = srcjo.get(0).type;
	var len = 0;
	switch(sType)
	{
		case "text":
		case "hidden":
		case "password":
		case "textarea":
		case "file":
			var val = srcjo.val();
			for (var i = 0; i < val.length; i++) 
			{
				if (val.charCodeAt(i) >= 0x4e00 && val.charCodeAt(i) <= 0x9fa5){ 
					len += 2;
				}else {
					len++;
				}
			}
			break;
		case "checkbox":
		case "radio": 
			len = $("input[@type='"+sType+"'][@name='"+srcjo.attr("name")+"'][@checked]").length;
			break;
		case "select-one":
			len = srcjo.get(0).options ? srcjo.get(0).options.selectedIndex : -1;
			break;
		case "select-more":
			break;
	}
	return len;
}
function InsertUnit(text, obj) {
	if(!obj) {
		obj = 'jstemplate';
	}
	var o = document.getElementById(obj);
	o.focus();
	if(!KnowfarCms.isUndefined(o.selectionStart)) {
		var opn = o.selectionStart + 0;
		o.value = o.value.substr(0, o.selectionStart) + text + o.value.substr(o.selectionEnd);
	} else if(document.selection && document.selection.createRange) {
		var sel = document.selection.createRange();
		sel.text = text.replace(/\r?\n/g, '\r\n');
		//sel.moveStart('character', -strlen(text));
	} else {
		o.value += text;
	}
}
function JoinSelect(selectName)
{
	var selectIDs="";
	$("input[@name='" + selectName + "']").each(function(){
   		if($(this).attr("checked")==true){
			if(selectIDs=="")
    				selectIDs = $(this).attr("value");
			else
				selectIDs += ","+$(this).attr("value");
   		}
	})
	return selectIDs;
}
function ExecuteJsonData(oJsonUrl, oTemplateUrl, oDiv, oFileName, oPluginName, oFileType)
{
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"time="+(new Date().getTime()),
		url:        oJsonUrl,
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			$("#"+oDiv).setTemplateURL(oTemplateUrl+"?time="+(new Date().getTime()), null, {filter_data: true});
			$("#"+oDiv).processTemplate(d);
			if(oFileName!=null)
			{
				SaveHtml2File($("#"+oDiv).html(), oFileName, oPluginName, oFileType);
			}
		}
	});
}
function SaveHtml2File(oHtml, oFileName, oPluginName, oFileType)
{
	if(oPluginName==null) oPluginName="";
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"html="+encodeURIComponent(oHtml)+"&filename="+oFileName+"&filetype="+oFileType+"&pluginname="+oPluginName+"&time="+(new Date().getTime()),
		url:		"/ajax/html2file.aspx",
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success: function(){}
	});
}
function ajaxPluginTopNav(oDiv, save2file)
{
	if(oDiv==null) oDiv="ajaxPluginTopNav";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_topnav.htm", oDiv, "/_data/style/j_topnav.js", "", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_topnav.htm", oDiv, "/_data/html/j_topnav.htm", "", "html");
	else
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_topnav.htm", oDiv);
}
function ajaxPluginRssMap(oDiv, save2file)
{
	if(oDiv==null) oDiv="ajaxPluginRssMap";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_rssmap.htm", oDiv, "/_data/style/j_rssmap.js", "", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_rssmap.htm", oDiv, "/_data/html/j_rssmap.htm", "", "html");
	else
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_rssmap.htm", oDiv);
}
function ajaxPluginSiteMap(oDiv, save2file)
{
	if(oDiv==null) oDiv="ajaxPluginSiteMap";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_sitemap.htm", oDiv, "/_data/style/j_sitemap.js", "", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_sitemap.htm", oDiv, "/_data/html/j_sitemap.htm", "", "html");
	else
		ExecuteJsonData("/_data/json/systemtree.js", "/themes/_sitemap.htm", oDiv);
}
function ajaxPluginTopNavStuHover() {
	var cssRule;
	var newSelector;
	for (var i = 0; i < document.styleSheets.length; i++)
		for (var x = 0; x < document.styleSheets[i].rules.length ; x++)
			{
			cssRule = document.styleSheets[i].rules[x];
			if (cssRule.selectorText.indexOf("LI:hover") != -1)
			{
				 newSelector = cssRule.selectorText.replace(/LI:hover/gi, "LI.iehover");
				document.styleSheets[i].addRule(newSelector , cssRule.style.cssText);
			}
		}
	var topnavbar = document.getElementById("topnavbar");
	if(topnavbar != null)
	{
		var getElm = topnavbar.getElementsByTagName("LI");
		for (var i=0; i<getElm.length; i++) {
			getElm[i].onmouseover=function() {
				this.className+=" iehover";
			}
			getElm[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" iehover\\b"), "");
			}
		}
	}
}
function ajaxAddMessage(userid,username){
	window.open('/user/pmsend/index.aspx?touserid='+userid+'&tousername='+encodeURIComponent(username));
}
function ajaxAddFriend(userid){
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"id="+userid+"&time="+(new Date().getTime()),
		url:		"/user/friendadd/ajax.aspx?oper=ajaxAddFriend",
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			switch (d.result)
			{
			case '0':
				alert(d.returnval);
				break;
			case '1':
				alert(d.returnval);
				break;
			}
		}
	});
}
function ajaxCopyright(oDiv, save2file)
{
	if(oDiv==null) oDiv="ajaxCopyright";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/systeminfo.js", "/themes/_copyright.htm", oDiv, "/_data/style/j_copyright.js","","js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/systeminfo.js", "/themes/_copyright.htm", oDiv, "/_data/html/j_copyright.htm","","html");
	else
		ExecuteJsonData("/_data/json/systeminfo.js", "/themes/_copyright.htm", oDiv);
}

function UrlSearch(){ //重复时只取最后一个
	var name,value; 
	var str=window.location.href; //取得整个地址栏
	var num=str.indexOf("?") 
	str=str.substr(num+1); //取得所有参数
	var arr=str.split("&"); //各个参数放到数组里
	for(var i=0;i < arr.length;i++){ 
		num=arr[i].indexOf("="); 
		if(num>0){ 
			name=arr[i].substring(0,num);
			value=arr[i].substr(num+1);
			this[name]=value;
		} 
	}
	this["getall"]=str;
}
function ShowUserPage(userid){
	//alert(userid);
}
var RQ=new UrlSearch(); //实例化
function formatStr(s){
	if(typeof(s) == "string")
		return s;
	else
		return "";
}
function joinValue(parameter){
	eval("var temp=RQ."+parameter);
	if((typeof(temp) == "string") && (typeof(temp) != null))
	{
		return "&"+parameter+"="+temp.replace(/(^\s*)|(\s*$)/g, "");
	}
	else
		return "";
}
/*
function q(parameter){
	eval("var temp=RQ."+parameter);
	if((typeof(temp) == "string") && (typeof(temp) != null))
	{
		return temp.replace(/(^\s*)|(\s*$)/g, "");
	}
	else
		return "";
}
*/
function q(pname){
	var query = location.search.substring(1);
	var qq = "";
	params = query.split("&");
	if(params.length>0){
		for(var n in params){
			var pairs = params[n].split("=");
			if(pairs[0]==pname){
				qq = pairs[1];
				break;
			}
		}
	}
	return qq;
}
function anchor(){
	var str=window.location.href; //取得整个地址栏
	var num=str.indexOf("#") 
	if(num>0){
	    str=str.substr(num+1);
	    return str;
	}
	else
	    return "";
}
/*获取当前页页码*/
function thispage(){
	var r = /^\+?[1-9][0-9]*$/;
	if(r.test(q('page')))
		return q('page');
	else
		return "1";
}
/*全选*/
function CheckAll(form)
{
	var f;
	if(form==null)
		f = document.getElementsByTagName('FORM')[0];
	else
		f = document.getElementById(form);
	for (var i=0;i<f.elements.length;i++)
	{
		var e = f.elements[i];
		if (e.name != 'chkall' && e.type == "checkbox")
			e.checked = document.getElementById("chkall").checked;
	}
}
/*全不选*/
function CheckNo(form)
{
	var f;
	if(form==null)
		f = document.getElementsByTagName('FORM')[0];
	else
		f = document.getElementById(form);
	for (var i=0;i<f.elements.length;i++)
	{
		var e = f.elements[i];
		if (e.type == "checkbox")
			e.checked = false;
	}
}
function WinFullOpen(url){
	var newwin=window.open("","","scrollbars");
	if(document.all){
		newwin.moveTo(0,0);
		newwin.resizeTo(screen.width,screen.height);
	}
	newwin.location=url;
}
function WindowOpen(url,iWidth,iHeight,name)
{
	if(name==null) name='';
	var iTop = (window.screen.availHeight-30-iHeight)/2;
	var iLeft = (window.screen.availWidth-10-iWidth)/2;
	window.open(url,name,'height='+iHeight+',,innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
function tabit(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++)
	{
		document.getElementById(tabName+"_div_"+i).style.display = "none"; 
		document.getElementById(tabName+"_btn_"+i).className = "none";
        
	}	
	document.getElementById(tabName+"_div_"+id).style.display = "block"; 
	btn.className = "curr";
}
var fodTime;
function delaytabit(btn){
	clearTimeout(fodTime);
	fodTime=setTimeout(function(){tabit(btn)},100);
}
/*字符串格式化*/
String.prototype.Trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");}
String.prototype.LTrim = function(){return this.replace(/(^\s*)/g, "");}
String.prototype.RTrim = function(){return this.replace(/(\s*$)/g, "");}
/*日期格式化(2009-06-30+++)*/
function formatDate(strDate, format){
	return parseDate(strDate).format(format);
} 
function formatDate2(strDate, format){
	var _date = formatDate(strDate, 'yyyy-MM-dd');
	return _date != "1900-01-01" ? parseDate(strDate).format(format) : "0000-00-00";
}
function formatDate3(strDate, format){
	var _date = formatDate(strDate, 'yyyy-MM-dd');
	return _date != "1900-01-01" ? parseDate(strDate).format(format) : "";
} 
Date.prototype.format = function(format)
{
	if(format == null) format = "yyyy-MM-dd hh:mm:ss";
	var o = 
	{
		"M+" : this.getMonth()+1, //month
		"d+" : this.getDate(),    //day
		"h+" : this.getHours(),   //hour
		"m+" : this.getMinutes(), //minute
		"s+" : this.getSeconds(), //second
		"q+" : Math.floor((this.getMonth()+3)/3), //quarter
		"S" : this.getMilliseconds() //millisecond
	}
		
	if(/(y+)/.test(format)) 
		format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)
		if(new RegExp("("+ k +")").test(format))
			format = format.replace(RegExp.$1,RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));
	return format;
}
function daysBetween(DateOne,DateTwo)   
{    
    var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-'));   
    var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1);   
    var OneYear = DateOne.substring(0,DateOne.indexOf ('-'));   
   
    var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-'));   
    var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1);   
    var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));   
   
    var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000);    
    return Math.abs(cha);   
}
//+---------------------------------------------------   
//| 日期计算   
//+---------------------------------------------------   
Date.prototype.DateAdd = function(strInterval, Number) {    
    var dtTmp = this;   
    switch (strInterval) {    
        case 's' :return new Date(Date.parse(dtTmp) + (1000 * Number));   
        case 'n' :return new Date(Date.parse(dtTmp) + (60000 * Number));   
        case 'h' :return new Date(Date.parse(dtTmp) + (3600000 * Number));   
        case 'd' :return new Date(Date.parse(dtTmp) + (86400000 * Number));   
        case 'w' :return new Date(Date.parse(dtTmp) + ((86400000 * 7) * Number));   
        case 'q' :return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number*3, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());   
        case 'm' :return new Date(dtTmp.getFullYear(), (dtTmp.getMonth()) + Number, dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());   
        case 'y' :return new Date((dtTmp.getFullYear() + Number), dtTmp.getMonth(), dtTmp.getDate(), dtTmp.getHours(), dtTmp.getMinutes(), dtTmp.getSeconds());   
    }   
} 
//+---------------------------------------------------   
//| 比较日期差 dtEnd 格式为日期型或者 有效日期格式字符串   
//+---------------------------------------------------   
Date.prototype.DateDiff = function(strInterval, dtEnd) {    
    var dtStart = this;   
    if (typeof dtEnd == 'string' )//如果是字符串转换为日期型   
    {    
        dtEnd = StringToDate(dtEnd);   
    }   
    switch (strInterval) {    
        case 's' :return parseInt((dtEnd - dtStart) / 1000);   
        case 'n' :return parseInt((dtEnd - dtStart) / 60000);   
        case 'h' :return parseInt((dtEnd - dtStart) / 3600000);   
        case 'd' :return parseInt((dtEnd - dtStart) / 86400000);   
        case 'w' :return parseInt((dtEnd - dtStart) / (86400000 * 7));   
        case 'm' :return (dtEnd.getMonth()+1)+((dtEnd.getFullYear()-dtStart.getFullYear())*12) - (dtStart.getMonth()+1);   
        case 'y' :return dtEnd.getFullYear() - dtStart.getFullYear();   
    }   
} 
function parseDate(str){   
	if(typeof str == 'string'){   
		var results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) *$/);   
		if(results && results.length>3)   
			return new Date(parseInt(results[1]),parseInt(results[2]) -1,parseInt(results[3]));    
		results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2}) *$/);   
		if(results && results.length>6)   
			return new Date(parseInt(results[1]),parseInt(results[2]) -1,parseInt(results[3]),parseInt(results[4]),parseInt(results[5]),parseInt(results[6]));    
		results = str.match(/^ *(\d{4})-(\d{1,2})-(\d{1,2}) +(\d{1,2}):(\d{1,2}):(\d{1,2})\.(\d{1,9}) *$/);   
		if(results && results.length>7)   
			return new Date(parseInt(results[1]),parseInt(results[2]) -1,parseInt(results[3]),parseInt(results[4]),parseInt(results[5]),parseInt(results[6]),parseInt(results[7]));    
	}   
	return null;   
}
/*预览HTML代码*/
function PreviewHTML(txt)
{
	var win = window.open("", "win");
	win.document.open("text/html", "replace"); 
	win.document.write(txt); 
	win.document.close();
}
function formatIsPass(ispass) {
	if(ispass == "-1")return "已删";
	return ispass == "1" ? "已审" : "未审";
}
function formatIsImg(isimg) {
	return isimg == "1" ? "有索引图" : "无索引图";
}
function formatIsTop(istop) {
	return istop == "1" ? "推荐" : "不推荐";
}
function formatIsPublish(ispublish) {
	return ispublish == "1" ? "已发布" : "未发布";
}
/*格式化列表*/
function FormatListValue(id)
{
	var _val = $('#'+id).val();
	if(_val=='') return;
	_val =_val.replace(/[，]/g,",");
	_val =_val.replace(/ /g,",");
	_val =_val.replace(/[,]+/g,",");
	$('#'+id).val(_val);
}



function tab(Id, tId, EclassName, iBeHavior){
	if(!document.getElementById(Id))return;
	if(iBeHavior==null)iBeHavior='mouseover';
	if(EclassName==null)EclassName='more';
	var self=this;
	var links=document.getElementById(Id).getElementsByTagName('a');
	if(links.length==0)return;

	this.init=function(){
		for(var i=0;i<links.length;i++){
			eval("links[i].on"+iBeHavior+"=function(e){return self.itab(this);};");
			links[i].onclick=function(){
				return (this.href.indexOf('javascript:')>-1 || this.href.indexOf('#')<0 || this.className==EclassName);
			};
			links[i].onfocus=function(e){
				this.blur();
			};
		}
		self.itab(links[0]);
	};
	this.itab=function(o){
		if(o.href.indexOf('javascript:')>-1 || o.href.indexOf('#')<0 || o.className==EclassName){return true;}
		for(var i=0;i<links.length;i++){
			if(links[i].className!=EclassName)links[i].className='';
		}
		o.className='s';
		var url=o.href.substring(o.href.indexOf('#')+1);
		this.showDiv(url);
		return false;
	};
	this.showDiv=function(tDiv){
		if(document.getElementById(tId) && document.getElementById(tDiv)){
			document.getElementById(tId).innerHTML=document.getElementById(tDiv).innerHTML;
			tab_img_border(document.getElementById(tId));
			//tab_blank_link(document.getElementById(tId));
			tab_set_className(document.getElementById(tId));
		}
	};
	this.createDiv=function(id){
		var div=document.createElement('div');
		div.style.display='none';
		div.id=id;
		document.body.appendChild(div);
		return div;
	};
	this.init();
}

function tab_img_border(obj){
	var li = obj.getElementsByTagName('li');
	var img = null;
	var bc = '#333';
	for(var i=0;i<li.length;i++){
		img = li[i].getElementsByTagName('img');
		for(var j=0;j<img.length;j++){
			bc = img[j].style.borderColor;
			img[j].onmouseover=function(){this.style.borderColor='#f60';};
			img[j].onmouseout=function(){this.style.borderColor=bc;};
		}
	}
}

function tab_blank_link(obj){
	obj=obj==null?document:obj;
	var links = obj.getElementsByTagName('a');
	for(var j=0;j<links.length;j++){
		links[j].setAttribute('target','_blank');
	}
}

function tab_set_className(obj){
	obj=obj==null?document:obj;
	this.initialize=function(){
		var ename='';
		var links=obj.getElementsByTagName('a');
		for(var i=0;i<links.length;i++){
			ename=links[i].className;
			if(ename=='new' || ename=='hot'){
				links[i].style.position='relative';
				this.createDiv(links[i],ename);
			}
		}
	};
	this.createDiv=function(ilink, en){
		var a=document.createElement('div');
		a.className='icon_'+en;
		a.style.left=parseInt(ilink.offsetLeft-15)+'px';
		a.style.top=parseInt(ilink.offsetTop-15)+'px';
		ilink.parentNode.appendChild(a);
		return a;
	};
	this.initialize();
}

function selectTag(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
}
//设置字体
function setfont(id,fsize){
	var ctext = document.getElementById(id);
	ctext.style.fontSize = fsize +"px";
}
//===================初始化方法（联想词||TAB)=====================
//初始化输入联想词
var initTextBoxDrop = function(inputId,showBoxId,url){
    var s_train = new TextBoxDrop(inputId,showBoxId);
    s_train.SetEnterHandler (function(value){
    });
    s_train.TextFeild = "v";
    s_train.KeyFeild = "k";
    s_train.ShowKey = true;
    s_train.SetAjaxMethod($.get);
    s_train.Url(url);
    s_train.SetContentStyle(function(input,contentbox){
        var inputBox = $(input);
        if($.browser.ie){
            contentbox.style.left = inputBox.offset().left;
            contentbox.style.top = inputBox.offset().top + 27;
        }
        else{
            $(contentbox).css({
                              top : inputBox.offset().top + 27,
                              left: inputBox.offset().left
                            });
        }
    });
    s_train.DisplayContentHandler(function(input,contentbox){
        if($(contentbox).width() < $(input).outerWidth()){
            $(contentbox).width($(input).outerWidth());
        }
    });
    return s_train;
}
Function.prototype.bindevent = function(scope, args){
		var method = this;
		if(args === undefined){
			args = [];
		}
		return function() {
			return method.apply(scope, args.concat(arguments));
		}
	}


/**
 * TextBox 提示
 */
var TextBoxDrop = function(pInputId,pContentId){
	var _self = this;
	var _EnterHandler;
	var _AjaxMethod;
	var _input = document.getElementById(pInputId);;
	var _ContentBox = document.getElementById(pContentId);
	var _Data;
	var _activeItemStyle = "active";
	var _activeId = -1;
	var _mouseInContent = false;
	var _DisplayContentHandler;	//显示事件
	var _SetContentStyle;
	var _url = "";	//查询地址
	var _oldStr = "";	
	var _timer;
	var _oldData;
	this.GetUrlHandler;
	this.KeyFeild;
	this.TextFeild;

	var bindevents = function(){
		_input.onkeyup = keyUpFun;
		_input.onkeydown = keyDownFun;
		_input.onfocus = function(){
			_input.select();
			getDataFun();
		};
		_input.onblur = function(){
			clearTimer();
			if(!_mouseInContent){
				hideBox();
			}
		};
		_ContentBox.onmousemove = function(){
			_mouseInContent = true;
		};
		_ContentBox.onmouseout = function(){
			_mouseInContent = false;
		};
	}
	
	/*Event*/
	this.ActiveItem;
	var keyDownFun = function(e){
		var key = window.event ? event.keyCode : e.which;
		switch(key){
			case 13:
				if(!isHiden()){
					clearTimer();
					hideBox();
				}
				else{
					return true;
				}
				if(_EnterHandler){
					_EnterHandler(_input.value);
				}
				//Enter
				return false;
			case 40:
				//Down
				_activeId += 1;
				hoverItem();
				return;
			case 38:
				//UP
				_activeId -= 1;
				hoverItem();
				return;
		}
	}
	
	var keyUpFun = function(e){
		var key = window.event ? event.keyCode : e.which;
		switch(key){
			case 13:
				if(!isHiden()){
					clearTimer();
					hideBox();
				}
				else{
					return true;
				}
				return false;
			case 40:
				return;
			case 38:
				return;
			default:
				_activeId = -1;
				getDataFun();
				break;
		}
	}

	var clearTimer = function(){
		if(_timer){
			window.clearTimeout(_timer);
			_timer = null;
		}
	}
	
	/*/Event*/
	var getDataFun = function(){
		clearTimer();
		_timer = window.setTimeout(searchFun,400);
	}
	
	var searchFun = function(){
		if(_input.value != ""){
			if(_oldStr != _input.value.Trim() || _oldStr == ""){
				var url = _url + encodeURIComponent(_input.value.Trim());
				if(_self.GetUrlHandler){
					url = _self.GetUrlHandler();
				}
				if(_AjaxMethod){
					_oldStr = _input.value.Trim();
					_AjaxMethod(url,function(data){
						var arr = eval(data);
						_oldData = arr;
						if(arr && arr.length > 0){
							showBox();
							displayContent(arr);
						}
						else{
							hideBox();
						}
					});
				}
			}
			else{
				if(_oldData && _oldData.length > 0){
					showBox();
					displayContent(_oldData);
				}
			}
		}
		else{
			_oldStr = "";
			hideBox();
		}
	}
	
	var hoverItem = function(){
		var liArr = _ContentBox.getElementsByTagName("li");
		if(_activeId > liArr.length-1){
			_activeId = 0;
		}
		if(_activeId < 0){
			_activeId = liArr.length-1;
		}
		for(var i = 0; i < liArr.length; i++){
			var item = liArr[i];
			if(i == _activeId){
				item.className = _activeItemStyle;
				setInputValue(item);
				_self.ActiveItem = item;
			}
			else{
				item.className = "";
			}
		}
	}
	
	var setInputValue = function(ele){
		if(_isArray){
			_input.value = ele.innerHTML;
		}
		else{
			
			if(_self.ShowKey){
				_input.value = ele.getAttribute("rel");
			}
			else{
				_input.value = ele.innerHTML;
			}
		}
	}
	
	this.ShowKey = false;
	var _isArray = true;
	var displayContent = function(arr){
		var html = "";
		if(_activeId > arr.length-1){
			_activeId = arr.length-1;
		}
		if(_activeId < -1){
			_activeId = -1;
		}
		_ContentBox.innerHTML = "";
		_self.ActiveItem = null;
		for(var i = 0; i < arr.length; i++){
			var item = document.createElement("li");
			if(typeof arr[i] == "string"){
				item.innerHTML = arr[i];
				_isArray = true;
			}
			else if(typeof arr[i] == "object"){
				if(_self.KeyFeild){
					item.innerHTML = arr[i][_self.TextFeild];
					item.setAttribute("rel",arr[i][_self.KeyFeild]);
				}
				_isArray = false;
			}
			item.onmouseover = mOver.bindevent(this,[item]);
			item.onmouseout = mOut.bindevent(this,[item]);
			item.onclick = mClick.bindevent(this,[item]);
			_ContentBox.appendChild(item);
		}
		if(_DisplayContentHandler){
			_DisplayContentHandler(_input,_ContentBox);
		}
		if(_SetContentStyle){
			_SetContentStyle(_input,_ContentBox);
		}
	}
	
	var mOver = function(ele){
		_activeId = -1;
		ele.className = _activeItemStyle;
	}
	
	var mOut = function(ele){
		ele.className = "";
	}
	
	var mClick =  function(ele){
		 setInputValue(ele);
		 _self.ActiveItem = ele;
		 if(_EnterHandler){
			_EnterHandler(_input.value);
		 }
		 
		 hideBox();
	}
	
	var isHiden = function(){
		return _ContentBox.style.display == "none";
	}
	
	var showBox = function(){
		_ContentBox.style.display = "block";
	}
	
	var hideBox = function(){
		_ContentBox.style.display = "none";
		_ContentBox.innerHTML = "";
	}

	var init = function(){
		bindevents();
	}
	
	this.SetEnterHandler = function(pHandler){
		_EnterHandler = pHandler;
	}
	this.SetAjaxMethod = function(pMethod){
		_AjaxMethod = pMethod;
	}
	this.SetContentStyle = function(callback){
		if(callback){
			_SetContentStyle = callback;
			_SetContentStyle(_input,_ContentBox);
		}
	}
	this.DisplayContentHandler = function(pHandler){
		_DisplayContentHandler = pHandler;
	}
	this.Url = function(pUrl){
		if(pUrl){
			_url = pUrl;
		}
	}
	init();
}
function ScrollText(content,btnPrevious,btnNext,autoStart,timeout,isSmoothScroll)
{
	this.Speed = 10;
	this.Timeout = timeout;
	this.stopscroll =false;//是否停止滚动的标志位
	this.isSmoothScroll= isSmoothScroll;//是否平滑连续滚动
	this.LineHeight = 20;//默认高度。可以在外部根据需要设置
	this.NextButton = this.$(btnNext);
	this.PreviousButton = this.$(btnPrevious);
	this.ScrollContent = this.$(content);
	if(!this.ScrollContent) return;
	this.ScrollContent.innerHTML += this.ScrollContent.innerHTML;//为了平滑滚动再加一遍

	if(this.PreviousButton)

	{
		this.PreviousButton.onclick = this.GetFunction(this,"Previous"); 
		this.PreviousButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.PreviousButton.onmouseout = this.GetFunction(this,"MouseOut");
	}
	if(this.NextButton){
		this.NextButton.onclick = this.GetFunction(this,"Next");
		this.NextButton.onmouseover = this.GetFunction(this,"MouseOver");
		this.NextButton.onmouseout = this.GetFunction(this,"MouseOut");
	}
	this.ScrollContent.onmouseover = this.GetFunction(this,"MouseOver");
	this.ScrollContent.onmouseout = this.GetFunction(this,"MouseOut");

	if(autoStart)
	{
		this.Start();
	}
}

ScrollText.prototype = {

	$:function(element)
	{
		return document.getElementById(element);
	},
	Previous:function()
	{
		this.stopscroll = true;
		this.Scroll("up");
	},
	Next:function()
	{
		this.stopscroll = true;
		this.Scroll("down");
	},
	Start:function()
	{
		if(this.isSmoothScroll)
		{
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"SmoothScroll"), this.Timeout);
		}
		else
		{		
			this.AutoScrollTimer = setInterval(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	Stop:function()
	{
		clearTimeout(this.AutoScrollTimer);
		this.DelayTimerStop = 0;
	},
	MouseOver:function()
	{	
		this.stopscroll = true;
	},
	MouseOut:function()
	{
		this.stopscroll = false;
	},
	AutoScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Speed);
		}
		else
		{
			if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
			{
				this.ScrollContent.scrollTop = 0;
			}
			clearTimeout(this.ScrollTimer);
			//this.AutoScrollTimer = setTimeout(this.GetFunction(this,"AutoScroll"), this.Timeout);
		}
	},
	SmoothScroll:function()
	{
		if(this.stopscroll) 
		{
			return;
		}
		this.ScrollContent.scrollTop++;
		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
	},
	Scroll:function(direction)
	{

		if(direction=="up")
		{
			this.ScrollContent.scrollTop--;
		}
		else
		{
			this.ScrollContent.scrollTop++;
		}
		if(parseInt(this.ScrollContent.scrollTop) >= parseInt(this.ScrollContent.scrollHeight) / 2)
		{
			this.ScrollContent.scrollTop = 0;
		}
		else if(parseInt(this.ScrollContent.scrollTop)<=0)
		{
			this.ScrollContent.scrollTop = parseInt(this.ScrollContent.scrollHeight) / 2;
		}
		
		if(parseInt(this.ScrollContent.scrollTop) % this.LineHeight != 0)
		{
			this.ScrollTimer = setTimeout(this.GetFunction(this,"Scroll",direction), this.Speed);
		}
	},
	GetFunction:function(variable,method,param)
	{
		return function()
		{
			variable[method](param);
		}
	}
}


// 显示当前日期，时间
function setCurrentDateTime(o){
	var d = new Date();
	var da = d.getDate();
	var mo = d.getMonth() + 1;
	var y = d.getFullYear();
	var h = d.getHours();
	if(h<10){h='0'+h}
	var m = d.getMinutes();
	if(m<10){m='0'+m}
	var s = d.getSeconds();
	if(s<10){s='0'+s}
	var week = ['天','一','二','三','四','五','六'];
	if(typeof(o) != 'object'){o=__(o)}
	o.innerHTML = y+'年'+mo+'月'+da+'日 星期'+week[d.getDay()]+'<br />'+h+':'+m+':'+s;
	window.setTimeout(function(){setCurrentDateTime(o)}, 1000);	
}

function CheckSearchData()
{
	var type = $("#search_channeltype").val();
	if($("#search_keywords").val()=="")
	{
		alert("请输入关键字");
		return;
	}
	window.open('/search/index.aspx?type='+type+'&k='+encodeURIComponent($("#search_keywords").val()));
}

var __JSON_Modules = {
	recordcount: 3, 
	table: [
		{no: 0, id: 5, title: '防务译文', type: 'version'},
		{no: 1, id: 7, title: '电子期刊', type: 'journal'},
		{no: 2, id: 6, title: '其他文档', type: 'document'}
	]
}
function BindModuleRadio(spanId,selecdType)
{
	var data = __JSON_Modules;
	var html = "";
	for (i=0;i<data.table.length;i++) {
		html += "<input id=\"RaChannelType_" + data.table[i].type + "\" type=\"radio\" name=\"type\" value=\"" + data.table[i].type + "\"";
		if(data.table[i].type == selecdType)
			html += " checked=\"checked\"";
		html += " /> <label for=\"RaChannelType_" + data.table[i].type + "\">" + data.table[i].title + "</label>";
	}
	html += "<input id=\"RaChannelType_all\" type=\"radio\" name=\"type\" value=\"all\"";
	if("all" == selecdType || "" == selecdType)
		html += " checked=\"checked\"";
	html += " /> <label for=\"RaChannelType_all\">全部</label>";
	$("#"+spanId).html(html);
}
var __JSON_Modes = {
	recordcount: 2, 
	table: [
		{no: 0, title: '加强模式'},
		{no: 1, title: '常规模式'}
	]
}
function BindModeRadio(spanId,selecdMode)
{
	var data = __JSON_Modes;
	var html = "";
	for (i=0;i<data.table.length;i++) {
		html += "<input id=\"RaSearchMode_" + data.table[i].no + "\" type=\"radio\" name=\"mode\" value=\"" + data.table[i].no + "\"";
		if(data.table[i].no == selecdMode)
			html += " checked=\"checked\"";
		html += " /> <label for=\"RaSearchMode_" + data.table[i].no + "\">" + data.table[i].title + "</label>";
	}
	$("#"+spanId).html(html);
}
var __JSON_Channels = {
	recordcount: 6, 
	table: [
		{no: 0, id: 8, title: '防务译文'},
		{no: 1, id: 23, title: '电子期刊'},
		{no: 2, id: 20, title: '防务报告'},
		{no: 3, id: 21, title: '美军条例'},
		{no: 4, id: 22, title: '外军期刊'},
		{no: 5, id: 24, title: '防务资源'}
	]
}
function BindChannelRadio(spanId,selecdId)
{
	var data = __JSON_Channels;
	var html = "";
	for (i=0;i<data.table.length;i++) {
		html += "<input id=\"RaChannelType_" + data.table[i].id + "\" type=\"radio\" name=\"ch\" value=\"" + data.table[i].id + "\"";
		if(data.table[i].id == selecdId)
			html += " checked=\"checked\"";
		html += " /> <label for=\"RaChannelType_" + data.table[i].id + "\">" + data.table[i].title + "</label>";
	}
	html += "<input id=\"RaChannelType_0\" type=\"radio\" name=\"ch\" value=\"0\"";
	if("0" == selecdId || "" == selecdId)
		html += " checked=\"checked\"";
	html += " /> <label for=\"RaChannelType_0\">不限</label>";
	$("#"+spanId).html(html);
}
function ajaxLoginbar(w)
{
	var uName="";
	var uPass="";
	if(w==null) w=0;
	if(w==-1)
	{
		$.ajax({
			type:		"get",
			dataType:	"json",
			data:		"time="+(new Date().getTime()),
			url:		"/ajax/user.aspx?oper=ajaxUserInfo",
			success:	function(data){
				window.location.href=site.LogoutUrl+"?userkey="+data.userkey;
			}
		});
	}
	else
	{
		$.ajax({
			type:		"post",
			dataType:	"json",
			data:		"name="+encodeURIComponent(uName)+"&pass="+encodeURIComponent(uPass)+"&state="+w,
			url:		"/ajax/user.aspx?oper=ajaxLoginbar&time="+(new Date().getTime()),
			error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
			success:	function(d){
				$("#ajaxLoginbar").setTemplateURL("/themes/_loginbar.htm?time="+(new Date().getTime()), null, {filter_data: true});
				$("#ajaxLoginbar").processTemplate(d);
				try{ showBubbleData();}
				catch(e){}
				ajaxShowWeather('search_bar_weather');//显示天气(2011.03.08)
			}
		});	
	}
}
///////////////////////////////////////////////////////////////////////////
//特约专题
///////////////////////////////////////////////////////////////////////////
function ajaxPluginSpecialList(oDiv, save2file)
{
	if(oDiv==null) oDiv="ajaxPluginSpecialList";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/special.js", "/themes/_speciallist.htm", oDiv, "/_data/style/p_special.js", "", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/special.js", "/themes/_speciallist.htm", oDiv, "/_data/html/p_special.htm", "", "html");
	else
		ExecuteJsonData("/_data/json/special.js", "/themes/_speciallist.htm", oDiv);
}
function ajaxGo2View(ccId,id)
{
	$.ajax({
		type:		"post",
		dataType:	"json",
		data:		"contentid="+id+"&channelid="+ccId+"&time="+(new Date().getTime()),
		url:		"/ajax/content.aspx?oper=ajaxGo2View",
        	error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			window.open(d.returnval);
		}
	});
}
function ajaxViewCount(cType,id,randomid,needadd)
{
	var addit = needadd == false ? 0 : 1;
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"oper=ajaxViewCount&id="+id+"&addit="+addit+"&cType="+cType+"&time="+(new Date().getTime()),
		url:		"/ajax/content.aspx",
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			$("#ajaxViewCount_"+id+"_"+randomid).text(d.count);
		}
	});
}
function replaceContentTags(ccid,cType,taglist,bodyid)
{
	try{
		var elms1 = $("#"+bodyid+" a");
		for (i = 0; i < elms1.length; i++){elms1[i].title="";}
		var elms2 = $("#"+bodyid+" img");
		for (i = 0; i < elms2.length; i++){elms2[i].alt="";}
		var returnhtml=$("#"+bodyid).html();
		var tags=taglist.split(',');
		for (i = 0; i < tags.length; i++) {
			if(tags[i].length>1)//只取2个字符以上的
			{
				returnhtml=returnhtml.replace(tags[i],"<a href='/extends/search/index.aspx?type="+cType+"&k="+encodeURIComponent(tags[i])+"&t=tag' target='_blank'><span class='tag'>"+tags[i]+"</span></a>");
			}
		}
		$("#"+bodyid).html(returnhtml);
	}
	catch(e){}
}
function addFavorite(ccid,cType,id)
{
	$.ajax({
		type:		"get",
		dataType:	"html",
		data:		"oper=addFavorite&id="+id+"&ccid="+ccid+"&cType="+cType+"&time="+(new Date().getTime()),
		url:		"/ajax/content.aspx",
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			alert(d);
		}
	});
}
var _closeTimer = -1;
function Go2PageForm(url)
{
	var _adminid = KnowfarCms.Cookie.get("knowfar_user", "adminid");
	if(_adminid != "" && _adminid != "0")
		window.open("/plus/"+url+"&userkey="+user.userkey);
	else{
		var oDialog = new jcms__Dialog('1', '确认框', 350, 130, 'success', false);
		oDialog.init();
		var sHtml = '<form id="Go2PageForm"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">\
				<tr><td height="30" align="left"><span id="closetimer"></span></td></tr>\
				<tr><td height="60" align="left">确定要下载该资源吗？<br /><br />同一资源只扣除一次K币。</td></tr>\
				<tr><td height="20" align="left"><input type="button" value="开始下载" onclick="Go2PageCheck(\''+url+'\');" />&nbsp;&nbsp;<input type="button" value="稍后再说" onclick="Go2PageStop();" /></td></tr>\
			</table></form>\
		';
		oDialog.event(sHtml,'');
		Go2PageStart();
	}
}
function Go2PageCheck(url){
	window.open("/plus/"+url+"&userkey="+user.userkey);
	Go2PageStop();
}
function Go2PageStart(){
	_closeTimer = 30;
	Go2PageAutoClose(_closeTimer, "closetimer");
}
function Go2PageStop(){
	_closeTimer = - 1;
	Go2PageAutoClose(_closeTimer, "closetimer");
}
function Go2PageAutoClose(secs, spanid){
	if(__(spanid) == null)
		return;
	if(secs > 0) 
	{
		_closeTimer = secs - 1;
		$('#'+spanid).html('还有 <span style="color:red;">' + _closeTimer + '</span> 秒自动关闭');
		window.setTimeout("Go2PageAutoClose(" + _closeTimer + ",'" + spanid + "')", 1000);
	} 
	else if(secs == 0) 
	{
		_closeTimer = -1;
		Go2PageAutoClose(_closeTimer,spanid);
	} 
	else
	{
		new jcms__Dialog().reset();
	}
}




//<!--插件开关begin


var PluginFeedback	= true;
var PluginLink	= true;
var PluginTranslate	= true;

//-->插件开关end


///////////////////////////////////////////////////////////////////////////
//留言扩展插件
///////////////////////////////////////////////////////////////////////////

function ajaxPluginFeedbackTopList(classid,pagesize,elementid)
{
	$.ajax({
		type:		"get",
		dataType:	"html",
		data:		"oper=ajaxPluginFeedbackTopList&classid="+classid+"&page=1&pagesize="+pagesize+"&time="+(new Date().getTime()),
		url:		"/extends/feedback/ajax.aspx",
		error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			$('#'+elementid).html(d);
		}
	});
}


///////////////////////////////////////////////////////////////////////////
//友情链接扩展插件
///////////////////////////////////////////////////////////////////////////
function ajaxPluginLink(oDiv, save2file)
{
	if(PluginLink==null)
	{
		$("#"+oDiv).hide();
		return;
	}
	if(oDiv==null) oDiv="ajaxPluginLink";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/p_link.js", "/themes/extends_link__link.htm", oDiv, "/_data/style/p_link.js", "Link", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/p_link.js", "/themes/extends_link__link.htm", oDiv, "/_data/html/p_link.htm", "Link", "html");
	else
		ExecuteJsonData("/_data/json/p_link.js", "/themes/extends_link__link.htm", oDiv);
}


///////////////////////////////////////////////////////////////////////////
//英中文查询扩展插件
///////////////////////////////////////////////////////////////////////////
function ajaxPluginTranslate(oDiv, save2file)
{
	if(PluginTranslate==null)
	{
		$("#"+oDiv).hide();
		return;
	}
	if(oDiv==null) oDiv="ajaxPluginTranslate";
	if(save2file=="js")
		ExecuteJsonData("/_data/json/module.js", "/themes/extends_translate__translate.htm", oDiv, "/_data/style/p_translate.js", "Translate", "js");
	else if(save2file=="html")
		ExecuteJsonData("/_data/json/module.js", "/themes/extends_translate__translate.htm", oDiv, "/_data/html/p_translate.htm", "Translate", "html");
	else
		ExecuteJsonData("/_data/json/module.js", "/themes/extends_translate__translate.htm", oDiv);
}
function ajaxPluginTranslateCheckData()
{
	var type = $("#translate_type").val();
	if($("#translate_keywords").val()=="")
	{
		alert("请输入关键字");
		return;
	}
	window.open("/extends/translate/index.aspx?type="+type+"&k="+encodeURIComponent($("#translate_keywords").val()));
}

function ajaxShowWeather(id)//显示天气(2011.03.08)
{
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"time="+(new Date().getTime()),
		url:		site.Dir + "tools/weather/json.aspx",
		success:	function(d){
			$('#'+id).html(d.cityname + " <br /><span style='vertical-align:text-bottom;'><img alt='" + d.weather + "' title='" + d.weather + "' src='"+site.Dir+"tools/weather/icon/" + d.img + ".gif' /></span> " + d.temperature);
		}
	});
}
function ajaxGetNeightor(type,id,tags)//相关内容(2011.03.11)
{
	$.ajax({
		type:		"get",
		dataType:	"json",
		data:		"time="+(new Date().getTime()),
		url:		"/search/ajax.aspx?oper=ajaxGetContentList&type="+type+"&mode=0&ch=0&k="+encodeURIComponent(tags)+"&pagesize=11&page=1",
		//error:		function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}},
		success:	function(d){
			if(d.recordcount != -1)
			{
				$("#ajaxGetNeightor").setTemplateElement("tplList", null, {filter_data: false});
				$("#ajaxGetNeightor").processTemplate(d);
			}
		}
	});
}
