$(document).ready(set_events_funktion);
function set_events_funktion() {
    $("#annonsbokningen").click(animeraInDet);
}

//Adressregistret
function animeraInDet() {
	$('#whiteBox').slideDown('fast', flyttaNerat);
}
function flyttaNerat() {
	$('#whiteBox').animate(
		{ top: '260px' },
		{ duration: 'fast', complete: forstoraAtHoger }
	);
}
function forstoraAtHoger() {
	$('#whiteBox').animate(
		{ width: '709px' },
		{ duration: 'slow', complete: visaInnehallet }
	);
}
function visaInnehallet() {
	$('#whiteBoxAnnonsbokningen_content').fadeIn();
}

function hideContent_page1() {
	$('#whiteBoxAnnonsbokningen_content').fadeOut(
	{ complete: forminskaAtVanster }
	);
}

function forminskaAtVanster() {
	$('#whiteBox').animate(
		{ width: '570px' },
		{ duration: '400', complete: flyttaUpp }
	);
}

function flyttaUpp() {
	$('#whiteBox').animate(
		{ top: '220px' },
		{ duration: 'fast', complete: taBort }
	);
}

function taBort() {
	$('#whiteBox').slideUp (
		{ duration: 'fast' }
	)
}

function showAnnonsbokningen_Gavleborg() {
	document.getElementById('whiteBoxAnnonsbokningen_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenVastmanland_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenOrebro_content').style.display = 'none';
	$('#whiteBoxAnnonsbokningenGavleborg_content').fadeIn('slow');
}

function showAnnonsbokningen_Vastmanland() {
	document.getElementById('whiteBoxAnnonsbokningen_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenGavleborg_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenOrebro_content').style.display = 'none';
	$('#whiteBoxAnnonsbokningenVastmanland_content').fadeIn('slow');
}

function showAnnonsbokningen_Orebro() {
	document.getElementById('whiteBoxAnnonsbokningen_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenVastmanland_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenGavleborg_content').style.display = 'none';
	$('#whiteBoxAnnonsbokningenOrebro_content').fadeIn('slow');
}

function hideBoxAnnonsbokningen_page1() {
	document.getElementById('whiteBoxAnnonsbokningen_content').style.display = 'none';
	document.getElementById('whiteBox').style.display = 'none';
}

function hideBoxAnnonsbokningen_page2() {
	document.getElementById('whiteBoxAnnonsbokningenGavleborg_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenVastmanland_content').style.display = 'none';
	document.getElementById('whiteBoxAnnonsbokningenOrebro_content').style.display = 'none';
	$('#gavleborgKarta').hide();
	$('#vastmanlandKarta').hide();
	$('#orebroKarta').hide();
	$('#whiteBoxAnnonsbokningen_content').fadeIn('slow');
}

function fadeAndShowMap_Gavleborg() {
	$('#gavleborgsLan').animate( { color: '#B81521' }, { duration: 'slow' } ); // 'fast' = 600, 'slow' = 200
	$('#gavleborgKarta').stop(true, true).fadeIn();
}
function hideMap_Gavleborg () {
	$('#gavleborgsLan').animate( { color: '#000000' }, { duration: 'slow' } );
	$('#gavleborgKarta').stop(true, true).fadeOut();
}
function fadeAndShowMap_Vastmanland() {
	$('#vastmanlandsLan').animate( { color: '#B81521' }, { duration: 'slow' } ); // 'fast' = 600, 'slow' = 200
	$('#vastmanlandKarta').stop(true, true).fadeIn();
}
function hideMap_Vastmanland () {
	$('#vastmanlandsLan').animate( { color: '#000000' }, { duration: 'slow' } );
	$('#vastmanlandKarta').stop(true, true).fadeOut();
}
function fadeAndShowMap_Orebro() {
	$('#orebroLan').animate( { color: '#B81521' }, { duration: 'slow' } ); // 'fast' = 600, 'slow' = 200
	$('#orebroKarta').stop(true, true).fadeIn();
}
function hideMap_Orebro () {
	$('#orebroLan').animate( { color: '#000000' }, { duration: 'slow' } );
	$('#orebroKarta').stop(true, true).fadeOut();
}

function preloadimages() {
	glowpicture = new Image();
	glowpicture.src = "redaktionen_glow.jpg";
	glowpicture.src = "annonsbokningen_glow.jpg";
	glowpicture.src = "adressregistret_glow.jpg";
	glowpicture.src = "tidningsarkivet_glow.jpg";
	glowpicture.src = "blogg_glow.jpg";
}

function makeGlow(caller) {
	var newSrc = caller.id + "_glow.jpg";
	caller.src = newSrc;
}

function makewhite(caller) {
	var newSrc = caller.id + ".jpg";
	caller.src = newSrc;
}
