// load gallery images
$("#gallery").html($("#gallery").html()+'<a href="/network-and-security.htm"><img src="/images/computer-solution/computer-security.jpg"/></a>');
$("#gallery").html($("#gallery").html()+'<a href="/free-computer-network-consultation_network-and-security.htm"><img src="/images/computer-solution/networking.jpg"/></a>');
$("#gallery").html($("#gallery").html()+'<a href="/computer-repair.htm"><img src="/images/computer-solution/pc-repair.jpg"/></a>');
$("#gallery").html($("#gallery").html()+'<a href="/remote-it-support_computer-repair.htm"><img src="/images/computer-solution/remote-support.jpg"/></a>');
$("#gallery").html($("#gallery").html()+'<a href="web-server-web-hosting_website-company.htm"><img src="/images/computer-solution/web-hosting.jpg"/></a>');

// load thumb images
$("#thumbs").html($("#thumbs").html()+'<img src="/images/computer-solution/computer-security-tn.jpg"/>');
$("#thumbs").html($("#thumbs").html()+'<img src="/images/computer-solution/networking-tn.jpg"/>');
$("#thumbs").html($("#thumbs").html()+'<img src="/images/computer-solution/pc-repair-tn.jpg"/>');
$("#thumbs").html($("#thumbs").html()+'<img src="/images/computer-solution/remote-support-tn.jpg"/>');
$("#thumbs").html($("#thumbs").html()+'<img src="/images/computer-solution/web-hosting-tn.jpg"/>');

var index = 0;
var images = $("#gallery a");
var thumbs = $("#thumbs img");
var imgHeight=thumbs.attr("height");
thumbs.slice(0,3).clone().appendTo("#thumbs");
	
for ( i=0; i<thumbs.length; i++ ){
	$(thumbs[i]).addClass("thumb-"+i);
	$(images[i]).addClass("image-"+i);
}

$("#gallery a img").hover(function(){$(this).fadeTo(1,0.9)},function(){$(this).fadeTo(1,1.0)});
$("#next").click(sift);
show(index);
setInterval(sift,8000);

function sift(){
	if (index<(thumbs.length-1)) { index+=1; } else {index=0;}
	show(index);
}

function show(num){
	images.fadeOut(400);
	$(".image-"+num).stop().fadeIn(400);
	var scrollPos = (num)*imgHeight;
	$("#thumbs").stop().animate({scrollTop: scrollPos},400);
}
