$(document).ready(function() {
	// make featured property scrollable
	if($('.scrollable').find('.items img').size() > 1) {
		// init scrollable() on desired div
		$('.scrollable').scrollable({
			circular:true,
			onSeek:function() {
				$('span.pager').html('Photo <span class="index">' + (this.getIndex() + 1) + '</span> of <span class="total">' + this.getSize() + '</span>');
			}
		}).autoscroll(7000);
	}
	/* Property Gallery */
	$('#property_gallery .items img').one("load",function(){
		/*if($(this).height() < 225){
			$(this).css('padding',Math.floor((($(this).height()-225)/2)*-1)+'px 0 '+Math.ceil((($(this).height()-225)/2)*-1)+'px 0');
		} else if($(this).height() > 230){
			$(this).css('height',226);
			$(this).removeAttr('width');
			if($(this).width() < 340){
				$(this).attr('width',$(this).width());
				$(this).css('padding','0 '+Math.floor((($(this).width()-340)/2)*-1)+'px 0 '+Math.ceil((($(this).width()-340)/2)*-1)+'px');
			}
		}*/
	})
	.each(function(){
		if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6))
		$(this).trigger("load");
	});
	
	/* Home Page */
	
	$('#featured_property .items img').one("load",function(){
		if($(this).height() < 208){
			$(this).css('padding',Math.floor((($(this).height()-208)/2)*-1)+'px 0 '+Math.ceil((($(this).height()-208)/2)*-1)+'px 0');
		}
	})
	.each(function(){
		if(this.complete || (jQuery.browser.msie && parseInt(jQuery.browser.version) == 6))
		$(this).trigger("load");
	}); 
	
	$(".property_info").each(function(){								 
		$(this).css('bottom',(($(this).height()-20)*-1));
	});
	
	// toggle property info (popup | popdown)
	$('#featured_property div.property_info').hover(function() {
		$(this).stop().animate({
			'bottom':'0'
		}, function() {
			$(this).toggleClass('show')
		})
	}, function() {
		var height = ($(this).height()-20)*-1;
		$(this).stop().animate({
			'bottom': height
		}, function() {
			$(this).toggleClass('show')
		})
	});
	
	// reset property info on prev/next click
	$('#featured_property .btn_arrow a').click(function() {
		//$('#featured_property div.property_info').css('bottom':'-43px');
		return false;
	});
	
	
});
