
/* #====================#
   ### Class HtmlProc ###
   #====================# */

function HtmlProc(Doc){
 this.Doc = Doc;
}

/* ### Public ### */

HtmlProc.prototype.AddEvent = function (t, e, f){
 if (typeof t.attachEvent != "undefined"){
  t.attachEvent(e, f);
 } else if (typeof t.addEventListener != "undefined") {
  e = e.replace("on", ""); t.addEventListener(e, f, true);
 }
}

HtmlProc.prototype.AddText = function (N, S){
 N.appendChild(this.Doc.createTextNode(S));
}

/* #===================#
   ### Class Globals ###
   #===================# */

function Globals(Doc){
 this.Doc = Doc;
 this.Val = new Array();
 this.GetDates();
 this.GetDocName();
}

/* ### Private ### */

Globals.prototype.Add = function (N, V){
 this.Val[this.Val.length] = {
  Name: N,
  Value: V
 };
}

Globals.prototype.Get = function (N){
 for (var i = 0; i < this.Val.length; i++)
  if (this.Val[i].Name == N)
   return this.Val[i].Value;
}

/* ### Public ### */

Globals.prototype.GetDates = function (){
 var Now = new Date();
 var Mod = new Date(this.Doc.lastModified);
 this.Add("Sec",   (Now.getSeconds() < 10) ? "0"+Now.getSeconds():Now.getSeconds());
 this.Add("Min",   (Now.getMinutes() < 10) ? "0"+Now.getMinutes():Now.getMinutes());
 this.Add("Hour",  (Now.getHours() < 10) ? "0"+Now.getHours():Now.getHours());
 this.Add("Date",  (Now.getDate() < 10) ? "0"+Now.getDate():Now.getDate());
 this.Add("Month", (Now.getMonth() < 10) ? "0"+Now.getMonth():Now.getMonth());
 this.Add("Year",  (Now.getFullYear()));
 this.Add("Now",    Now.toLocaleString());
 this.Add("Modify", Mod.toLocaleString());
}

Globals.prototype.GetDocName = function (){
 var DocName = document.location.href;
 DocName = DocName.substr(DocName.lastIndexOf("/")+1, DocName.lastIndexOf(".")-DocName.lastIndexOf("/")-1);
 this.Add("DocName", DocName);
}

/* #=====================#
   ### Class Row Hover ###
   #=====================# */

function RowHover(CHtml){
 var This    = null;
 this.CHtml  = CHtml;
 This = this;
 this._mouseover = function (e){This.MouseOver(e);}
 this._mouseout  = function (e){This.MouseOut(e);}
}

/* ### Private ### */

RowHover.prototype.MouseOver = function (e){
 var Src = e.srcElement||e.target;
 while (Src.tagName != "TR")
  Src = Src.parentNode;
 Src.className = "RowOver";
}

RowHover.prototype.MouseOut = function (e){
 var Src = e.srcElement||e.target;
 while (Src.tagName != "TR")
  Src = Src.parentNode;
 Src.className = "RowOut";
}

/* ### Public ### */

RowHover.prototype.Add = function (Table){
 var Bodies = Table.tBodies;
 for (var i = 0; i < Bodies.length; i++){
  for (var j = 0; j < Bodies[i].childNodes.length; j++){
   if (Bodies[i].childNodes[j].tagName == "TR"){
    this.CHtml.AddEvent(Bodies[i].childNodes[j], "onmouseover", this._mouseover);
    this.CHtml.AddEvent(Bodies[i].childNodes[j], "onmouseout", this._mouseout);
   }
  }
 }
}

/* ### Class Parameter ###
   #=====================# */

function Parameters(){
 this.Params = new Array();
 this.Search = document.location.search;
 this.Get();
}

Parameters.prototype.Get = function(){
 var Temp = new Array();
 this.Search = this.Search.substr(1);
 Temp = this.Search.split("&");
 for (var i = 0; i < Temp.length; i++){
  if (Temp[i] != "") {
   this.Params[i] = {
    Name: Temp[i].substr(0, Temp[i].indexOf("=")),
    Value: Temp[i].substr(Temp[i].indexOf("=")+1)
   };
  }
 }
}

Parameters.prototype.Set = function(){
 for (var i = 0; i < this.Params.length; i++){
  var Tag = document.getElementsByName(this.Params[i].Name);
  for (var j = 0; j < Tag.length; j++){
   if (Tag[j] != "undefined") {
    if (typeof Tag[j].value != "undefined"){
     Tag[j].value = this.Params[i].Value;
    }
   }
  }
 }
}

/* ### Scripts ###
   #=============# */

var CHtml = new HtmlProc(document);
var CGlob = new Globals(document);
var CRowH = new RowHover(CHtml);
var CParm = new Parameters();

function DocInit(){
 SetFocus();
 SetGlobals();
 SetHover();
 CParm.Set();
}

function SetGlobals(){
 var Nodes = document.getElementsByTagName("Span");
 for (var i = 0; i < Nodes.length; i++){
  for (var j = 0; j < CGlob.Val.length; j++){
   if (Nodes[i].className == CGlob.Val[j].Name){
    CHtml.AddText(Nodes[i], CGlob.Val[j].Value);
   }
  }
 }
}

function SetHover(){
 var Nodes = document.getElementsByTagName("Table");
 for (var i = 0; i < Nodes.length; i++){
  if (Nodes[i].className != null){
   if (Nodes[i].className.toLowerCase() == "list"){
    CRowH.Add(Nodes[i]);
   }
  }
 }
}

function SetFocus(){
 var Node = document.getElementById("Focus");
 if (Node == null) {return;}
 if (typeof Node.focus != "undefined")
  Node.focus();
}

/* ########################################## */

var IncDir = document.location.href;
if (IncDir.lastIndexOf("Director") != -1)
 IncDir = IncDir.substr(0, IncDir.lastIndexOf("Director")+9);
else IncDir = IncDir.substr(0, IncDir.lastIndexOf("Pages"))+"Director/";
document.writeln('<link rel= "Stylesheet" type= "Text/Css" href= "style.css" />');

if (typeof window.attachEvent != "undefined")
 window.attachEvent("onload", DocInit);
if (typeof window.addEventListener != "undefined")
 window.addEventListener("load", DocInit, true);