$(document).ready(function(){
	// plan-tabs
	$('#mapTabs').tabs({
		selected: 1,
		select: function(event, ui) {showMapList(ui.tab.href.split('#')[1])}
	});
	if($('#mapTabs').length > 0) {
		showMapList($('#mapTabs .ui-tabs-selected a:eq(0)').attr('href').split('#')[1]);
	}
	
	// plan-point
	$(".counters li").not(".counters li.disabled").mouseover(function(){
		$(".counters li").css("z-index", "0");
		$(".cloud").hide();
		$(this).css("z-index", "100");
		var cloud = $(this).children(".cloud");
		cloud.css("bottom", $(this).outerHeight());
		cloud.show();
	});
	$(".counters li").not(".counters li.disabled").mouseout(function(){
		$(this).css("z-index", "0");
		var cloud = $(this).children(".cloud");
		cloud.hide();
	});
	
	// list-point
	$("#mapParterList a").click(function(e){
		var num = $.inArray(this, this.parentNode.parentNode.getElementsByTagName("a"));
		var elm = $("#mapParter .counters li").not("li.disabled").get(num);
		$(elm).trigger("mouseover");
		return false;
	});
	$("#mapPietroList a").click(function(e){
		var num = $.inArray(this, this.parentNode.parentNode.getElementsByTagName("a"));
		var elm = $("#mapPietro .counters li").not("li.disabled").get(num);
		$(elm).trigger("mouseover");
		return false;
	});
	
	// prettyPhoto
	$("a[rel^='prettyPhoto']").prettyPhoto({
		theme:'facebook',
		default_width:960,
		changepicturecallback: function(){
			panoramaStart();
		}
	});
});

function showMapList(id) {
	$('.counterList').hide();
	$('#' + id + 'List').show();
}

// panorama
function panoramaStart() {
	$("div#mainPanoramaSliderInner").smoothDivScroll({
		scrollingSpeed: 12,
		mouseDownSpeedBooster: 3
	});
}

// miniMap
function miniMapShow(id) {
	$("#miniMap .locNum").hide();
	$("#mmPoint"+id).show();
}
function miniMapHide() {
	$("#miniMap .locNum").hide();
	$("#miniMap .active").show();
}
