﻿if(!window["ElemObjectHash"])
    var ElemObjectHash = new Hashtable();
///Elem Object is a base class that allows Html Objects to be accessed via DOM objects
ElemObject = function ElemObject(ElemId, DivElem)
{
    this.ID = ElemId;
    this.Id = ElemId;
    this.Object = document.getElementById(ElemId);
    if(this.Object)
    {
        this.Object.setAttribute('GetElemObjJSRaw', "ElemObjectHash.get('"+this.Id+"')");
        this.Object.setAttribute('GetElemObjJS', "javascript:eval(ElemObjectHash.get('"+this.Id+"'))");
    }
    else if(DivElem)
    {
        DivElem.setAttribute('GetElemObjJS', "ElemObjectHash.get('"+this.Id+"')");
    }
    this.GetObject = function () 
                  {
                      if (this.Object != document.getElementById(ElemId)) {
                          this.Object = document.getElementById(ElemId);
                    this.Object.setAttribute('GetElemObjJS', "ElemObjectHash.get('"+this.Id+"')");
                  }
                     return this.Object; };
    this.ChildNodes = function (){ return this.Object.ChildNodes; }
    this.GetElemByTagAndName = function(tag, elemname) 
    {
        return getElementInParentByTagAndName(this.Object, 'elemName', tag, elemname);
    }
    ElemObjectHash.put(this.Id, this);
    this.GetJS = "javascript:ElemObjectHash.get('"+this.Id+"')";
    var getJS = this.GetJS;
    this.GetJSRaw = "ElemObjectHash.get('"+this.Id+"')";
    this.callThis = function(oFuncName)
    {
        return function () { eval(getJS+'.'+oFuncName+'()'); };
    };
    this.getElemChild = function(tag, name)
    {
        return getElementInParentByTagAndName(this.Object, 'elemname', tag, name);
    };
}
