if(!jsFrontend) {var jsFrontend = new Object();}

jsFrontend.house = {
	init: function() {
		// slideshow
		jsFrontend.house.slideshow();

		// tooltip
		$('#legend li').tooltip();

		// google maps
		var latLong = $('.googleMap').attr('rel').split(';');
		if(latLong[0] != 0 && latLong[1] != 0) jsFrontend.house.gMaps(latLong[0], latLong[1]);

	},

	gMaps: function(lat, lng) {
		var latlng = new google.maps.LatLng(lat, lng);
		var myOptions = {
			zoom: 8,
			center: latlng,
			mapTypeId: google.maps.MapTypeId.ROADMAP,
			scrollwheel:false
		};
		var map = new google.maps.Map(document.getElementById("googleMap"), myOptions);

		// marker
		var marker = new google.maps.Marker({
			position: latlng,
			map: map,
			icon: '/modules/core/layout/images/marker.png',
			shadow: '/modules/core/layout/images/marker_shadow.png'
		});
	},

	slideshow: function() {
		var thumbs = $(".slideshow .thumbs");

		thumbs.jCarouselLite({
			 btnNext: ".selectionDown a",
			 btnPrev: ".selectionUp a",
			 visible: 4,
			 vertical: true,
			 circular: false,
			 scroll: 1
		});

		thumbs.find('a').each(function(index){
			var imgBig = $('div.bigImage a');

			$(this).bind('click', function(evt){
				evt.preventDefault();
				imgBig.hide();
				imgBig.filter('#photo-' + index).show();
			});

		});

		// prettyPhoto
		$('a[rel^="prettyPhoto"], div.bigImage a').prettyPhoto({
			showTitle: true,
			theme: 'light_rounded',
			allowresize: false,
			animation_speed: 'fast'
		});
	}
}

jQuery(function(){
	jsFrontend.house.init();
});
