//context.js created on 5/23/05. Used of finding the ancestor of a window where the data frame is loaded.
function getRootWindow(win)
{
  var rootWin = getHighestParent(win)  
  return rootWin;
}

function getHighestParent(win)
{
  var curWin = win;
  var curParent = curWin.parent;
  while(curWin.parent != curWin)
  {
    curWin = curWin.parent;
  }
  return curWin;
}

function _request()
{
  this.paramArray = new Array();

  var tmpStr = location.search;
  if (tmpStr.indexOf("?") != -1) {
    tmpStr = tmpStr.substring(tmpStr.indexOf("?")+1);
    var tmpArray = new Array();
    if (tmpStr.match("%26")) {

      tmpArray = tmpStr.split("%26");
    } else {

      tmpArray = tmpStr.split("&");
    }
    for (i in tmpArray) {
      var param = tmpArray[i].split("=");
      if (param[0] != "") {
        this.paramArray[param[0]] = param[1];
      }
    }
  }

  this.getParameter = function(name) {
    if (!this.paramArray[name]) {
      return null;
    }
    return this.paramArray[name];
  }
}

function AttributeContainer()
{

 this.attrMap = new ActiveXObject("Scripting.Dictionary")
 this.getAttribute = function(name)
 {
   if (this.attrMap.Exists(name))
   {
     
     return this.attrMap.Item(name);
   }
   
   return null;
 }
 this.setAttribute = function(name, value)
 {
    
   if (this.attrMap.Exists(name))
   {
     this.attrMap.Remove(name);
     this.attrMap.Add(name, value);
   }
   else
   {
     this.attrMap.Add(name, value);
   }
 }
 this.removeAttribute = function(name)
 {
   if (this.attrMap.Exists(name))
   {
     return this.attrMap.Remove(name);
   }
 }
}
var application = new AttributeContainer();
var session = new AttributeContainer();

/**Modified on 2006/01/12 for removing Window dependency **/
try
{
	application=getRootWindow(window)._application;
	session=getRootWindow(window)._session
}
catch(e)
{
//	alert("Error in context.js");
}

var request = new _request();

