function goTo(url){
	document.location = url;
}

function openWindow(x,y,namn,url){
	if (y > screen.height) {
		y = screen.height - 100;
	}

	window.open(url,namn,"scrollbars=yes,resizable=yes,width="+x+",height="+y+",left=50,top=50");
}

function setMailListAction(action){
	document.forms[1].action.value=action;
	document.forms[1].submit();
}

function checkGroupUsers(){
	var groupId = document.forms[0].markGroup[document.forms[0].markGroup.selectedIndex].value;
	var url = "checkGroupUsers.php?groupId=" + groupId;
	openWindow('100','100','checkusers',url);
}

function setPart(value){
	document.forms["links"].part.value = value;
	document.forms["links"].submit();
}

function vote(ao){
	var found = false;
	for ( i = 0; i < ao.elements.length; i++ ){
		lsName = ao.elements[i].name;
		if (ao.elements[i].checked == true){
			found = true;
		}
	}
	if (found == false) {
	 	alert("Du valde inget svarsalternativ.");
		return false;
	}
	
	window.open('','vote','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=no,width=450,height=400');
	return true;
}

function voteResult(URL){
	window.open('','vote','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=auto,resizable=yes,copyhistory=no,width=450,height=400');
	window.open(URL,'vote')
}

function verifyAction(url){
	var x=window.confirm("\xC4r du s\xE4ker?")
 	if (x)
 		document.location = url;
 	else
 		return false;
}

function getElementsByClassName(classname, node)  {
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
	var els = node.getElementsByTagName("*");
	for(var i=0,j=els.length; i<j; i++)
		if(re.test(els[i].className))a.push(els[i]);
	return a;
}