
// JavaScript Document

$(document).ready(function() {						   
	$(document).initialize();	
 });

$.fn.initialize = function() {
	
	$(".back_inhoud").animate( { opacity:"0.0",width:"0px" } , 1 );		
	$(".inhoudstekst").animate( { opacity:"0.0" } , 1 );
			var so = new SWFObject("flsSource/stich_a.swf", "stitch", "600", "450", "8.0.23", "", true);						
        		so.addParam("menu", "0");
		so.addParam("wmode", "transparent");
		so.write("stitch");
		if (document.getElementById('fotolijst')) {	
			$(document).initScrollBars();
		}
}

$.fn.initScrollBars = function() {
	$('#fotolijst').animate( { top: "0px" }, 1 );
	var hGalerij = document.getElementById('fotolijst').clientHeight;
	var fHeight = document.getElementById('vlak_midden').clientHeight;
	if (hGalerij > fHeight) {
		document.getElementById('fotogalerij_nav').style.display='block';
	} else {
		document.getElementById('fotogalerij_nav').style.display='none';	
	}
}

$.fn.scrollDown = function() {	
	var hGalerij = document.getElementById('fotolijst').clientHeight;
	var positie = document.getElementById('fotolijst').style.top;
	var fHeight = document.getElementById('vlak_midden').clientHeight;
	
	positie = parseInt(positie);
	hGalerij = parseInt(hGalerij);
	var som = positie + hGalerij;	
	var status = document.getElementById('state').value;
	if (som>(fHeight-15) && status==1) {
			newpos = positie - 200;
			document.getElementById('state').value=0;
			$('#fotolijst').animate( { top: newpos + 'px' }, 600 );
			setTimeout("document.getElementById('state').value=1;",700);
	}	
	
}

$.fn.scrollUp = function() {	
	var hGalerij = document.getElementById('fotolijst').clientHeight;
	var positie = document.getElementById('fotolijst').style.top;
	var fHeight = document.getElementById('vlak_midden').clientHeight;
	var status = document.getElementById('state').value;

	positie = parseInt(positie);
	if (positie<0 && status==1) {
			newpos = positie + 200;
			document.getElementById('state').value=0;
			$('#fotolijst').animate( { top: newpos + 'px' }, 600 );
			setTimeout("document.getElementById('state').value=1;",700);
	}	
	
}

$.fn.showInhoudsText = function() {
	$("#back_inhoud").animate( { opacity:"0.8",width:"250px" } , 500 );		
	$("#inhoudstekst").animate( { opacity:"1.0" } , 1500 );	
	$("#midleesmeer").animate( { opacity:"0.0" } , 700 );
}

$.fn.toonmenu = function() {
	$("#back_inhoud").animate( { opacity:"0.8",width:"488px" } , 500 );		
	$("#menukaart_inhoud").animate( { opacity:"1.0" } , 1500 );	
}

$.fn.chooseTheme = function(theme) {
	setActiveStyleSheet('theme_' + theme);
	$(document).loadBackFlash(theme);
}

$.fn.loadBackFlash = function(theme) {
		var so = new SWFObject("flsSource/stich_" + theme + ".swf", "stitch", "600", "450", "8.0.23", "", true);							
		so.addParam("menu", "0");
		so.addParam("wmode", "transparent");
		so.write("stitch");
}

$.fn.randomTheme = function() {
	var themas =  
	[ 
	 "a",  
	 "b",  
	 "c",  
	 "d"
	] 
	var thema = themas[Math.floor(Math.random()*themas.length)] 
	
	$(document).chooseTheme(thema);
}

$.fn.loadFoto = function(foto) {
	if (document.getElementById('inhoud')) {		
		$("#inhoud").animate( { opacity:"0.0" } , 1 );
		$("#inhoud").animate( { opacity:"1.0" } , 800).css({ backgroundImage: 'url("' + foto + '")'});	
	}
}

