;(function($) {
$(document).ready(function() {
	
	//smooth navigation tab transition
	$(".navlink").click(function(e){
		$(".navlink").removeClass("current");
		$(this).addClass("current");
	})

	// clear the search field on click
	clearField("#SearchForm_SearchForm");
	
	
	// cascade
	
	
	if ( $('div.tabs').length ) { 
	
	$("div.tabs").tabs(".images > div", {

		// enable "cross-fading" effect
		effect: 'fade',
		fadeOutSpeed: "slow",
		
		// start from the beginning after the last tab
		rotate: true
		
	// use the slideshow plugin. It accepts its own configuration
	}).slideshow({autoplay:true, interval: 5000, autopause: true});
	
	};
	
	// initialize scrollable
	if ( $('.scrollable').length ) { 
	$(".scrollable").scrollable({circular:true});
	}
	
	//subIntro slides
	if ( $('.slideshow').length ) { 	
	$(".slideshow").cycle();
	$(".slideshow img").css({visibility:"visible"});
	}
	
	
	
	});

// search form clearer
function clearField(form) {
        jQuery(form).find("input.text, textarea").each(function(){  
            this.defaultValue = this.value;
            jQuery(this).click(function(){
                if(this.value == this.defaultValue){
                    jQuery(this).val("");
                }
                return false;
            });
            jQuery(this).blur(function(){
                if(this.value == ""){
                    jQuery(this).val(this.defaultValue);
                }
            });
        });
}
})(jQuery);
