function GNFTreeUpdate(b,a,f,e,d){var c=GNFTreeUpdate.arguments[5];if(typeof c=="undefined"){c=0}if(document.getElementById("cat"+b).innerHTML==""||d==1){GNFAjax(a,f+"&amp;parentId="+b+"&amp;depth="+e,"cat"+b);if(b!=0){if(document.getElementById("tree"+b)!=null){document.getElementById("tree"+b).src=globalFiles+"/admin/minus.gif"}}document.getElementById("cat"+b).style.display="none"}if((document.getElementById("cat"+b).style.display!="none")){document.getElementById("cat"+b).style.display="none";if(c){if(document.getElementById("tree"+b)!=null){document.getElementById("tree"+b).src=globalFiles+"/admin/plus.gif"}}else{if(document.getElementById("tree"+b)!=null){document.getElementById("tree"+b).src=globalFiles+"/admin/plusbottom.gif"}}}else{document.getElementById("cat"+b).style.display="block";if(c){if(document.getElementById("tree"+b)!=null){document.getElementById("tree"+b).src=globalFiles+"/admin/minus.gif"}}else{if(document.getElementById("tree"+b)!=null){document.getElementById("tree"+b).src=globalFiles+"/admin/minusbottom.gif"}}}}function handleEnter(d,b){var c=b.keyCode?b.keyCode:b.which?b.which:b.charCode;if(c==13){var a;for(a=0;a<d.form.elements.length;a++){if(d==d.form.elements[a]){break}}a=(a+1)%d.form.elements.length;d.form.elements[a].focus();return false}else{return true}}function FWSAjax(){GNFAjax(FWSAjax.arguments[0],FWSAjax.arguments[1],FWSAjax.arguments[2],FWSAjax.arguments[3])}function GNFAjax(){var spanId=GNFAjax.arguments[2];var execWhenFinished=GNFAjax.arguments[3];var randomnumber=Math.floor(Math.random()*11111);var url=GNFAjax.arguments[0];var parameters="&"+GNFAjax.arguments[1]+"&cache="+randomnumber;parameters=parameters.replace(/\?/g,"");var http;var browser=navigator.appName;if(browser=="Microsoft Internet Explorer"){http=new ActiveXObject("Microsoft.XMLHTTP")}else{http=new XMLHttpRequest()}document.body.style.cursor="wait";var elems=document.getElementsByTagName("a");for(var i=0;i<elems.length;i++){elems[i].style.cursor="wait"}http.onreadystatechange=function(){if(http.readyState==4||http.readyState=="complete"){if(typeof documentChanged!="undefined"){documentChanged=false}document.body.style.cursor="";var elems=document.getElementsByTagName("a");for(var i=0;i<elems.length;i++){elems[i].style.cursor=""}var response=http.responseText;if(typeof spanId!="undefined"){if(spanId!=""){document.getElementById(spanId).innerHTML=response}}if(typeof execWhenFinished!="undefined"){eval(execWhenFinished)}}};http.open("POST",url,true);http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");http.send(parameters)}function dragInit(c,e,f,j,n,l,h,d,a,i,p){if(typeof(c)=="string"){c=document.getElementById(c)}if(c==null){return}if(f!=null&&j!=null){var t=f.Min(j);j=f.Max(j);f=t}var r=null;var k=null;var m=false;var o=false;var g=false;function s(v){if(m||!o||g){return}m=true;if(n!=null){n(v,c,a,i,p)}r=absoluteCursorPostion(v);k=new Position(parseInt(c.style.left),parseInt(c.style.top));k=k.Check();hookEvent(document,"mousemove",q);hookEvent(document,"mouseup",b);return cancelEvent(v)}function q(w){if(!m||g){return}var v=absoluteCursorPostion(w);v=v.Add(k).Subtract(r);v=v.Bound(f,j);v.Apply(c);if(l!=null){l(w,a,i)}return cancelEvent(w)}function b(v){u();return cancelEvent(v)}function u(){if(!m||g){return}unhookEvent(document,"mousemove",q);unhookEvent(document,"mouseup",b);r=null;k=null;if(h!=null){h(c,a,i,p)}m=false}this.Dispose=function(){if(g){return}this.StopListening(true);c=null;e=null;f=null;j=null;n=null;l=null;h=null;g=true};this.StartListening=function(){if(o||g){return}o=true;hookEvent(e,"mousedown",s)};this.StopListening=function(v){if(!o||g){return}unhookEvent(e,"mousedown",s);o=false;if(v&&m){u()}};this.IsDragging=function(){return m};this.IsListening=function(){return o};this.IsDisposed=function(){return g};if(typeof(e)=="string"){e=document.getElementById(e)}if(e==null){e=c}if(!d){this.StartListening()}}function itemDragBegin(c,b,a,e,d){document.getElementById(b.id+"_image").src=globalFiles+"/admin/loading.gif";b.style.top=b.offsetTop+"px";b.style.left=b.offsetLeft+"px";b.className="drag";e.style.height=b.offsetHeight+"px";a.insertBefore(e,b);e.SourceI=b}function itemMoved(e,c,g){e=e?e:window.event;var d=mouseY(e);var f="end";for(var b=0;b<c.childNodes.length;b++){if(c.childNodes[b].className=="list"){var a=parseInt(c.childNodes[b].offsetHeight)/2;if((findPosY(c.childNodes[b])+(a))>d){f=c.childNodes[b];break}}}if(f==g||f==g.SourceI){return}g.SourceI=f;if(f!="end"){c.insertBefore(g,c.childNodes[b])}else{c.appendChild(g)}}function itemDragEnd(d,c,f,e){if(f.SourceI!=null){f.SourceI=null;c.replaceChild(d,f)}d.className="list";d.style.top="0px";d.style.left="0px";var a=new Array();for(var b=0;b<c.childNodes.length;b++){if(c.childNodes[b].className=="list"){a.push(c.childNodes[b].id.replace(/[^\d\.]+/g,""))}}GNFAjax(scriptPath,queryHead+queryHead+"&id="+e+"&returnStatusNote=1&pageAction=reorderItems&itemOrder="+a.join("|"),"","document.getElementById('"+d.id+"_image').src=globalFiles+'/admin/page.gif';")}function findPosX(a){var b=0;if(a.offsetParent){while(1){b+=a.offsetLeft;if(!a.offsetParent){break}a=a.offsetParent}}else{if(a.x){b+=a.x}}return b}function closeAllEdit(){var a=document.getElementsByTagName("div");for(x=0;x<a.length;x++){if(a[x].className=="editBoxControls"){a[x].style.left="-9999px"}if(a[x].className=="editBoxExpander"){a[x].innerHTML="+"}}}function editModeClicky(c,b){var a=c.childNodes[1].innerHTML;closeAllEdit();if(a!="-"){c.childNodes[1].innerHTML="-";document.getElementById(b).style.left=(findPosX(c)+17)+"px";document.getElementById(b).style.width=(c.offsetWidth-19)+"px";document.getElementById(b).style.top=(findPosY(c))+"px"}}function findPosY(b){var a=0;if(b.offsetParent){while(1){a+=b.offsetTop;if(!b.offsetParent){break}b=b.offsetParent}}else{if(b.y){a+=b.y}}return a}function Position(a,b){this.X=a;this.Y=b;this.Add=function(d){var c=new Position(this.X,this.Y);if(d!=null){if(!isNaN(d.X)){c.X+=d.X}if(!isNaN(d.Y)){c.Y+=d.Y}}return c};this.Subtract=function(d){var c=new Position(this.X,this.Y);if(d!=null){if(!isNaN(d.X)){c.X-=d.X}if(!isNaN(d.Y)){c.Y-=d.Y}}return c};this.Min=function(d){var c=new Position(this.X,this.Y);if(d==null){return c}if(!isNaN(d.X)&&this.X>d.X){c.X=d.X}if(!isNaN(d.Y)&&this.Y>d.Y){c.Y=d.Y}return c};this.Max=function(d){var c=new Position(this.X,this.Y);if(d==null){return c}if(!isNaN(d.X)&&this.X<d.X){c.X=d.X}if(!isNaN(d.Y)&&this.Y<d.Y){c.Y=d.Y}return c};this.Bound=function(c,e){var d=this.Max(c);return d.Min(e)};this.Check=function(){var c=new Position(this.X,this.Y);if(isNaN(c.X)){c.X=0}if(isNaN(c.Y)){c.Y=0}return c};this.Apply=function(c){if(typeof(c)=="string"){c=document.getElementById(c)}if(c==null){return}if(!isNaN(this.X)){c.style.left=this.X+"px"}if(!isNaN(this.Y)){c.style.top=this.Y+"px"}}}function hookEvent(b,a,c){if(typeof(b)=="string"){b=document.getElementById(b)}if(b==null){return}if(b.addEventListener){b.addEventListener(a,c,false)}else{if(b.attachEvent){b.attachEvent("on"+a,c)}}}function unhookEvent(b,a,c){if(typeof(b)=="string"){b=document.getElementById(b)}if(b==null){return}if(b.removeEventListener){b.removeEventListener(a,c,false)}else{if(b.detachEvent){b.detachEvent("on"+a,c)}}}function cancelEvent(a){a=a?a:window.event;if(a.stopPropagation){a.stopPropagation()}if(a.preventDefault){a.preventDefault()}a.cancelBubble=true;a.cancel=true;a.returnValue=false;return false}function getEventTarget(a){a=a?a:window.event;return a.target?a.target:a.srcElement}function absoluteCursorPostion(a){a=a?a:window.event;if(isNaN(window.scrollX)){return new Position(a.clientX+document.documentElement.scrollLeft+document.body.scrollLeft,a.clientY+document.documentElement.scrollTop+document.body.scrollTop)}else{return new Position(a.clientX+window.scrollX,a.clientY+window.scrollY)}}function mouseY(a){if(a.pageY){return a.pageY}else{if(a.clientY){return a.clientY+(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)}else{return null}}};
