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,"b")}else{$n(C,B)}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(C){var A=$(A);var C=$(C);var B={x:0,y:0};while(C){B.x+=C.offsetLeft;B.y+=C.offsetTop;C=C.offsetParent}return B}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")}else{this.d=document.implementation.createDocument("","",null);this.d.async="false";this.s=new XMLSerializer();this.p=new DOMParser()}if(A){$n(this.d.importNode(A,true),this.d)}}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 loadAsync(I,C,G,B,E){var K=new Date();var F=K.getTime()+Math.random();var I=I||"setValue";var J="/callbacks/"+I+".php?request_id="+F;var G=(C&&C.list)?C.list:G;if(B){J=urify(B,J)}var D={};if(C){for(var H in C){D[H]=C[H]}}if(G){D.list_id=G;for(var H in window.lists[G]){D["list_"+H]=window.lists[G][H]}}for(var H in D){if(typeof (D[H])=="object"){D[H]=JSON.stringify(D[H])}}D._window=window.name;var A=new AReq(J,urify(D),runXML,"POST");A.send();A.s=createSpinner(F);if(E){replaceBySpinner(E,A.s)}return A}function createSpinner(A){var B=$c("div","spinner","spinner_"+A);return B}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(A){var A=A.d.documentElement;if(A){var D=A.getAttribute("id");if(D){removeSpinner(D)}var B=A.selectNodes("./action");if(!B.length){return }for(var E=0;E<B.length;E++){var H=B[E].selectNodes("./*");var G={};for(var C=0;C<H.length;C++){G[H[C].nodeName]=getContent(H[C])}switch(B[E].getAttribute("type")){case"addItem":addItem(G.list,G.id,G.order,G.item);break;case"replaceItem":replaceItem(G.list,G.id,G.item);break;case"removeItem":removeItem(G.list,G.id);break;case"replaceNode":replaceNode(G.id,G.content);break;case"addNode":addNode(G.id,G.content);break;case"setValue":setValue(G.id,G.value);break;case"setContent":setContent(G.id,G.content);break;case"setDisplay":sDpl(G.id,G.display);break;case"setDisabled":setDisabled(G.id,G.disabled);break;case"setChecked":setChecked(G.id,G.checked);break;case"setAttribute":setAttribute(G.id,G.attribute,G.value);break;case"refreshList":if($(G.list+"_list")){loadAsync("findItems",{},G.list,null,G.list+"_list")}break;case"updatePager":updatePager(G.id,G.min,G.max,G.total);break;case"scrollToView":scrollToView(G.id);break;case"processError":processError(G.id,G.error);break;case"reload":reload(G.url,true);break;case"redirect":reload(G.url);break;default:var F=window[B[E].getAttribute("type")];if(typeof (F)=="function"){F(G)}break}}runScripts(A)}}function getFirstChild(B){a=B.childNodes;for(var A=0;A<a.length;A++){if(a[A].nodeType==1){return a[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){var C=toEl(A);$n(C,B)}}function removeItem(A,B){var C=$(A+"_item_"+B);if(C){$n(C)}}function getValue(C){C=$(C);if(C){switch(C.nodeName.toLowerCase()){case"select":return C.options[C.selectedIndex].value;break;case"ul":var A=document.getElementsByName(C.id);if(A&&A.length>0){for(var B=0;B<A.length;B++){if(A[B].checked){return A[B].value}}}break;default:return C.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(A,B){var D=$(A);if(D){if(ie()){var C=D.nodeName.toLowerCase();switch(C){case"select":D.innerHTML="";D.outerHTML=D.outerHTML.replace(/\<\/SELECT\>/,B+"</SELECT>");break;case"table":case"thead":case"tbody":case"tfoot":domClearContent(D);domMoveContent(toEl("<table>"+B+"</table>"),D);break;case"tr":case"col":case"colgroup":domClearContent(D);domMoveContent(getFirstChild(toEl("<table><"+C+">"+B+"</"+C+"></table>")),D);break;case"frameset":case"html":case"style":case"title":domClearContent(D);domMoveContent(toEl("<"+C+">"+B+"</"+C+">"),D);break;default:D.innerHTML=B;break}}else{D.innerHTML=B}}}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){n=$(B);if(n){n.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;window.lists[A].selected="";loadAsync("findItems",{},A,null,A+"_list");if(window.lists[A].mode.substr(0,4)=="tbl_"){loadAsync("redraw",{id:"totals",_mode:"tbl_footer"},A,null,A+"_item_totals")}if(typeof (doOnSetFilter)=="function"){doOnSetFilter(A,s)}}}function setDate(A,D,E,G,C,B,F){loadAsync(F,{table:D,field:E,id:C,value:getDate(G)},A)}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);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");loadAsync("findItems",{set:"next"},G.id);break;case 33:setValue(G.id+"_lookup_focussed","-1");loadAsync("findItems",{set:"prev"},G.id);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); loadAsync('findItems', {}, '"+A+"', null, '"+A+"_list'); n.pending = null;",B?0:300)}function refreshLookup(A,C){var D=$(A);if(D){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); loadAsync('findItems', {}, '"+A+"', null, '"+A+"_lookup_footer_buttons'); 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&&A!=""){if(B){window.location.replace(A)}else{window.location.href=A}}else{window.location.reload()}}function switchItem(B,C,A,D){if(typeof (clearRTEs)=="function"){clearRTEs(B+"_item_"+C)}return loadAsync("redraw",{id:C,_mode:A},B,null,D)}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 B.document}else{return window.frames[B].document}}}}function createFrame(C){var A=new Date();var B="asyncFrame_"+A.getTime()+Math.random();h="<iframe src='"+urify({request_id:B},C)+"' name='"+B+"' id='"+B+"' style='display:none;' onload='removeFrame(\""+B+"\");'></iframe>";$n(toEl(h),getBody());return B}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(B){setContent(B.list_id+"_progress_label_"+B.id,B.value);$S(B.list_id+"_progress_meter_"+B.id).width=B.value+"%";if(B.value<100){var A=function(){loadAsync("files/progress",{id:B.id,upload_id:B.upload_id,failed:B.failed},B.list_id)};if(B.failed<3){setTimeout(A,1000)}}else{}}function initList(B,C,A){if(C){window.lists[B]=C;if(A){loadAsync("initList",C,B,null,B+"_list")}}else{if(window.lists[B]&&!window.lists[B].initialized){loadAsync("initList",window.lists[B],B,null,B+"_list")}}}function initLists(){if(typeof (window.lists)!="undefined"&&window.lists!=null){for(var A in window.lists){}}}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")}loadAsync("findItems",{set:D},A,null,A+"_list")}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 runScripts(n){if(n.tagName.toLowerCase()=="script"){eval(getContent(n))}else{var a=n.selectNodes(".//*");for(var i=0;i<a.length;i++){if(a[i].nodeName.toLowerCase()=="script"){eval(getContent(a[i]));$n(a[i])}}}}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(B,D,A){var C=$(B+"_item_"+D+"_edit_button");if(C){$S(C).zIndex=(A)?500:1;sDpl(C,(A)?"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 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){sDpl("overlay","block");loadAsync("loadOverlay",C,A);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)}};