// JavaScript Document

// Set and Clear
(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() {
	
	// Breaking News
	$('#breakingNews').append('<p class="breakingNewsLink">View Our Designs at Marble Hill</p>');
	var newsStatus = 'closed';
	
	$('.breakingNewsLink').click(
		function(){
			
			if (newsStatus === 'closed') {
				$('#breakingNews').animate({
					top: "+=100px"
				}, 500, "swing");
				newsStatus = 'open';
			} else {
				$('#breakingNews').animate({
					top: "-100px"
				}, 500, "swing");
				newsStatus = 'closed';
			}
			
		}
	);
	
	$('#imageSlider').anythingSlider({
		easing: "swing",          // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		delay: 5500,                    // How long between slide transitions in AutoPlay mode
		animationTime: 700,             // How long the slide transition takes
		hashTags: false,                // 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       // Details at the top of the file on this use (advanced use)
	});
	
	$('#textSlider').anythingSlider({
		easing: "swing",          // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		delay: 5500,                    // How long between slide transitions in AutoPlay mode
		animationTime: 700,             // How long the slide transition takes
		hashTags: false,                // Should links change the hashtag in the URL?
		buildNavigation: true,         // If true, builds and list of anchor links to link to each slide
		buildArrows: false,
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "Start",             // Start text
		stopText: "Stop",               // Stop text
		navigationFormatter : function(index, panel){
			return panel.children('h3').text(); // This would have each tab with the text 'Panel #X' where X = index
		}
	});
	
	
	
	$("a[rel=imageGroup]").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	$("a[rel=fancybox]").fancybox({
		'overlayShow'	: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
	
	// SET AND CLEAR DEFAULT
	$('input.clear-default').clearDefault();

	
	
	
	
	
					   
});
