// JavaScript Document
$().ready(function(){
var selimage='';

var count=0;
var initmouseov=-1;
var mouseov=-1;
var lis='';
var j=0;
for(var i=0;i<16;i++){
	$("#thumbs").append('<li><img id="t'+i+'" class="hd'+j+'" src="images/hd'+j+'.jpg" alt="" /></li>');
	j++;
	if(j>7) j=0;

}
for(var k=0;k<8;k++){
	$("#big").append('<li id="hd'+k+'b"><img src="images/hd'+k+'big.jpg" alt="" /></li>');
}


 $('#thumbs img').mouseenter(function(){
	 mouseov=parseInt($(this).attr("class").replace("hd",""));
	 initmouseov=mouseov;
	 $(this).css('border-color','#fff');
	 $('#big').hide();
	 $('#big li').hide();
	 selimage="#"+$(this).attr("class")+"b";
	 $(selimage).show();
	 $('#big').fadeIn(800);

 }
 );
 
  $('#thumbs img').mouseleave(function(){
	 $(this).css('border-color','#000');
	 $('#big').hide();
 }
 );

	
	
  function init(){
	  $('#thumbs').animate({
    left: '-=168'
  }, 5000, function() {
	  count++; 
	  if(count==8){
		  $('#thumbs').css('left',0);
		  count=0;
	  }
  
	 
	  init();
	  
  });
  }

  init();  
	
});

