//function to center a popup window
function centerpopup(theURL, winname, popupwidth, popupheight, options) {
	var agt=navigator.userAgent.toLowerCase();
  	var is_ie=(agt.indexOf("msie") != -1);
 	//if window already opened close it, then open new one 
  	if ((window.winHandle) && (!window.winHandle.closed) && (is_ie))   {
  		window.winHandle.close();
  	}

	//open new window
    var popup_width=popupwidth
    var popup_height=popupheight
    var screen_width=window.screen.width
    var screen_height=window.screen.height
    var popup_left=Math.round((screen_width-popup_width)/2)
    var popup_top=Math.round((screen_height-popup_height)/2)     
    var winHandle=window.open(theURL,winname,"height="+popup_height+",width="+popup_width+",left="+popup_left+",top="+popup_top+","+options);
	
	//do this to make sure its not open in background
	winHandle.focus()
	
}//end function centerpopup