﻿// JScript File

function openRadWindow(url, windowname)
{
    var oWnd = radopen(url, windowname);
    //oWnd.add_Close(OnClientClose);   
}

function openRadWindowWithRefreshOnClose(url, windowname)
{
    var oWnd = radopen(url, windowname);
    oWnd.add_Close(OnClientClose);   
}

function GetRadWindow()
        {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        } 

function CloseWindowRefresh()
{
    GetRadWindow().Close();
     
    GetRadWindow().BrowserWindow.location.href = GetRadWindow().BrowserWindow.location.href
}

function CloseWindow()
{
     GetRadWindow().Close();
}

function OnClientClose()   
    {   
        window.location.href = window.location.href;
    }  
    
function CloseWindowRefreshURL(url)
    {
        GetRadWindow().Close();

        GetRadWindow().BrowserWindow.location.href = url;
    }
    
function CancelWithPrompt()
 {
  if (confirm("Are you sure you want to cancel? Any changes will not be saved.")) {
    CloseWindow();
    }
}

function OnPDFClose(sender) {
    sender.setUrl("Blank.aspx");
}

function CloseAndTerminateAcrobat()
{
   
var strcomputer = "."
var objWMIService = GetObject("winmgmts:{impersonationlevel=impersonate}!\\\\" + strcomputer + "\\root\\cimv2");
var colitems = new Enumerator(objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'AcroRd32.exe'"));
for (; !colitems.atEnd(); colitems.moveNext()) 
{
colitems.item().Terminate();
}
}


//ToolTip Functions
        var toHide = false;       
        function OnBeforeShow(sender, args)  
        {  
            toHide = false;  
        }  
          
        function OnBeforeHide(sender, args)  
        {  
            if (!toHide) args.set_cancel(true);  
        }  
          
        function OnTargetMouseOut()  
        {  
            toHide = true;  
        }  
        
var formPrefix = 'ctl00$ContentPlaceHolder1$';

function ShowLoading()
{
   
    document.all['imgLoading'].style.visibility = 'visible';
    document.all[formPrefix + 'btnPrint'].style.visibility = 'hidden';
    
}


//function openRadWindow(url, windowname)     
//    {     
//        var oWnd = $find("testing");  
//        oWnd.setUrl(url);  
//        oWnd.set_Title(windowname);  
//        oWnd.show();   
//    }     

//function ShowRadWindow(winName, url)
//{        
//    var win = GetRadWindowManager().GetWindowByName(winName); 
//    
//    if (url != '')  
//    {
//        win.SetUrl(url);
//    }

//    win.Show();  
//}

//function ShowProcessingSplash()
//{
//   //document.all['LoadingMessage'].style.height = '100px';
//   //document.all['LoadingMessage'].style.width = '100px';     
//   document.all['LoadingMessage'].style.visibility = 'visible';

//}

// This function forces a postback from js
//function MasterForcePostback()
//{
//     __doPostBack(null,'');

//}

// Use this as a Telerik windows "OnClientClose" event and
//   it will refresh the parent page when a pop-up closes
//function MasterRefreshOnClose()
//{
//    MasterForcePostback();
//}
