﻿var OpenPopupWindow = function(url,width,height)
{
    //Calculating left and top to make the popup window show on center of screen
    var scr_width = screen.width;
    var left=parseInt(scr_width/2)-parseInt(width/2);
    var scr_height = screen.height;
    var top = parseInt(scr_height/2)-parseInt(height/2);
    var parameters = "location=0,status=0,scrollbars=0,toolbar=0,directories=0,alwayRaised=1,menubar=0,width="+width+"px,height="+height+"px,resizable=1,left="+left+",top="+top;
    
    mywindow = window.open (url,"mywindow",parameters);        
}
// added date      : 2009/2/10
//added for open radwindow
function openradwindow(windowname,TitleBarBackgroundColor,navigateurl,width,height,titleimage,titlename)
{
    try
    {
    
    var oWindow =window.radopen(navigateurl, windowname);
//	var oContentFrame = oWindow.get_ContentFrame();     
	
    oWindow.SetTitle(titlename);
    var divWin = document.getElementById("RadWindowWrapper_ctl00_radwindow");
    divWin.style.backgroundColor = TitleBarBackgroundColor;
    //divWin.style.zIndex=3049;
    //divWin.style.position=relative;
     divWin.style.titlename=titlename;
    var i;
    
    for(i=0;i<10;i++)
    {
        if(document.styleSheets[i]!=null)
        {
            
            var strStyleSheetName = document.styleSheets[i].href;
            if(strStyleSheetName != null)
            {
            //added for radwindow icon image and background color of icon image
            if( strStyleSheetName.indexOf( "RadControls/Window.RadControls.css" ) != -1 )
            {
                try
                {
                    //document.styleSheets[i].rules[0].style.backgroundImage = "url("+titleimage+")";
                    
                    document.styleSheets[i].rules[0].style.backgroundColor =TitleBarBackgroundColor;
                }
                catch(err)
                {
               
                    //document.styleSheets[i].cssRules[0].style.backgroundImage = "url("+titleimage+")";
                   
                    document.styleSheets[i].cssRules[0].style.backgroundColor = TitleBarBackgroundColor;
                   
                }
            }
            }
        }
    }
    oWindow.SetWidth(width);
    oWindow.SetHeight(height);
    //oWindow.alwaysLowered=yes;
    
    oWindow.show();
  }
  catch(err)
  {
  }   
       oWindow.OnClientClose = function()   
    {   
        oWindow.SetUrl("about:blank");   
    }  
   
 }
 


