﻿// JScript File
url = document.location.href;
xend = url.lastIndexOf("/") + 1;
var base_url = url.substring(0, xend);

function ajax_do (url) {
        // Does URL begin with http?
        if (url.substring(0, 4) != 'http') {
                url = base_url + url;
        }
        // Create new JS element
        var jsel = document.createElement('SCRIPT');
        jsel.type = 'text/javascript';
        jsel.src = url;

        // Append JS element (therefore executing the 'AJAX' call)
        document.body.appendChild (jsel);
}
function loadAjaxData(sUrl,sObj,bCache)
{
    var ob=document.getElementById(sObj);
    var oLoad=document.getElementById("divLoading");
    if(ob!=null)
    {
        oLoad.style.display="none";
        ob.innerHTML="<div class='loading_block'></div>";
    }else{
        oLoad.style.display="block";
        oLoad.style.left=mCurrentX;
        oLoad.style.top=mCurrentY-oLoad.offsetHeight;
        oLoad.style.zIndex=100;
    }
    if(bCache)
        ajax_do("Load.aspx?"+sUrl+"&obj="+sObj+"&token="+tokenKey);
    else
        ajax_do("Load.aspx?"+sUrl+"&obj="+sObj+"&token="+tokenKey+"&vhn_key="+getStrRandom(6));
}

function finishLoadAjaxData(sHTML,sObj)
{
      var ob=document.getElementById(sObj);
      ob.innerHTML=sHTML;
      if(sObj!="")
      {
          var oLoad=document.getElementById("divLoading");
          oLoad.style.display="none";
      }
}

function finishExcuteAjaxData()
{
    var oLoad=document.getElementById("divLoading");
    oLoad.style.display="none";
}

function reloadAfterExcute()
{
    var oLoad=document.getElementById("divLoading");
    if(oLoad.style.display=="none")
    {
        location.reload(true);
    }
}

//Tab Controls: BEGIN
var currentTab = new Array();

function doClickTab(obj,sLink,oDiv,bCache,cssNormal,cssActive,sKey)
{
    if(currentTab[sKey]!=null)
    {
        currentTab[sKey].className=cssNormal;
    }
    currentTab[sKey]=obj;
    loadAjaxData(sLink,oDiv,bCache);
    
    obj.className=cssActive;
}
//Tab Controls: END

document.write("<div id='divLoading' class='loading'></div>");