﻿ 
    
        function ShowMessage(sender, args)
        {
            var id = args.getDataKeyValue("GraphicInventoryID");
            var wnd = window.radopen("ViewGraphicsDetail.aspx?mode=1&GraphicID=" + id, id);
            wnd.setActive(true);
         
            //Get the clicked row 
            var index = args.get_itemIndexHierarchical(); 
            var item = args.get_tableView().get_dataItems()[index]; 
            var rowElement = item.get_element();
          
            //Get coordinates of the row and reposition the window relative to it
           // var bounds = $telerik.getBounds(rowElement); 
            //wnd.moveTo(bounds.x + 120 + index*10, bounds.y - 180);
        }
        function ShowMessageOpenParent(sender, args) {
          
            var id = args.getDataKeyValue("GraphicInventoryID");
            var wnd = GetRadWindow().BrowserWindow.window.radopen("ViewGraphicsDetail.aspx?mode=1&GraphicID=" + id, null);

            //Get the clicked row 
            var index = args.get_itemIndexHierarchical();
            var item = args.get_tableView().get_dataItems()[index];
            var rowElement = item.get_element();

            //Get coordinates of the row and reposition the window relative to it
            var bounds = $telerik.getBounds(rowElement);
            wnd.moveTo(bounds.x + 120 + index * 10, bounds.y - 180);
        }

        function ShowMessageOpenParentThumb(id) {

            
            var wnd = GetRadWindow().BrowserWindow.window.radopen("ViewGraphicsDetail.aspx?mode=1&GraphicID=" + id, null);

            //Get the clicked row 
            var index = args.get_itemIndexHierarchical();
            var item = args.get_tableView().get_dataItems()[index];
            var rowElement = item.get_element();

            //Get coordinates of the row and reposition the window relative to it
            var bounds = $telerik.getBounds(rowElement);
            wnd.moveTo(bounds.x + 120 + index * 10, bounds.y - 180);
        }
        function rrr() {
            // alert('dadam rocksd');
            window.location.href = window.location.href;
            //window.location.reload();//- will reload the page (equal to pressing F5)   
            // window.location.href = window.location.href;// - will refresh the page by reloading the URL
        }

         
    function CloseListWindow(sender,args)   
    {   
        //window.location.reload();//- will reload the page (equal to pressing F5)   
        //window.location.href = window.location.href;// - will refresh the page by reloading the URL
    }
    function OpenListWindow() {
       
      
        GetRadWindow().Close();
    }



    function DisableList(rd) {       
        rd.BrowserWindow.refreshGrid("DisableList");
    }

  

    function CloseOnReload() {
        
        GetRadWindow().Close();
    }
    function CloseOnReload2() {
        // two lines removed since we are no loger using a popUpList
        //var oManager = GetRadWindow().get_windowManager();
       // oManager.open(null, "GraphicsListWindow");
        GetRadWindow().Close();
        GetRadWindow().BrowserWindow.refreshGrid("EnableList");
    }

   


    
        function AlreadyOnList() {
        alert('The graphic you selected was already on the show list.  Please select a different graphic.');
    }

      //This code is used to provide a reference to the RadWindow "wrapper"
     function GetRadWindow() {
         var oWindow = null;
         if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
         else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
         return oWindow;
     }    
      


     function OnClientclose(radWindow) {
         window.location.href = window.location.href;
     }   
     
     function RefreshParentPage() {
         //GetRadWindow().BrowserWindow.location.reload();

         //Get a reference to the parent page (Default.aspx)

         var oWnd = GetRadWindow();

         //get a reference to the second RadWindow
         var dialog1 = oWnd.get_windowManager().getWindowByName("GraphicsListWindow");
         // alert(dialog1);
         // Get a reference to the first RadWindow's content  
         var contentWin = dialog1.get_contentFrame().contentWindow
         //alert(contentWin);
         //Call the predefined function in Dialog1
         contentWin.rrr();

         //  alert(contentWin.document.refresh);
     }

    function resizeWindow() {
        window.setTimeout(function() {
            var oWnd = GetRadWindow();
            
            oWnd.SetWidth(450);
            oWnd.SetHeight(535);
           }, 400);
    }  


