var hWnd;

function new_target(wintarget, url ,pwidth,pheight)
{

	var h = self.screen.availHeight/2;
	var v = self.screen.availWidth/2;

	var	features = "toolbar=0,"
         + "location=0,"
	 + "directories=0,"
	 + "status=0,"
	 + "menubar=0,"
	 + "scrollbars=1,"
	 + "resizable=1,"
	 + "width=" + pwidth + ","
	 + "height=" + pheight;
	
	hWnd = window.open(url,wintarget,features);

	CenterWnd(pwidth,pheight);
	//hWnd.moveTo(v-(pwidth/2),h-(pheight/2));
}

function view_big(img,pwidth,pheight)
{

	var h = self.screen.availHeight/2;
	var v = self.screen.availWidth/2;

	var	features = "toolbar=0,"
         + "location=0,"
	 + "directories=0,"
	 + "status=0,"
	 + "menubar=0,"
	 + "scrollbars=0,"
	 + "resizable=0,"
	 + "width=" + pwidth + ","
	 + "height=" + pheight;
	
	hWnd = window.open('images/'+img,'view_big',features);

	hWnd.moveTo(v-(pwidth/2),h-(pheight/2));
}

function CenterWnd(pwidth,pheight) {
	//Centers Window
	var h = self.screen.availHeight/2;
	var v = self.screen.availWidth/2;
	try {hWnd.moveTo(v-(pwidth/2),h-(pheight/2));}
	catch (e){}
	return;
}

function setFocusWnd() {
	//Creates the effect of having a modal box.
	try {hWnd.focus();}
	catch (e){this.event.returnValue=false;}
	return;
}

function unloadWnd() {
	try {hWnd.close();}
	catch (e){this.event.returnValue=false;}
	return;
}

window.onunload = unloadWnd;
window.onfocus = unloadWnd;

