(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() {

	/* 	MIKOS SLIDER
		-------------------------------------------------------------*/
	
		$('#video_list').mikos_slider({
			visibleElements: 4
		});
	   
	   	$('#slider').mikos_slider({
    		slide_interval: 4000
		});



	/* 	TABS
		-------------------------------------------------------------*/
		
		$('.tabbed').each(function() {
			var height = 0;
			
			$('.tab_content', this).each(function() {
				height = $(this).height() > height ? $(this).height() : height;
			});
			
			$(this).height(57 + height);
		});
		
		$('.tabs a').click(function() {
			var index = $(this).parent().index();
			var panel = $(this).parent().parent().parent();
			$('.tabs li.on', panel).removeClass('on')
			$(this).parent().addClass('on');
			$('.tab_on', panel).removeClass('tab_on');
			$('.tab_content:eq('+index+')', panel).addClass('tab_on');
			panel.height($('.tab_on', panel).height() + 57);
			return false;
		});



	/* 	EXTERNAL LINKS
		-------------------------------------------------------------*/
		
		$("a.external").click( function() {
			window.open( $(this).attr("href") );
			return false;
		});
	


	/*	CLEAR INPUT FIELDS ONFOCUS
		-------------------------------------------------------------*/
		
		$("input.clearinput").clearDefault();	
		
		
			
		
		
 	/* 	COLORBOX LINKS
		-------------------------------------------------------------*/
		
		// $("[rel=iframe]").colorbox({width:"546", height:"410", iframe:true});



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

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



	/* 	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
		// });

	
	
});
