// JavaScript Document
jQuery.fn.loadthumb = function(options) {
	options = $.extend({
		 src : ""
	},options);
	var _self = this;
	_self.hide();
	var img = new Image();
	$(img).load(function(){
		_self.attr("src", options.src);
		$("#imgload a").attr("href", options.href);
		_self.fadeIn("slow");
	}).attr("src", options.src);  
	return _self;
}

$(window).load(function(){
	 var len  = $("#num > li").length;
	 var index = 0;
	 var adTimer;
	 $("#num li").mouseover(function(){
		index  =   $("#num li").index(this);
		showImg(index);
	 }).eq(0).mouseover();	
	 $('#imgload').hover(function(){
			 clearInterval(adTimer);
		 },function(){
			 adTimer = setInterval(function(){
			    index++;
				if(index==len){index=0;}
				showImg(index);				
			  } , 5000);
	 }).trigger("mouseleave");
});

function showImg(index){
		$("#imgload img").loadthumb({src:src[index],href:href[index] });
		$("#num li").removeClass("on")
			.eq(index).addClass("on");
}

