

// JQUERY CUSTOM COMMANDS
$(document).ready( function() {  // start javascript when document is loaded
	
   // start the plugin cycle
   $('#s1').cycle('fade');
   
   //make content layer 'white' a little transparant
   $('.content_main .white').fadeTo("1", 0.88);

  
   
   
   
   
   // the other functions
   fancyBox_images();
   contentHeightSetter();
   subKoppenSetters();
   subMenuFade();
   set_external_links();
   
}); // end ready function


function set_external_links(){
   //external links open in a new window
   //middle part for naming the serving domain
   $("a[href^='http']").not("[href*='hoveniersbedrijf-wentink.nl']").attr('target','_blank');
}


function fancyBox_images(){

    $("a[rel='lightbox']").fancybox();

    $(".extra_pictures a.single_image").fancybox();
    
    /* Using custom settings */
    $(".extra_pictures a.inline").fancybox({
        'hideOnContentClick': true
    });
    $(".extra_pictures a.group").fancybox({
        'zoomSpeedIn': 300,
        'zoomSpeedOut': 300,
        'overlayShow': false
    });
}


function contentHeightSetter(){
	//we've got a container with a border, and two absolute layers above it
	//layer 'white' is for the white bg
	//layer 'inner' is for the content and for controlling the height of the other 2
	
	var contentBGBorder    = $('.content_main .content');
	var contentBGWhite     = $('.content_main .white');
	var contentBGInner     = $('.content_main .inner');
	var paddingTop         = 23;
	var paddingBottom      = 18;
	
	// get height of the controlling layer
	contentBGInner_height = contentBGInner.height();
	
	// math the new height
	new_height_contentBGBorder = contentBGInner_height + paddingTop + paddingBottom;	    
	// set contentBGBorder.height
    contentBGBorder.css({
        'height' : new_height_contentBGBorder        
    });
	
	// math the new height
	new_height_contentBGWhite = contentBGInner_height + paddingTop + paddingBottom ;      
    // set contentBGBorder.height
    contentBGWhite.css({
        'height' : new_height_contentBGWhite        
    });
}

function subKoppenSetters(){
    // odd or even, yep 'odd on even'; and 'even on odd' ;-)
	
	$("#subKoppen ul li:odd").addClass('even');
    $("#subKoppen ul li:even").addClass('odd');
}

function subMenuFade(){
	/* A IMG BUTTON HOVERS + UPDATE */
	$('.extra_pictures a, .planten_overzicht img').hover(function(){ // IE6 does not support :hover on elements other than <a>   //.menu_main li, .menu_main li a,
		$(this).fadeTo(100, 0.80); //SET
	}, function(){
		$(this).fadeTo(100, 1.00); //RESET
	});
}
