var isIE=window.ActiveXObject?true:false;
function rui_toggle(obj, tTag, cTag){ var hs=$$('#'+obj+' '+tTag); var uls=$$('#'+obj+' '+cTag); for (var i=0;i<hs.length;i++){ hs[i].id='sdl_'+i; hs[i].getElementsByTagName('A')[0].οnfοcus=function(){this.blur()} hs[i].οnmοuseοver=function(){intFaq(obj, hs, uls, this.id)} } for (var i=0;i<uls.length;i++) uls[i].style.display='none'; uls[0].style.display=''; hs[0].className='actLink'; } function intFaq(obj, newHs, newUls, id){ for (var i=0;i<newHs.length;i++) newHs[i].className=(id=='sdl_'+i)?'actLink':''; for (var i=0;i<newUls.length;i++) newUls[i].style.display=(id=='sdl_'+i)?'':'none'; }
var imgUrl=new Array(); var imgLink=new Array(); var imgIntro=new Array(); var imgFont=new Array(); var imgDate=new Array(); var adNum=-1;
function cNew(text,url,images,intro,indate){ var rno = imgUrl.length; imgUrl[rno] = images; imgLink[rno] = url; imgFont[rno] = text; imgIntro[rno] = intro; imgDate[rno] = indate; loadimg = new Image(); loadimg.src = images; }
function playTran(){ if (document.all) $("imgInit").filters.revealTrans.play(); }
var key=0;
function nextAd(){ var aoArr=$("adNumList").getElementsByTagName("A"); if(adNum<imgUrl.length - 1)adNum++ ; else adNum=0; if( key==0 ){ key=1; } else if (document.all){ $("imgInit").filters.revealTrans.Transition=Math.floor(Math.random()*23); $("imgInit").filters.revealTrans.apply(); playTran(); } for(var i=0;i<aoArr.length;i++){ aoArr[i].className=""; if(i==adNum){ aoArr[i].className="actLink"; } } $("imgInit").src = imgUrl[adNum]; $("CirTitle").innerHTML=imgFont[adNum]; //$("CirIntro").innerHTML=imgIntro[adNum] + " ["+imgDate[adNum]+"]"; $("Cirurlimg").href=imgLink[adNum]; $("Cirurl").href=imgLink[adNum]; theTimer=setTimeout("nextAd()", 5000); $("imgInit").οnerrοr=function(){this.src='images/skin01/loading.gif'} return imgUrl[adNum]; }
function gogo(k) { var aoArr=$("adNumList").getElementsByTagName("A"); for(var i=0;i<aoArr.length;i++){ aoArr[i].className=""; } $("Cirurl"+k).className="actLink"; $("imgInit").src=imgUrl[k]; $("CirTitle").innerHTML=imgFont[k]; //$("CirIntro").innerHTML=imgIntro[k] + " ["+imgDate[k]+"]"; $("Cirurlimg").href=imgLink[k]; $("Cirurl").href=imgLink[k]; adNum=k; }
function goUrl(){ jumpUrl=imgLink[adNum]; jumpTarget="_blank"; if (jumpUrl !=""){ if (jumpTarget != "") window.open(jumpUrl,jumpTarget); else location.href=jumpUrl; } } if(!isIE && window.Event){ window.constructor.prototype.__defineGetter__("event", function(){ var e, o=arguments.callee.caller; while(o != null){ e = o.arguments[0]; if(e && (e.constructor == Event || e.constructor == MouseEvent)) return e; o = o.caller; } return null; }); }
function openMyPanel(){ var pObj, nDiv1, nDiv2, nUl, nLi, nLink, nText; with(window.parent){ if(!document.getElementById('myPanelOpt')){ pObj=document.getElementById('login'); nDiv1=document.createElement("div"); nDiv1.id='myPanelOpt'; nDiv2=document.createElement("div"); nDiv2.id='myPanelOptBg'; nUl=document.createElement("ul"); for(var i=0;i<mpOpt.length;i++){ nLi=[], nLink=[], nText=[]; nLi[i]=document.createElement("li"); nLink[i]=document.createElement("a"); nLink[i].href=mpOpt[i].url; nText[i]=document.createTextNode(mpOpt[i].title) nLink[i].appendChild(nText[i]); nLi[i].appendChild(nLink[i]); nUl.appendChild(nLi[i]); } nDiv1.appendChild(nDiv2); nDiv1.appendChild(nUl); pObj.appendChild(nDiv1); }else{ document.getElementById('myPanelOpt').style.display=(!document.getElementById('myPanelOpt').style.display)?'none':''; } document.documentElement.οnclick=function(){ if(document.getElementById('myPanelOpt') && !document.getElementById('myPanelOpt').style.display)document.getElementById('myPanelOpt').style.display='none'; } } event.cancelBubble=true; document.body.οnclick=function(){ window.parent.document.getElementById('myPanelOpt').style.display='none'; } }
//EditRate EditConfig-------------
//显示提示层 function showhintinfo(obj, objleftoffset,objtopoffset, title, info , objheight, showtype ,objtopfirefoxoffset) { if(info==null || info=="")return; var p = getposition(obj); if((showtype==null)||(showtype =="")) { showtype =="up"; } document.getElementById('hintiframe'+showtype).style.height= objheight + "px"; document.getElementById('hintinfo'+showtype).innerHTML = info; document.getElementById('hintdiv'+showtype).style.display='block'; if(objtopfirefoxoffset != null && objtopfirefoxoffset !=0 && !isie()) { document.getElementById('hintdiv'+showtype).style.top=p['y']+parseInt(objtopfirefoxoffset)+"px"; } else { if(objtopoffset == 0) { if(showtype=="up") { document.getElementById('hintdiv'+showtype).style.top=p['y']-document.getElementById('hintinfo'+showtype).offsetHeight-40+"px"; } else { document.getElementById('hintdiv'+showtype).style.top=p['y']+obj.offsetHeight+5+"px"; } } else { document.getElementById('hintdiv'+showtype).style.top=p['y']+objtopoffset+"px"; } } document.getElementById('hintdiv'+showtype).style.left=p['x']+objleftoffset+"px"; }
//隐藏提示层 function hidehintinfo() { document.getElementById('hintdivup').style.display='none'; document.getElementById('hintdivdown').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; }
function isie() { if(navigator.userAgent.toLowerCase().indexOf('msie') != -1) { return true; } else { return false; } }
function GetValue(UpgradeEXP,Unit,Level) { var RetValue = ""; //alert(UpgradeEXP); //alert(Unit); //alert(Level); switch(Unit.toLowerCase()) { case "seconds": RetValue = (parseInt(UpgradeEXP)/parseInt(Level)); break; case "minutes": RetValue = (parseInt(UpgradeEXP)/parseInt(Level))/60; break; case "hours": RetValue = (parseInt(UpgradeEXP)/parseInt(Level))/3600; break; case "days": RetValue = (parseInt(UpgradeEXP)/parseInt(Level))/3600/24; break; } //alert(RetValue); return RetValue; }
function SetValue(TimeValue,Unit,Level) { var UpgradeEXP = ""; switch(Unit.toLowerCase()) { case "seconds": UpgradeEXP = (parseInt(TimeValue)*parseInt(Level)); break; case "minutes": UpgradeEXP = (parseInt(TimeValue)*60)*parseInt(Level); break; case "hours": UpgradeEXP = (parseInt(TimeValue)*3600)*parseInt(Level); break; case "days": UpgradeEXP = (parseInt(TimeValue)*3600*24)*parseInt(Level); break; } return UpgradeEXP; }
//EditRate-------------
//通用的提交提示层
function CreateDivElement(MsgTitle,MsgBody,FormSubmitCallBack,IsShowBtn,IsDisplayCloseImg) { var divID = "_____floater";//避免重名 // 如果div在页面中不存在,创建一个新的div if (!document.getElementById(divID)) { var newNode = document.createElement("div"); newNode.setAttribute("id", divID); document.body.appendChild(newNode); } var BackGroudGlobalDiv = document.getElementById(divID); BackGroudGlobalDiv.style.cssText = "z-index:100; display:none;position:absolute;top:0;left:0;background-color:gray;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=20);"; var CenterDivID = "_____Centerfloater";//避免重名 // 如果div在页面中不存在,创建一个新的div if (!document.getElementById(CenterDivID)) { var CenterNewNode = document.createElement("div"); CenterNewNode .setAttribute("id", CenterDivID); document.body.appendChild(CenterNewNode); } var CenterGlobalDiv = document.getElementById(CenterDivID); CenterGlobalDiv.style.cssText = "display:none; z-index:101; position:absolute; left:20%; top:40%; "; var HtmlStr = ""; HtmlStr +="<div id=/"___CenterDiv1/" style=/"width:380px;height:56px;background-color: #FFFFFF;border:solid #000000 1px;font-size:14px;/">" HtmlStr +="<div id=/"___CenterDiv2/" style=/"height:26px;background:#f1f1f1;line-height:26px;padding-left:10px;font-weight:bolder;/">" if(IsDisplayCloseImg) { HtmlStr +="<a οnclick=/"HiddenFloatDiv();/" href=/"javascript:void(0);/"><img style=/"float:right;padding:10px 10px 0px 0px;/" border=/"0/" src=/"../images/close.gif/" //><//a>" } HtmlStr += MsgTitle+"<//div>" HtmlStr +="<div id=/"___CenterDiv3/" style=/"height:70px;line-height:150%;padding:0px 3px 0px 3px;/" align=/"center/">" HtmlStr +="<BR //>" HtmlStr += MsgBody HtmlStr += "<BR //>" if(IsShowBtn) { HtmlStr += "<input type=submit id=imb_Ok name=imb_Ok value=/" 确定 /" style=/"font:12px;height:20px;/" οnclick=/"SetModalResult(1)/" shortKey=/"T/"> <input type=button id=imb_Cancel name=imb_Cancel value=/" 取消 /" style=/"height:20px;font:12px/" οnclick=/"SetModalResult(0)/" shortKey=/"C/">" } HtmlStr += "<BR //>" HtmlStr += "<BR //>" HtmlStr +="<//div>" HtmlStr +="<//div>"; CenterGlobalDiv.innerHTML = HtmlStr; } var DialogCallBackFunc = null; function disabledocument(MsgTitle,MsgBody,FormSubmitCallBack) { DialogCallBackFunc = FormSubmitCallBack; CreateDivElement(MsgTitle,MsgBody,FormSubmitCallBack,true,false); document.all._____floater.style.display=(_____floater.style.display!="none")?"none":""; _____floater.style.width = document.documentElement.clientWidth + document.documentElement.scrollLeft; _____floater.style.height= document.documentElement.clientHeight + document.documentElement.scrollTop; SetDivCenter(); document.getElementById("imb_Cancel").focus(); } function SetDivCenter() { document.getElementById("_____Centerfloater").style.left = ((parseInt(document.documentElement.clientWidth)+parseInt(document.documentElement.scrollLeft))-380)/2; document.getElementById("_____Centerfloater").style.top = ( (parseInt(document.documentElement.clientHeight)+parseInt(document.documentElement.scrollTop))-56)/2; document.getElementById("_____Centerfloater").style.display = ""; HideOverSels('_____Centerfloater'); } function HiddenFloatDiv() { document.all._____floater.style.display=(_____floater.style.display!="none")?"none":""; document.all._____Centerfloater.style.display=(_____Centerfloater.style.display!="none")?"none":""; }
function SetModalResult(value) { HiddenFloatDiv(); //alert(DialogCallBackFunc); //alert(value); if (DialogCallBackFunc!=null && DialogCallBackFunc!="") eval(DialogCallBackFunc.replace("$",value)); } //用于操作提示 function ShowModalDiv(MsgTitle,MsgBody,FormSubmitCallBack,IsDisplayCloseImg) { DialogCallBackFunc = FormSubmitCallBack; CreateDivElement(MsgTitle,MsgBody,FormSubmitCallBack,false,IsDisplayCloseImg); document.all._____floater.style.display=(_____floater.style.display!="none")?"none":""; _____floater.style.width=document.documentElement.clientWidth + document.documentElement.scrollWidth; _____floater.style.height=document.documentElement.clientHeight + document.documentElement.scrollHeight; SetDivCenter(); } //隐藏指定元素位置下方的"下拉列表框",该函数主题解决ie6以前(包括ie6)的下拉列表框遮挡显示层的问题 function HideOverSels(objID) { var sels = document.getElementsByTagName('select'); for (var i = 0; i < sels.length; i++) { if (Obj1OverObj2(document.getElementById(objID), sels[i])) { sels[i].style.visibility = 'hidden'; } else { sels[i].style.visibility = 'visible'; } } }
function getLeftPosition(Obj) { try { for (var sumLeft=0;Obj!=document.body;sumLeft+=Obj.offsetLeft,Obj=Obj.offsetParent); return sumLeft; } catch(e) {} }
function getTopPosition(Obj) { try { for (var sumTop=0;Obj!=document.body;sumTop+=Obj.offsetTop,Obj=Obj.offsetParent); return sumTop; } catch(e) {} }
//判断obj1是否遮挡了obj2 function Obj1OverObj2(obj1, obj2) { var result = true; var obj1Left = getLeftPosition(obj1) - document.body.scrollLeft; var obj1Top = getTopPosition(obj1) - document.body.scrollTop; var obj1Right = obj1Left + obj1.offsetWidth; var obj1Bottom = obj1Top + obj1.offsetHeight; var obj2Left = getLeftPosition(obj2) - document.body.scrollLeft; var obj2Top = getTopPosition(obj2) - document.body.scrollTop; var obj2Right = obj2Left + obj2.offsetWidth; var obj2Bottom = obj2Top + obj2.offsetHeight;
if (obj1Right <= obj2Left || obj1Bottom <= obj2Top || obj1Left >= obj2Right || obj1Top >= obj2Bottom) { result = false; } return result; }
//通用的提交提示层
function toggle_collapse(objname) { var obj = document.getElementById(objname); obj.style.display = obj.style.display == '' ? 'none' : ''; var img = document.getElementById(objname + '_toggle_img'); img.src = img.src.indexOf('_yes.gif') == -1 ? img.src.replace(/_no/.gif/, '_yes/.gif') : img.src.replace(/_yes/.gif/, '_no/.gif') }
function $() { var elements = new Array(); for (var i = 0; i < arguments.length; i++) { var element = arguments[i]; try { if (typeof element == 'string') { element = document.getElementById(element) || document.all(element) || document.forms(0).all(element); } } catch(ex) { element = null; }
if (arguments.length == 1) { return element; } elements.push(element); } return elements; }
//执行暂停函数
function Pause(obj,iMinSecond){ if (window.eventList==null) window.eventList=new Array(); var ind=-1; for (var i=0;i<window.eventList.length;i++){ if (window.eventList[i]==null) { window.eventList[i]=obj; ind=i; break; } } if (ind==-1){ ind=window.eventList.length; window.eventList[ind]=obj; } setTimeout("GoOn(" + ind + ")",iMinSecond); } /* 该函数把要暂停的函数放到数组window.eventList里,同时通过setTimeout来调用继续函数。
继续函数如下: */
function GoOn(ind){ var obj=window.eventList[ind]; window.eventList[ind]=null; if (obj.NextStep) obj.NextStep(); else obj(); } /* 该函数调用被暂停的函数的NextStep方法,如果没有这个方法则重新调用该函数。
函数编写完毕,我们可以作如下测试: */ //function Test(){ // alert("hellow"); // Pause(this,5000);//调用暂停函数 // this.NextStep=function(){ // alert("NextStep"); // } //} //Test();
如果在网页还没有加载的时候调用,那么会报错.