var Ajaxs=new Array();var AjaxStacks=new Array(0,0,0,0,0,0,0,0,0,0);var ajaxpostHandle=0;var evalscripts=new Array();var ajaxpostresult=0;function init_ajax_menu(){if($("ajax_item_menu")!=null){return }menu=document.createElement("div");menu.id="ajax_item_menu";menu.style.visibility="hidden";menu.className="itemtooltip";document.body.appendChild(menu)}if(window.addEventListener){window.addEventListener("load",init_ajax_menu,false)}else{if(window.attachEvent){window.attachEvent("onload",init_ajax_menu)}}function Ajax(C,B){for(var A=0;A<AjaxStacks.length&&AjaxStacks[A]!=0;A++){}AjaxStacks[A]=1;var D=new Object();D.loading="Loading...";D.recvType=C?C:"XML";D.waitId=B?$(B):null;D.resultHandle=null;D.sendString="";D.targetUrl="";D.stackId=0;D.stackId=A;D.setLoading=function(E){if(typeof E!=="undefined"&&E!==null){D.loading=E}};D.setRecvType=function(E){D.recvType=E};D.setWaitId=function(E){D.waitId=typeof E=="object"?E:$(E)};D.createXMLHttpRequest=function(){var G=false;if(window.XMLHttpRequest){G=new XMLHttpRequest();if(G.overrideMimeType){G.overrideMimeType("text/xml")}}else{if(window.ActiveXObject){var E=["Microsoft.XMLHTTP","MSXML.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.7.0","Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"];for(var F=0;F<E.length;F++){try{G=new ActiveXObject(E[F]);if(G){return G}}catch(H){}}}}return G};D.XMLHttpRequest=D.createXMLHttpRequest();D.showLoading=function(){if(D.waitId&&(D.XMLHttpRequest.readyState!=4||D.XMLHttpRequest.status!=200)){changedisplay(D.waitId,"");D.waitId.innerHTML='<div class="ajax_box"><div class="ajax_img"> </div><div class="ajax_text">'+D.loading+"</div></div>"}};D.processHandle=function(){if(D.XMLHttpRequest.readyState==4&&D.XMLHttpRequest.status==200){for(k in Ajaxs){if(Ajaxs[k]==D.targetUrl){Ajaxs[k]=null}}if(D.waitId){changedisplay(D.waitId,"none")}if(D.recvType=="HTML"){D.resultHandle(D.XMLHttpRequest.responseText,D)}else{if(D.recvType=="XML"){try{D.resultHandle(D.XMLHttpRequest.responseXML.lastChild.firstChild.nodeValue,D)}catch(E){D.resultHandle("",D)}}}AjaxStacks[D.stackId]=0}};D.get=function(G,E){if(G.indexOf("?")!=-1){G=G+"&inajax=1"}else{G=G+"?inajax=1"}setTimeout(function(){D.showLoading()},500);if(in_array(G,Ajaxs)){return false}else{Ajaxs.push(G)}D.targetUrl=G;D.XMLHttpRequest.onreadystatechange=D.processHandle;D.resultHandle=E;var F=100;if(window.XMLHttpRequest){setTimeout(function(){D.XMLHttpRequest.open("GET",D.targetUrl);D.XMLHttpRequest.send(null)},F)}else{setTimeout(function(){D.XMLHttpRequest.open("GET",G,true);D.XMLHttpRequest.send()},F)}};D.post=function(G,F,E){if(G.indexOf("?")!=-1){G=G+"&inajax=1"}else{G=G+"?inajax=1"}setTimeout(function(){D.showLoading()},500);if(in_array(G,Ajaxs)){return false}else{Ajaxs.push(G)}D.targetUrl=G;D.sendString=F;D.XMLHttpRequest.onreadystatechange=D.processHandle;D.resultHandle=E;D.XMLHttpRequest.open("POST",G);D.XMLHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");D.XMLHttpRequest.send(D.sendString)};return D}function newfunction(C){var A=new Array();for(var B=1;B<arguments.length;B++){A.push(arguments[B])}return function(D){doane(D);window[C].apply(window,A);return false}}function changedisplay(B,A){if(A=="auto"){B.style.display=B.style.display==""?"none":""}else{B.style.display=A}return false}function evalscript(B){if(B.indexOf("<script")==-1){return B}var C=/<script[^\>]*?src=\"([^\>]*?)\"[^\>]*?(reload=\"1\")?(?:charset=\"([\w\-]+?)\")?><\/script>/ig;var A=new Array();while(A=C.exec(B)){appendscript(A[1],"",A[2],A[3])}C=/<script (?!src)[^\>]*?( reload=\"1\")?>([^\x00]+?)<\/script>/ig;while(A=C.exec(B)){appendscript("",A[2],A[1])}return B}function appendscript(E,D,B,G){var F=hash(E+D);if(!B&&in_array(F,evalscripts)){return }if(B&&$(F)){$(F).parentNode.removeChild($(F))}evalscripts.push(F);var A=document.createElement("script");A.type="text/javascript";A.id=F;A.charset=G;try{if(E){A.src=E}else{if(D){A.text=D}}$("append_parent").appendChild(A)}catch(C){}}function stripscript(A){return A.replace(/<script.*?>.*?<\/script>/ig,"")}function ajaxupdateevents(B,A){A=A?A:"A";var D=B.getElementsByTagName(A);for(k in D){var C=D[k];ajaxupdateevent(C)}}function ajaxupdateevent(B){if(typeof B=="object"&&B.getAttribute){if(B.getAttribute("ajaxtarget")){if(!B.id){B.id=Math.random()}var A=B.getAttribute("ajaxevent")?B.getAttribute("ajaxevent"):"click";var C=B.getAttribute("ajaxurl")?B.getAttribute("ajaxurl"):B.href;_attachEvent(B,A,newfunction("ajaxget",C,B.getAttribute("ajaxtarget"),B.getAttribute("ajaxwaitid"),B.getAttribute("ajaxloading"),B.getAttribute("ajaxdisplay")));if(B.getAttribute("ajaxfunc")){B.getAttribute("ajaxfunc").match(/(\w+)\((.+?)\)/);_attachEvent(B,A,newfunction(RegExp.$1,RegExp.$2))}}}}function ajaxget(url,showid,waitid,loading,display,recall){waitid=typeof waitid=="undefined"||waitid===null?showid:waitid;var x=new Ajax();x.setLoading(loading);x.setWaitId(waitid);x.display=typeof display=="undefined"||display==null?"":display;x.showId=$(showid);if(x.showId){x.showId.orgdisplay=typeof x.showId.orgdisplay==="undefined"?x.showId.style.display:x.showId.orgdisplay}if(url.substr(strlen(url)-1)=="#"){url=url.substr(0,strlen(url)-1);x.autogoto=1}var url=url+"&inajax=1&ajaxtarget="+showid;x.get(url,function(s,x){evaled=false;if(s.indexOf("ajaxerror")!=-1){evalscript(s);evaled=true}if(!evaled&&(typeof ajaxerror=="undefined"||!ajaxerror)){if(x.showId){changedisplay(x.showId,x.showId.orgdisplay);changedisplay(x.showId,x.display);x.showId.orgdisplay=x.showId.style.display;ajaxinnerhtml(x.showId,s);ajaxupdateevents(x.showId);if(x.autogoto){scroll(0,x.showId.offsetTop)}}}if(!evaled){evalscript(s)}ajaxerror=null;if(recall){eval(recall)}})}function ajaxpost(D,E,C){showloading();if(ajaxpostHandle!=0){return false}var B="ajaxframe";var A=$(B);if(A==null){if(is_ie&&!is_opera){A=document.createElement("<iframe name='"+B+"' id='"+B+"'></iframe>")}else{A=document.createElement("iframe");A.name=B;A.id=B}A.style.display="none";$("append_parent").appendChild(A)}$(D).target=B;$(D).action=$(D).action+"&inajax=1";ajaxpostHandle=[E,B,D,$(D).target,C];if(A.attachEvent){A.detachEvent("onload",ajaxpost_load);A.attachEvent("onload",ajaxpost_load)}else{document.removeEventListener("load",ajaxpost_load,true);A.addEventListener("load",ajaxpost_load,false)}$(D).submit();return false}function ajaxpost_load(){showloading("none");if(is_ie){var A=$(ajaxpostHandle[1]).contentWindow.document.XMLDocument.text}else{var A=$(ajaxpostHandle[1]).contentWindow.document.documentElement.firstChild.nodeValue}evaled=false;if(A.indexOf("ajaxerror")!=-1){evalscript(A);evaled=true}if(A.indexOf("ajaxok")!=-1){ajaxpostresult=1}else{ajaxpostresult=0}if(ajaxpostHandle[4]){setTimeout(ajaxpostHandle[4]+"('"+ajaxpostHandle[0]+"',"+ajaxpostresult+")",10)}if(!evaled&&(typeof ajaxerror=="undefined"||!ajaxerror)){ajaxinnerhtml($(ajaxpostHandle[0]),'<div class="popupmenu_inner">'+A+"</div>");if(!evaled){evalscript(A)}setMenuPosition($(ajaxpostHandle[0]).ctrlid,0);jsmenu.timer[$(ajaxpostHandle[0]).ctrlid]=setTimeout("hideMenu()",1000)}ajaxerror=null;if($(ajaxpostHandle[2])){$(ajaxpostHandle[2]).target=ajaxpostHandle[3]}ajaxpostHandle=0}function ajaxmenu(G,C,H,D,E){var F=0;showloading();if(jsmenu.active[0]&&jsmenu.active[0].ctrlkey==C){hideMenu();doane(G);return }else{if(is_ie&&is_ie<7&&document.readyState.toLowerCase()!="complete"){return }}cache=0;divclass="popupmenu_popup";optionclass="popupmenu_option";if(isUndefined(H)){H=3000}if(isUndefined(D)){D=""}if(isUndefined(E)){E=0}duration=H>10000?3:0;executetime=duration?2000:H;if(E==-1){divclass="popupmenu_centerbox";F=1}var B=$(C+"_menu");if(cache&&B){showMenu(C,G.type=="click",E,duration,H,0,C,500,1);if(D){setTimeout(D+"("+C+")",executetime)}doane(G)}else{if(!B){B=document.createElement("div");B.ctrlid=C;B.id=C+"_menu";B.style.display="none";B.className=divclass;$("append_parent").appendChild(B)}var I=new Ajax();var A=!isUndefined($(C).href)?$(C).href:$(C).attributes.href.value;I.div=B;I.etype=G.type;I.optionclass=optionclass;I.duration=duration;I.timeout=H;I.executetime=executetime;I.get(A+"&ajaxmenuid="+C+"_menu&popupmenu_box="+F,function(J){evaled=false;if(J.indexOf("ajaxerror")!=-1){evalscript(J);evaled=true;if(!cache&&duration!=3&&I.div.id){setTimeout('$("append_parent").removeChild($(\''+I.div.id+"'))",H)}}if(!evaled&&(typeof ajaxerror=="undefined"||!ajaxerror)){if(I.div){I.div.innerHTML='<div class="'+I.optionclass+'">'+J+"</div>"}showMenu(C,I.etype=="click",E,I.duration,I.timeout,0,C,500,1);if(D){setTimeout(D+'("'+C+'")',I.executetime)}}if(!evaled){evalscript(J)}ajaxerror=null;showloading("none")});doane(G)}showloading("none");doane(G)}function hash(B,D){var D=D?D:32;var E=0;var C=0;var A="";filllen=D-B.length%D;for(C=0;C<filllen;C++){B+="0"}while(E<B.length){A=stringxor(A,B.substr(E,D));E+=D}return A}function stringxor(E,C){var F="";var G="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";var A=Math.max(E.length,C.length);for(var D=0;D<A;D++){var B=E.charCodeAt(D)^C.charCodeAt(D);F+=G.charAt(B%52)}return F}function showloading(B,A){var B=B?B:"block";var A=A?A:"Loading...";$("ajaxwaitid").innerHTML=A;$("ajaxwaitid").style.display=B}function ajaxinnerhtml(G,F){if(G.tagName!="TBODY"){G.innerHTML=F}else{while(G.firstChild){G.firstChild.parentNode.removeChild(G.firstChild)}var E=document.createElement("DIV");E.id=G.id+"_div";E.innerHTML='<table><tbody id="'+G.id+'_tbody">'+F+"</tbody></table>";$("append_parent").appendChild(E);var A=E.getElementsByTagName("TR");var C=A.length;for(var D=0;D<C;D++){G.appendChild(A[0])}var B=E.getElementsByTagName("INPUT");var C=B.length;for(var D=0;D<C;D++){G.appendChild(B[0])}E.parentNode.removeChild(E)}}function get_absolute_offset(C){var B=0,A=0;while(C){B+=C.offsetLeft;A+=C.offsetTop;C=C.offsetParent}return[B,A]}function get_window_size(){var B=0,A=0;if(typeof window.innerWidth=="number"){B=window.innerWidth;A=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){B=document.documentElement.clientWidth;A=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){B=document.body.clientWidth;A=document.body.clientHeight}}}return[B,A]}function get_scroll_size(){var A=0,B=0;if(typeof (window.pageYOffset)=="number"){A=window.pageXOffset;B=window.pageYOffset}else{if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){A=document.body.scrollLeft;B=document.body.scrollTop}else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){A=document.documentElement.scrollLeft;B=document.documentElement.scrollTop}}}return[A,B]}function ajax_item_menu(C,E){var D=$("ajax_item_menu");if(D==null){init_ajax_menu()}D.style.visibility="visible";D.innerHTML="Loading...";var A=new Ajax();var B="do.php?ac=ajax&op=show_item&id="+E;A.div=D;A.duration=3;A.timeout=3000;A.executetime=2000;A.get(B,function(V){var G=$("ajax_item_menu");G.innerHTML=V;var K=G.offsetWidth;var F=G.offsetHeight;var O=get_absolute_offset(C),H=O[0],P=O[1],U=0,T=0,J=C.offsetWidth,N=C.offsetHeight,R=get_window_size(),Q=get_scroll_size(),M=R[0],I=R[1],S=Q[0],L=Q[1];if(H+J+K>M){H=Math.max(H-K,U)}else{H+=J}if(H<U){H=U}else{if(H+K>S+M){H=S+M-K}}if(P-F>Math.max(L,T)){P-=F}else{P+=N}if(P<T){P=T}else{if(P+F>L+I){P=Math.max(L,L+I-F)}}G.style.left=H+"px";G.style.top=P+"px"})}function ajax_item_hide(){$("ajax_item_menu").style.visibility="hidden"};