// JavaScript Document
// Pic Slide Show
var _c = _h = 0;
var picnum = 0;
$(function(){
	$('#play > a').eq(0).addClass('active');
    $('#play > a').click(function(){
        var i = $(this).attr('title') - 1;
        clearInterval(_h);
        _c = i;
        play();
        change(i); 
		return false;
    })
    $("#brandBanner img").hover(function(){clearInterval(_h)}, function(){play()});
    play();
});

function play()
{
    _h = setInterval("auto()", 4000);
}
function change(i)
{
    $('#play > a').removeClass('active').eq(i).addClass('active').blur();
    $("#brandBanner img").fadeOut('slow').eq(i).fadeIn('slow'); 
}
function auto()
{    
	picnum = $("#pic img").length - 2;
    _c = _c > picnum ? 0 : _c + 1;
    change(_c);
}