function active(id){
	//document.getElementById(id).style.backgroundColor = "#A89A6A";
	document.getElementById(id).style.backgroundColor = "#bbbbbb";
}

function deActive(id){
	document.getElementById(id).style.backgroundColor = "#29355B";
}


function checkForm(){
	var errors = 0;
	if(document.getElementById("name").value == 0){
		alert("Du måste ange ditt namn!");
		errors++;
	}
	else if(document.getElementById("msg").value == 0){
		alert("Ett meddelande saknas");
		errors++;
	}
	else if(document.getElementById("email").value == 0 && document.getElementById("phone").value == 0){
		alert("Du måste antingen ange en epostadress eller ett telefonnr du kan nås.");	
		errors++;
	}

	if(errors > 0)
		return false;
	else
		return true;
}


function checkEmail(hello){
	emailOK = 0;
	thisString = document.getElementById(hello).value;
	stringLength = thisString.length;
	if(stringLength > 0){
		for(i = 0; i < stringLength; i++){
			if(thisString.charAt(i) == '@')
				emailOK = 1;
		}
		if(thisString.charAt(stringLength-4) == '.' || thisString.charAt(stringLength-3) == '.' || thisString.charAt(stringLength-5) == '.')
			emailOK++;
		if(emailOK != 2){
			alert("Ogiltlig email-adress, kolla stavningen igen.");
			setTimeout("setFocus(\"" + hello  + "\")", 50);
		}
	}
}

function setFocus(hello){
		document.getElementById(hello).focus();
		document.getElementById(hello).select();
}
