var w1 = null, is_nav = 0, is_nav3 = 0, is_nav4 = 0, is_nav4up = 0, is_ie  = 0;
var is_ie3 = 0, is_ie4 = 0, is_ie4up = 0, is_ie5 = 0, is_ie5up = 0;

function DetermineBrowserTypeVersion()
{
   var agt=navigator.userAgent.toLowerCase();

   // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
   var is_major = parseInt(navigator.appVersion);
   var is_minor = parseFloat(navigator.appVersion);

   // Navigator Checks
   is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('compatible') == -1))
;
   if( is_nav )
   {
     is_nav3 = (is_nav && (is_major == 3));
     is_nav4 = (is_nav && (is_major == 4));
     is_nav4up = (is_nav && (is_major >= 4));
   }

   // IE Checks
   is_ie   = (agt.indexOf("msie") != -1);
   if( is_ie )
   {
     is_ie3  = (is_ie && (is_major < 4));
     is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) );
     is_ie4up  = (is_ie  && (is_major >= 4));
     is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
     is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);
   }
}

function CreateSatellite( theURL, name, width, height, center, options )
{
        DetermineBrowserTypeVersion()

        // Different Browsers have different ways to get the
        // position and size of the browser window.
        if( is_nav4up && center )
        {
                var x = window.screenX;
                var y = window.screenY;
                var w = window.outerWidth;
                var h = window.outerHeight;
                var midx = x + (w - width)/2;
                var midy = y + (h - height)/2;
                w1 = window.open( theURL, name, "left=" + midx + ",top=" + midy + ",height="+ height + ", scrollbars=1, width=" +  width + options );
        }else if( is_ie5up && center )
        {
                var x = window.screenLeft;
        var y = window.screenTop;
                var w = document.body.clientWidth;
                var h = document.body.clientHeight;
                var midx = x + (w - width)/2;
                var midy = y + (h - height)/2;

                // Next bit forces IE5 to give focus and display the window in the correct position
                if( w1 != null && !w1.closed ){w1.close(); w1 = null;}

                w1 = window.open(theURL, name, "left=" + midx + ",top=" + midy + ",height="+ height + ", scrollbars=1, width=" +  width + options );
        }else{
            // Older browsers can't determine browser window pos/size and IE4 has probs
            // closing and re-opening a window
                w1 = window.open(theURL, name, "height="+ height + ", scrollbars=1, width=" +  width + options );
        }
        w1.focus();
}
