var photos = new Array();
var items = new Array();

function initGallery(){
	photos = $('.hl-photo div.hl-photo-view div.hl-photo-large');
	items = $('.hl-photo div.hl-photo-thumb div.hl-photo-item');
	$.each(items,function(i, it){
		$(it).click(function(){
			changePhoto(i);
		});
	});
	
	changePhoto(0);
}

function changePhoto(i){
	index = i==banners.length ? 0 : i;

	$(items).removeClass('active');
	$(items).eq(index).addClass('active');
	$(photos).stop().animate({opacity: 0},1000,function(){$(this).css('z-index','1');});
	$(photos).eq(index).stop().animate({opacity: 1},1000,function(){$(this).css('z-index','5');});
}

