$(document).ready(function(){
    // reset de counter
	resetCounter();
    // witte storing animatie bij laden pagina
	storingAnimatie();
	// bepaalAchtergrond();
	menuItemHome();

$("#main_frame").fadeIn(4000);
posterShow();
//posterHide();
});

function posterShow()
{
$(this).oneTime(5000, function() {
		$("#poster").fadeIn(50);
	
	});}
function posterHide()
{
$(this).oneTime(15000, function() {
		$("#poster").fadeOut(500);
	
	});}
	
function menuItemHome()
{   
	show('','logo','');
	var startNumber=Math.floor(Math.random()*4+1);
	var startImage='img/front'+startNumber+'.png';
	var startBackground={'background':'#000000 url('+startImage+') top center no-repeat'};
    var background = {'background':'#25290e url(img/rookbg2.png) top left'};
	$(this).oneTime(2000, function() {
	$("#startfoto").css(startBackground);
	$("#startfoto").fadeIn(5000);
	$("html").css(background);
	$("#hoofdmenu").fadeIn(500);
	//debug(startNumber);
	});
};

function menuItemNieuws(item)
{
$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();
var randomNumber=Math.floor(Math.random()*4+1);
var linkerImage='img/linker'+randomNumber+'.png';
var linkerBackground={'background':'#000000 url('+linkerImage+') top left no-repeat'};
$(this).oneTime(2000, function() {
    
	$("#nieuws").fadeIn(1000);
	$("#linkerfoto").css(linkerBackground);
	$("#linkerfoto").fadeIn(1000);
	showHoofdmenu();
	
	
});
}

function menuItemMuziek(id1)
{

$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();



$(this).oneTime(1000, function() {
		//var htmlcode=$("#"+id1).html();
	    //$("#contentCenter").after('<div id="middenPaneel" style="position:absolute; top:100px;">'+htmlcode+'</div>');
		$("#muziek1").css({'display':'block'})
		$("#linkerfoto").css({'background':'#000000 url(img/speakerL.png) top left no-repeat'});
	    $("#linkerfoto").fadeIn(1000);
		//$("#rechterfoto").css({'background':'#000000 url(img/speakerR.png) top right no-repeat'});
	    //$("#rechterfoto").fadeIn(1000);
		$("#muziekalbums").fadeIn(1000);
		showHoofdmenu();
  });

}

function menuItemVideo(id1)
{
$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();

$(this).oneTime(1300, function() {
		
		var htmlcode=$("#"+id1).html();
	    $("#contentCenter").after('<div id="middenPaneel" class="videoPaneel" style="position:absolute; top:100px;">'+htmlcode+'</div>');
  });
// $("#video3").expose({color:'#000',opacity:0.9});
$("#videoYoutube").expose({color:'#000',opacity:0.9});
showHoofdmenu();
	
}



function menuItemBiografie()
{
$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();
var randomNumber=Math.floor(Math.random()*4+1);
var rechterImage='img/rechter'+randomNumber+'.png';
var rechterBackground={'background':'#000000 url('+rechterImage+') top right no-repeat'};
$(this).oneTime(2000, function() {
    
	$("#biografie").fadeIn(1000);
	$("#rechterfoto").css(rechterBackground);
	$("#rechterfoto").fadeIn(1000);
	showHoofdmenu();
	
	
});
}

function menuItemInfo()
{
$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();
var randomNumber=Math.floor(Math.random()*4+1);
var linkerImage='img/linker'+randomNumber+'.png';
var linkerBackground={'background':'#000000 url('+linkerImage+') top left no-repeat'};
$(this).oneTime(2000, function() {
    
	$("#info").fadeIn(1000);
	$("#linkerfoto").css(linkerBackground);
	$("#linkerfoto").fadeIn(1000);
	showHoofdmenu();
	
	
});
}

function menuItemShows()
{
$("#hoofdmenu").fadeOut(300);
$("#startfoto").remove();
// video weghalen
$("#middenPaneel").remove();
$(".videoPaneel").remove();
show('','logo','');
// reset de counter
resetCounter();
// witte storing animatie bij laden pagina
storingAnimatie();
var randomNumber=Math.floor(Math.random()*4+1);
var rechterImage='img/rechter'+randomNumber+'.png';
var rechterBackground={'background':'#000000 url('+rechterImage+') top right no-repeat'};
$(this).oneTime(2000, function() {
    
	$("#shows").fadeIn(1000);
	$("#rechterfoto").css(rechterBackground);
	$("#rechterfoto").fadeIn(1000);
	showHoofdmenu();
	
	
});
}


function test()
{ $("#video3").css({'display':'none'});}

function switchBackground()
{document.getElementById('canvas_bg').style.background='url(img/storing_bg3.png)';}
 
function bepaalAchtergrond ()
{
var luckyNumber2=4;
    var luckyNumber2=Math.floor(Math.random()*4+1);
	var luckyNumber3=4;
    var luckyNumber3=Math.floor(Math.random()*4+1);
	var img2=new Array(4);
	img2[1]='url(img/davidbowie2_099.png) no-repeat center center';
	img2[2]='url(img/johnlennon_099.png) no-repeat center center';
	img2[3]='url(img/pijnzalhetdoen_099.png) no-repeat center center';
	img2[4]='url(img/girl2_099.png) no-repeat center center';
	$("#storingbackground").css("background",img2[luckyNumber2]);
	$("#storingbackground").fadeIn(100);

	storingAnimatie();
	
}
function storingAnimatie()
{
	// hide content panelen
	$("contentLeft").css("display","none");
	$("contentRight").css("display","none");
	// storing animatie door background te wisselen
	var counter=$("#counter").val();
	counter=parseInt(counter)+1;
	$("#counter").val(counter);
	var status=$("#background_status").val();
	$("#scherm").html(counter);
	//background images
	var img=new Array(8);
	img[1]='url(img/storing_bg1.png)';
	img[2]='url(img/storing_bg2.png)';
	img[3]='url(img/storing_bg3.png)';
	img[4]='url(img/storing_bg4.png)';
	img[5]='url(img/storing_bg5.png)';
	img[6]='url(img/storing_bg6.png)';
	img[7]='url(img/storing_bg7.png)';
	img[8]='url(img/storing_bg8.png)';
	var luckyNumber=4;
    var luckyNumber=Math.floor(Math.random()*8+1);
    // bepaal de laatste background	
	document.getElementById('canvas_bg').style.background=img[luckyNumber];
	var schakelaar=$("#schakelaar").val();
	// als de achtergrond 10x gewisseld is dan de stop schakelaar op 0 zetten
	if(counter>10){
	schakelaar=0;$("#scherm").html(counter);
	var luckyNumber=Math.floor(Math.random()*8+1);
	document.getElementById('canvas_bg').style.background=img[luckyNumber];
	}
	if(counter==5){$("#storingbackground").fadeOut(1000);}
	if(schakelaar==1){setTimeout("storingAnimatie()", 100);}
	else {
	stopAnimatie();
    }
}

function stopAnimatie()
{
	var img=new Array(8);
	img[1]='url(img/storing_bg1.png)';
	img[2]='url(img/storing_bg2.png)';
	img[3]='url(img/storing_bg3.png)';
	img[4]='url(img/storing_bg4.png)';
	img[5]='url(img/storing_bg5.png)';
	img[6]='url(img/storing_bg6.png)';
	img[7]='url(img/storing_bg7.png)';
	img[8]='url(img/storing_bg8.png)';
var luckyNumber=Math.floor(Math.random()*8+1);
document.getElementById('canvas_bg').style.background='#000'//img[luckyNumber]; //bepaal de laatste achtergrond afbeelding
}

function resetCounter()
{var counter=$("#counter").val(0);}

function restoreNormal()
{
$("#contentLeft").fadeIn(2000);
}

function schakelaarSwitch()
	 {
	 $("#counter").val(0);
	 var schakelaar=$("#schakelaar").val();
     document.getElementById('scherm').innerHTML=schakelaar;
	 if(schakelaar==1){$("#schakelaar").val(0);}
	 else {$("#schakelaar").val(1);storingAnimatie();}
	 }

function showHoofdmenu()
{
$(this).oneTime(2000, function() {
		$("#hoofdmenu").css({'display':'block'})
		});
}

function show(id1,id2,id3)
{
//alle huidige panelen verbergen
$(".hide").css({'display':'none'});
// gekozen panelen laten zien
//$("#"+id1).addClass("show");$("#"+id1).css({"display":"block"});
//$("#"+id2).addClass("show");$("#"+id2).css({"display":"block"});
//$("#"+id3).addClass("show");$("#"+id3).css({"display":"block"});
//$("#contentCenter").css("display","block");
//$("#canvas_bgbgCenter").fadeIn(1000);
$("#contentCenter").fadeIn(2000);
$("#contentLeft").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
}

function showInMiddenPaneel(id1)
{
$("#middenPaneel").remove();
$("#contentLeft").fadeIn(2000);
$("#contentCenter").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
$(this).oneTime(1300, function() {
		var htmlcode=$("#"+id1).html();
	    $("#contentCenter").after('<div id="middenPaneel" style="position:absolute; top:100px;">'+htmlcode+'</div>');
  });
}

function startInMiddenPaneel(id1)
{
bepaalBackgroundFotos();
$(this).oneTime(3000, function() {
var htmlcode=$("#"+id1).html();
	$("#contentCenter").after('<div id="middenPaneel" style="position:absolute; top:100px;display:none">'+htmlcode+'</div>');
	$("#middenPaneel").fadeIn(3000);
  });
	
  
}

function showInRechterPaneel(id1)
{
bepaalBackgroundFotos();
// clear midden paneel
$("#middenPaneel").remove();
// verberg alle items
$(".hide").css({'display':'none'});
// gekozen panelen laten zien
$("#"+id1).addClass("show");$("#"+id1).css({"display":"block"});
// fade de panelen in 
$("#contentLeft").fadeIn(2000);
$("#contentCenter").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
}

function showInLinkerPaneel(id1)
{
bepaalBackgroundFotos();
// clear midden paneel
//$("#middenPaneel").remove();
// verberg alle items
$(".hide").css({'display':'none'});
// gekozen panelen laten zien
$("#"+id1).addClass("show");$("#"+id1).css({"display":"block"});
// fade de panelen in 
$("#contentLeft").fadeIn(2000);
$("#contentCenter").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
}

function showBio(id1,id2,id3)
{
bepaalBackgroundFotos();
// clear midden paneel
//$("#middenPaneel").remove();
// verberg alle items
$(".hide").css({'display':'none'});
// gekozen panelen laten zien
$("#"+id1).addClass("show");$("#"+id1).css({"display":"block"});
$("#"+id2).addClass("show");$("#"+id2).css({"display":"block"});
$("#"+id3).addClass("show");$("#"+id3).css({"display":"block"});
// fade de panelen in 
$("#contentLeft").fadeIn(2000);
$("#contentCenter").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
}

function showShows(id1,id2,id3)
{
noBackgroundFotos();
// clear midden paneel
//$("#middenPaneel").remove();
// verberg alle items
$(".hide").css({'display':'none'});
// gekozen panelen laten zien
$("#"+id1).addClass("show");$("#"+id1).css({"display":"block"});
$("#"+id2).addClass("show");$("#"+id2).css({"display":"block"});
$("#"+id3).addClass("show");$("#"+id3).css({"display":"block"});
// fade de panelen in 
$("#contentLeft").fadeIn(2000);
$("#contentCenter").fadeIn(2000);
$("#contentRight").fadeIn(2000);
$("#ticker").fadeIn(2000);
$("#logo").fadeIn(2000);
}

function fadeInTekst(id)
{
//$("#"+id).fadeIn(2000);
$("#"+id).css("display","block");
}
function fadeOutTekst(id)
{var teller=0;
if(teller<1){$("#"+id).fadeOut(2000)}
var teller=1;}

function fadeInMenu(id)
{var teller=0;
if(teller<1){$("#"+id).fadeIn(2000)};
teller=1;
}

function fadeOut(id)
{$("#"+id).fadeOut(2000)}

function openVideo(i,j,margin)
{

//document.getElementById('preview').style.marginTop=-margin+'px';
//document.getElementById('contentCenter').style.paddingBottom=margin+'px';
//document.getElementById('player').style.height=i+'px';
//document.getElementById('player').style.height=j+'px';

}

function showFlyer(id)
{
$("#rotonde").fadeIn(2000);
}

function bepaalBackgroundFotos(p)
{
	$(this).oneTime(10, function() 
	{
    var imgLinks=new Array(4);
	imgLinks[1]={'background' : '#000000 url(img/horv01.png) no-repeat center left'}
	imgLinks[2]={'background' : '#000000 url(img/horv5.png) no-repeat center left'}
	imgLinks[3]={'background' : '#000000 url(img/horv05.png) no-repeat top left'}
	imgLinks[4]={'background' : '#000000 url(img/djgit.png) no-repeat center left'}
	var imgRechts=new Array(4);
	imgRechts[1]={'background' : '#000000 url(img/lorq01.png) no-repeat center right'}
	imgRechts[2]={'background' : '#000000 url(img/rubi1.png) no-repeat center right'}
	imgRechts[3]={'background' : '#000000 url(img/ruud03.png) no-repeat center right'}
	imgRechts[4]={'background' : '#000000 url(img/ruud1.png) no-repeat center right'}
	
	var imgInit={'background' : 'none'};
	var randomNumber=4;
    var randomNumber=Math.floor(Math.random()*4+1);
	var randomNumber2=4;
    var randomNumber2=Math.floor(Math.random()*4+1);
	
	$("#contentLeft").css(imgLinks[randomNumber]);

	$("#contentRight").css(imgRechts[randomNumber2]);
  });
	}

	function noBackgroundFotos()
{	var imgInit={'background' : '#000000'};
	$("#contentLeft").css(imgInit);
	$("#contentRight").css(imgInit);

	}

function debug(value)
{
$("#debug").val(value);
$("#debug").css({'display':'block'});
}

function toggleTwitter(){
var s = $('#twitter').css('display');
if(s=='none'){$('#twitter').slideDown('slow')}
else {$('#twitter').slideUp('slow')}
alert(height);
}


