//<script>
/*
 * This script was created by Even Zhuang (ywzhuang@longtop.com)
 * for cross browser.
 * 
 * Referrence to: http://www.cross-browser.com/
 *
 *
 *
 */
 
 /*************************
  * Define a class for browser information
  */
  function BrowserInfomation()
  {
	  this.isIE5Up = false;
	  this.isFirefox = false;
	  
	  if (document.getElementById)
	  {
		  if (!document.all) this.isFirefox = true;
		  else this.isIE5Up = true;
	  }
  }
  
  /*************************
  * Define a class for browser information
  */
  function IsIE5Up()
  {
	 if (document.getElementById)
	 {
		 if (!document.all) return false;
		 else return true;
	 }
	 
	 return false;
  }
  
 /*****************************
  */
 function xWindowOpen(sUrl, sWinName, iHeight, iWidth, oWinArgument)
 {
	 if (sUrl == null) return;
	 if (sWinName == null) sWinName = "NewWin";
	 if (iHeight == null) iHeight = 200;
	 if (iWidth == null) iWidth = 300;
	 
	 iHeight = iHeight - 60;	// for firefox, the width are different.
	 
	 try
	 {
	    var left = parseInt((screen.Width - iWidth)/2);
	    var right = parseInt((screen.Height - iHeight)/2);
        var sFeatures = "height=" + iHeight + "px,width=" + iWidth + "px,left=" + left + ",top=" + right + ",toolbar=1, menubar=1, scrollbars=1, resizable=1,location=1, status=1";
		var newWin = window.open(sUrl, oWinArgument, sFeatures);
		newWin.focus();
	 }catch(ex){
	 }
 }
 
 function xWindowOpenCenter(sUrl, sWinName, iMargin)
 {
    var iWidth = screen.Width - 2*iMargin;
	var iHeight = screen.Height - 2*iMargin;
	
	var sFeatures = "height=" + iHeight + "px,width=" + iWidth + "px,left=" + iMargin + ",top=" + iMargin+ ",location=1,status=1,scrollbars=1,toolbar=1,resizable=1";
	var newWin = window.open(sUrl, sWinName, sFeatures);
    newWin.focus();
 }
 
 function xWindowOpenEmpty(sUrl, sWinName, iMargin)
 {
    var iWidth = screen.Width - 2*iMargin;
	var iHeight = screen.Height - 2*iMargin;
	
	var sFeatures = "height=" + iHeight + "px,width=" + iWidth + "px,left=" + iMargin + ",top=" + iMargin+ ",location=1,status=1,scrollbars=1,toolbar=1,resizable=1";
	var newWin = window.open(sUrl, sWinName, sFeatures);
    newWin.focus();
 }
 
  /*****************************
  * close the current window
  */
 function xWindowClose()
 {
	 var bi = new BrowserInfomation();
	 if (bi.isIE5Up) window.close();
	 else top.close();
 }