function CJL_BrowserSniffer()
{
   var ua = navigator.userAgent;

   this.isOpera = function() {
      return /Opera/.test(ua);
   }

   this.isSafari = function() {
      return /Safari/.test(ua);
   }

   this.isGecko = function() {
      return navigator.product == "Gecko" &&
	     ! ( this.isOpera() || this.isSafari() );
   }

   this.isIEWin = function() {
      return window.external && /Win/.test(ua);
   }

   this.isIEMac = function() {
      return window.external && /Mac/.test(ua);
   }

   this.getVersion = function() {
      if( this.isIEWin() || this.isIEMac() ) {
         return Number(ua.match(/MSIE ([0-9.]+)/)[1]);
      } else if( this.isSafari() ) {
         return Number(ua.match(/[0-9.]+$/));
      } else if( this.isGecko() ) {
         var n = ua.match(/rv:([0-9.]+)/)[1];
         var ar = n.split(".");
         var s = ar[0] + ".";
         for(var i = 1; i < ar.length; ++i) {
            s += ("0" + ar[i]).match(/.{2}$/)[0];
         }
         return Number(s);
      } else if( this.isOpera() ) {
         return Number(ua.match(/Opera ([0-9.]+)/)[1]);
      } else {
         return null;
      }
   }
}

function MM_openBrWindow(theURL,winName,width,height) { //v2.0

   sniffer = new CJL_BrowserSniffer();

   var width = width
   var height = height
    
   if( sniffer.isIEWin() ) {
      var top = screen.availHeight-height-40
	  var left = screen.availWidth/2-width/2
   } else if( sniffer.isIEMac() ) {
      var top = screen.availHeight-height-40
	  var left = screen.availWidth/2-width/2
   } else if( sniffer.isSafari() ) {
      var top = screen.availHeight-height-40
	  var left = screen.availWidth/2-width/2
   } else if( sniffer.isGecko() ) {
      var top = screen.availHeight-height-40
	  var left = screen.availWidth/2-width/2
	} else if( sniffer.isOpera() ) {
	  var top = screen.availHeight-height-170
	  var left = screen.availWidth/2-width/2
	  var width = width-5
	  var height = height-10
   } else {
      var top = screen.availHeight-height-40
	  var left = screen.availWidth/2-width/2
   }
	
	var features="width=" + width + ",height=" + height +",left=" + left +",top=" + top

  	window.open(theURL,winName,features);

}

