(function($){
	$.fn.clearDefault = function(){
		return this.each(function(){
			var default_value = $(this).val();
			$(this).focus(function(){
				if ($(this).val() == default_value) $(this).val("");
			});
			$(this).blur(function(){
				if ($(this).val() == "") $(this).val(default_value);
			});
		});
	};
})(jQuery);




$(document).ready(function() {

	

	/* 	EXTERNAL LINKS
		-------------------------------------------------------------*/

		$("[rel=external]").click( function() {
			window.open( $(this).attr("href") );
			return false;
		});
		
		
		
	/*	FORM VALIDATION
		-------------------------------------------------------------*/
		
		$(".form").validate();
		
		
		
 	/* 	COLORBOX LINKS
		-------------------------------------------------------------*/
		
		$("[rel=iframe]").colorbox({width:"546", height:"410", iframe:true});
		$("a.colorbox").colorbox;



	/* 	SHOW/HIDE
		----------------------------------------------------------*/

		$("ul.accordion ul").hide();
	   
		$("ul.accordion li a").click(function () {
			$(this).next("ul").toggle();
			return false;
		});
	


	/*	CLEAR INPUT FIELDS ONFOCUS
		-------------------------------------------------------------*/
		
		$("input.clear").clearDefault();



	/* 	CYCLE EFFECT
		----------------------------------------------------------*/

		$(".anythingSlider").anythingSlider({
		   easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
		   autoPlay: false,                 // This turns off the entire FUNCTIONALITY, not just if it starts running or not
		   startStopped: false,            // If autoPlay is on, this can force it to start stopped
		   delay: 3000,                    // How long between slide transitions in AutoPlay mode
		   animationTime: 600,             // How long the slide transition takes
		   hashTags: true,                 // Should links change the hashtag in the URL?
		   buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		   pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		   startText: "Start",             // Start text
		   stopText: "Stop",               // Stop text
		   navigationFormatter: null       // Advanced Use: details below
		});
		
		$(".carousel-wrapper").anythingSlider({
		   easing: "swing",                // Anything other than "linear" or "swing" requires the easing plugin
		   autoPlay: true,                 // This turns off the entire FUNCTIONALITY, not just if it starts running or not
		   startStopped: false,            // If autoPlay is on, this can force it to start stopped
		   delay: 6000,                    // How long between slide transitions in AutoPlay mode
		   animationTime: 800,             // How long the slide transition takes
		   hashTags: true,                 // Should links change the hashtag in the URL?
		   buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		   pauseOnHover: false,             // If true, and autoPlay is enabled, the show will pause on hover
		   startText: "Start",             // Start text
		   stopText: "Stop",               // Stop text
		   navigationFormatter: null       // Advanced Use: details below
		});


	
});
