<%@ Page Language="C#" AutoEventWireup="true" Codebehind="WebForm1.aspx.cs" Inherits="ClientScripting.WebForm1" %>

<%@ Register Assembly="RadWindow.Net2" Namespace="Telerik.WebControls" TagPrefix="radW" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title>Untitled Page</title>
</head>
<body onload="Load()">

    <script type="text/javascript">
//      function SetName(first, last)
//      {
//        document.getElementById('tbFirst').value = first; 
//        document.getElementById('tbLast').value = last; 
//      }

      function GetRadWindow()
      {
        var oWindow = null;
        if (window.radWindow) 
          oWindow = window.radWindow;
        else if (window.frameElement.radWindow) 
          oWindow = window.frameElement.radWindow;
        return oWindow;
      } 

      function Done()
      {
        var currentWindow = GetRadWindow();
        var userObj = new Object(); 
        userObj.First = document.getElementById('tbFirst').value;
        userObj.Last = document.getElementById('tbLast').value;
        currentWindow.CallBack(userObj);
        currentWindow.Close();
      }
      
      function min(window)
      {
        alert("onminimize: " + window.Name);
      }

      function max(window)
      {
        alert("onmaximize: " + window.Name);
      }

      function restore(window)
      {
        alert("onrestore: " + window.Name);
      }
       
      function Load()
      {
        var rwEntry = GetRadWindow();
        userObj = rwEntry.argument; 
        document.getElementById('tbFirst').value = userObj.First; 
        document.getElementById('tbLast').value = userObj.Last;  
        
        rwEntry.AttachClientEvent("onminimize", min); 
        rwEntry.AttachClientEvent("onmaximize", max); 
        rwEntry.AttachClientEvent("onrestore", restore); 
      }

  </script>
  
  <form id="form1" runat="server" >		
      First Name:
      <asp:TextBox ID="tbFirst" runat="server"></asp:TextBox>
      <br />
      Last Name:
      <asp:TextBox ID="tbLast" runat="server"></asp:TextBox>
	  <button id=btnOK onclick="Done()">Ok</button>
  </form>
  
</body>
</html>
