﻿
    function ClickDiv(sDivName)
    {
        var elem, vis;
        elem = GetElement(sDivName);
        if (elem == null) {
            if (document.layers) {
                elem = document.layers[sDivName];
            }
        }
        vis = elem.style;
        //window.alert(vis.display);
        if ((vis.display == 'none') || (vis.display == '')) {
            vis.display = 'block';
        }
        else
        {
            vis.display = 'none';
        }
        //vis.display = (bShow==true)?'block':'none';
    }
    
    function ShowHideDiv(sDivName, bShow)
    {
        var elem, vis;
        elem = GetElement(sDivName);
        if (elem == null) {
            if (document.layers) {
                elem = document.layers[sDivName];
            }
        }
        vis = elem.style;
        //window.alert(vis.display);
        if (bShow == true) {
            vis.display = 'block';
        }
        else
        {
            vis.display = 'none';
        }
        //window.alert(vis.display);
        //vis.display = (bShow==true)?'block':'none';
    }
    function GetElement(id, o)
    {
        //var elem = null;        
        //if (document.getElementById) {
        //    elem = document.getElementById(sElemName);
        //}
        //if (elem == null) {
        //    if (document.all) {
        //        elem = document.all[sElemName];
        //    }
        //    else {
        //        elem = null;
        //    }
       // }
        //return (elem);
        
         var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
         else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
         if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
         for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
         f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
         for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
         return null;
    }
    function GetAppPath(sURL)
    {
        var sPath = String('');
        var sPathArray;
        var sDelimChar = String('/');
        sURL = String(sURL).replace('\\', sDelimChar);
        sPathArray = String(sURL).split(sDelimChar);
        var nIndex = 0;    
    
        for (nIndex=0;nIndex<sPathArray.length;nIndex++)
        {
            sPath = sPath + sPathArray[nIndex] + sDelimChar;
            if (sAppFolder.toUpperCase() == String(sPathArray[nIndex]).toUpperCase())
            {
                return (sPath);
            }
        }
        return (sPath);
    }
    function GetPathDelimChar(sURL)
    {         
        var sDelim = String('/');
        if(String(sURL).indexOf('\\') >= 0) {
            sDelim = String('\\');
        }
        return (sDelim);
    }
    function ResetPathDelim(sPath, sDelim)
    {
        sPath = String(sPath).replace('/', sDelim);
        sPath = sPath.replace('\\', sDelim);
        return (sPath);     
    }