/*
** $Revision: 1 $
*/

// `detect' browser
var b = new Object;
b.w3c = !!(document.getElementById);
b.ns4 = !!(document.layers);
b.ie4 = !!(document.all && !b.w3c);
b.ie5 = !!(document.all && b.w3c);
b.ns6 = !!(b.w3c && navigator.userAgent.indexOf("Gecko/") >= 0);
b.safari = !!(b.w3c && navigator.userAgent.indexOf("Safari") >= 0);
b.mac = !!(navigator.platform.indexOf('Mac') == 0);
b.iemac = b.mac && (b.ie4 || b.ie5);

// create a click method for Gecko
if (b.ns6)
{
	try {
		// create a element so that HTMLAnchorElement is accessible
		document.createElement('a');
		HTMLElement.prototype.click = function () {
			if (typeof(this.onclick) == 'function') {
				var res = this.onclick({type: 'click'});
				if ((res == null || res) && this.href) 
				{
					window.open(this.href, this.target ? this.target : '_self');
				}
			}
			else if (this.href)
				window.open(this.href, this.target ? this.target : '_self');
		};
	}
	catch (e) {
		alert('click method for HTMLAnchorElement couldn\'t be added')
	}
}


var oldimgsrc = null;
function hl(obj, img)
{
	oldimgsrc = obj.src;
	obj.src = img;
}

function unhl(obj)
{
	obj.src = 'images/nixel.gif';
}

function unhighlight(obj)
{
	if (oldimgsrc != null)
		obj.src = oldimgsrc;
	oldimgsrc = null;
}

function over(name)
{
  if (document.images)
  {
		obj = document.images[name];
		if (obj)
		{
	    obj.oldsrc = obj.src;
			if (name.substr(name.length-2,2) == "hs") name = name.substr(0,name.length-2);
	    obj.src = "pics/" + name + "hl.png";
		}
  }
}
function out(name)
{
  if (document.images)
  {
		obj = document.images[name];
		if (obj && obj.oldsrc)
		{
			obj.src = obj.oldsrc;
		}
  }
}

function rrpop(url)
{
	var nw = window.open(url, '_blank', 'width=500,height=450');
}
function lhpop(url)
{
	var nw = window.open(url, '_blank', 'width=500,height=400');
}
function emmiapop(url)
{
	var nw = window.open(url, '_blank', 'width=500,height=300');
}
function MM_openBrWindow(url)
{
	var nw = window.open(url, '_blank', 'width=550,height=550');
}

var input_enabled = false;

var boxheight = 0;
var boxwidth = 0;
var speed = 20;
var pixelstep = 8;
var godown = true;
var timerID = null;
var curTop = null;
var curCat = null;
var prev_chosen_cat = null;

var outer,inner,elementheight,ref;
function element(ID)
{
	return b.ie4? (document.all[ID]): (document.getElementById(ID));
}

function elements(tagName)
{
	return b.ie4? (document.all) : (document.getElementsByTagName(tagName));
}

function elementsByName(name)
{
	if (b.ie4)
		return (document.all);
		
	alert("retreiving elements with name " + name);
	return document.getElementsByName(name);
}

function frame_element(iframeName, ID)
{
	fe = window.frames[iframeName].document.getElementById(ID); // works in Opera
	if (fe)
		return fe;
	else
		return b.ie4? (window.frames[iframeName].document.all[ID]): (document.getElementById(iframeName).contentWindow.document.getElementById(ID)); // doesn't work in Opera
}

function showframetab(tabid)
{
	var id=1;
	var el = frame_element("pl_frame", id);
	while(el)
	{
		if (id == tabid)
			el.style.display = 'inline';
		else
			el.style.display = 'none';
		
		id++;
		el = frame_element("pl_frame", id);
	}
}

function showtab(tabid)
{
	for(id=1;id<=20;id++)
	{
		var el = element(id);
		var el_left = element("ali" + id);
		if (el)
		{
			if (id == tabid)
				el.style.display = 'inline';
			else
				el.style.display = 'none';
		}
		if (el_left)
		{
			if (id == tabid)
				el_left.className = 'articlelistitem_act';
			else
				el_left.className = 'articlelistitem_inner';
		}
	}
}


// vim: set ts=2 sw=2 ai :
