/**
 * Copyright 2002.01.04 - WKS Working Solutions GmbH - Claudio Eichenberger
 */
function goTo(select)
{
	var i = select[select.selectedIndex].value;
	//
	if(0 == i)
	{
		return false;
	}
	if(0 > i)
	{
		i *= -1;
		document.fm.action = i + ".jsp";
	}
	else
	{
		document.fm.action = "index.jsp";
	}
	document.fm.toid.value = i;
	document.fm.sarg.value = "";
	document.fm.submit();
	return true;
}
function setOptV(select, elem)
{
	for (var i=0; i<select.options.length; i++)
	{
		if(Math.abs(select.options[i].value) == elem)
		{
			select.selectedIndex = i;
			break;
		}
	}
}
function swap(a,b)
{
	var c	= a.text;
	a.text	= b.text;
	b.text	= c;
	c	= a.value;
	a.value = b.value;
	b.value = c;
}
function div(a)
{
	return (a - a % 2) / 2;
}
function doInit()
{
	with(document.fm)
	{
		setOptV(topic, eval(toid.value));
	}
}
function checkSearch()
{
	with(document.fm)
	{
		if(3 > sarg.value.length)
		{
			sarg.focus();
			return false;
		}
		toid.value = 0;
		return true;
	}
}
function checkEmail(o, mm, maxlen)
{
	var p	= o.value;
	var l	= p.length;
	var a	= p.lastIndexOf('@');
	var d	= p.lastIndexOf('.');
	var j	= 0;
	var m	= 0;
	//
	for(var i=0; i<l; i++)
	{
		var c = p.charAt(i);
		//
		if('@' == c)		 m++;
		if('#' == c)		 continue; //#
		if('&' == c)		 continue; //&
		if('+' == c)		 continue; //+
		if('-' == c)		 continue; //-
		if('.' == c)		 continue; //.
		if('0' <= c && c <= '9') continue; //0-9
		if(':' == c)		 continue; //:
		if('@' == c)		 continue; //@
		if('A' <= c && c <= 'Z') continue; //A-Z
		if('_' == c)		 continue; //_
		if('a' <= c && c <= 'z') continue; //a-z
		//
		j = 1;
	}
	if(0 != j || 1 < m || 7 > l || maxlen < l || 4 < (l - d) || 3 > (l - d) || 2 > (d - a) || -1 == a)
	{
		alert(mm);
		o.focus();
		return false;
	}
	return true;
}
