function del(url,msg) {
   if(confirm(msg)) {
     document.location = url
   }
   else {
   }
}

function getCookie(cookiename) {
  var search = cookiename + "="
  var returnvalue = "";
	
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
		
    if (offset != -1) { 
      offset += search.length
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}

function alerter(cookiename,alertmessage) {
  if (getCookie(cookiename)==''){
    alert(alertmessage)
    document.cookie="alerted=yes"
  }
}

function sortlist(url,val){ 
  window.location=url+"?order="+val.options[val.selectedIndex].value;
}

function valContact(formToValidate){
  var errorMsg = '';  
  
  if (formToValidate.email.value.length<7){
    errorMsg = errorMsg + '- E-postadress\n';
  }
  if (formToValidate.name.value.length<5){
    errorMsg = errorMsg + '- Namn\n';
  }
  if (formToValidate.description.value.length<7){
    errorMsg = errorMsg + '- Ärende\n';
  }
	
  if (errorMsg.length > 0){
    alert('Du måste fylla i följande fält:\n'+errorMsg);
	  return false;
  }
  else{
    return true;
  }      
}