﻿//Set default button based on a given textbox
function clickButton(e, buttonid){ 
      var bt = document.getElementById(buttonid); 
      if (typeof bt == 'object'){ 
            if(navigator.appName.indexOf("Netscape")>(-1)){ 
                  if (e.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
            if (navigator.appName.indexOf("Microsoft Internet Explorer")>(-1)){ 
                  if (event.keyCode == 13){ 
                        bt.click(); 
                        return false; 
                  } 
            } 
      } 
}


//Returns a Rad Window Object
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;   
		}
		
		
		
//Refreshing the Parent Window while closing the Rad Pop up Window		   
function CloseAndReload()   
        {   
          var oWnd = GetRadWindow();           
          oWnd.BrowserWindow.location.reload(); 
          oWnd.unload();  
          oWnd.Close();   
        }

function Cancel()
        {
          var oWnd = GetRadWindow();     
          oWnd.Close();   
        }
        

function CustomRadOpen(urlString,Height,Width)
        {
         var rdWindow = window.radopen(urlString,"WindowNew"); 
         rdWindow.SetSize (Height,Width);  
         return false;                
        }  
