//PRELOAD OVER MENU

$(function(){			
	$.preload( 'img.rollover', {
	    find:'.jpg',
	    replace:'-click.jpg'
	});
	
	//add animation
	$('img.rollover').hover(function(){
		this.src = this.src.replace('.jpg','-click.jpg');	
	},function(){
		this.src = this.src.replace('-click','');
	});
});

//SLIDESHOW

function slideSwitch() {
    var $active = $('#slideshow IMG.active'); 
    var $ttlactive = $('#title-news h1.title-active');
    var $txtactive = $('#txt-news h2.txt-active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    if ( $ttlactive.length == 0 ) $ttlactive = $('#title-news h1:last');
    if ( $txtactive.length == 0 ) $txtactive = $('#txt-news h2:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');
        
    var $ttlnext =  $ttlactive.next().length ? $ttlactive.next()
        : $('#title-news h1:first');
        
    var $txtnext =  $txtactive.next().length ? $txtactive.next()
        : $('#txt-news h2:first');

    $active.addClass('last-active');
    $ttlactive.addClass('last-title-active');
    $txtactive.addClass('last-txt-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1500, function() {
            $active.removeClass('active last-active');
        });
        
    $ttlnext.css({opacity: 0.0})
        .addClass('title-active')
        .animate({opacity: 1.0}, 1500, function() {
            $ttlactive.removeClass('title-active last-title-active');
        });
        
   $txtnext.addClass('txt-active')
   $txtnext.animate({fontWeight:'bold'}, 1500, function() {
   	$txtactive.removeClass('txt-active last-txt-active');
   });
        
}

$(function() {
    setInterval( "slideSwitch()",6000 );
});

// UNIFORM

$(function(){
	$("input:checkbox").uniform();
});

