/* javascript for popup window */
function popupWindow(url, title, popup_width,popup_height, poptop, popleft) 
{
  var screen_width=window.screen.width
  var screen_height=window.screen.height
  var leftCoord=Math.round((screen_width-popup_width)/2);
  var topCoord=Math.round((screen_height-popup_height)/2);     

  popupWin = window.open(url, 'NewWindow', 'location=no,width='+popup_width+',height='+popup_height+',scrollbars=yes,toolbar=no,status=no,top=' + poptop + ",left=" + popleft + ',screenx=' + (leftCoord + 300) + ',screeny=' + (topCoord + 100) + + ',resizable=yes');
  popupWin.focus();
}//end function windowOpener


//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