/
treeItem.prototype.getFirstChild = function()
{
if(this.childNodes.length>0 && this.open)
return this.childNodes[0];
return this;
}
treeItem.prototype.getLastChild = function()
{
if(this.childNodes.length>0 && this.open)
return this.childNodes[this.childNodes.length-1].getLastChild();
return this;
}
treeItem.prototype.getPreviousSibling = function()
{
if(!this.parent) return null;
for(var i=0;i
if(i == 0)
return this.parent;
else
return this.parent.childNodes[i-1].getLastChild();
}
treeItem.prototype.getNextSibling = function()
{
if(!this.parent) return null;
for(var i=0;i
if(i == this.parent.childNodes.length-1)
return this.parent.getNextSibling();
else
return this.parent.childNodes[i+1];
}
treeItem.prototype.KeyDown=function(e){
var code,o;
if(!e) e = window.event;
code = e.which ? e.which : e.keyCode;
o = this;
if(code == 37)
{
if(o.open) o.collapse();
else
{
if(o.parent) o.parent.select();
}
return false;
}
else if(code == 38)
{
var tmp = o.getPreviousSibling();
if(tmp) tmp.select();
return false;
}
else if(code == 39)
{
if(o.childNodes.length>0)
{
if(!o.open) o.expand();
else
{
var tmp = o.getFirstChild();
if(tmp) tmp.select();
}
}
return false;
}
else if(code == 40)
{
if(o.open&&o.childNodes.length>0)o.getFirstChild().select();
else
{
var tmp = o.getNextSibling();
if(tmp) tmp.select();
}
return false;
}
else if(code == 13)
{
o.toggle();
o.openURL();
return false;
}
return true;
}
Array.prototype.indexOf=function(o){
for(var i=0;i
return -1;
}
Array.prototype.removeAt=function(i){
return this.slice(0,i).concat(this.slice(i+1))
}
Array.prototype._remove=function(o){
var i=this.indexOf(o);
if(i!= -1) return this.removeAt(i)
return this
}
function xtreeItem(uid,text,action,target,title,Icon,xml){
this.uid=uid;
this.base=treeItem;
this.base(text,action,target,title,Icon);
this.Xml=xml;
}
xtreeItem.prototype=new treeItem;
xtreeItem.prototype.parseElement=function(dom){
return dom.selectSingleNode("/TreeNode");
}
xtreeItem.prototype.addNodesLoop = function(oItem)
{
for(var i=0;i
var o = oItem.childNodes[i];
var tmp = new xtreeItem(o.getAttribute("id"),o.getAttribute("text"),o.getAttribute("href"),o.getAttribute("target"),o.getAttribute("title"),o.getAttribute("icon"),o.getAttribute('Xml'));
this.add(tmp);
if(o.getAttribute("Xml")) tmp.add(new treeItem("Loading..."));
else
{
tmp.load=true;
tmp.addNodesLoop(o);
}
}
}
xtreeItem.prototype.loadChildren=function()
{
var oItem = this;
var oLoad = oItem.childNodes[0];
var XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
XmlHttp.onreadystatechange=function(){
if(XmlHttp.readyState==4){
if(XmlHttp.status==200){
if(XmlHttp.responseXML.xml == ""){ oLoad.setText("unavaible1");return;}
var XmlItem=oItem.parseElement(XmlHttp.responseXML.documentElement);
if(XmlItem.childNodes.length == 0){ oLoad.setText("unavaible") }
else
{
oItem.addNodesLoop(XmlItem);
for(var i=0;i
if(parseInt(getcookie("item"+oItem.childNodes[i].id)) ==1)
{ oItem.childNodes[i].expand();}
}
if(Global.selectedItem == oItem.childNodes[0])oItem.select();
oLoad.remove();
}
}
else{
oLoad.setText("unavaible");
}
XmlHttp = null;
oItem.select(1);
}
}
try{
XmlHttp.open("get",this.Xml+(/?/g.test(this.Xml)?"&":"?")+"temp="+Math.random(),true);
XmlHttp.send();
}catch(e){ oLoad.setText("unavaible");}
}
xtreeItem.prototype.setup=function(oTarget){
this.add(new treeItem("Loading..."));
oTarget.appendChild(this.toString());
this.setuped=true;
if(this.childNodes.length>0 || this.open) this.expand();
}
function setcookie(name,value)
{
var Days = 7;
var exp = new Date();
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getcookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}
function delcookie(name)
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getcookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}



