 $(document).ready(function() {
      $("#news").newsticker();
      
      var mydate=new Date()
      var year=mydate.getYear()
      if (year < 1000)
      year+=1900
      var day=mydate.getDay()
      var month=mydate.getMonth()
      var daym=mydate.getDate()
      if (daym<10)
      daym="0"+daym
      
      if(taal == 0){
      var dayarray=new Array("Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag")
      var montharray=new Array("Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December")
      }
      else if (taal ==1){
      var dayarray=new Array("Sunday","Monday","tuesday","Wednesday","thursday","friday","Saturday")
      var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
      }
      else{

      var dayarray=new Array("dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi")
      var montharray=new Array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Ao&ucirc;t","Septembre","octobre","Novembre","Decembre")
      }
      var regel ="<small><font color='#999999' face='Georgia' size='1'><em>"+dayarray[day]+ " "+daym+" "+montharray[month]+",  "+year+"</em></font></small>";
      $("#timebox").html(regel);
     
    
      //Execute the slideShow 
  		slideShow();

      });

	

function slideShow() {

	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel')) ;
	
	$('#gallery a img').hover(function(){
			//open on hover
			 $('#gallery .caption').stop().animate({top:'160px', opacity: 0.7},{queue:false,duration:300});
				}, 
			function() {
			$('#gallery .caption').stop().animate({top:'190px', opacity: 0.7},{queue:false,duration:300});
		});
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
  setInterval("gallery()", 6000); 
	
}

function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set caption in start position
	$('#gallery .caption').animate({opacity: 0.0}, 0).animate({height: '30px', top: '190px'}, 0);
	
	//fill caption with content 
	$('#gallery .content').html(caption);
	
	$('#gallery a img').hover(function(){
		 $('#gallery .caption').stop().animate({top:'160px',opacity: 0.7},{queue:false,duration:300});
			}, 
		function() {
		 $('#gallery .caption').stop().animate({top:'190px', opacity: 0.7},{queue:false,duration:300});
	});
}

