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 setDefault(place,phone,mail,fax,url){
	document.forms[0].place.value 	= place;
	document.forms[0].phone.value 	= phone;
	document.forms[0].mail.value 	= mail;
	document.forms[0].fax.value 	= fax;
	document.forms[0].url.value 	= url;
}

function setDefaultAd(adTypeId,headline,body,price,name,streetAdress,postAdress,phone,email){
	for (var i=0; i<document.forms[0].adTypeId.length; i++) {
		if (document.forms[0].adTypeId.options[i].value == adTypeId) {
			document.forms[0].adTypeId.selectedIndex = i;
		}
	}
	document.forms[0].headline.value 		= headline;
	document.forms[0].body.value 			= body;
	document.forms[0].price.value 			= price;
	document.forms[0].name.value 			= name;
	document.forms[0].streetAdress.value 	= streetAdress;
	document.forms[0].postAdress.value 		= postAdress;
	document.forms[0].phone.value 			= phone;
	document.forms[0].email.value 			= email;
}