//Image preloader
imageSource = new Array (
	"images/bg-main.gif",
	"images/bg-masthead.jpg",
	"images/bg-menu-top.gif",
	"images/karta-avstaand.gif",
	"images/karta_01.png",
	"images/karta_02.png",
	"images/karta_03.png",
	"images/logo-gyllene-kaerven.jpg",
	"images/menu-btm.jpg",
	"images/menu-top.jpg"
);

imageList = new Array ();

for (counter in imageSource) {
    imageList[counter] = new Image();
    imageList[counter].src = imageSource[counter];
}

//Remove outline around links
function removeFocusOnAllLinks(){
for(var i=0 ; i < document.links.length ; i++)
document.links[i].onfocus=blurLink;
}

function blurLink() {
if (this.blur) this.blur();
}

window.onload=removeFocusOnAllLinks;

//Function for contact form
function funcfrmContact() {
	if (document.frmContact.Kontaktperson.value == "") {
		alert('Du måste ange kontaktperson!');
		document.frmContact.Kontaktperson.focus();
		return false;
	}
	else if (document.frmContact.Epostadress.value == "") {
		alert('Du måste ange din epostadress!');
		document.frmContact.Epostadress.focus();
		return false;
	}
	else if (document.frmContact.Meddelande.value == "") {
		alert('Du måste skriva ett meddelande!');
		document.frmContact.Meddelande.focus();
		return false;
	}
	document.frmContact.email.value = document.frmContact.Epostadress.value;
	document.frmContact.realname.value = document.frmContact.Kontaktperson.value;
	document.frmContact.submit();
}

//Call popup window for map
function popupThis(url, width, height, scrolling, thisType) {
	leftPos = (screen.width) ? (screen.width-width)/2 : 0;
	topPos = (screen.height) ? (screen.height-height)/2 : 0;
	if (thisType == "img") {
		width = parseInt(width) + 20;
		height = parseInt(height) + 30;
	}
	window.open( url, "", "resizable=0,height="+height+",width="+width+",left="+leftPos+",top="+topPos+",scrollbars="+scrolling);
}