// DROPLINE MENU
droplinemenu.buildmenu("dropline")

// HOME PAGE GALLERY FADE
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}, 1000, function() {
			$active.removeClass('active last-active');
			$("#slideshow img:not(.active)").css('opacity','0');
		});
}

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


// JQUERY
$(document).ready(function () {

	// HOME SCROLL
	$(".scrollable").scrollable({
		size: 3,
		clickable: false
	}).circular().autoscroll({interval:8000});

	// PHOTO GALLERY
	$('#gallery-1, #gallery-2, #gallery-3, #gallery-4, #gallery-5, #gallery-6, #gallery-7, #gallery-8, #gallery-9, #gallery-10, #gallery-11, #gallery-12, #gallery-13, #gallery-14, #gallery-15, #gallery-16, #gallery-17, #gallery-18, #gallery-19, #gallery-20, #gallery-21, #gallery-22, #gallery-23, #gallery-24, #gallery-25, #gallery-26, #gallery-27, #gallery-28, #gallery-29, #gallery-30').bxSlider({
		wrapper_class: 'gallery-wrap',
		margin: 0,
		width: 525,
		pager: false
	});

});
