//HOVER EFFEKT PÅ LAGER
function hover(id){
	document.getElementById(id).style.opacity = 0.85;//FF
	document.getElementById(id).style.filter='alpha(opacity=85)';//IE
}
function hoverOut(id){
	document.getElementById(id).style.opacity = 1.0;//FF
	document.getElementById(id).style.filter='alpha(opacity=100)';//IE
}

//GÖR ATT VÄNSTER OCH HÖGER KOLUMN BLIR LIKA HÖGA
function fixHeight(){

	if(document.getElementById('idSubmenu') && document.getElementById('idContent')){

		var submenuHeight = document.getElementById('idSubmenu').offsetHeight;
		var contentHeight = document.getElementById('idContent').offsetHeight;

		if(submenuHeight < contentHeight){
			submenuHeight = contentHeight+14;
		}
		else if(submenuHeight > contentHeight){
			contentHeight = submenuHeight-14;
		}

		//Kontroll av webbläsare
		if(document.all){
			document.getElementById('idSubmenu').style.height = submenuHeight+"px";
			document.getElementById('idContent').style.height = contentHeight+"px";
		}
		else{
			document.getElementById('idSubmenu').style.minHeight = submenuHeight+"px";
			document.getElementById('idContent').style.minHeight = contentHeight+"px";
		}

	}

}

//KONTROLLERAR SÖKORD I SÖKMOTOR
//ARGUMENT: Sökordet får inte vara tomt
function checkSearch(language){
	
	//Tilldelar sökordet från sökfältet (tar bort eventuella mellanslag före och efter sträng)
	var search = trimin(document.getElementById("SearchText").value);
	
	//Validerar
	if(search != ""){
		return;
	}
	else{
		
		//Om svenska
		if(language == "swe-SE"){
			alert("Felmeddelande!\nDu angav inte ett riktigt sökord.");
		}
		
		//Om annat språk
		else{
			alert("Error!\nYou didn’t use a correct word.");
		}
		
		return false;
	
	}
	
}

//TAR BORT EXTRA MELLANSLAG I STRÄNG SAMT FÖRST OCH SIST
function trimin(str) 
{ 
	if (str=='' || str == null)
		return '';	

	var tmp="";
	for(i=0; i<str.length; i++)
	{
		if(str.charAt(i) != ' ')
		{
			tmp += str.charAt(i);
		}
		else if(i != str.length-1)
		{
			if(str.charAt(i+1) != ' ')
			{
				tmp += str.charAt(i);
			}
		}
	}
	
	return tmp;
}
