//ignore this comment - dd
function openWindow(surl,windowName,params,width,height) {

// We have to double-encode some URL strings to account for an IE bug where
// IE un-encodes the URL before passing it to this function. This line
// causes the function to un-encode the URL if the URL was double-encoded
// but was (correctly) passed without decoding by a sane browser.

  if (surl.indexOf('%2520') != -1) {
    surl = unescape(surl);
  }

// If a separate "width" argument is passed, the window will be centered.
// horizontally and vertically.
// If a "width" argument is passd, but no "height" argument is passed, 
// the height will be set to 400px.
// If no separate "width" argument is passed, no centering will happen.
// This allows for backwards compatibility with existing pages where the 
// width and height are set in the "param" argument.

   if (width != null) {
        leftPosition = (screen.width-width)/2;
        if (height == null) {
           height = 400
        }
	topPosition = (screen.height-height)/3;
        sizeAndPosition = ', width='+width+',height='+height+',top='+topPosition+',left='+leftPosition;
	params = params + sizeAndPosition
    }
  windowHandle = window.open(surl,windowName,params);
    
  if(window.focus) {
    windowHandle.focus();
  }
}

// add a name and value dynamically to the hard-coded URL before calling openWindow().

function modURLOpenWindow(the_name, the_value,surl,windowName,params) {
    if ( (the_value!=null) && (the_name!=null)) {
        if (surl.indexOf('#')>=0) {
            xa = surl.split("#");
            if (xa[0].indexOf('?')>=0) {
                surl = xa[0] + '&' + the_name + '=' + the_value + '#' + xa[1];
            } else {
                surl = xa[0] + '?' + the_name + '=' + the_value + '#' + xa[1];
            }
        } else {
            if (surl.indexOf('?')>=0) {
                surl = surl + '&' + the_name + '=' + the_value ;
            } else {
                surl = surl + '?' + the_name + '=' + the_value ;
            }
        }
    }

    openWindow(surl,windowName,params);

}