<!--

// these global variables store the X and Y position of the pop-up box //
var oldX, oldY;

// variable to hold the status of window dragging //
var dragIt = false;

// a wee bit of short-hand for browser checking routines //
var ie=document.all&&document.getElementById;
var ns=document.getElementById&&!document.all;

function openPopUp(url,w,h,caption)
{
	if (!ie&&!ns)

		// if viewed with an older browser, open a standard pop-up window //
		window.open(url,caption,"width="+w+",height="+h);
	else {

		// sets up the pop-up box element ready to display some content //
		document.getElementById("popWin").style.display='';

		// sets the width of the pop-up box //
		document.getElementById("popWin").style.width=w+"px";

		// sets the height of the pop-up box //
		document.getElementById("popWin").style.height=h+"px";

		// check to see if the window has been opened before //
		if(oldX == null)
		{

			// if not, position it in the middle of the browser window //

			// first, get the horizontal centre of browser window //
        	cw = (getBrowserWidth() / 2) - w/1.5;

			// now, position the pop-up box centrally and 25 pixels from the top of the main window //
			document.getElementById("popWin").style.left = cw+"px";
			document.getElementById("popWin").style.top = 160+"px";
		}

		// pop the right page caption in the mover bar //

		temp = document.getElementById("winTitle");  
		temp.firstChild.nodeValue = caption;


		// finally, load the page specified into the iframe //
		document.getElementById("contentiFrame").src=url;

	}

}

function closePopUp()

{

	// retain the last position of the window ready to open it again in the same place

	oldX = document.getElementById("popWin").style.left;
	oldY = document.getElementById("popWin").style.top;

	// setting the display style to none renders the element invisible	
	document.getElementById("popWin").style.display="none";

}

function startDrag(e)

{

	offsetx=ie? event.clientX : e.clientX;
	offsety=ie? event.clientY : e.clientY;
	tempx=parseInt(document.getElementById("popWin").style.left);
	tempy=parseInt(document.getElementById("popWin").style.top);
	dragIt = true;
	document.getElementById("popWin").onmousemove=DragNDrop;
}

function DragNDrop(e){

	// move the pop-up window script for Internet Explorer //
	if (ie&&dragIt&&event.button==1){

		document.getElementById("popWin").style.left=tempx+event.clientX-offsetx+"px";
		document.getElementById("popWin").style.top=tempy+event.clientY-offsety+"px";
	}

	// move the pop-up window script for Netscape //
	else if (ns&&dragIt){

		document.getElementById("popWin").style.left=tempx+e.clientX-offsetx+"px";
		document.getElementById("popWin").style.top=tempy+e.clientY-offsety+"px";
	}

}

function stopDrag(){

	dragIt=false;
	document.getElementById("popWin").onmousemove=null;

}

function getBrowserWidth()

{
	if (navigator.userAgent.indexOf("MSIE") > 0)
		return(document.body.clientWidth);
    else
		return window.outerWidth;
}

//-->
