/**************************************************************************

  Copyright (c) AwardSoft Inc. 2002-2003. All rights reserved.
  Award TreeView Script - www.awardsoft.com
  Version 1.1
  Update: 2003.03.01

  Notes: Registration needed to use this script on your web site.
  Registration for this version is FREE for evaluating, personal and non-profit use.

  Unregistered
**************************************************************************/

function AwardTree(tr,sk,s)
 {
 this.skin    = sk
 this.name    = tr; 
 this.plus    = new Image(); this.plus.src    = this.skin+"/plus.gif"; 
 this.plus_L  = new Image(); this.plus_L.src  = this.skin+"/plus_l.gif";  
 this.minus   = new Image(); this.minus.src   = this.skin+"/minus.gif"; 
 this.minus_L = new Image(); this.minus_L.src = this.skin+"/minus_l.gif"; 
 this.cross_I = new Image(); this.cross_I.src = this.skin+"/cross_i.gif";
 this.cross_L = new Image(); this.cross_L.src = this.skin+"/cross_l.gif";
 this.cross_T = new Image(); this.cross_T.src = this.skin+"/cross_t.gif";
 this.fold    = new Image(); this.fold.src    = this.skin+"/fold.gif";
 this.fold_O  = new Image(); this.fold_O.src  = this.skin+"/fold_o.gif";
 this.blank   = new Image(); this.blank.src   = this.skin+"/blank.gif";
 this.file    = new Image(); this.file.src    = this.skin+"/file.gif";
 this.first   = new Image(); this.first.src   = this.skin+"/top.gif";


 this.gete=function(id)
  {
  (document.layers)?(document.layers[id]):((document.getElementById)?(id = document.getElementById(id)):(id = document.all[id]));
  return id;
  }

 o=this.gete(this.name);
 qu=window.opera?"\"":"\'";
 if ((this.skin != "gfx/tree")&&(this.skin != "msdn"))
    {
    o.innerHTML="<div class=\"si\"><img src="+this.first.src+">"+s+"</div>";
    };

 this.show=function(id)
 {
  var i=1, p=0, s="", temp=0;

  id1 = id;
  id = ((id>"")?id+"-":"");
  o=this.gete(this.name+id1);

  do{
    a = this.gete(this.name+"-"+id+i);
    if (a != null)
      {
      fl_child = (this.gete(this.name+"-"+id+i+"-1") == null)?(true):(false);
      fl_last  = (this.gete(this.name+"-"+id+(i+1)) == null)?(true):(false);
      image    = (fl_child)?((fl_last)?(this.cross_L.src):(this.cross_T.src)):((fl_last)?(this.plus_L.src):(this.plus.src));
      image1   = (fl_child)?(this.file.src):(this.fold.src);

      click    = (fl_child)?(""):("onclick="+this.name+ ".change("+qu+id+i+qu+");");
      dblclick = (fl_child)?(""):("ondblclick="+this.name+ ".change(\'"+id+i+"\');");
      f = a.innerHTML;
      s = s + "<div id = "+this.name+id+i+" class=\"sd\" style=display:block>";
      pos = id.indexOf('-');
      temp = 0;
      while (pos >0)
         {
         image2 = (this.gete(this.name+((temp>0)?(id.substring(0,temp)+"-"):(""))+(eval(id.substring((temp>0)?(temp+1):(temp),pos))+1)) == null)?(this.blank.src):(this.cross_I.src);
         s = s + "<img style=\"cursor:hand\" height=16 src=\""+image2+"\">";
         temp = pos;
         pos = id.indexOf('-',pos+1);
         } 
      if ((this.skin != "msdn")&&(this.skin != "gfx/tree")) {  s = s + "<img height=16 width=19 id = i"+this.name+id+i+" src=\""+image+ "\" "+click+">";}

      if ((this.skin != "wing")&&(!((f.indexOf("SRC")>0)||(f.indexOf("src")>0)))) {
         if ((this.skin == "msdn")||(this.skin == "gfx/tree")) {            
            s = s + "<img style=\"cursor:hand\" height=16 width=19 id = f"+this.name+id+i+" src=\""+image1+"\""+click+">"+""}
         else {
            s = s + "<img style=\"cursor:hand\" height=16 width=19 id = f"+this.name+id+i+" src=\""+image1+"\""+dblclick+">"+""}
            }
      s = s + f + "</div>";
      }
      i = i + 1;
    }
  while (a != null); 

  pos = s.indexOf('> ');
  while (pos >0)
         {
         s=s.substring(0,pos+1) + s.substring(pos+2);
         pos = s.indexOf('> ');
         }
  o.innerHTML = o.innerHTML + " <div id=d"+this.name+id1+" class=\"si\" style=display:block>" + s + "</div>";
 }


this.change=function(id)
 {
 o  = this.gete("d"+this.name+id);
 o1 = this.gete("i"+this.name+id);
 o2 = this.gete("f"+this.name+id);
 if (o2!=null) {(o2.src.indexOf(this.fold_O.src)>-1)?(o2.src = this.fold.src):(o2.src = this.fold_O.src);}
 if ((this.skin != "msdn")&&(this.skin != "gfx/tree"))
    {
    (o1.src.indexOf(this.plus.src)>-1)?(o1.src = this.minus.src):((o1.src.indexOf(this.minus.src)>-1)?(o1.src = this.plus.src):((o1.src.indexOf(this.minus_L.src)>-1)?(o1.src = this.plus_L.src):(o1.src = this.minus_L.src)));
    } 

 (o!=null)?((o.style.display=="none")?(o.style.display="block"):(o.style.display="none")):(this.show(id));
 }

 }

/**************************************************************************
  This function must be implemented it is called by DHTML Treeview 
  everytime you click on a leave. 
**************************************************************************/

function SelectItem(id) 
{
   alert("You just clicked on title: "+id);
}