/**********************************TOGGLE INPUT VALUE ON FOCUS**********************************/
$.fn.ToggleInputValue = function(){
    return $(this).each(function(){
        var Input = $(this);
        var default_value = Input.val();

        Input.focus(function() {
           if(Input.val() == default_value) Input.val("");
        }).blur(function(){
            if(Input.val().length == 0) Input.val(default_value);
        });
    });
}
/**********************************END TOGGLE INPUT VALUE ON FOCUS**********************************/
	
$(document).ready(function() {
	
	$('.slideshow.cdc').cycle({ 
		fx: 'none',
	    speed: 100,
	    timeout: 2000,
	    prev: '.prev',
	    next: '.next',
	    autostop: 20,
	    before: onBeforeCDC
	});
	
	function onBeforeCDC() { 
	    $('.year').html(this.alt); 
	}
	
	$('.slideshow.home').cycle({ 
		fx: 'fade',
	    speed: 1500,
	    timeout: 8000,
	    pager: '.slide-nav',
	    before: onBeforeProducts,
		pagerAnchorBuilder: function(index, el) {
        return '<a href="#"> </a>';
		}
	});
	
	function onBeforeProducts() { 
	    $('.product-desc').html(this.alt); 
	}
	
	$('.solution-content').hide();
	$('.problemBtn').css("background-color","#1b58a5");
	
	$('.solutionBtn').click(function(){
		$('.problem-content').fadeOut(300);
		$('.solution-content').delay(300).fadeIn(800);
		$('.sidebar-section.stats').slideDown(800);
		$(this).css("background-color","#1b58a5");
		$('.problemBtn').css("background-color","#a5a5a9");
	});
	
	$('.problemBtn').click(function(){
		$('.solution-content').fadeOut(300);
		$('.problem-content').delay(300).fadeIn(800);
		$('.sidebar-section.stats').slideUp(800);
		$(this).css("background-color","#1b58a5");
		$('.solutionBtn').css("background-color","#a5a5a9");
	});
	
	$('#respond').addClass('clearfix');
	
	$('#mp_2_8').ToggleInputValue();
	
});

