var _c = _h = 0;
var _quantity=-1;
$(function(){
    $("#pic img").each(function(i){
        $("#play").prepend('<a href="javascript:void(0);" alt="'+(i+1)+'">'+(i+1)+'</a>');
		_quantity++;
    });
    
    //$("#tips").html($("#pic img:first").attr("data"));
    
    $('#play>a').click(function(){
        var i = $(this).attr('alt') - 1;
        clearInterval(_h);
        _c = i;
        play();
        change(i);
    })
    $("#pic img").hover(function(){clearInterval(_h)}, function(){play()});
	change(0);
    play();
})
function play()
{
    _h = setInterval("auto()", 5000);
}
function change(i)
{
    $('#play > a').css('background-color','#002C9C').eq(i).css('background-color','#00A69E').blur();
    $("#pic img").hide().eq(i).fadeIn('slow');
	//$("#tips").html($("#pic img").eq(i).attr("data"));
}
function auto()
{    
    _c = _c >= _quantity ? 0 : _c + 1;
    change(_c);
}


