﻿
function loadTreeViewEvent(tvNode, panelId)
{ 
    try 
    {   
        var elem = document.getElementById(tvNode);
        //alert(elem.id + ", " + panelId);
        
        if(elem != null )   
        {     
            var node = document.getElementById(elem.value);     
            if(node != null)     
            {       
                node.scrollIntoView(true);       
                //Panel1.scrollLeft = 0;     
                var panel = document.getElementById(panelId);
                if (panel != null) {panel.scrollLeft = 0;}
                //alert(panel.id);
            }   
        } 
    } 
    catch(oException) 
    {}
}

// Javascript File
function openwindow(url, height, width, left, top)
{
    var hi = parseInt(height);
    var wd = parseInt(width);
    var dt = Date();

    if (hi == 0){hi = 710;}
    if (wd == 0){wd = 1015;}
    
    //Add current datetime with url to avoid to open page from history
    if (url.indexOf("?") >= 0)
    {
        url += "&date=" + dt;
    }
    else
    {
        url += "?date=" + dt;
    }
    thisWindow = window.open(url,self,"dialogHeight:" + hi + "px;dialogWidth:" + wd + "px;" +
                 "dialogLeft:" + left + "px;dialogTop:" + top + "px;center:yes;location:no;" +
                 "directories:no;menubar:no;status:no;scroll:no;resizable:no;");
    return false;
}

function openscrollwindMowodal(url, height, width, left, top)
{
    var hi = parseInt(height);
    var wd = parseInt(width);
    var dt = Date();

    if (hi == 0){hi = 710;}
    if (wd == 0){wd = 1015;}
    
    //Add current datetime with url to avoid to open page from history
    if (url.indexOf("?") >= 0)
    {
        url += "&date=" + dt;
    }
    else
    {
        url += "?date=" + dt;
    }
    
    thisWindow = window.showModalDialog(url,self,"dialogHeight:" + hi + "px;dialogWidth:" + wd + "px;" +
                 "center:yes;location:no;directories:no;menubar:no;status:no;scrollbars:yes;resizable:no;");
                
    return false;
}

function openwindowscroll(url, height, width, left, top)
{    
     thisWindow = thisWindow = window.open(url,"","location=no,status=no,directories=no,menubar=no,scrollbars=yes,resizable=no,height=" 
                + height + ",width=" + width + ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top);
                return false;
}

function close_Window()
{
    window.close();
    return false;
}

function closeWindowModeless()
{
    window.close();
    window.opener.location.reload(true);
    return false;
}

function openwindowModeless(url, height, width, left, top)
    {

    var hi = parseInt(height);
    var wd = parseInt(width);
    var dt = Date();
    if (hi == 0){
        hi = 710;
    }
    
    if (wd == 0){
        wd = 1015;
    }
    if (url.indexOf("?") >= 0)
    {
        url += "&date=" + dt;
    }
    else
    {
        url += "?date=" + dt;
    }
    
    thisWindow = window.open(url,"","location=no,status=no,directories=no,menubar=no,scrollbars=no,resizable=no,height=" 
                + hi + ",width=" + wd + ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top);
   
}

function sessionExpired(msg)
{
    alert(msg); //'Session is expired'
}

function showClientMessage(msg)
{
    alert(msg);
}

function printspecial()
 {
    shell = new ActiveXObject("WScript.Shell");
    shell.SendKeys("^p");
    setTimeout("shell.SendKeys('{ENTER}')",1500);
    setTimeout("window.close()",1400);
 }
 
function closeChildWindow()
{
    
    if(window.opener == "undefined" || window.opener == null)
    {
        window.dialogArguments.location.reload(true);
       
    }
    else
    {
        window.opener.location.reload(true);
    }
    
    window.close();
    
    return true;
}

function disableControl(ctl)
{
    ctl.disabled = true;
    //__doPostBack(ctl.id, '');
    //alert(ctl.id);
}
