var browser = navigator.appName.toLowerCase();
var agent= navigator.userAgent.toLowerCase();
var version= parseInt(navigator.appVersion);
var is_ie= ((agent.indexOf("msie") != -1) && (agent.indexOf("opera") == -1));
var is_ie3= (is_ie && (version < 4));
var is_ie4= (is_ie && (version == 4) && (agent.indexOf("msie 4")!=-1) );
var is_aol= (agent.indexOf("aol") != -1);
var is_aol3= (is_aol && is_ie3);
var is_aol4= (is_aol && is_ie4);
var is_aol5= (agent.indexOf("aol 5") != -1);
var is_aol6= (agent.indexOf("aol 6") != -1);
var is_comp= (agent.indexOf("compuserve") != -1);
var is_comp2000= (agent.indexOf("cs") != -1);	 
var is_compie= (is_comp && is_ie);


   function moveWindow(placement, offsetX, offsetY) {
   //moves browser window (works in IE and Netscape)
   //arguments:
   //   placement - 'c'  - center
   //               'ul' - upper left
   //               'ur' - upper right
   //               'll' - lower left
   //               'lr' - lower right
   //   offsetX, offsetY - negative, zero or positive number in pixels
   //
      var clientWidth = 0;
      var clientHeight = 0; 
      var moveToX = 0;     
      var moveToY = 0;
      var ie = false;

      //get window size - IE
      if (document.all){   
         ie = true;
         clientWidth = document.body.offsetWidth-4;
         clientHeight = document.body.offsetHeight-4;
      }   
      //get window size - Netscape
      else if (browser == 'netscape') {
         clientWidth = this.window.innerWidth;
         clientHeight = this.window.innerHeight;
      }
   
      //get display size
      var winWidth = window.screen.width;
      var winHeight = window.screen.height;

      //center
      if (placement == 'c') {
         moveToX = (winWidth-clientWidth)/2;      
         moveToY = (winHeight-clientHeight)/2;
      }
      //upper left
      else if (placement == 'ul') {
         moveToX = 0;      
         moveToY = 0;
      }
      //upper right
      else if (placement == 'ur') {
         if (ie) {
            moveToX = winWidth-clientWidth-6;
         }
         else { 
            moveToX = winWidth-clientWidth;
         }   
         moveToY = 0;      
      }
      //lower left
      else if (placement == 'll') {
         moveToX = 0;      
         if (ie) {
            moveToY = winHeight-clientHeight-34;
         }
         else {     
            moveToY = winHeight-clientHeight;
         }       
      }
      //lower right
      else if (placement == 'lr') {
         if (ie) {
            moveToX = winWidth-clientWidth-6;
            moveToY = winHeight-clientHeight-34;
         }
         else {     
            moveToX = winWidth-clientWidth;
            moveToY = winHeight-clientHeight;
         }       
      }   
      //default placement: upper left
      else {
         moveToX = 0;
         moveToY = 0;
      }   
   
      //include offset
      moveToX = moveToX + offsetX; 
      moveToY = moveToY + offsetY;

      //consider when window dimensions exceed screen dimensions
      if (moveToX+clientWidth > winWidth) {
         moveToX = winWidth - clientWidth;
      }
      if (moveToY+clientHeight > winHeight) {
         moveToY = winHeight - clientHeight;
      }
      //make sure upper-left corner of window is always visible
      if (moveToX < 0) {
         moveToX = 0;
      }   
      if (moveToY < 0) {
         moveToY = 0;
      }

      window.moveTo(moveToX, moveToY);

   } //moveWindow()



   function popup(url, title, options, parentUrl) {
      var host = location.hostname;
      var popupWin = window.open(url, title, options);
      if (parentUrl) {
         popupWin.opener.location = parentUrl;
      }
      if (!( is_aol6 || is_aol3 || is_aol4 || is_aol5 || is_compie || is_comp2000)) {
         popupWin.opener.top.name = "opener";
         popupWin.focus();
      }
   } //popup()



   function closeWindow(refreshParent) {
   //close window, refresh parent if needed
      if (refreshParent) window.opener.location.reload();
      window.close();
   }


