// JavaScript Document
$(document).ready(function(){ 
$imageShow=$('.imageShow'); 
$images=$('.imageSrc li',$imageShow); 
$imageSwitches=$('.imageSwitch li',$imageShow); 
if($images.size()>0){ 
init(); 
var timer=setInterval(autoSwitch,3000); 
$imageSwitches.each(function(index,item){ 
$(item).click(function(){ 
clearInterval(timer); 
setTimeout(function(){timer=setInterval(autoSwitch,3000)},3000); 
$imageSwitches.css('background-color','').eq(index).css('background-color','#E22E51'); 
if(index!=$imageShow.data('show')){ 
$imageShow.data('show',index); 
$images.hide().eq(index).fadeIn('slow'); 
} 
}); 
}); 
} 
function autoSwitch(){ 
$nowIndex=$imageShow.data('show')+1; 
if($images.size()>$nowIndex){ 
$imageSwitches.css('background-color','').eq($nowIndex).css('background-color','#E22E51'); 
$imageShow.data('show',$nowIndex); 
$images.hide().eq($nowIndex).fadeIn('slow'); 
}else{ 
init(); 
} 
} 
function init(){ 
$imageShow.data('show',0); 
$images.hide().eq(0).fadeIn('slow'); 
$imageSwitches.css('background-color','').eq(0).css('background-color','#E22E51'); 
} 
});
