// JavaScript Document
//this script is for sample and overview pages
var currentImg
$(document).ready(function(){
	
	$('.thList li').eq(0).addClass('thActive');
	
	$('.imgList li').hide();
	currentImg = $('.imgList li').eq(0);
	$(currentImg).show();
	//
	
	$('.thList li').hover(
		function(){
			$(this).addClass('thOver');	
		},
		function () {
			$(this).removeClass('thOver');
		}
	);
	$('.thList li').click(function(){		
			//
			$('.thList li').removeClass('thActive');
			$('.thList li').removeClass('thOver');
			
			var position = inArray($(this), $('.thList li'));
			var nextImg = $('.imgList li').eq(position);
			$(currentImg).hide();
			$(nextImg).fadeIn('fast');
			currentImg = nextImg;
			
			$(this).addClass('thActive')
		}
	);	
});
//
function inArray(value, arr) {
	for(i = 0; i< arr.length; i++) {
		var v1 = $(arr[i]).attr('id');	
		var v2 = $(value).attr('id');
		if(v1 == v2){
			return i;
		}
	}
}