function checkLen(len,field,output,wrnfield)
{
	if ( field.value.length < len )
	{
		document.getElementById(output).innerHTML =  "<font color=\"#901a10\">(!)</font>";
		document.getElementById(wrnfield).style.display = 'block';
		document.getElementById(wrnfield).innerHTML = "(!) För kort!";
		document.getElementById('warnNUMB').value = "1";
	}
	else
	{
		document.getElementById(output).innerHTML =  "<font color=\"#00CC00\">(OK)</font>";
		document.getElementById(wrnfield).style.display = 'none';
		document.getElementById(wrnfield).innerHTML = "";
		document.getElementById('warnNUMB').value = "0";
	}
}
function doSearch()
{
	document.getElementById('searchfield').focus();
}
function getSelectedValue(group)
{
	for (i=0;i<document.ogform.gender.length;i++) 
	{ 
		if (document.ogform.gender[i].checked) 
		{ 
			var valuetoreturn = document.ogform.gender[i].value; 
		} 
	} 
	return valuetoreturn;
}
function swapUserContent(show)
{
	if ( document.getElementById(show).style.display == 'none' )
	{
		document.getElementById(show).style.display = 'block';
		document.getElementById(show+'_pic').src = 'gfx/admin_icon_uparrow.png';
	}
	else
	{
		document.getElementById(show).style.display = 'none';
		document.getElementById(show+'_pic').src = 'gfx/admin_icon_downarrow.png';
	}
}
function suggestionBoxState(state)
{
	if ( state == "show" )
	{
		document.getElementById('shitty').style.display = 'block';
	}
	else
	{
		document.getElementById('shitty').style.display = 'none';
	}
}
function initSubmit(set,val)
{
	document.getElementById(set).value = val;
	document.forms[0].submit();
	
	return true;
}
function checkWarn (field,output)
{
	if (document.getElementById(field).value > 0)
	{
		output.disabled = true;
	}
	else
	{
		output.disabled = false;
	}
}
function clock()
{
	var cT = new Date ();
	var cH = cT.getHours ();
	var cM = cT.getMinutes ();
	var cS = cT.getSeconds ();
	var cD = cT.getDay();

	var cDay = cT.getDate ();
	var cMonth = cT.getMonth ();
	var cYear = cT.getYear ();

	cH = ( cH < 10 ? "0" : "" ) + cH;
	cM = ( cM < 10 ? "0" : "" ) + cM;
	cS = ( cS < 10 ? "0" : "" ) + cS;
	
	cMonth += 1;

	var months = new Array();
	months[1] = 'Januari';
	months[2] = 'Februari';
	months[3] = 'Mars';
	months[4] = 'April';
	months[5] = 'Maj';
	months[6] = 'Juni';
	months[7] = 'Juli';
	months[8] = 'Augusti';
	months[9] = 'September';
	months[10] = 'Oktober';
	months[11] = 'November';
	months[12] = 'December';

	var days = new Array();
	days[0] = 'Söndag';
	days[1] = 'Måndag';
	days[2] = 'Tisdag';
	days[3] = 'Onsdag';
	days[4] = 'Torsdag';
	days[5] = 'Fredag';
	days[6] = 'Lördag';

	tDay = days[cD];
	tMonth = months[cMonth];

	document.getElementById('siteClock').innerHTML = tDay + ", " + cDay + " " + tMonth + " " + cYear + " " + cH + ":" + cM;
	y=setTimeout('clock()',500);
}
function getPage(url,data,text)
{
	myRand = parseInt(Math.random()*9999999);
	var req = XHConn();
	var url;
	var data = data + '&rand=' + myRand;
	var text;
	//document.getElementById(text).innerHTML = "(L)";
	req.connect(url, 'GET', data, showPage,text);
}
function showPage(resp,field)
{
		document.getElementById(field).innerHTML = resp.responseText;
}
function XHConn()
{
	var xmlhttp, bComplete = false;
	try { xmlhttp = new XMLHttpRequest(); }
	catch (e) { try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { xmlhttp = false; }}}
	if (!xmlhttp) return null;
	this.connect = function(sURL, sMethod, sVars, fnDone, field)
	{
		if (!xmlhttp) return false;
			bComplete = false;
			sMethod = sMethod.toUpperCase();
			try
			{
				if (sMethod == "GET")
				{
					xmlhttp.open(sMethod, sURL+"?"+sVars, true);
					sVars = "";
				}
				else
				{
					xmlhttp.open(sMethod, sURL, true);
					xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
					xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded;");
				}
				xmlhttp.onreadystatechange = function()
				{
					if (xmlhttp.readyState == 4 && !bComplete)
					{
						bComplete = true;
						fnDone(xmlhttp,field);
					}
				};
 				xmlhttp.send(sVars);
			}
			catch(z) { return false; }
		return true;
	};
return this;
}