// bluenova.js v 0.5 - 2008, 2009 (C) by Georg Bege <bege@cpv-computer.de>
/*
	Description
	------------------
	The bluenova.js is used to manage
	the hover buttons in the blue nova style
	navigation.
	It also holds a jquery helper section
	which executes various routines.
	
	Last Change:	11th November 2009
*/

var navbutton_prefix = "images/bluenova/navbutton_";
var navbutton_ext = ".jpg";

function bluenova_nav_over(which) {
    document.getElementById(which).src = navbutton_prefix + which + "_active" + navbutton_ext;
}

function bluenova_nav_out(which) {
    document.getElementById(which).src = navbutton_prefix + which + navbutton_ext;
}

// jquery code section

function imgFade(section) {

	// Set the opacity of all images to 0
	$(section + ' a').css( {opacity: 0.0} );
	
	// Get the first image and display it (set it to full opacity)
	$(section + ' a:first-child').css( {opacity: 1.0} );
	
	// Call the gallery function to run the slideshow, change after seconds
	setInterval('gallery("' + section + '")', 6000);
	
}

function gallery(section) {

	// if no IMGs have the show class, grab the first image
	var current = ($(section + ' a.show')? $(section + ' a.show') : $(section + ' a:first'));
	
	// Get next image, if it reached the end of the imgFade, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $(section + ' a:first') : current.next()) : $(section + ' 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 the opacity to 0 and height to 1px
	$(section + ' .caption').animate( {opacity: 0.0}, {queue: false, duration: 0} ).animate( {height: '1px'}, { queue: true, duration: 300} );
	
	// Animate the caption, opacity to 0.7 and height to 100px, a slide up effect
	$(section + ' .caption').animate( {opacity: 0.7}, 100 ).animate( {height: '100px'}, 500 );
	
	// Display the content
	$(section + '.content').html(caption);

}

