if(!document.getElementById)
{
	if(document.all)
	{
		document.getElementById = function()
		{
			if(typeof document.all[arguments[0]]!="undefined")
			{
				return document.all[arguments[0]];
			}
			else
			{
				return null;
			}
		};
	}
	else if(document.layers)
	{
		document.getElementById = function()
		{
			if(typeof document[arguments[0]]!="undefined")
			{
				return document[arguments[0]];
			}
			else
			{
				return null;
			}
		};
	}
};

// visa eller gom en div
function toggle(a){
	var e=document.getElementById(a);
	if(!e) {return true;}
	if(e.style.display=="none"){
		e.style.display="block";
	} else {
		e.style.display="none";
	}
	return true;
};
/*
$(document).ready(function()
{
	$('li.headlink').hover(
	function() { $('ul', this).css('display', 'block'); },
	function() { $('ul', this).css('display', 'none'); });
});
*/
$(document).ready(function()
{
	$('ul.headlink').hover(
	function() { $('ul', this).css('display', 'block'); },
	function() { $('ul', this).css('display', 'none'); });
});

function CheckForm ()
{
	//Initialise variables
	var errorMsg = "";

	//Check for a first name
	if ((document.contactForm.email.value == "") || (document.contactForm.email.value.length > 0 && (document.contactForm.email.value.indexOf("@",0) == - 1 || document.contactForm.email.value.indexOf(".",0) == - 1))) {
		errorMsg += "\n* E-post - fyll i rätt epostadress";
	}	//If there is aproblem with the form then display an error
	if (document.contactForm.firstName.value.length < 1)
		errorMsg += "\n* Förnamn måste fyllas i";
	if (document.contactForm.lastName.value.length < 1)
		errorMsg += "\n* Efternamn måste fyllas i";
	if (document.contactForm.street.value.length < 1)
		errorMsg += "\n* Gatuadress måste fyllas i";
	if (document.contactForm.zip.value.length < 1)
      	errorMsg += "\n* Postnummer måste fyllas i";
	if (document.contactForm.city.value.length < 1)
		errorMsg += "\n* Efternamn måste fyllas i";
	if (errorMsg != ""){
		msg = "Följande fält är ej ifyllda, eller är inte fyllda på rätt sätt\n";
		msg += "_____________________________________________\n\n";

		errorMsg += alert(msg + errorMsg + "\n\n");
		return false;
	}
	return true;
}
