﻿var mm = Array();
function STM(s)
{
    mm[mm.length] = s;   
}

// SMAT (ShowMenuAt)
// m) Client ID of RadMenu
// mX and mY need to be set in client code
function SMAT(m)
{
    m.ShowAt(mX, mY);
}

// SM (ShowMenu)
// e) event
// m) Client ID of RadMenu
function SM(e,m)
{
    if ((!e.relatedTarget) || (!m.IsChildOf(m.DomElement, e.relatedTarget)))
    {
        m.Show(e);
    }
    e.cancelBubble = true;
    if (e.stopPropagation)
        e.stopPropagation();
}

// SMA (SetMenuAttribute)
// m) Client ID of RadMenu
// a) Attribute Name
// r) Attribute Value
function SMA(m,a,r)
{
   m.SetAttribute(a,r);
}

// SW (Show Window)
function SW(id,u)
{ 
     var mgr = GetRadWindowManager();     
     var oWin = mgr.GetWindowByName(id);                
     oWin.SetUrl(u);
     oWin.OnClientClose = null;     
     oWin.SetTitle('');    
     oWin.Show();       
}
// SW (Show Window)
function SW(id,u,occ)
{     
     var mgr = GetRadWindowManager();     
     var oWin = mgr.GetWindowByName(id);                
     oWin.SetUrl(u);
     oWin.OnClientClose = occ;
     oWin.SetTitle('');    
     oWin.Show();  
}
// SW (Show Window)
function SW(id,u,h,w)
{                    
     var mgr = GetRadWindowManager();     
     var oWin = mgr.GetWindowByName(id);                  
     oWin.SetUrl(u);
     oWin.SetHeight(h);
     oWin.SetWidth(w); 
     oWin.SetTitle('');    
     oWin.Show();          
}
// SW (Show Window)
function SW(id,u,occ,h,w)
{                  
     var mgr = GetRadWindowManager();     
     var oWin = mgr.GetWindowByName(id);                 
     oWin.SetUrl(u);          
     oWin.SetHeight(h);
     oWin.SetWidth(w);
     oWin.OnClientClose = occ;
     oWin.SetTitle('');
     oWin.Show();
}

// CCW (Client Close Window)
// Closes a window
function CCW()
{
     var w = window.frameElement.radWindow;
     w.Close();
}

// MAXCW (Maximize Current Window)
// Generally called OnClientShow. PageBase has this configuration for its general window.
function MAXCW()
{          
     //alert('MAXCW');
     if (window.radWindow) 
     { 
          //alert('window'); 
          window.radWindow.Maximize();
     }
     else if (window.frameElement && window.frameElement.radWindow) 
     { 
          //alert('frame'); 
          window.frameElement.radWindow.Maximize();
     }     
}

/* The following functions did not work as expected - the approaches could be useful for future needs. */
/* Resizes Rad Window to content 
function SWSZ(id)
{
     alert ('SWSZ2');
     var mgr = GetRadWindowManager();     
     var oWin = mgr.GetWindowByName(id);
     alert ('SWSZ ' + oWin);
     oWin.SetWidth(document.body.scrollWidth + 4);
     oWin.SetHeight(document.body.scrollHeight + 70);     
}*/
/* Gets the Active Rad Window 
function GAW()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}*/
/* Gets the Rad Window specified by the following id and reopens if necessary 
function GW(id)
{
     var mgr = GetRadWindowManager();     
     var win = mgr.GetWindowByName(id);
     alert ('GW ' + win);
     if (win == null) win = mgr.Open("", "");
     alert ('GWN ' + win);
     return win;
}*/
