$(document).ready(function(){

	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c1.png) no-repeat');
	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c2.png) no-repeat');
	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c3.png) no-repeat');
	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c4.png) no-repeat');
	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c5.png) no-repeat');
	// $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c1.png) no-repeat');

	// $('#c1').hover( function(){
        // $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c1.png) no-repeat');
    // });
    // $('#c2').hover( function(){
        // $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c2.png) no-repeat');
    // });
	// $('#c3').hover( function(){
        // $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c3.png) no-repeat');
    // });
	// $('#c4').hover( function(){
        // $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c4.png) no-repeat');
    // });
    // $('#c5').hover( function(){
        // $('#homebanner').css('background', 'url(homepage_assets/img/homebanner/c5.png) no-repeat');
    // });
	
	$('#homebanner .left').cycle({ 
		fx: 'none',
		cleartypeNoBg: true,
		timeout: 10000
	});

	$('#homebanner .right li').each(function(i, el){
		$(el).mouseover(function(){
			$('#homebanner .left').cycle(i);
		});
	});
	
	//trigger slideshow
	$(function() {
    $('#slideshow IMG').not('.active').hide();
	setInterval( "slideSwitch()", 5000 );
	});
});

//slideshow function from http://jonraasch.com/blog/a-simple-jquery-slideshow
function slideSwitch(switchSpeed) {
    var $active = $('#slideshow IMG.active');
    
    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next('IMG').length ? $active.next('IMG')
       : $('#slideshow IMG:first');
    
    $active.addClass('last-active');
   
    $next.css({opacity: 0.0})
        .addClass('active')
		.animate({opacity: 1.0}, switchSpeed, function() {
            $(".last-active").fadeOut("slow");
			$active.removeClass('active last-active');
			$(".active").fadeIn("slow");
        });
}
