$(document).ready(function() {
	if ($("#pronounce")) {
		var source=$("#pronounce").attr('href');
		if (source!=undefined) {
			var so=new SWFObject(window.staticRoot+"/swf/player.swf","flashpronounce","290","24","8","#FFFFFF");
			so.addVariable("soundFile",source);
			so.write("pronounce");
		}
	}
	if ($("#maptabs")) {
		if ($("#localitybtn").length>0) {
			showTab("locality");
		} else {
			showTab("metro");
		}
		if ($("#metrobtn")) {
			$("#metrobtn").click(function() {
				return showTab("metro");
			});
		}
		if ($("#exitbtn")) {
			$("#exitbtn").click(function() {
				return showTab("exit");
			});
		}
		if ($("#localitybtn")) {
			$("#localitybtn").click(function() {
				return showTab("locality");
			});
		}
	}
});
function enlargePhoto(medium_url,width,height,photo_title,owner_url,owner_name,photo_url) {
		$('#bigphotoimg').css('visibility',"hidden");
		$('#bigphotoimg').load(function() {
			$(this).css('visibility',"visible");
		});
		$('#bigphotoimg').attr('src',medium_url);
		$('#bigphotoimg').width(width);
		$('#bigphotoimg').height(height);
		$('#bigphotoimg').attr('alt',photo_title);
		$('#bigphotoimg').attr('title',photo_title);
		$('#bigphotoowner').html(owner_name);
		$('#bigphotoowner').attr('href',owner_url);
		$('#bigphototitle').html(photo_title);
		$('#bigphototitle').attr('href',photo_url);
}
function showTab(name) {
	
	if ($("#tabmetro")) {
		$("#tabmetro").css('display',getVis(name=="metro"));
		if (name=="metro") {
			$("#metrobtn").parent().addClass('current');
		} else {
			$("#metrobtn").parent().removeClass('current');
		}
	}
	if ($("#tabexit")) {
		$("#tabexit").css('display',getVis(name=="exit"));
		if (name=="exit") {
			$("#exitbtn").parent().addClass('current');
		} else {
			$("#exitbtn").parent().removeClass('current');
		}
	}
	if ($("#tablocality")) {
		$("#tablocality").css('display',getVis(name=="locality"));
		if (name=="locality") {
			$("#localitybtn").parent().addClass('current');
		} else {
			$("#localitybtn").parent().removeClass('current');
		}
	}
	
	return false;
}
function getVis(bool) {
	return bool?"block":"none";
}