// JavaScript Document

var exWin = "";

//	Basic script for opening popup windows of all kinds
function basicPopup(newUrl,pageTitle,params)	{
	if (!exWin.closed && exWin.location)	{
		exWin.location.href = newUrl;
	}	else	{
		exWin = window.open(newUrl,pageTitle,params);
		if (!exWin.opener)	exWin.opener = self;
	}
	if (window.focus)	exWin.focus();
}

//	Script that makes it all work
function executePopups()	{
	if (!document.getElementsByTagName)	return false;
	
	var winName, Params;
	var as = document.getElementsByTagName("a");
	
	for (var i = 0; i < as.length; i++)	{
		var anchor = as[i];

		anchor.onclick = function()	{
			winName = "popup";
			Params = "top=50,left=50,status=1,directories=0,resizable=1,scrollbars=1,status=1,";
			
			if (this.className.match("popup"))	{
				if (this.getAttribute("rel") && this.getAttribute("rel") != "external")	{
					Params += "toolbar=0,location=0,menubar=0," + this.getAttribute("rel");
				}	else	{
					Params += "toolbar=0,location=0,menubar=0,width=650,height=480";
				}
			}	else if (this.getAttribute("rel") == "external")	{
				this.target = "_blank";
				return true;
			}	else	{
				return true;
			}
			
			basicPopup(this.getAttribute("href"),winName,Params);
			return false;
		}
	}
}

function cheat()	{
	window.focus();
}

function addLoadEvent(func)	{
	var oldOnLoad = window.onload;
	if (typeof oldOnLoad != "function")	{
		window.onload = func;
	}	else	{
		window.onload = function()	{
			oldOnLoad();
			func();
		}
	}
}
