if (self != top) top.location.href = self.location;

function autoForm()
{
	var ie = (document.all && !window.opera) ? 1 : 0;
	if (df = document.forms)
	{
		for (var i = 0; i < df.length; i++)
		{
			if (ie) df[i].setAttribute('autocomplete', 'off');
			for (var j = 0; j < df[i].elements.length; j++)
			{
				if ((df[i].elements[j].type == "submit") || (df[i].elements[j].type == "reset") || (df[i].elements[j].type == "image"))
				{
					df[i].elements[j].setAttribute("onfocus", "this.blur()");
					if (ie) df[i].elements[j].click = function(){ return null; }
				}
			}
		}
	}
}

function download(src)
{
	txt = new String(src);
	arr = txt.split("/");
	self.location.href = self.location+"&file="+arr.pop();
	return false;
}

function popupWin(src)
{
	h = window.opera ? window.innerHeight-10 : screen.availHeight;
	pwi = window.open(src, 'blank', 'width=800, height='+h+', left=0, top=0, resizable=yes, scrollbars=yes');
	pwi.focus();
	void(0);
	return false;
}

function autoLoad()
{
	if (anchors = document.getElementsByTagName("a"))
	{
		for (var i = 0; i<anchors.length; i++)
		{
			if (anchors[i].className == "blank")    anchors[i].target  = "_blank";
			if (anchors[i].className == "popup")    anchors[i].onclick = function() { return popupWin(this); };
			if (anchors[i].className == "download") anchors[i].onclick = function() { return download(this); };
		}
	}
	autoForm();
}

try
{
	window.addEventListener("load", autoLoad, true);
}
catch(e)
{
	window.attachEvent("onload", autoLoad);
}

