$(document).ready(function() {

    $(".icon").mouseover(function(){
      $(this).animate({ 
        opacity: 0.4
      }, 500 );
    });
    $(".icon").mouseout(function(){
      $(this).animate({ 
        opacity: 1.0
      }, 500 );
    });

	
/*
	$("#nav a, .link, .box").mouseover(function(){
		$(this).animate({
			opacity: 0.60
		}, 250 );
	});
	
	$("#nav a, .box, .link").mouseout(function(){
		$(this).animate({
			opacity: 1
		}, 250 );
	});
*/

    jQuery('#carousel').jcarousel({
        auto: 5,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
    var i = 0;
    
    $('.hidden').click(function() {
    	i++;
    	if (i % 2 == 1) {
    		$('.arr').html('^ ');	
    	} else {
    		$('.arr').html('&gt; ');	
    	}
    	
    	$('.hiddencontent').slideToggle();
    });
    
    // this little guy is used to get the id of a specific video
    // instance and load up the player so it doesn't mess up validation.
    // The id is sent to the controller which trims the 'video_' prefix
    // and sends back the complete video player.
    $('.player').click(function() {
    	var id = $(this).attr('id');
    	$('.player').load('/adeeva/flash/'+id);
    });
    
    $('.row').mousedown(function() {
    	var data = $(this).attr('title');
    	$('#infoblock').fadeIn();
    	$('#info').html("<strong>Event: </strong>"+data);
    });
    
    $("#seminars tr:nth-child(odd)").addClass("odd");
    
});

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

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

    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
