LoadScript = false;

var req = false;

function getElementById(el)
 {
  return document.getElementById(el);
 }

function createElement(tag)
 {
  return document.createElement(tag.toUpperCase());
 }

function createRequestObject()
 {
  var request = false;

  if(!request)
   {
    try
     {
      request = new ActiveXObject('Msxml2.XMLHTTP');
     }
    catch (e){}
   }

  if(!request)
   {
    try
     {
      request = new ActiveXObject('Microsoft.XMLHTTP');
     }
    catch (e){}
   }

  if(!request)
   {
    try
     {
      request = new XMLHttpRequest();
     }
    catch (e){}
   }

  return request;
 }

function loadXMLDoc(url,query,func_name)
 {
  if (req = createRequestObject())
   {
    req.onreadystatechange = func_name;

    req.open("POST", url, false);
    req.setRequestHeader('Content-Type',"application/x-www-form-urlencoded");

    req.send(query);
   }
 }

function action(ID,Doc_ID,lang)
 {
  fmenu = document.getElementById("menu");
  fmenu.search.value = "";

  if ((ID != '') && (ID) && (ID != 'ID'))
   {
    fmenu.Item_Id.value = ID;
    if (Doc_ID)
     {
      fmenu.Doc_Id.value = Doc_ID;
     }

    if(lang)
     {
      fmenu.lang.value  = lang;
     }
    fmenu.submit();
   }
 }

function delete_ask()
 {
  oAsk = document.getElementById("frame_ask");
  oAsk.removeNode(true);
 }

function setStyle(oElement,sStyle)
 {
  var aStyle = sStyle.split(";");

  if (isArray(aStyle))
   {
    while(sItemStyle = aStyle.each().val)
     {
      aStyleParam = sItemStyle.split(":");
      oElement.style[aStyleParam[0]] = aStyleParam[1];
     }
   }
 }

function createTable(iRow,iCell)
 {
  oTab = createElement("table");
  oTb  = createElement("tbody");
  oTab.appendChild(oTb);

  for (indexRow=1;indexRow<=iRow;indexRow++)
   {
    oTr = createElement("tr");
    for (indexCell=1;indexCell<=iCell;indexCell++)
     {
      td = createElement("td");
      oTr.appendChild(td);
     }
    oTb.appendChild(oTr);
   }
  return oTab;
 }

function setAttributeExt(oElement,sAttrName,mAttr)
 {
  if (sAttrName.match(/^on.*/ig))
   {
    if (!(window.attachEvent)) oElement.addEventListener(sAttrName.substr(2), mAttr, false);
    else oElement.attachEvent(sAttrName,mAttr);
   }
  else if (sAttrName.toLowerCase() == "style") setStyle(oElement,mAttr);
  else if (sAttrName.toLowerCase() == "class") oElement.className = mAttr;
  else oElement.setAttribute(sAttrName,mAttr);
 }

function getPos(el)
 {
  var r = {x : el.offsetLeft, y : el.offsetTop};

  if (el.offsetParent)
   {
    var tmp = getPos(el.offsetParent);
    r.x += tmp.x;
    r.y += tmp.y;
   }

  return r;
 }

function isNumber(obj)
 {
  if (typeof(obj) == "number") return true;
  return false;
 }

function isString(obj)
 {
  if (typeof(obj) == "string") return true;
  return false;
 }

function isObject(obj)
 {
  if ((obj instanceof Object) || (typeof(obj) == "object")) return true;
  return false;
 }

function isArray(obj)
 {
  if (obj instanceof Array) return true;
  return false;
 }

function isUndefined(property)
 {
  return (typeof property == 'undefined');
 }

function isEmpty(obj)
 {
  if ((isString(obj) || isArray(obj)) && obj.length) return false;
  else if (isObject(obj) && obj.count()) return false;
  else true;
 }

function isEven(iVal)
 {
  return !(iVal%2);
 }
function getElementById(el)
 {
  return document.getElementById(el);
 }

function createElement(tag)
 {
  return document.createElement(tag.toUpperCase());
 }

function Tpl(name)
 {
  this.Name       = name;
  this.SourceText = getElementById(name).innerHTML;
  this.ParseText  = "";
  this.VarArray   = new Array();
  this.ParseFlag  = true;

  this.Clear = function()
   {
    this.VarArray  = new Array();
    this.ParseText = "";
    this.ParseFlag = true;
   }

  this.AssignVar = function(VarName,VarVal)
   {
    if (!VarVal || VarVal == "undefined")
     {
      VarVal = "";
     }

    this.VarArray[VarName] = isUndefined(this.VarArray[VarName]) ? "" : this.VarArray[VarName];

    if (this.AssignVar.arguments[2]) this.VarArray[VarName] = this.VarArray[VarName]+VarVal;
    else this.VarArray[VarName] = VarVal;
    this.ParseFlag = true;
   }

  this.Parse = function()
   {
    TmpStr = this.SourceText;

    for (i in this.VarArray)
     {
      re = new RegExp("%"+i+"%","g");
      TmpStr = TmpStr.replace(re,this.VarArray[i]);
     }

    if (this.Parse.arguments[0]) text = this.ParseText;
    else text = "";

    this.ParseText = text+TmpStr;
    this.ParseFlag = false;

    return TmpStr;
   }

  this.AssignTpl = function(sVarName,oTpl)
   {
    if (oTpl.ParseFlag) oTpl.Parse();

    if (this.AssignTpl.arguments[2]) this.AssignVar(sVarName,oTpl.ParseText,true);
    else                             this.AssignVar(sVarName,oTpl.ParseText);
   }

  this.Aply = function(id)
   {
    if (this.Aply.arguments[1]) text = getElementById(id).innerHTML;
    else text = "";

    if (this.ParseFlag) this.Parse();

    getElementById(id).innerHTML = text+this.ParseText;
   }
 }

function isNumber(obj)
 {
  if (typeof(obj) == "number") return true;
  return false;
 }

function isString(obj)
 {
  if (typeof(obj) == "string") return true;
  return false;
 }

function isObject(obj)
 {
  if ((obj instanceof Object) || (typeof(obj) == "object")) return true;
  return false;
 }

function isArray(obj)
 {
  if (obj instanceof Array) return true;
  return false;
 }

function isUndefined(property)
 {
  return (typeof property == 'undefined');
 }

function isEmpty(obj)
 {
  if ((isString(obj) || isArray(obj)) && obj.length) return false;
  else if (isObject(obj) && obj.count()) return false;
  else true;
 }

function isEven(iVal)
 {
  return !(iVal%2);
 }

LoadScript = true;