﻿jQuery(document).ready(function($) {
	// Tabs News Event
	// Tabs News Event	
	$('.right_content a.tab').click(function(){
		$('.right_content .active').removeClass('active');
		$(this).addClass('active');
		$('.right_content .content').hide();
		var content_show = $(this).attr('title');
		$('#'+ content_show).show();
		return false;
	});
	$('.left_content a.tab').click(function(){
		$('.left_content .active').removeClass('active');
		$(this).addClass('active');
		$('.left_content .content').hide();
		var content_show = $(this).attr('title');
		$('#'+ content_show).show();
		return false;
	});
	$(".jCarouselLite_product").jCarouselLite({
        btnNext: ".carousel_product .next",
        btnPrev: ".carousel_product .prev",
		visible: 1,
		speed: 500 
    });
});
$(window).load(function(){

    //slider
    $('#slider').nivoSlider({
        directionNav    : false,
        keyboardNav     : false,
        captionOpacity  : .5
    });

    //logo
    var max_height_logo = 0;
    var total_width_logo = 0;
    $('#extras .logo li img').wrap('<span></span>');
    $('#extras .logo li').each(function(){
        if ($(this).outerHeight() > max_height_logo){
            max_height_logo = $(this).outerHeight();
        }
        total_width_logo += $(this).outerWidth();
    }).each(function(){
        $(this).css({
            'padding-top': Math.floor((max_height_logo - $(this).outerHeight()) / 2),
            'height'     : max_height_logo
        });
    }).parent().css('height', max_height_logo);
    $('#extras .logo li span').each(function(){
        var logo = $(this).find('img').attr('src');
        var bg = logo.replace('-bw', '');
        $(this).css({
            'background': 'url(' + bg + ') no-repeat',
            'display'   : 'block'
        }).find('img').stop().hover(
            function(){ $(this).animate({'opacity': 0}, 500); },
            function(){ $(this).animate({'opacity': 1}, 500); }
        );
    });

});

