//Image preloader
imageSource = new Array (
	"images/branding_logo.jpg",
	"images/logo_europabilvard.gif",
	"images/bg_topnav.jpg",
	"images/bg_topnav_right.jpg",
	"images/bg_topnav_hover.jpg",
	"images/bg_footer.jpg",
	"images/bg_wrapper.gif",
	"images/branding_logo_subpage.jpg",
	"images/logo_europabilvard.gif",
	"images/logo_europabilvard_subpage.gif",
	"images/karta_01.png",
	"images/karta_02.png",
	"images/karta_03.png"
);

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;

//Call popup window
function popThis(url, width, height) {
	leftPos = (screen.width) ? (screen.width-width)/2 : 0;
	topPos = (screen.height) ? (screen.height-height)/2 : 0;
	window.open( url, "", "resizable=0,height="+height+",width="+width+",left="+leftPos+",top="+topPos);
}

//Function for contact form
function checkfrmContact() {
	if (document.frmContact.name.value == "") {
		alert('Du måste ange kontaktperson!');
		document.frmContact.name.focus();
		return false;
	}
	else if (document.frmContact.email.value == "") {
		alert('Du måste ange din epostadress!');
		document.frmContact.email.focus();
		return false;
	}
	
	if (document.frmContact.email.value != "") {
		var _x = document.frmContact.email.value;
		if (!_x.match(/^([\w-_]+\.)*[\w-_]+\@([\w-_]+\.)+[\w-_]+$/)) {
			alert('Din epostadress är inte giltig!');
			document.frmContact.email.focus();
			return false;
		}
	}
	
	if (document.frmContact.message.value == "") {
		alert('Du måste skriva ett meddelande!');
		document.frmContact.message.focus();
		return false;
	}
}