	var panel = '';

	function doPopup(URL, title, width, height, toolbar, scrollbar, resize ) {
	
		panel = window.open( "#", title, '' );
		
		//if (!panel.closed && panel.location) {
			panel.close();
		//} 
	
		//displayProps( screen );
		var left, top;
		left = parseInt( (( screen.width - width ) / 2 ) - 6 );
		top = parseInt( (( screen.height - height ) / 2) - 30 );
		
		toolStr = toolbar ? 'yes' : 'no';
		scrollStr = scrollbar ? 'yes' : 'no';
		resizeStr = resize ? 'yes' : 'no';
		widthStr = parseInt( width );
		heightStr = parseInt( height );
		
		
		panel = window.open( URL, title, 'toolbar=' + toolStr + ',scrollbars=' + scrollStr + ',resizable=' + resizeStr + ',width=' + widthStr + ',height=' + heightStr + '' );
		
		if( panel ) {
			//displayProps( panel );
			if (!panel.opener) {
				panel.opener = self;
			}
			panel.moveTo( left, top );
			panel.focus();
		} else {
			alert( "This site requires you to allow popup windows.\nPlease ensure popups are enabled, and then reload this page" );
		}
	}
	
	function openInParent( URL ) {
		//alert( 1 );
		if(window.opener) {
			if( window.opener.closed ) {
				aaa = window.open( URL, "_blank", '' );
				aaa.focus();
			} else {
				if (typeof( window.opener.location.hostname ) == "unknown") {
					bbb = window.open( URL , "_blank", '' );
					bbb.focus();
				} else {
					window.opener.document.location = URL;			
					window.opener.focus();			
				}
			}
		} else {
			aaa = window.open( URL , "_blank", '' );
			aaa.focus();
		}
		window.close();
	}