var _c = _h = 0;
$(function(){
    $('#play > a').click(function(){
        var i = $(this).attr('alt') - 1;
//        clearInterval(_h);
        _c = i;
//        play();
        change(i);        
    })
//    $('#play > a').hover(function(){
//	$(this).css('background-color','#f221a1');
//    }).mouseout(function(){
//	$(this).css('background-color','#fff');
//    })
//    $("#pic img").hover(function(){clearInterval(_h)}, function(){play()});
    play();
})
$(function(){
$('#h-pre > a').click(function(){
//        clearInterval(_h);
        _c = _c < 1 ? 4 : _c - 1;
        change(_c);

//	play();
	})
//	.mouseout(function(){
//           play();
//	})
})

$(function(){
$('#h-next > a').click(function(){
//        clearInterval(_h);
        _c = _c > 3 ? 0 : _c + 1;
        change(_c);

//	play();
	})
//	.mouseout(function(){
//           play();
//	})
})

$(function(){
$('#stop > a:eq(0)').click(function(){
	$(this).hide();
	$('#stop > a:eq(1)').show();
        clearInterval(_h);
	})
$('#stop > a:eq(1)').click(function(){
	$(this).hide();
	$('#stop > a:eq(0)').show();
	play();
	})
})
function play()
{
	_num = document.getElementById('kv_num').value;
	_num = _num > 0 ? _num -2 : 1;
    _h = setInterval("auto()", 5500);
}
function change(i)
{
    $('#play a').addClass("nomal_navi").removeClass("current_navi").eq(i).addClass("current_navi").removeClass("nomal_navi").blur();
    $("#pic img").hide().eq(i).fadeIn('slow');
}
function auto()
{    
    _c = _c > _num ? 0 : _c + 1;
    change(_c);
}

