//javascript
//simple popup window code for dialogs

function getparm( name ) // function to grab value of known parameter from URL used by openpopwinscroll()
{
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  if( results == null )
    return "";
  else
    return results[1];
}

var pagetoshow = null; 
var popups = null;

function openpopwin(pagetoshow,popupwidth,popupsdowheight) {// pass in URL , width, height - NON scrolling popup

	// main popup window code below. 	
	popups = window.open('','popups','width='+popupwidth+',height='+popupsdowheight+',toolbar=0,location=0,scrollbars=0,resizable=0,screenX=200,screenY=150,top=150,left=200');
	
	popups.location.href = pagetoshow ;
	if (popups.opener == null) popups.opener = self;
		
	// give the popup focus after it has had a chance to open
	setTimeout ("popups.focus()",500);
}

function openpopwinscroll(pagetoshow,popupwidth,popupsdowheight) {// pass in URL , width, height for a scrolling popup

	// main popup window code below. 	
	popups = window.open('','popups','width='+popupwidth+',height='+popupsdowheight+',toolbar=0,location=0,scrollbars=1,resizable=1,screenX=200,screenY=150,top=150,left=200');
	
	var gotoanchor = getparm('conid'); // get the conid for the current page in order to use it as an anchor ID
	if (gotoanchor == '') gotoanchor = 'home'; // set conid to home if nothing passed in
	var gotoanchor = '#' + gotoanchor; // format variable as anchor
	
	popups.location.href = pagetoshow + gotoanchor ;
	if (popups.opener == null) popups.opener = self;
				
	// give the popup focus after it has had a chance to open
	setTimeout ("popups.focus()",500);
}
