//网站参数end //模型end var _jcms_DialogUrl = site.Dir + "style/dialog/"; /*------------------------------------------------------------------*/ function $OBJ(el) { if(typeof el=='string') return document.getElementById(el); else if(typeof el=='object') return el; } var JumbotCms=new Object(); JumbotCms.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!=null && domain.length>0)?";domain="+domain:""); }, get:function(name, subname){ 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"; } } }; //追加/删除事件 JumbotCms.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事件 JumbotCms.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; } }; JumbotCms.isFunction=function(variable) { return typeof variable == 'function' ? true : false; }; JumbotCms.isUndefined=function(variable) { return typeof variable == 'undefined' ? true : false; }; JumbotCms.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; }; JumbotCms.Eval=function(data) { JumbotCms.Loading.hide(); try { eval(data); } catch(e) { alert(data); } }; ///////////////////////////// //弹出消息框 ///////////////////////////// JumbotCms.Message=function(errstr, success, returnFunc){ new _jcms_Dialog().reset(); var MSG = $.message; MSG.lays(200, 24); //MSG.anim('fade', 'slow'); MSG.anim('fade', 'slow', site.Dir+'_libs/jquery.messager/'); if(returnFunc) MSG.doafter(returnFunc); MSG.show(success, errstr, 3000); }; ///////////////////////////// //弹出提示框 ///////////////////////////// JumbotCms.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、JumbotCms.Confirm("是否操作", act, null) //函数不加() //2、JumbotCms.Confirm("是否操作", "alert('yes')", "alert('no')") ///////////////////////////// JumbotCms.Confirm = function (errstr, returnSubmitFunc, returnCancelFunc) { var oDialog = new _jcms_Dialog('2', '', 360, 180, null, true); oDialog.init(); oDialog.event(errstr, ''); oDialog.button('dialogSubmit', returnSubmitFunc); if (returnCancelFunc == null) oDialog.button('dialogCancel', ''); else oDialog.button('dialogCancel', returnCancelFunc); }; ///////////////////////////// //弹出模拟窗口 ///////////////////////////// JumbotCms.Popup={ show:function(url, width, height, showCloseBox, showTitle, returnFunc) { new _jcms_Dialog().reset(); if(showTitle==null) showTitle=" "; var oDialog = new _jcms_Dialog('2', showTitle, width, height, null, showCloseBox); if (url.indexOf("?") == -1) oDialog.open(url+"?windowCode="+(new Date().getTime()), returnFunc, "auto"); else oDialog.open(url+"&windowCode="+(new Date().getTime()), returnFunc, "auto"); }, hide:function(callReturnFunc){ new _jcms_Dialog().reset(callReturnFunc); } }; ///////////////////////////// //弹出加载层 ///////////////////////////// JumbotCms.Loading={ show:function(msgstr, width, height) { if(width==null) width=280; if(height==null) height=100; var oDialog = new _jcms_Dialog('0', '友情提示', width, height, null, false); oDialog.init(true); oDialog.html("
"+msgstr+"

"); }, hide:function(callReturnFunc){ new _jcms_Dialog().reset(callReturnFunc); } }; JumbotCms.Event.add(window,"load",_jcms_OperatorPlus); JumbotCms.Event.add(window,"scroll",_jcms_OperatorPlus); JumbotCms.Event.add(window,"resize",_jcms_OperatorPlus); //////////////////////////////////////////////////////////////////////////////////////////// //标题栏跑马灯 //////////////////////////////////////////////////////////////////////////////////////////// var _jcms_ScrollTitle__Oldtitle = top.document.title; var _jcms_ScrollTitle__i = 0; var _jcms_ScrollTitle__Speed = 200; var _jcms_ScrollTitle__Timer = function(message){ if(_jcms_ScrollTitle__i == message.length) { top.document.title = _jcms_ScrollTitle__Oldtitle; _jcms_ScrollTitle__i = 0; return; } else{ top.document.title = message.substring(_jcms_ScrollTitle__i); _jcms_ScrollTitle__i++; setTimeout("_jcms_ScrollTitle__Timer('"+message+"')",_jcms_ScrollTitle__Speed); } } //////////////////////////////////////////////////////////////////////////////////////////// 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()-44) { oHeight=_jcms_GetViewportHeight()-44; 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 = ' '; var sClose = ''; if (showCloseBox == null || showCloseBox == true) sClose = '关闭'; var sSuccess = ''; if (iswhat != null) sSuccess = ''; else sSuccess = ''; var sBody = '\ \ \ ' + sSuccess + '\ \ \ \
' + sButtonFunc + '
\ '; var sBox = '\ \ \ '; 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;}; $OBJ('dialogFrame') ? $OBJ('dialogFrame').src='' : function(){}; $OBJ('dialogCase') ? $OBJ('dialogCase').parentNode.removeChild($OBJ('dialogCase')) : function(){}; $OBJ('windowMask') ? $OBJ('windowMask').parentNode.removeChild($OBJ('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 = $OBJ("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) $OBJ("dialogTitleDiv").style.display = "block"; else $OBJ("dialogTitleDiv").style.display = "none"; _jcms_OperatorPlus(); } //this.show = function(){$OBJ('dialogBox') ? function(){} : this.init();_jcms_DialogIsShown=true;this.middle('dialogBox');} this.show = function(){$OBJ('dialogBox') ? function(){} : this.init();_jcms_DialogIsShown=true;this.middle('dialogBox');this.shadow();this.middle('dialogBoxShadow');_jcms_OperatorPlus();} this.html = function(_sHtml){ this.show(); $OBJ('dialogBody').innerHTML = _sHtml; } this.button = function(_sId, _sFuc){ if($OBJ(_sId)){ $OBJ(_sId).style.display = ''; if($OBJ(_sId).addEventListener){ if($OBJ(_sId).act){$OBJ(_sId).removeEventListener('click', function(){eval($OBJ(_sId).act);}, false);} $OBJ(_sId).act = _sFuc; $OBJ(_sId).addEventListener('click', function(){eval(_sFuc);this.reset();}, false); }else{ if($OBJ(_sId).act){$OBJ(_sId).detachEvent('onclick', function(){eval($OBJ(_sId).act);});} $OBJ(_sId).act = _sFuc; $OBJ(_sId).attachEvent('onclick', function(){eval(_sFuc);}); } } } this.shadow = function(){ if(shadowBorderBoth>0){ var oShadow = $OBJ('dialogBoxShadow'); var oDialogDiv = $OBJ('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"){ $OBJ("dialogBody").innerHTML = ""; $OBJ("dialogFrame").src = _sUrl; //} } this.reset = function(callReturnFunc){$OBJ('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;}; $OBJ('dialogFrame') ? $OBJ('dialogFrame').src='' : function(){}; $OBJ('dialogCase').parentNode.removeChild($OBJ('dialogCase')); $OBJ('windowMask').parentNode.removeChild($OBJ('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; } //$OBJ('dialogBoxShadow').style.display = "none"; } this.event = function(_sMsg, _sSubmit, _sCancel, _sClose){ this.show(); $OBJ('dialogFunc').innerHTML = sButtonFunc; $OBJ('dialogBoxClose').innerHTML = sClose; $OBJ('dialogBodyBox') == null ? $OBJ('dialogBody').innerHTML = sBody : function(){}; $OBJ('dialogMsg') ? $OBJ('dialogMsg').innerHTML = _sMsg : function(){}; _sSubmit ? this.button('dialogSubmit', _sSubmit) | $OBJ('dialogSubmit').focus() : $OBJ('dialogSubmit').style.display = "none"; _sCancel ? this.button('dialogCancel', _sCancel) : $OBJ('dialogCancel').style.display = "none"; _sClose ? this.button('dialogBoxClose', _sClose) : function(){}; } this.set = function(_oAttr, _sVal){ var oDialogDiv = $OBJ('dialogBox'); var oHeight = $OBJ('dialogHeight'); if(_sVal != ''){ switch(_oAttr){ case 'title': $OBJ('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){ $OBJ('dialogBoxFace') ? $OBJ('dialogBoxFace').src = path + _sVal + '.png' : function(){}; }else{ $OBJ('dialogBoxFace') ? $OBJ('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; } $OBJ(_sId).style.display = ''; $OBJ(_sId).style.position = "absolute"; $OBJ(_sId).style.left = (theWidth / 2) - ($OBJ(_sId).offsetWidth / 2)+"px"; if(document.all||$OBJ("user_page_top")){ $OBJ(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - ($OBJ(_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) - ($OBJ(_sId).offsetHeight / 2); $OBJ(_sId).style.top = (theHeight / 2 + document.body.scrollTop) - ($OBJ(_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_OperatorPlus() { if (_jcms_DialogIsShown == true) { var oDialogDiv = $OBJ("dialogBox"); var oShadow = $OBJ("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 { $OBJ('dialogBoxTitle').innerHTML = window.document.title; } catch(e) { try { parent.$OBJ('dialogBoxTitle').innerHTML = window.document.title; } catch(e) { } } } } function _jcms_SetDialogSize(w,h){ try { if(w>0) $OBJ('dialogBox').style.width = w; if(h>0) $OBJ('dialogHeight').style.height = h; _jcms_OperatorPlus(); } catch(e) { try { if(w>0) parent.$OBJ('dialogBox').style.width = w; if(h>0) parent.$OBJ('dialogHeight').style.height = h; parent._jcms_OperatorPlus(); } catch(e) { } }} /* Url编码 */_jcms_UrlEncode = function(unzipStr){ var zipstr=""; var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; var tt= ""; for(var i=0;i 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解码 */_jcms_UrlDecode=function(zipStr){ var uzipStr=""; for(var i=0;i0x7f){ 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(JumbotCms.Cookie.get(site.CookiePrev + "user", "id") == ""){//游客 user.id = "0"; user.name = "guest"; user.nickname = "游客"; user.password = "666666"; user.userkey = "666666"; user.groupid = "0"; user.adminid = "0"; user.groupname = "游客组"; user.setting = ""; user.cookies = "88888888"; } else{ user.id = JumbotCms.Cookie.get(site.CookiePrev + "user", "id"); user.name = JumbotCms.Cookie.get(site.CookiePrev + "user", "name"); user.nickname = JumbotCms.Cookie.get(site.CookiePrev + "user", "nickname"); user.password = JumbotCms.Cookie.get(site.CookiePrev + "user", "password"); user.userkey = JumbotCms.Cookie.get(site.CookiePrev + "user", "password").substring(4,12); user.groupid = JumbotCms.Cookie.get(site.CookiePrev + "user", "groupid"); user.adminid = JumbotCms.Cookie.get(site.CookiePrev + "user", "adminid"); user.groupname = JumbotCms.Cookie.get(site.CookiePrev + "user", "groupname"); user.setting = JumbotCms.Cookie.get(site.CookiePrev + "user", "setting"); user.cookies = JumbotCms.Cookie.get(site.CookiePrev + "user", "cookies"); } var _jcms_StuHover = function() { 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 = $OBJ("topnavbar"); if(topnavbar != null) { var getElm = topnavbar.getElementsByTagName("LI"); for (var i=0; i)/gi,function(s,a,b,c){return a+b.toLowerCase()+c;}); } /*获取指定字符串的长度*/ 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 = $OBJ(obj); o.focus(); if(!JumbotCms.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 ajaxAddMessage(userid,username){ window.open(site.Dir + 'user/pmsend_default.aspx?touserid='+userid+'&tousername='+encodeURIComponent(username)); } function ajaxAddFriend(userid){ $.ajax({ type: "post", dataType: "json", data: "id="+userid+"&time="+(new Date().getTime()), url: site.Dir + "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 ShowUserPage(userid){ //alert(userid); } /*========================================================================================*/ 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; } 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("#") str=str.substr(num+1); return str; } /*获取当前页页码*/ 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 = $OBJ(form); for (var i=0;i3) 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;} /** * 将数值四舍五入(保留2位小数)后格式化成金额形式 * * @param num 数值(Number或者String) * @return 金额格式的字符串,如'1,234,567.45' * @type String */ function formatCurrency(num) { num = num.toString().replace(/\$|\,/g,''); if(isNaN(num)) num = "0"; sign = (num == (num = Math.abs(num))); num = Math.floor(num*100+0.50000000001); cents = num%100; num = Math.floor(num/100).toString(); if(cents<10) cents = "0" + cents; for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3)); return (((sign)?'':'-') + num + '.' + cents); } /*预览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 formatIsFocus(isfocus) { return isfocus == "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 PlayCodeVoice(wmpid) { if(!wmpid) wmpid="player"; var _voicewmp2 = $OBJ(wmpid); var _voicecode = JumbotCms.Cookie.get("ValidateCode"); _voicewmp2.innerHTML = ""; //alert(_voicewmp2.innerHTML); } function userstatetop() { var id = JumbotCms.Cookie.get(site.CookiePrev + "user", "id"); var memberbar = ""; if (id == "") { window.location.href = "/passport/login.aspx"; memberbar += "登录注册"; } else { var name = JumbotCms.Cookie.get(site.CookiePrev + "user", "name"); memberbar += "用户名:" + name + "修改密码 退出"; } return memberbar; } function reg() { var isNull = /^[\s' ']*$/ var uname = $("#txtUserName").val(); var truename = $("#txtTrueName").val(); var pass1 = $("#txtPass1").val(); var pass2 = $("#txtPass2").val(); var code = $("#txtCode").val(); var email = $("#txtEmail").val() if (isNull.test(uname)) { alert("请输入用户名!"); $("#txtTitle").focus(); return false; } if (isNull.test(truename)) { alert("请输入姓名!"); $("#txtTrueName").focus(); return false; } if (isNull.test(pass1)) { alert("请输入密码!"); $("#txtPass1").focus(); return false; } if (pass1 != pass2) { alert("确认密码有误!"); $("#txtPass2").focus(); return false; } if (isNull.test(code)) { alert("请输入验证码!"); $("#txtCode").focus(); return false; } $.ajax({ type: "get", datatype: "html", data: "oper=reg&username=" + escape(uname) + "&truename=" + escape(truename) + "&email=" + escape(email) + "&pass1=" + escape(pass1) + "&code=" + code + "&time=" + (new Date().getTime()), url: "/passport/ajax.aspx", success: function (d) { if (d == "ok") { location = "http://xswyh.yuwei-crystal.com/default.aspx"; } else if (d == "error") { alert("验证码输入不正确!"); } } }); } function chkLogin() { var uName = ""; var uPass = ""; var uCode = ""; uName = $("#username").val(); uPass = $("#pass").val(); uCode = $("#code2").val(); if (uName == "") { alert('请填写用户名'); $("#username").focus(); return; } if (uPass == "") { alert('请填写密码'); $("#pass").focus(); return; } if (uCode == "") { alert('请填写校验码'); $("#code2").focus(); return; } $.ajax({ type: "get", dataType: "html", data: "oper=login&name=" + encodeURIComponent(uName) + "&pass=" + encodeURIComponent(uPass) + "&code=" + encodeURIComponent(uCode) + "&time=" + (new Date().getTime()), url: "/passport/ajax.aspx", error: function (XmlHttpRequest, textStatus, errorThrown) { alert(XmlHttpRequest.responseText); }, success: function (d) { if (d == "ok") top.location.href = "http://xswyh.yuwei-crystal.com/default.aspx"; else { alert("登录失败"); } } }); } function addMessages() { var isNull = /^[\s' ']*$/ var name = JumbotCms.Cookie.get(site.CookiePrev + "user", "name"); if (isNull.test(name)) { alert("请先登录!"); return false; } var name = $("#txtname").val(); var item = $("#txtitem").val(); var tel = $("#txttel").val(); var mail = $("#txtmail").val(); var title = $("#txttitle").val(); var content = $("#txtcon").val(); if (isNull.test(name)) { alert("请输入姓名!"); $("#txtname").focus(); return false; } if (isNull.test(tel)) { alert("请输入电话!"); $("#txttel").focus(); return false; } if (isNull.test(title)) { alert("请输入标题!"); $("#txttitle").focus(); return false; } if (isNull.test(mail)) { alert("请输入邮箱地址!"); $("#mail").focus(); return false; } if (isNull.test(content)) { alert("请输入内容!"); $("#txtcon").focus(); return false; } $.ajax({ type: "post", url: "/message/ajax.aspx?oper=ajaxPluginFeedbackAdd", dataType: "html", data: "&name=" + encodeURIComponent(name)+"&item=" + encodeURIComponent(item)+"&tel=" + encodeURIComponent(tel)+"&mail=" + encodeURIComponent(mail)+"&title=" + encodeURIComponent(title)+"&content=" + encodeURIComponent(content)+ "&time=" + (new Date().getTime()), error: function (XmlHttpRequest, textStatus, errorThrown) { alert(XmlHttpRequest.responseText); }, success: function (d) { alert(d); window.location = '/10/22/list.aspx'; switch (d.result) { case '-1': JumbotCms.Alert(d.returnval, "0", "top.window.location='http://xswyh.yuwei-crystal.com/default.aspx';"); break; case '0': JumbotCms.Alert(d.returnval, "0"); break; case '1': JumbotCms.Alert(d.returnval, "1"); break; } } }); } function get_user_status(w) { //参数说明:w=0,1分别指"初始化"和"登陆" var uName=""; var uPass=""; if(w==null) w=0; if(w==1) { uName=$("#loginBarName").val(); uPass=$("#loginBarPass").val(); if(!uName || !uPass) { window.location.href = site.Dir+"passport/login.aspx"; return; } $("btnLoginbar").attr("disabled","disabled"); } $.ajax({ type: "post", dataType: "json", data: "name="+encodeURIComponent(uName)+"&pass="+encodeURIComponent(uPass)+"&state="+w, url: site.Dir + "ajax/user.aspx?oper=ajaxLoginbar&time="+(new Date().getTime()), success: function(d){ if(d.result!="1" && w==1) alert(d.returnval); else { if(d.result == "1"){//成功登录 var _adminBar = ''; if(d.adminid != "0") _adminBar = '
  • |
  • 管理中心
  • '; var _messageBar = ''; if(d.newpmcount > 0) _messageBar = '
  • 消息(' + d.newpmcount + ')
  • '; else _messageBar = '
  • 消息
  • '; var _ajaxLoginbar = '\ \ '; $("#user_status").html(_ajaxLoginbar); } } $("#user_status").show(); ajaxShowWeather('search_bar_weather');//显示天气(2011.03.6) } }); } // 显示当前日期,时间 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=$OBJ(o)} o.innerHTML = "今天是:"+y+'年'+mo+'月'+da+'日 星期'+week[d.getDay()];//+' '+h+':'+m+':'+s; //window.setTimeout(function(){setCurrentDateTime(o)}, 1000);} // 显示当前日期,时间 function setCurrentDateTime2() { 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 = ['天', '一', '二', '三', '四', '五', '六']; var _document = y + '年' + mo + '月' + da + '日 星期' + week[d.getDay()]; return _document; } $(function () { $("body").keydown(function () { if (event.keyCode == "13") {//keyCode=13是回车键 if ($.trim($("#i_Key").val()) != "") { CheckSearchData2(); } } }); }); function CheckSearchData() { var type = "article"; if ($("#i_Key").val() == "") { alert("请输入关键字"); $("#i_Key").val(''); return; } window.open(site.Dir + 'searchhttp://xswyh.yuwei-crystal.com/default.aspx?type=' + type + '&k=' + encodeURIComponent($("#i_Key").val())); } function CheckSearchData2() { if ($("#i_key").val() == "") { alert("请输入关键字"); $("#i_key").val(''); return; } window.open(site.Dir + 'search.aspx?k=' + encodeURIComponent($("#i_key").val())); } function BindModuleRadio(spanId,selecdType) { var data = ___JSON_Modules; var html = ""; for (i=0;i " + data.table[i].title + ""; } html += " 所有"; $("#"+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[i].title + ""; } $("#"+spanId).html(html); } function ajaxGo2View(ccId,id) { $.ajax({ type: "post", dataType: "json", data: "contentid="+id+"&channelid="+ccId+"&time="+(new Date().getTime()), url: site.Dir + "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: site.Dir + "ajax/content.aspx", error: function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}}, success: function(d){ $("#ajaxViewCount_"+id+"_"+randomid).text(d.count); } }); } var _closeTimer = -1; function Go2PageForm(url) { if(user.adminid != "0") window.open(site.Dir + "plus/"+url+"&userkey="+user.userkey); else{ var oDialog = new _jcms_Dialog('1', '确认框', 350, 130, null, false); oDialog.init(); var sHtml = '
    \ \ \ \
    确定要下载该资源吗?

    同一资源只扣除一次点数。
      
    \ '; oDialog.event(sHtml,''); Go2PageStart(); } } function Go2PageCheck(url){ window.open(site.Dir + "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($OBJ(spanid) == null) return; if(secs > 0) { _closeTimer = secs - 1; $('#'+spanid).html('还有 ' + _closeTimer + ' 秒自动关闭'); window.setTimeout("Go2PageAutoClose(" + _closeTimer + ",'" + spanid + "')", 1000); } else if(secs == 0) { _closeTimer = -1; Go2PageAutoClose(_closeTimer,spanid); } else new _jcms_Dialog().reset(); } function addFavorite(ccid,cType,id) { $.ajax({ type: "get", dataType: "html", data: "oper=addFavorite&id="+id+"&ccid="+ccid+"&cType="+cType+"&time="+(new Date().getTime()), url: site.Dir + "ajax/content.aspx", error: function(XmlHttpRequest,textStatus, errorThrown){if(XmlHttpRequest.responseText!=""){alert(XmlHttpRequest.responseText);}}, success: function(d){ alert(d); } }); } 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="";} if (taglist.length == 0) return; var keys = taglist.split(","); var element = $OBJ(bodyid); for (var i = 0; i < keys.length; i++) { highlightWord(element, keys[i], site.Dir + 'searchhttp://xswyh.yuwei-crystal.com/default.aspx?ch='+ccid+'&type='+cType+'&k='); } } catch(e){} } function highlightWord(node, word, linkurl) { // Iterate into this nodes childNodes if (node.hasChildNodes) { var hi_cn; for (hi_cn = 0; hi_cn < node.childNodes.length; hi_cn++) { highlightWord(node.childNodes[hi_cn], word, linkurl); } } // And do this node itself if (node.nodeType == 3) { // text node tempNodeVal = node.nodeValue.toLowerCase(); tempWordVal = word.toLowerCase(); if (tempNodeVal.indexOf(tempWordVal) > -1) { pn = node.parentNode; if (pn.className != "highlight") { nv = node.nodeValue; ni = tempNodeVal.indexOf(tempWordVal); before = document.createTextNode(nv.substr(0, ni)); docWordVal = nv.substr(ni, word.length); after = document.createTextNode(nv.substr(ni + word.length)); hiwordtext = document.createTextNode(docWordVal); hiword = document.createElement("A"); hiword.className = "highlight"; if(linkurl) hiword.href = linkurl + encodeURIComponent(tempWordVal); hiword.appendChild(hiwordtext); pn.insertBefore(before, node); pn.insertBefore(hiword, node); pn.insertBefore(after, node); pn.removeChild(node); } } } } /*选项卡*/ function jTab(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-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= 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); } } } var isIE=!-[1,]; //JS图片播放器 function renderPicPlayer(id){ var interv=4000; //切换间隔时间 var intervSpeed=10; //切换速度 var cpic=0; var tpic=1; var timer, timer1, timer2; var list=$OBJ(id + '-list'); if(list){list=list.getElementsByTagName('li')} var change = $OBJ(id + '-change'); if(!list || !list.length || list.length < 2 || !change){return} var lis = cls = ''; var picnum = list.length; for(var i=0;i'+(i+1)+''} change.innerHTML = lis; change = change.getElementsByTagName('li'); var div = list[0].getElementsByTagName('div')[0]; var img_fit_with = div.offsetWidth, img_fit_height = div.offsetHeight; for(var i=0;i0){ list[i].opacity = 0; alpha(list[i]); }else{ list[i].opacity = 100; } change[i].onmouseover = function(){ list[cpic].opacity = 0; alpha(list[cpic]); setActive(cpic); cpic = tpic = this.index; list[tpic].opacity = 100; alpha(list[tpic]); setActive(tpic,true); tpic = tpic == (picnum - 1) ? 0 : tpic + 1; window.clearInterval(timer); timer = window.setInterval(loop, interv); } } function setActive(n,f){change[n].className=f?'active':''} if(picnum < 2){return} //控制图层透明度 function alpha(o){if(isIE){o.style.filter="alpha(opacity="+o.opacity+")";}else{o.style.opacity=(o.opacity/100)}o.style.display=o.opacity>0?'':'none'} //渐显 var fadeon=function(){setActive(tpic,true);var o=list[tpic];o.opacity+=5;alpha(o);if(o.opacity<100){window.clearTimeout(timer1);timer1=setTimeout(fadeon,intervSpeed)}else{cpic=tpic;tpic=tpic==(picnum-1)?0:tpic+1;}} //渐隐 var fadeout=function(){setActive(cpic);var o=list[cpic];o.opacity-=10;alpha(o);if(o.opacity>0){window.clearTimeout(timer2);timer2=setTimeout(fadeout,intervSpeed)}else{o.opacity=0;}} //循环 var loop = function(){fadeout();setTimeout(fadeon,intervSpeed+50)} timer = window.setInterval(loop, interv); } function _jcms_SearchBar(){ var _document = "
    "; _document +="
    "; _document +="