

/* ******************** SLIDESHOW ******************** */

var image_id = 0;
var interval_id;

/* set image to id */
function slideshow_setImage(id){
	if(id != image_id) {
		image_id = id;
		$(".slideshow .slide.current").fadeOut(600, function(){ $(this).removeClass('current'); });
		$(".slideshow .slide").slice(image_id, image_id+1).fadeIn(600).addClass("current");
		
		$(".slideshow .small.button.current").removeClass("current");
		$(".slideshow .small.button").slice(image_id, image_id+1).addClass("current");
		
		resetSlideshow();
	}
}

/* move to next image function */
function slideshow_nextImage(){
	if(++image_id >= 4) image_id = 0;
	
	$(".slideshow .slide.current").fadeOut(2000, function(){ $(this).removeClass('current'); });
		$(".slideshow .slide").slice(image_id, image_id+1).fadeIn(2000).addClass("current");
		
		$(".slideshow .small.button.current").removeClass("current");
		$(".slideshow .small.button").slice(image_id, image_id+1).addClass("current");
}

/* reset slideshow */
function resetSlideshow(){
	if(interval_id) clearInterval(interval_id);
	interval_id = setInterval("slideshow_nextImage()", 5000);
}


$(function(){ 
	resetSlideshow(); 
});


/* ******************** EMAIL FIELDS DEFAULT VALUE ******************** */

/* default text */
$(function() {
	$("#joinMailingListInput, #fields_email").focus(function(){
		if($(this).val() == "Email Address") 
			$(this).val("").removeClass("default");
	});
	
	$("#joinMailingListInput, #fields_email").blur(function(){
		if($(this).val() == "") 
			$(this).val("Email Address").addClass("default");
	});
});


/* ******************** DROPDOWN MENUS ******************** */

$(function(){
	$(".header-primaryNavigation li").hover(
		function() {
			
			if($.browser.msie)
				$(".header-dropDown", this).show();
			else 
				$(".header-dropDown", this).slideDown(300);
		},
		function() {
			if($.browser.msie)
				$(".header-dropDown", this).hide();
			else
				$(".header-dropDown", this).slideUp(100);
		}
	);
});



/* ******************** LIGHTBOX ******************** */

$(function() {
	$('a.lightbox').lightBox({
		imageLoading:			'img/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
		imageBtnPrev:			'img/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
		imageBtnNext:			'img/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
		imageBtnClose:			'img/lightbox/lightbox-btn-close.gif',			// (string) Path and the name of the close btn
		imageBlank:				'img/lightbox/lightbox-blank.gif'				// (string) Path and the name of a blank image (one pixel)
	});
});

