/***********************************************************
PhotoViewer (using  jQuery)
by BEE SOFT srl
***********************************************************/

var imgsrc = new Array(), linksrc = new Array(), caption = new Array(), num = 0, current = 0;

$(document).ready(function(){ photo_init();	});

function photo_init() {
	num = $("#image").find("IMG").size();
	
	$("#image").find("IMG").each(function(i){
		caption[i] = this.getAttribute("alt");
		imgsrc[i] = this.getAttribute("src");
	});
	
	show(0);
}

function show(index) {
    $("#image").find(".item").hide();
	gg = $("#image").find(".item").get(index);
	$(gg).show();
	
	current = "["+ (index + 1) +"/"+ num +"]"; 
	
	if (index == 0) $("#nav").html("<span class='prev'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Larr.jpg'/></span><span class='next'><a href='javascript:show("+ (index + 1) +");'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Rarr_active.jpg'/></a></span><div id='caption'>"+ caption[index] +"</div><div id='current'>"+ current +"</div>");
	else if (index == num - 1 ) $("#nav").html("<span class='prev'><a href='javascript:show("+ (index - 1) +");'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Larr_active.jpg'/></a></span> <span class='next'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Rarr.jpg'/></span><div id='caption'>"+ caption[index] +"</div><div id='current'>"+ current +"</div>");
	else $("#nav").html("<span class='prev'><a href='javascript:show("+ (index - 1) +");'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Larr_active.jpg'/></a></span> <span class='next'><a href='javascript:show("+ (index + 1) +");'><img src='http://www.hotelteta.it/wp-content/themes/hotelteta.it/images/Rarr_active.jpg'/></a></span><div id='caption'>"+ caption[index] +"</div><div id='current'>"+ current +"</div>");
}
