// Main JavaScript

$(document).ready(function () {
	load_vaas('over', '');
	load_lijn('over', '');
	
	// Shadowbox
    
    Shadowbox.init({
       skipSetup: true,
	   overlayColor : "#fff", 
	   overlayOpacity: .95,
	   handleOversize: "resize",
	   continuous: true
    });
	
	resetButtons();
	
	$(".buttons span").click(function () {
		$(".buttons span").css('color', '#ccdfe1');
		$(".buttons span").css('fontWeight', 'normal');
      	$(this).css('color', '#fff');
		$(this).css('fontWeight', 'bold');
		Cufon.refresh('#lijn66 .buttons span');
    });
});


function resetButtons() {
	$(".buttons span").css('color', '#ccdfe1');
	$(".buttons span").css('fontWeight', 'normal');
	
	$("#lijnOver, #vaasOver").css('color', '#fff');
	$("#vaasOver").css('fontWeight', 'bold');
	
	Cufon.refresh('#lijn66 .buttons span');
}

// Page load functions.
function load_lijn(page, arguments) {
	$('#lijn_content').load('/pages/lijn_' + page + '.php?' + arguments, function() { Shadowbox.clearCache(); Shadowbox.setup("a.shadowbox"); });
}

function load_vaas(page, arguments) {
	$('#vaas_content').load('/pages/vaas_' + page + '.php?' + arguments, function() { Shadowbox.clearCache(); Shadowbox.setup("a.shadowbox"); });
	
}


// Switch function.
function switchSides(side) {
	if (side == 'vaasotheek') {
		// Change the site title.
		document.title = 'Vaasotheek';
		
		$('#headerOff').fadeIn(800);
		
		load_vaas('over', '');
		load_lijn('clear', '');
		
		resetButtons();
		
		
		// Glide to site.
		$('#main').animate( { scrollTop: -606 }, 2500);
		
	} else if (side == 'lijn66') {
		// Change the site title.
		document.title = 'Lijn 66';
		
		$('#headerOff').fadeOut(800);
		
		load_vaas('clear', '');
		load_lijn('over', '');
		
		resetButtons();
		
		// Glide to site.
		$('#main').animate( { scrollTop: 606 }, 1500);
	}
}
