$(function(){
	$(".b-tabs dt a").click(function(e){
		$(this).parent().siblings().removeClass("current").end().addClass("current").next().addClass("current");
		$(".b-places-tabs dt a[rel=" + $(this).attr('rel') + "]").click();
		return false;
	});
	
	$(".b-places-tabs dt a").click(function(e){
		$(this).parent().parent().find('dt').removeClass("current");
		$(this).parent().addClass("current");
		$('.b-places-table').removeClass("tcurrent");
		$('#' + $(this).attr('rel')).addClass("tcurrent");
		
		fly($(this));
		return false;
	});
	
	$(".b-places-table a.show-on-map").click(function(e){
		var $this = $(this);
		if (YMapApp.mapAreaIsHide()) {
			YMapApp.showMapAreaCallBack = function() {
				fly($this);
			}
			YMapApp.showMapArea();
			return false;
		}
		fly($this);
		return false;
	});
	
	function fly(el) {
		YMapApp.lng = el.attr('lng');
		YMapApp.lat = el.attr('lat');
		YMapApp.point_name = el.attr('pointname');
		YMapApp.point_desc = el.attr('pointdesc');
		YMapApp.fly();
	}
});

