// Slideshow initaliseren
function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1500, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 6000 );
});

Cufon.replace('h1', { fontFamily: 'Brush Script MT' });
Cufon.replace('h2', { fontFamily: 'Brush Script MT' });
Cufon.replace('h3', { fontFamily: 'Brush Script MT' });
Cufon.replace('div#hdr ul#mnu li a.main', { fontFamily: 'Brush Script MT' });
Cufon.replace('div#hdr ul#mnu li span.dir', { fontFamily: 'Brush Script MT' });



$(document).ready(function(){
   $("ul.thumb li").hover(function() {
      $(this).css({'z-index' : '10'}); /*Add a higher z-index value so this image stays on top*/ 
      $(this).find('img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
         /*.animate({
            marginTop: '-110px',  The next 4 lines will vertically align this image 
            marginLeft: '-110px',
            top: '50%',
            left: '50%',*/ 
            /*width: '71px',  Set new width */
            /*height: '71px',  Set new height 
            padding: '20px'*/
         /*}, 200);  this value of "200" is the speed of how fast/slow this hover animates */

      } , function() {
      $(this).css({'z-index' : '0'}); /* Set z-index back to 0 */
      $(this).find('img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
         /*.animate({
            marginTop: '0',  Set alignment back to default 
            marginLeft: '0',
            top: '0',
            left: '0',*/
            /*width: '71px',  Set width back to default */
            /*height: '71px',  Set height back to default
            padding: '5px' 
         }, 400);*/
   });
   $("ul.thumb li a").click(function() {
		
		var mainImage = $(this).attr("href"); //Find Image Name
		$("#main_view img").attr({ src: mainImage });
      $("#main_view a").attr({ href: mainImage });
		return false;		
	});
});

$(document).ready(function(){
   $("a#fancy").fancybox({
      'transitionIn'	: 'elastic',
      'transitionOut'	: 'elastic',
      'overlayOpacity' :	'0.5',
      'overlayColor' : '#000'
	});
});
