function StringFormat()
{
    if( arguments.length == 0 )
    {
        return null; 
    }
    var str = arguments[0]; 
	for(var i=1;i<arguments.length;i++)
    {
        var re = new RegExp('\\{' + (i-1) + '\\}','gm');
        str = str.replace(re, arguments[i]);
    }
    return str;
};
function showPhotos(json,rel){
        var galleryTemplate='<a rel="'+rel+'" href="{0}" class="photogallery" title="{1}"><img src="{2}" alt="" border="0" /></a>';    
        var htmlStr="";   
        var numentries = json.feed.entry.length;
        for (var i = 0; i < numentries; i++) {
            var entry = json.feed.entry[i];
            var thumbnail=entry.media$group.media$thumbnail[0];
			if(entry.media$group.media$description.$t!=undefined) {
			var description=entry.media$group.media$description.$t;	
			} else {
			var description= entry.title.$t;	
			}
            htmlStr=htmlStr+StringFormat(galleryTemplate, entry.media$group.media$content[0].url+'?imgmax=1024' ,description,thumbnail.url);    
        }
        $('div.'+rel).html(htmlStr);
} // end of showalbums	
$.fn.idle = function(time)
  {
      var o = $(this);
      o.queue(function()
      {
         setTimeout(function()
         {
            o.dequeue();
         }, time);
      });
      return this;              //****
  }
function closemovie() {
$('div#homemovie').empty().hide();
//$('div#top, div#middle').fadeTo("fast", 1);
	$('div#top, div#middle').show();
$('div#intro_close').hide();
return false;
}
$(document).ready(function() {

//$('div#home_intro').hide();
	setTimeout( function() {
		$('div#home_logo').fadeIn('slow',function() {
			setTimeout( function() {
				$('div#home_tekst').fadeIn('slow',function() {
					setTimeout( function() {
						$('div#home_intro').fadeOut('slow',function() {
							$('div#home_intro').remove();
							$('div#top,div#middle').show();
						});
					}, 4000);
				});
			}, 1000);
		});
	},1000);

	$('a#showmovie').click(function() {

	$('div#top, div#middle').hide();
		$('div#homemovie').show(function() {
		    $('div#homemovie').flash({
        src: '/images/mediaplayer.swf',
		  flashvars: { file: 'http://dl.getdropbox.com/u/1027410/kok_met_vleugels.flv', autostart: 'true', bufferlength: '10', allowfullscreen: 'true' },
		 width: 530,
          height: 414 });
		  $('div#intro_close').fadeIn('fast');
		});
	return false;
	});

	$('a#menusuggesties').click(function() {
	$('div#menu div.submenu div').show();
		$('div#menu div.submenu').slideToggle();

		return false;
	});
	
	$("a[class='photogallery']").fancybox();
	$('a[href^="http://www.youtube.com"]').flash(
		{ width: 425, height: 344 },
		{ version: 8 },
		function(htmlOptions) {
			$this = $(this);
			htmlOptions.src = $this.attr('href');
			$this.before($.fn.flash.transform(htmlOptions));						
		}
	);
});
