$(document).ready(function() {
  $('#taglineClose').click(function() {
  $('#tagline').fadeTo('fast', 0, function() {
      // Animation complete.
    });
  $('#tagline').slideUp('slow', function() {
    // Animation complete.
  });
});		

homeload();
	resizer();


$(".frontHero").hover(
  function () {
    $(this).children('.imageCaption').addClass("title_hover");
    },
  function () {
    $(this).children('.imageCaption').removeClass("title_hover");
  }
);

});


$(window).resize(function() {
	resizer();
});


function resizer(){

	if($(window).width() < 1400 && $(window).width() >= 1130){
		$('#col3').fadeIn('slow');
		$('#col4').fadeOut('slow',
			function(){
			$('.container').addClass('width1130');
			$('.header_inside').addClass('width1130');
			$('.container').removeClass('width860');
			$('.header_inside').removeClass('width860');
			$('form.search_form').addClass('hideThis');
			$('.logo').removeClass('width280');
			$('.logo').addClass('width650');
			
			});
		}
		
	if($(window).width() < 1130){
		$('#col4').fadeOut('slow');
		$('#col3').fadeOut('slow',
					function(){
		
		$('.logo').addClass('width280');
		$('.logo').removeClass('width650');

		$('.container').removeClass('width1130');
		$('.header_inside').removeClass('width1130');
		$('.container').addClass('width860');
		$('.header_inside').addClass('width860');
		$('form.search_form').addClass('hideThis');

		$('#brand').hide();
		});
		}	
		
		
if($(window).width() > 1399){
		$('#col3').fadeIn('slow');
		$('#col4').fadeIn('slow');
		$('.logo').removeClass('width280');
		$('.logo').removeClass('width650');
		$('.container').removeClass('width1130');
		$('.header_inside').removeClass('width1130');
		$('.container').removeClass('width860');
		$('.header_inside').removeClass('width860');
		$('form.search_form').removeClass('hideThis');
		$('#brand').fadeIn('slow');

			}
}		


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
		
		
var tweetsShown = 0;			
function homeload(){
	
	$('#col1').load('/pages/components/ajaxCols.php?col=20&size=home_column_wide', function() { populateTweet("#col1"); });
	$('#col2').load('/pages/components/ajaxCols.php?col=21&size=home_column_wide', function() { populateTweet("#col2"); });
	$('#col3').load('/pages/components/ajaxCols.php?col=23&size=home_column_narrow', function() { populateTweet("#col3"); });
	$('#col4').load('/pages/components/ajaxCols.php?col=22&size=home_column_narrow', function() { populateTweet("#col4"); });
	}
		

function populateTweet(div) {
	if(tweetsShown < twitterStatuses.length && $(div +" .twitter-box").size() > 0) {
		$(div +" .twitter-box").html(twitterStatuses[tweetsShown]);
		tweetsShown++;	
	} else {
		$(div +" .twitter-box").remove();
	}
}
		

