function siteinit(){
	header_roll();
	tickertape();
	
	$("a[rel=fotoboekgroep]").fancybox({
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'titlePosition' 	: 'over',
		'titleFormat'		: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Foto: ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});	
		
	$(".socialmediabox").fancybox({
		'onComplete': function() { 
			startup();
		}	
	});
	
}



var roll_id = 0;
var totaal = 5;
function header_roll(){
	if(totaal < roll_id){		
		$('#tblf').css('marginLeft', '+=4200');
		roll_id = 0;
		$('#photo'+roll_id).addClass('active');
	}

	
	$('#tblf').delay(4000).animate({marginLeft: '-=700'}, 1000, function() {
		$('#photo'+roll_id).removeClass('active');
		roll_id = roll_id+1;
		$('#photo'+roll_id).addClass('active');
		header_roll();
	});
	
	noa();
	
}


function zeilklasseoverlay(e,n){
	var offset = $('#'+e.id).offset();
	var t = offset.top;
	var l = offset.left;
	
	$('#uitslagnaam').html('<div>'+n+'</div>');
	$('#uitslagnaam').css('top',t+'px');
	$('#uitslagnaam').css('left',l+'px');
	$('#uitslagnaam').css('display','block');
}

function hidezeilklasseoverlay(e){
	$('#uitslagnaam').css('display','none');
}


function noa(){
	timestamp = Number(new Date());
	var aurl = "/xml/noa/1?ts="+timestamp;
	$.ajax({
	  url: aurl,
	  success: function(data) { //xml in de data var
		$(data).find("song").each(function(){
			var a = $(this).find("artiest").text();	
			var t = $(this).find("titel").text();	
			var f = $(this).find("foto").text();	
		
			$('#noaartist').html(a);
			$('#noatitle').html(t);
			$('#noaphoto').html('<div><img src="'+f+'" /></div>');
		
		
		});
	  },
	  dataType: 'xml'
	});

}

var tickertape_show = 0;
var tickertape_totaal = 0;
var firstrun = true;
function tickertape(){	
	if(firstrun == true){
		$("#tickertape").find("div").each(function(){
			tickertape_totaal++;
		});
		firstrun = false;
	}

	
	
	$('#tape'+tickertape_show).slideDown('fast',function(){
		$('#tape'+tickertape_show).delay(2000).slideUp('fast',function(){
			tickertape_show++;
			if(tickertape_show == tickertape_totaal){
				tickertape_show = 0;
			}
			tickertape();
		});
	});
	
}

function removebckg(){
	$('#bckg').css('background-image','url(/a/images/csite2.jpg)');
}


function setpoll(){
	$('#qa').load('/poll.php');
}

function pollanswer(answer){

	$('#qa').load('/poll.php?a='+answer);
}


function winPopup(sURL, sWinName, iWidth, iHeight) {var f="scrollbars=no,resizable=no,width=" + iWidth + ",height=" + iHeight + ",top=" + ((screen.height-iHeight)/2) + ",left=" + ((screen.width-iWidth)/2);window.open(sURL,sWinName,f);}
