function validateForm( form )
{					
	var i = 0;
	var j = 0;
	var match = false;
	var anyChecked = false;						
	
	while ( j < form.criteria.length && (!match)) {
		if ( form.criteria[j].checked && form.criteria[j].value == "selection" )
			match = true;
		j++;
	}
						
	if ( match ) {		
		while ((i < form.categories.length) && (!anyChecked)) {				
			if ( form.categories[i] !=null && form.categories[i].checked ) {			
				anyChecked = true;				
			}			
			i++; 			
		}
						
		if ( anyChecked ) {			
			return true;
		}
				
		alert ( "Du må krysse av for én eller flere typer" );
		return false;			
	}		
}

function undoCheck( form )
{
	var i;
	
	for ( i = 0; i < form.categories.length; i++ ) {
		form.categories[i].checked = false;
	}
}

function selectButton( form )
{
	var i = 0;
	
	while ( i < form.criteria.length && form.criteria[i].value != "selection" ) {
		i++;
	}
	form.criteria[i].checked = true;
}

function setElementValue( theElement, newValue )
{
	theElement.value = newValue;	
}

function submitAndRefresh( form, theURL, longDate )
{						
	form.submit();
	
	if ( longDate != "" )		
		theURL += "?date=" + longDate;		
						
	redirect( theURL );		
}

function redirect( theURL )
{	
	self.location = theURL;		
}

function formSubmit( form )
{		
	form.submit();		
}

function changeSite(url){
	if(url!=""){
		var win;
		win=window.open(url);
	}
}
