// JavaScript Document

function mycarousel_initCallback(carousel, item, idx, state) {
	
	// External controls
	$('.jcarousel-control a').bind('click', function() {
		var index = $(this).attr("id").split("_");
		carousel.scroll(jQuery.jcarousel.intval(index[1]));
        $(".jcarousel-control a").removeClass("current"); //Remove any "active" class
		$(this).addClass("current");
        return false;
        carousel.startAuto(0);
    });
	
    // 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();
    });
	
	 // Pause autoscrolling if the user moves with the cursor over the tab navigation
    $('.jcarousel-control a').hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

function mycarousel_itemVisibleInCallbackAfterAnimation(carousel, item, idx, state) {
    $(".jcarousel-control a").removeClass("current");
	$(".jcarousel-control #_" + idx).addClass("current");
};

$(document).ready(function() {
    $('#homeSlideshow').jcarousel({
        scroll: 1,
		auto: 8,
        wrap: 'last',
        initCallback: mycarousel_initCallback,
		itemVisibleInCallback: {
            onAfterAnimation:  mycarousel_itemVisibleInCallbackAfterAnimation
        }
    });
});


$(document).ready(function() {
var parentTaglineEl = $('#tagline');
parentTaglineEl.cycle({
fx: 'fade',
speed: 1000,
timeout: 10000,
random: 0
});
});

function collapsElement(id) {
    if ( document.getElementById(id).style.display != "none" ) 
	
	{
        document.getElementById(id).style.display = 'none';
    }
    else {
        document.getElementById(id).style.display = '';
    }
}
