// ################ This is Active for Dropshadow ##################
window.onload = function()  
{
	$(".figure_left").dropShadow({top: 0,right: 0, bottom: 0, left: 0, opacity: 0.2, blur: 3});
};

//-------------------------- this is active for Banner Slideshow --------------------------
function slideSwitch() {
	var $active = $('#slideshow IMG.active');

	if ( $active.length == 0 ) $active = $('#banner 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');
		});
}

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

//------------------------- This is active for Custom Controls -------------------------	
/*
$(document).ready(function(){ 
	$(function(){		
		$("select").uniform();
		$(":radio").uniform();
		$(":checkbox").uniform();
	});	
});
*/


// ------------------------ This is Active for Menu ----------------------------
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)
//$("ul.topnav li span").click(function() { //When trigger is clicked...

$("ul.topnav li a").mouseover(function() 
{		
	$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

	$(this).parent().hover(function(){}, function(){
		$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
	});
	
//$(this).parent().find("ul.subnav").hover(function(){$(this).addClass("subhover");},function(){$(this).removeClass("subhover");} );

}).hover(function() { 
		$(this).addClass("subhover"); //On hover over, add class "subhover"
	}, function(){	//On Hover Out
		$(this).removeClass("subhover"); //On hover out, remove class "subhover"
		});

//Remain hover status for ".parent_item"
$("ul.subnav").hover(
  function () {
	$(this).parent().find(".parent_item").addClass("subhover");
  },
  function () {
	$(this).parent().find(".parent_item").removeClass("subhover");
  }
 );

// ------------------------ This is Active for Carousel ----------------------------
jQuery('#mycarousel').jcarousel({
	auto: 0, /* 0 for not auto scroll */
	wrap: 'last',
	scroll: 1,
	initCallback: mycarousel_initCallback
});

function mycarousel_initCallback(carousel)
{
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});		
	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});

	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};

// ------------------------ This is Active for Round Corner ----------------------------
$('.gallery_pic img').corner("5px");


