document.write('
'); var QYT = new Object(); QYT.main = document.getElementById("qyt_main"); /*********通用函数库*********/ QYT.Common = { getRnd : function() { var rnd = Math.random() * 1000000; return rnd; }, includeJS : function(src, id) { var script = document.getElementById("qyt_script_"+id); if(script) QYT.main.removeChild(script); src += (src.match(/\?/) ? '&' : '?'); //+ "rnd=" + QYT.Common.getRnd(); if(QYT.main) { var scriptNew = document.createElement("script"); scriptNew.src = src; scriptNew.id = "qyt_script_"+id; scriptNew.type = "text/javascript"; //scriptNew.charset = "utf-8"; QYT.main.appendChild(scriptNew); } else { document.write(''); //document.write(""); } }, includeStyle : function(src) { if(document.createStyleSheet) { document.createStyleSheet(src); } else { var link = ''; document.getElementsByTagName("head")[0].innerHTML += link; } }, setCookie : function(sName, sValue) { var nextYear = new Date(); nextYear.setFullYear(nextYear.getFullYear()+2); document.cookie = sName + "=" +escape(sValue)+ ";path=/;expires="+ nextYear.toGMTString(); }, getCookie : function(sName) { var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return null; } } /**********End*********/ //焦点判断 if(!focu) { var focu=1; var sign=0; } QYT.getfocus= function getfocus() { //debugger; focu=1; if(sign==0) { return; } //setTimeout(QYT.update, 3000); clearTimeout(QYT.getfocu); QYT.update(); } QYT.blurfocus=function blurfocus() { focu=0; // setTimeout(QYT.update, 15000); //alert(focu); // clearTimeout(QYT.getfocu); //QYT.update(); } /*********系统设置数据*********/ QYT.setting = { home : "http://ww4.qyt.com:9999/", //需服务端打 //home : "http://192.168.0.31/QYT/BookSir.QYTV3.Web.Visit/", //需服务端打 siteId : "372", //需服务端打 position : "left", //需服务端打 //scroll : true //需服务端打 scroll : true, skin : "blue", mode : "list", autoRefuse : 5 //邀请框自动拒绝 } QYT.stat = { url : escape(document.URL), urlReferrer : escape(document.referrer), title : escape(document.title.substr(0,40)), screenWidth : screen.width, screenHeight : screen.height, siteId : QYT.setting.siteId, visitorId : (QYT.Common.getCookie("visitorId"))?QYT.Common.getCookie("visitorId"):"31d1e0389f6a42aebd47115b0c9e51cf", codepage : document.charset || document.characterSet, language : 'zh-cn' } QYT.loaded = { base : 0, templet : 0, data : 0, js : 0, stat: 0, resources : 0 } /**********End*********/ if(QYT.main) QYT.Common.includeJS(QYT.setting.home + "js/prototype.js","base"); /*********控制*********/ QYT.preRender = function() { if(QYT.setting.mode=="icon") { QYT.main.innerHTML = QYT.templet.icon.replace(/\[HOME\]/g,QYT.setting.home); Event.observe(QYT.main, "mousemove", showHeader); Event.observe(QYT.main, "mouseout", hideHeader); } else { QYT.main.innerHTML = QYT.templet.container.replace(/\[HOME\]/g,QYT.setting.home).replace(/\[SKIN\]/g,QYT.setting.skin); } QYT.position(); function showHeader() { $("qyt_header").style.visibility = "visible"; } function hideHeader() { $("qyt_header").style.visibility = "hidden"; } } QYT.render = function() { if(QYT.setting.mode=="icon") { QYT.buildIcon(); } else { QYT.buildDept(); QYT.buildCs(); } QYT.loaded.data = 0; var action = QYT.setting.mode=="icon" ? 5 : 2; QYT.Common.includeJS(QYT.setting.home +"GetData.aspx?action=" +action+ "&id="+QYT.stat.visitorId+"&lang="+QYT.stat.language+ "&rnd=" + QYT.Common.getRnd(), "data"); //QYT.Common.includeJS(QYT.setting.home +"json/update.js", "data"); sign=1; setTimeout(QYT.update, 3000); //setTimeout(QYT.update, 3000); } QYT.update = function() { if(QYT.loaded.data) { if(QYT.setting.mode=="icon") { QYT.buildIcon(); } else { QYT.updateDept(); QYT.updateCs(); } QYT.handleMessages(); QYT.loaded.data = 0; var action = QYT.setting.mode=="icon" ? 5 : 2; QYT.Common.includeJS(QYT.setting.home +"GetData.aspx?action=" +action+ "&id="+QYT.stat.visitorId+"&lang="+QYT.stat.language+ "&rnd=" + QYT.Common.getRnd(), "data"); //QYT.Common.includeJS(QYT.setting.home +"json/update.js", "data"); if(focu==1) { QYT.getfocu=setTimeout(QYT.update, 3000); } else if(focu==0) { QYT.getfocu=setTimeout(QYT.update, 8000); } } else { setTimeout(QYT.update, 500); } } /**********End*********/ /*********图标模式*********/ QYT.buildIcon = function() { //第一次数据 if(QYT.online) { Element.show($("qyt_icon_online")); Element.hide($("qyt_icon_offline")); } else { Element.show($("qyt_icon_offline")); Element.hide($("qyt_icon_online")); } } /**********End*********/ /*********部门列表*********/ QYT.buildDept = function() { //第一次数据 if(QYT.dept) { QYT.dept.each ( function(dept) { var div = document.createElement("div"); div.id = "qyt_dept" + dept.deptId; div.innerHTML = '