$(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({clickable:false});
	};
	
	// initialize scrollable
	if ( $('.scrollable').length ) { 
	$(".scrollable").scrollable({circular:true});
	}
	
	//subIntro slides
	if ( $('.slideshow').length ) { 	
	$(".slideshow").cycle();
	$(".slideshow img").css({visibility:"visible"});
	}
	
	
	
	//************ ACCORDIAN *******************************
	
	//this works - uses the jquery ui tabs so don't need accordian plugin
	//$("#faq").tabs("#faq div", {tabs: 'a', effect: 'slide', initialIndex: 0});

	
	//this works - uses the jquery.accordian plugin
	//$('#faq').accordion({
	//			autoheight: false
	//		});
	
	//this is just straight jquery - allows multiple questions to be open - no plugin
	$('#faq a').click(function() {
			$(this).next().toggle('fast');
			return false;
		}).next().hide();
		
		
		
		
	
	
	
	});













// 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);
                }
            });
        });
}
