function $(A){return(typeof (A)=="string")?document.getElementById(A):A}function $S(A){var A=$(A);if(A){return A.style}}function $c(B,G,F,D,C){var E=document.createElement(B);if(G){E.className=G}if(F){E.id=F}if(D){for(var A in D){E.setAttribute(A,D[A])}}if(C){E.innerHTML=C}return E}function $n(C,B,A){var C=$(C),B=$(B);if(B){switch(A){case"b":B.parentNode.insertBefore(C,B);break;case"a":if(B.nextSibling){$n(C,B.nextSibling,"b")}else{$n(C,B.parentNode)}break;case"r":B.parentNode.replaceChild(C,B);break;default:B.appendChild(C);break}}else{C.parentNode.removeChild(C)}}function ie(){return window.ActiveXObject}function stopProp(A){if(!A){window.event.cancelBubble=true}else{if(A.stopPropagation){A.stopPropagation()}}}function cE(){return false}function absXY(B){var C=$(C);var A={x:0,y:0};while(C){A.x+=C.offsetLeft;A.y+=C.offsetTop;C=C.offsetParent}return A}function vpSize(){if(typeof (window.innerHeight)!="undefined"){var A=window.innerWidth;var B=window.innerHeight}else{var C=(document.compatMode==="CSS1Compat")?document.documentElement:getBody();if(typeof (C.clientHeight)=="undefined"){C=getBody()}var B=C.clientHeight;var A=C.clientWidth}return{w:A,h:B}}function getBody(){var A=document;if(A.body){return A.body}if(A.getElementsByTagName.body){return A.getElementsByTagName.body[0]}else{return all.body}}function within(B,A,C){return(B>=A&&B<=C)?true:false}function XY(B,A){var C=ie()?[event.clientX+getBody().scrollLeft,event.clientY+getBody().scrollTop]:[B.pageX,B.pageY];return C[zero(A)]}function zero(A){A=parseInt(A);return !isNaN(A)?A:0}function getXML(A){if(window.ActiveXObject){return A.innerText}return A.textContent}function setXML(B,A){if(ie()){B.innerText=A}else{B.textContent=A}}function getContent(A){if(ie()){C=A.xml}else{var B=new XWrap(A);var C=B.serialise()}C=C.replace(/(^\<[^\<\>]*\>)|(\<\/[^\<\>]*\>$)/g,"");return C}function getArgs(B,C){var A=[];for(i=C;i<B.length;i++){A[i-C]=B[i]}return A}function zeroFill(B,A){while((B+".").indexOf(".")<A){B="0"+B}return B}Function.prototype.bind=function(C){var B=this;var A=getArgs(arguments,1);A.unshift("");return function(D){D=D||event;A[0]=D;return B.apply(C,A)}};function AReq(B,E,C,A){this._d=E;this._f=C;this._m=A.toUpperCase();this._u=B;this._r=null;if(window.XMLHttpRequest){try{this._r=new XMLHttpRequest()}catch(D){this._r=null}}else{if(ie()){try{this._r=new ActiveXObject("Msxml2.XMLHTTP")}catch(D){try{this._r=new ActiveXObject("Microsoft.XMLHTTP")}catch(D){this._r=null}}}}}AReq.prototype.send=function(){var B=this._u;var A=this._m;var C=this._r;if(C){C.onreadystatechange=this.hsc.bind(this);if(A=="POST"){C.open(A,B);if(typeof (this._d)=="string"){C.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}C.send(this._d)}else{C.open(A,B);C.send("")}}};AReq.prototype.hsc=function(){if(this._r.readyState==4){var A=new XWrap();A.parse(this._r.responseText);this._f.call(this,A)}};function XWrap(A){if(ie()){this.d=new ActiveXObject("Microsoft.XMLDOM");this.d.async="false";this.d.setProperty("SelectionLanguage","XPath");if(A){$n(this.d.importNode(A,true),this.d)}}else{var D=(A)?A.nodeName:"";this.d=document.implementation.createDocument("",D,null);this.d.async="false";this.s=new XMLSerializer();this.p=new DOMParser();if(A){var B=A.childNodes;for(var C=0;C<B.length;C++){$n(this.d.importNode(B[C],true),this.d.documentElement)}}}}XWrap.prototype.setNS=function(B,A){if(ie()){this.d.setProperty("SelectionNamespaces",B+"='"+A+"'")}};XWrap.prototype.serialise=function(){return(ie())?this.d.xml:this.s.serializeToString(this.d)};XWrap.prototype.parse=function(A){if(ie()){this.d.loadXML(A);var B=this.d.parseError;if(B.errorCode){alert("Error:\n"+B.reason+"\nat:\n"+B.srcText)}}else{this.d=this.p.parseFromString(A,"text/xml")}};if(!ie()){Element.prototype.selectNodes=function(B){var E=(this.ownerDocument)?this.ownerDocument:new XPathEvaluator();var C=E.createNSResolver(E.documentElement);var D=E.evaluate(B,this,C,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);var A=[];if(D){while(x=D.iterateNext()){A.push(x)}}return A};Element.prototype.selectSingleNode=function(A){var C=(this.ownerDocument)?this.ownerDocument:new XPathEvaluator();var B=C.createNSResolver(C.documentElement);var B=C.evaluate(A,this,B,XPathResult.FIRST_ORDERED_NODE_TYPE,null);return(B)?B.singleNodeValue:null}}function urify(D,B){var C="";if(B){C=(B.indexOf("?")>0)?"&":"?"}else{var B=""}for(var A in D){B+=C+A+"="+encodeURIComponent(D[A]);C="&"}return B}function uniqueId(){var A=new Date();return A.getTime()+Math.random()}function runActions(G){var C=uniqueId();var B="/callbacks/actions.php?request_id="+C+"&window="+window.name;var F={};var A=getArgs(arguments,1);for(var D=0;D<A.length;D++){if(A[D].list_id){A[D].list_props=window.lists[A[D].list_id]}F[D]=JSON.stringify(A[D])}var E=new AReq(B,urify(F),runXML,"POST");E.send();E.id=C;E.s=createSpinner(C);if(G){replaceBySpinner(G,E.s)}return E}function createSpinner(A){return $c("div","spinner","spinner_"+A)}function replaceBySpinner(B,A){var B=$(B);if(B){if(!B.previousSibling||B.previousSibling.className!="spinner"){$S(B).display="none";B.parentNode.insertBefore(A,B)}else{B.previousSibling.id=A.id}}}function removeSpinner(A){var B=$("spinner_"+A);if(B){$S(B.nextSibling).display="";$n(B)}}function runXML(x){var x=x.d.documentElement;if(x){var s=getScripts(x);var sId=x.getAttribute("id");if(sId){removeSpinner(sId)}var a=x.selectNodes("./action");if(!a.length){return }for(var i=0;i<a.length;i++){var y=a[i].selectNodes("./*");var p={};for(var j=0;j<y.length;j++){p[y[j].nodeName]=getContent(y[j])}switch(a[i].getAttribute("type")){case"addItem":addItem(p.list,p.id,p.order,p.item);break;case"replaceItem":if(typeof (clearRTEs)=="function"){clearRTEs(p.list+"_item_"+p.id)}replaceItem(p.list,p.id,p.item);break;case"removeItem":if(typeof (clearRTEs)=="function"){clearRTEs(p.list+"_item_"+p.id)}removeItem(p.list,p.id);break;case"replaceNode":replaceNode(p.id,p.content);break;case"attachNode":$n(p.id,p.target_id,p.mode);break;case"addNode":addNode(p.id,p.content);break;case"setValue":setValue(p.id,p.value);break;case"setContent":setContent(p.id,p.content);break;case"setDisplay":sDpl(p.id,p.display);break;case"setDisabled":setDisabled(p.id,p.disabled);break;case"setChecked":setChecked(p.id,p.checked);break;case"setAttribute":setAttribute(p.id,p.attribute,p.value);break;case"refreshList":if($(p.list+"_list")){runActions(p.list+"_list",{action:"lists/refresh",list_id:p.list})}break;case"updatePager":updatePager(p.id,p.min,p.max,p.total);break;case"scrollToView":scrollToView(p.id);break;case"processError":processError(p.id,p.error);break;case"reload":reload(p.url,true);break;case"redirect":reload(p.url);break;default:var f=window[a[i].getAttribute("type")];if(typeof (f)=="function"){f(p)}break}}for(var i=0;i<s.length;i++){eval(s[i])}}}function getFirstChild(B){a=$(B).childNodes;for(var A=0;A<a.length;A++){if(a[A].nodeType==1){return a[A]}}}function getPrevSibling(A){var A=$(A).previousSibling;while(A&&A.nodeType!=1){A=A.previousSibling}return A}function getNextSibling(A){var A=$(A).nextSibling;while(A&&A.nodeType!=1){A=A.nextSibling}return A}function toEl(B){var A=$c("div",null,null,null,B);var C=getFirstChild(A);$n(C);A=null;return C}function addItem(A,B,D,C){var A=$(A+"_list");if(A){var E=toEl(C);if(D!="desc"){$n(E,A)}else{$n(E,A.firstChild,"b")}scrollToView(E,A)}}function replaceItem(A,B,C){replaceNode(A+"_item_"+B,C)}function replaceNode(C,A){var C=$(C);if(C){var B=C.nodeName.toLowerCase();switch(B){case"thead":case"tbody":case"tfoot":$n(getFirstChild(toEl("<table>"+A+"</table>")),C,"r");break;case"tr":case"col":case"colgroup":$n(getFirstChild(getFirstChild(toEl("<table><tbody>"+A+"</tbody></table>"))),C,"r");break;default:$n(toEl(A),C,"r");break}}}function addNode(B,A){var B=$(B);if(B){$n(toEl(A),B)}}function removeItem(A,B){var C=$(A+"_item_"+B);if(C){$n(C)}}function getValue(D){D=$(D);if(D){switch(D.nodeName.toLowerCase()){case"select":return D.options[D.selectedIndex].value;break;case"ul":var A=document.getElementsByName(D.id);if(A&&A.length>0){for(var B=0;B<A.length;B++){if(A[B].checked){return A[B].value}}}else{var C=getSelected(D.id);if(!C){C=0}return C}break;default:return D.value;break}}else{return 0}}function setValue(C,I){var B=$(C);if(B){switch(B.nodeName.toLowerCase()){case"input":B.value=I;var F=$(B.id+"_toggle");if(F){var A=$(B.id+"_item_"+I);if(A){var J=A.getElementsByTagName("strong")[0];F.value=J.innerHTML}}break;case"select":for(var E=0;E<B.options.length;E++){if(B.options[E].value==I){B.selectedIndex=E;break}}break;case"ul":var H=document.getElementsByName(C);if(H.length>0){for(var E=0;E<H.length;E++){if(H[E].value==I){H[E].checked=true;break}else{if(H[E].getAttribute("type")=="radio"){H[E].checked=false}}}break}else{var H=document.getElementsByName(C+"[]");I=I.replace(/ /g,"").split(",");for(var E=0;E<H.length;E++){var G=false;for(var D=0;D<I.length;D++){if(H[E].value==I[D]){G=true;break}}H[E].checked=G}}break;default:B.innerHTML=I;break}}}function parseFormToObject(C){var D={};for(var B in C){if(C[B]&&(C[B].form==C||C[B].length)){if(typeof (C[B].nodeName)!="undefined"){D[C[B].name]=getValue(C[B])}else{if(C[B].length>0&&typeof (C[B][0])!="undefined"&&C[B][0].type=="radio"){for(var A in C[B]){if(C[B][A].checked){D[C[B][A].name]=getValue(C[B][A]);break}}}}}}return D}function domMoveContent(D,C){var D=$(D);var C=$(C);var A=D.childNodes;for(var B=0;B<A.length;B++){if(A[B].nodeType==1){$n(A[B],C)}}}function domClearContent(C){var C=$(C);var A=C.childNodes;for(var B=0;B<A.length;B++){$n(A[B])}}function setContent(C,A){var C=$(C);if(C){if(ie()){var B=C.nodeName.toLowerCase();switch(B){case"select":C.innerHTML="";C.outerHTML=C.outerHTML.replace(/\<\/SELECT\>/,A+"</SELECT>");break;case"table":case"thead":case"tbody":case"tfoot":domClearContent(C);domMoveContent(toEl("<table>"+A+"</table>"),C);break;case"tr":case"col":case"colgroup":domClearContent(C);domMoveContent(getFirstChild(toEl("<table><"+B+">"+A+"</"+B+"></table>")),C);break;case"frameset":case"html":case"style":case"title":domClearContent(C);domMoveContent(toEl("<"+B+">"+A+"</"+B+">"),C);break;default:C.innerHTML=A;break}}else{C.innerHTML=A}}}function setAttribute(C,A,B){C=$(C);if(C){C.setAttribute(A,B)}}function sDpl(B,A){s=$S(B);if(s){s.display=A}}function setDisabled(D,B){var A=document.getElementsByName(D);for(var C=0;C<A.length;C++){A[C].disabled=(B=="true")}}function setChecked(B,A){B=$(B);if(B){B.checked=(A=="true")}}function toggleList(D,B){var A=$(D);if(A){for(var C=0;C<A.childNodes.length;C++){var E=A.childNodes[C];sDpl(E,(E.id==D+"_"+B)?"block":"none")}}}function setListFilter(A,C,B){if(A&&window.lists[A]){if(!window.lists[A].filters){window.lists[A].filters={}}window.lists[A].filters[C]=B;runActions(A+"_list",{action:"lists/refresh",list_id:A,set:"first"});if(window.lists[A].mode&&window.lists[A].mode.substr(0,4)=="tbl_"){runActions(A+"_item_totals",{action:"lists/redraw",list_id:A,ids:"totals",mode:"tbl_footer"})}if(typeof (doOnSetFilter)=="function"){doOnSetFilter(A,s)}}}function setDate(A,C,D,F,B){var E={action:"generic/set",table:C,field:D,ids:B,value:getDate(F)};if(A){E.list_id=A}runActions(null,E)}function getDate(E){var D={Y:["0000",""],m:["00","-"],d:["00","-"],H:["00"," "],i:["00",":"],s:["00",":"]},B="";var A=$(E);A=(A)?A.id.replace(/_[YmdHis]$/,""):E;for(var C in D){B+=D[C][1]+""+zeroFill(getValue(A+"_"+C),D[C][0].length)}return B}function getSelectedItem(A){if(A&&window.lists[A]){return window.lists[A].selected}return getValue(A)}function swapSelectedItem(A,B){var C=(A&&window.lists[A])?window.lists[A].selected:getValue(A);var D=$(A+"_item_"+C);if(D){D.className="repeatable"}if(A&&window.lists[A]){window.lists[A].selected=B}else{setValue(A,B)}var E=$(A+"_item_"+B);if(E){E.className="repeatable selected_item"}}function selectItem(B,C,E){swapSelectedItem(B,C);if(window.lists[B]&&window.lists[B].mode=="lookup"){var D=$(B+"_popup_toggle");var A=$(B);if(A){A.defaultValue=A.value=E}if(D&&A==document.activeElement){D.focus()}}if($(B)&&($(B+"_toggle"))){setValue(B+"_toggle",E);toggle(B+"_popup","off")}if(typeof (doOnSelectItem)=="function"){doOnSelectItem(B,C,E)}}function getListParam(A,B){if(A&&window.lists[A]){return window.lists[A].parameters[B]}return null}function setListParam(A,C,B){if(A&&window.lists[A]){window.lists[A].parameters[C]=B}}function setListProps(B){if(B.list_id&&window.lists[B.list_id]){for(var A in B){if(A!="list_id"){if(B[A].substr(0,1)=="%"){window.lists[B.list_id][A]=JSON.parse(decodeURIComponent(B[A]))}else{window.lists[B.list_id][A]=B[A]}}}}}function getSelected(D){var D=(typeof (D)!="string")?D=D.name:D+"[]";var A=document.getElementsByName(D);var B=d="";for(var C=0;C<A.length;C++){if(A[C].checked){B+=d+A[C].value;d=","}}return B}function getBitmask(D){var D=(typeof (D)!="string")?D.name:D+"[]";var A=document.getElementsByName(D);var B=0;for(var C=0;C<A.length;C++){if(A[C].checked){B+=Math.pow(2,C)}}return B}function resetLookup(A){A.value=A.defaultValue}function handleLookupBlur(A,B){if(B.value==""){B.value=B.defaultValue}if(window.lists[B.id]&&B.value!=B.defaultValue){window.lists[B.id].selected=0}setTimeout("toggle('"+B.id+"_popup', 'off');",100);setValue(B.id+"_lookup_focussed","-1");raise(B.parentNode)}function handleLookupFocus(A,B){if(B.value!=""){B.defaultValue=B.value}B.select();refreshLookup(B.id,1);toggle(B.id+"_popup","on");raise(B.parentNode,true)}function toggleLookup(A){if($S(A+"_popup").display=="none"){$(A).defaultValue=$(A).value;setValue(A,"");$(A).focus()}else{$(A+"_popup_toggle").focus()}}function handleLookupKey(F,G){F=F||event;var D=G.id;var C=F.keyCode||F.which;switch(C){case 34:setValue(G.id+"_lookup_focussed","-1");runActions(G.id+"_list",{action:"lists/refresh",list_id:G.id,set:"next"});break;case 33:setValue(G.id+"_lookup_focussed","-1");runActions(G.id+"_list",{action:"lists/refresh",list_id:G.id,set:"prev"});break;case 27:case 13:var H=$(G.id+"_popup_toggle");if(H){H.focus()}return false;break;case 40:var H=$(G.id+"_lookup_focussed");if(H){var B=$(G.id+"_list");var A=B.selectNodes("./div");if(A.length>0){var E=H.value;if(E>=0){$S($(A[E]).selectSingleNode("./div")).backgroundColor=""}E++;if(E>A.length-1){E=0}$S($(A[E]).selectSingleNode("./div")).backgroundColor="#ffdd8c";H.value=E}}break;case 38:var H=$(G.id+"_lookup_focussed");if(H){var B=$(G.id+"_list");var A=B.selectNodes("./div");if(A.length>0){var E=H.value;if(E>=0){$S($(A[E]).selectSingleNode("./div")).backgroundColor=""}E--;if(E<0){E=A.length-1}$S($(A[E]).selectSingleNode("./div")).backgroundColor="#ffdd8c";H.value=E}}break;default:setValue(G.id+"_lookup_focussed",-1);refreshLookup(G.id);break}}function getNextListItem(B,D){var A=$(B+"_list");if(!D){var C=A.selectSingleNode("./*")}else{var C=$(B+"_item_"+D);if(C){C=C.nextSibling}}if(C&&C.id){return C}return null}function toggleLookupHint(D){if(getValue(D).replace(/\s/,"")==""){var C="block";var A="none";var B=true}else{var C="none";var A="block";var B=false}sDpl(D+"_list",A);sDpl(D+"_lookup_footer",A);sDpl(D+"_lookup_create_hint",A);sDpl(D+"_lookup_hint",C);return B}function catchLookupKeyDown(F,G){var F=F||window.event;var E=F.keyCode||F.which;var H=$(G.id);switch(E){case 27:resetLookup(G);return false;break;case 13:var D=$(G.id+"_lookup_focussed");if(D){var C=D.value;if(C>=0){var B=$(G.id+"_list");var A=B.selectNodes("./div");if(A[C]){$S(A[C]).backgroundColor="";A[C].selectNodes("./div")[0].onclick()}}}return false;break}}function handleDropDownKey(E,G){E=E||window.event;var B=E.keyCode||E.which;switch(B){case 34:break;case 33:break;case 27:var F=$(G+"_item_"+$(G).defaultValue);if(F){F=F.getElementsByTagName("a")[0];F.onclick();$(G).onchange()}break;case 13:var F=$(G+"_toggle");if(F){F.focus()}return false;break;case 40:var F=$(G+"_item_"+getValue(G));if(F){F=F.nextSibling}if(!F){F=$(G+"_list").selectSingleNode("./div")}F=F.getElementsByTagName("a")[0];F.onclick();return false;break;case 38:var F=$(G+"_item_"+getValue(G));if(F){F=F.previousSibling}if(!F){F=$(G+"_list").selectNodes("./div").pop()}F=F.getElementsByTagName("a")[0];F.onclick();return false;break;default:var F=$(G);if(typeof (F.typetrack)=="undefined"){F.typetrack=""}F.typetrack+=String.fromCharCode(B);if(typeof (F.typetimer)!="undefined"){clearTimeout(F.typetimer)}F.typetimer=setTimeout("$('"+G+"').typetrack = ''",500);var A=$(G+"_list").getElementsByTagName("a");var D=new RegExp(F.typetrack,"im");for(var C=0;C<A.length;C++){if(getXML(A[C]).match(D)){A[C].onclick();break}}break}}function handleSearchKey(C,A){var C=C||event;var B=C.keyCode||C.which;switch(B){case 27:$(A+"_search_submit").focus();break;case 13:$(A+"_search_submit").click();$(A+"_search_submit").focus();return false;break;default:break}}function searchList(A,B){var C=$(A+"_criteria");window.lists[A].search=getSelected(A+"_searches");if(C.pending){clearTimeout(C.pending)}C.pending=setTimeout("var n = $('"+A+"_criteria'); window.lists['"+A+"'].criteria = getValue(n); runActions('"+A+"_list', {action:'lists/refresh', list_id:'"+A+"', set:'first'}); n.pending = null;",B?0:300)}function refreshLookup(A,C){var D=$(A);if(D){window.lists[A].initialized=true;var B=false;if($(A+"_lookup_hint")){B=toggleLookupHint(A)}setValue(A+"_lookup_create",D.value);if(!B){if(D.pending){clearTimeout(D.pending)}D.pending=setTimeout("var n = $('"+A+"'); window.lists['"+A+"'].criteria = getValue(n); runActions('"+A+"_lookup_footer_buttons', {action:'lists/refresh', list_id:'"+A+"', set:'first'}); n.pending = null;",C?0:200)}}return false}function toggle(A,B){var D=$(A);if(D){if(!B){B=($S(D).display=="none")?"on":"off"}if(B=="on"){$S(D).display="block";raise(D,true);scrollToView(D)}else{$S(D).display="none";raise(D)}var C=$(A+"_toggle");if(C){C.className="toggle toggle_"+B}}}function reload(A,B){if(A=="back"){window.back()}else{if(A&&A!=""){var A=A.replace(/\&amp;/ig,"&");if(B){window.location.replace(A)}else{window.location.href=A}}else{window.location.reload()}}}function switchItem(B,C,A,D){return runActions(D,{action:"lists/redraw",list_id:B,ids:C,mode:A})}function removeFrame(B){var C=getFrameDoc(B);if(C.location.href=="about:blank"){return }var A=new XWrap();A.parse(C.body.innerHTML.replace(/\<\!--\s--/,"").replace(/--\s--\>/,""));runXML(A);setTimeout("$n($('"+B+"'));",10)}function getFrameDoc(B){var A=$(B);if(A.contentDocument){return A.contentDocument}else{if(A.contentWindow){return A.contentWindow.document}else{if(A.document){return A.document}else{return window.frames[B].document}}}}function createFrame(B){var A="asyncFrame_"+uniqueId();h="<iframe src='"+urify({request_id:A},B)+"' name='"+A+"' id='"+A+"' style='display:none;' onload='removeFrame(\""+A+"\");'></iframe>";$n(toEl(h),getBody());return A}function refreshFrame(C,A){var B=getFrameDoc(C);if(B.location){B.location.replace(A)}else{if(B.window.location){B.window.location.replace(A)}else{$(C).src=A}}}function uploadAsync(F,D,A){var C=createFrame(D);setValue("upload_id",C);F.setAttribute("action",urify({request_id:C},F.getAttribute("action").replace(/[?].*/,"")));F.setAttribute("enctype","multipart/form-data");F.setAttribute("target",C);var G={};if(A){G.list_id=A;for(var B in window.lists[A]){G["list_"+B]=window.lists[A][B]}}for(var B in G){if(typeof (G[B])=="object"){G[B]=JSON.stringify(G[B])}}G._window=window.name;for(var B in G){$n($c("input","","",{type:"hidden",name:B,value:G[B]}),F)}var E=createSpinner(C);return E}function uploadProgress(C){if(C.value=="---"){C.value=0}var A=Math.min(100,C.value);setContent("progress_label_"+C.id,A);$S("progress_meter_"+C.id).width=A+"%";setContent("progress_memory_usage",C.mem);if(A<100&&C.failed<3){var B=function(){C.action="progress";runActions(null,C)};setTimeout(B,1000)}else{}}function initList(B,C,A){if(C){window.lists[B]=C}else{A=true}if(A&&window.lists[B]&&!window.lists[B].initialized){runActions(B+"_list",{action:"lists/init",list_id:B})}}function flipList(A,D){var C=["first","prev","offset","next","last"];for(var B=0;B<C.length;B++){setDisabled(A+"_pager_"+C[B],"true")}runActions(A+"_list",{action:"lists/refresh",list_id:A,set:D})}function updatePager(C,B,A,D){var G=C+"_pager_";var F={first:1,prev:1,offset:1,next:1,last:1};if(B==1){F.first=F.prev=0}if(A==D){F.next=F.last=0}for(var E in F){setDisabled(G+E,(F[E]==0)?"true":"false")}setValue(G+"offset",(B!=A)?B+"-"+A:B);setValue(G+"total",D);sDpl(C+"_empty",((D>0)?"none":""))}function getScripts(D){if(D.tagName.toLowerCase()=="script"){var C=getContent(D)}else{var C=[];var A=D.selectNodes(".//*");for(var B=0;B<A.length;B++){if(A[B].nodeName.toLowerCase()=="script"){C.push(getContent(A[B]));$n(A[B])}}}return C}function raise(C,A){var C=$(C);var B=1000;while(C.parentNode&&C.nodeName.toLowerCase!="body"&&$S(C).zIndex<=1000){$S(C).zIndex=(A)?B:1;B--;C=C.parentNode}}function handleItemHover(C,E,B){var D=$(C+"_item_"+E+"_edit_button");if(D){$S(D).zIndex=(B)?500:1;var A=$(C+"_item_"+E+"_menu");if(!A||$S(A).display=="none"){sDpl(D,(B)?"block":"none")}}}function scrollToView(D,B){var D=$(D);if(D){var C=absXY(D).y;B=$(B)||document.documentElement;if(B==document.documentElement){var A=vpSize().h}else{C-=absXY(B).y;var A=B.offsetHeight}B.scrollTop=Math.max(C+D.offsetHeight+10-A,B.scrollTop);B.scrollTop=Math.min(C-10,B.scrollTop)}}function sortItem(H,B,D,A,E,F){if(B){var C=$(B+"_item_"+D);if(C){switch(A){case"up":A=getPrevSibling(C);break;case"down":A=getNextSibling(C);break}if(A&&(A.id||typeof (A)!="object")){var G={action:"generic/sort",list_id:B,id:D,scope:E,field:((F)?F:"sort_order")};if(A&&A.id){G.target_id=A.id.split("_")[A.id.split("_").length-1]}else{G.value=A}runActions(H,G)}}}}function processError(A,C){var B=$(A);var D=$(A+"_error");if(D){if(C){setContent(D,C);sDpl(D,"block");return false}else{setContent(D,"");sDpl(D,"none");return true}}return true}function initOverlay(C,A,B,D){sDpl("overlay","block");C.action="overlays/init";if(A){C.list_id=A}runActions(D,C);if(typeof (B)=="function"){$("overlay_callback").onchange=B}}function closeOverlay(){sDpl("overlay","none");setContent("overlay_header","<h1>Initializing...</h1>");setContent("overlay_body",'<p>Please wait...</p><img src="/images/spinner_small_nobg.gif" > </img>');setContent("overlay_footer"," ");if(typeof ($("overlay_callback").onchange)=="function"){return $("overlay_callback").onchange()}else{return true}}Calendar=function(C,B,A){var B=$(B);this.n=$c("div","calendar",C+"_calendar");B.innerHTML="";$n(this.n,B);this.p=B;this.ws=["Su","Mo","Tu","We","Th","Fr","Sa"];this.ms=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];this.cb=A;this.id=C;this.now=new Date();this.today=this.now.getFullYear()+"-"+this.now.getMonth()+"-"+this.now.getDate()};Calendar.prototype.init=function(E,J,B){var N=/([0-9]{4})-([0-9]{2})-([0-9]{2})/;var D=N.exec(B);if(D){var C=new Date(D[1],D[2]-1,D[3])}if(!D||C.getFullYear()<1900){var C=new Date()}if(!J){var J=this.now.getFullYear()}if(!E){var E=J-10}if(C.getFullYear()<E){C.setFullYear(E)}if(C.getFullYear()>J){C.setFullYear(J)}this.y=C.getFullYear();this.m=C.getMonth();this.dm=this.m;this.dy=this.y;this.dd=C.getDate();this.n.innerHTML="";var L=$c("div","list");for(var F=J;F>=E;F--){var H=$c("div","repeatable");var K=$c("a","selector",null,{href:"javascript:void(0);"},F);K.onclick=this.render.bind(this,F,-1);if(F==this.dy){$S(K).textDecoration="underline"}$n(K,H);$n(H,L)}$n(L,this.n);var M=$c("table",null,null,{cellspacin:0,cellpadding:0,border:0});var G=$c("thead");for(var F=0;F<12;F++){if(F%4==0){var A=$c("tr");$n(A,G)}var H=$c("th");var K=$c("a",null,null,{href:"javascript:void(0);"},this.ms[F]);K.onclick=this.render.bind(this,-1,F);K.onmousedown=function(O){return false};if(F==this.dm){$S(K).textDecoration="underline"}$n(K,H);$n(H,A)}$n(G,M);$n(M,this.n);var M=$c("table",null,null,{cellspacin:0,cellpadding:0,border:0});var G=$c("thead");var I=$c("tbody");var A=$c("tr","cal_current");$n($c("th",null,"cal_"+this.id+"_my",{colspan:7},this.ms[this.m]+" "+this.y),A);$n(A,G);var A=$c("tr");for(var F=1;F<8;F++){$n($c("th",null,null,null,this.ws[F%7]),A)}$n(A,G);$n(G,M);$n(I,M);$n(M,this.n);this.b=I;this.render(null,this.y,this.m)};Calendar.prototype.render=function(E,H,A){if(H>-1){this.y=H}if(A>-1){this.m=A}setContent("cal_"+this.id+"_my",this.ms[this.m]+" "+this.y);var F=1;var D=new Date(this.y,this.m,F);this.b.innerHTML="";while(D.getDate()==F){var C=$c("tr");for(var B=1;B<8;B++){var G=$c("td");if(D.getDate()==F&&D.getDay()==B%7){a=$c("a",null,null,{href:"javascript:void(0);"},F);a.onclick=this.select.bind(this,F);if(this.y==this.dy&&this.m==this.dm&&F==this.dd){$S(a).textDecoration="underline"}if(this.y+"-"+this.m+"-"+F==this.today){a.setAttribute("style","border: 1px solid #ccc; padding: 0;")}$n(a,G);F++;D.setDate(F)}$n(G,C)}$n(C,this.b)}return false};Calendar.prototype.select=function(A,B){selectItem(this.id+"_Y",this.y,this.y);selectItem(this.id+"_m",this.m+1,this.ms[this.m]);selectItem(this.id+"_d",B,B);toggle(this.p,"off");$(this.id+"_calendar_toggle").value=this.y+"-"+this.m+1+"-"+B;if(typeof (this.cb)=="function"){this.cb.call($(this.id+"_m"),this.y,this.m+1,B)}};
