/*
Open in New Window
FairSky Pages Component
-----------------------
Copyright 2004 Joshua Paine
Created by Joshua Paine of FairSky Networks <http://fairsky.us/>
Contact at <http://fairsky.us/contact>
Updated 2004-05-18

The latest version should be available at
<http://demo.fairsky.us/javascript/new_win.html>

You may copy, reuse, or produce derivative works of this code
only under the terms of the Linky License v0.1 or later.
The Linky License can be found at <http://fairsky.us/linky>.
The main points of the license are:
	1) Do not alter or remove this notice.
	2) Notify me of your usage through one of the means listed
	   at <http://fairsky.us/contact>.
*/

gNewWinList = new Array();

function clickNewWin(e)
{
	try{
		var a, c, i, w, h, str, win, list;
		list = gNewWinList;
		a = this;
		c = a.className;
		w = /Pop\.width:([0-9]+)\b/.exec(c);
		h = /Pop\.height:([0-9]+)\b/.exec(c);
		n = /Pop\.name:(\S+)\b/.exec(c);
		if(!n || !n[1]) n=new Array('','newWinName');
		str = "resizable,scrollbars";
		if(w && w[1]) str += ",width="+w[1];
		if(h && h[1]) str += ",height="+h[1];
		if(list[n[1]]) list[n[1]].close();
		win = window.open(a.href,n[1],str);
		if(win)
		{
			win.focus();
			list[n[1]] = win;
			return false;
		}
		else return true;
	}
	catch(err){ }
}

document.register('a','Pop',clickNewWin,'click',true);

