/* Autocomplete Functions
==============================================*/
/* ShadowBox */
jQuery.noConflict();


/* End AutoComplete Functions
==============================================*/
jQuery(document).ready(function() {
	// initialize scrollable
	jQuery(".scrollable").scrollable();
		
	jQuery("#sideSearchButton").click(function(){
		jQuery("#sideSearchForm").attr("action","/search/"+jQuery("#CityAjaxSelect").attr("value"));
	});
	
	/* Property Unit Types
	==============================================*/
	jQuery("ul#apt-types li").each(function(){
		var o = jQuery(this);
		o.children('div.extend-apt-type').hide();
		o.children('div.type-headline').click(function(){
			o.children('div.extend-apt-type').slideToggle();
			jQuery(this).children('span.button').toggleClass('expand-minus');
		});
	});
	jQuery('#move-in-date').datepicker({
		dateFormat:'mm/dd/yy',
		minDate: '+1D',
		mandatory: true,
		showOn: 'both',
		buttonImage: '/images/calendar.gif',
		buttonImageOnly: true
	});
	
	/* Property Detail Reward Slide
	==============================================*/
	jQuery('div.detail-images-sub-container div.detail-images-sub img').each(function(){
		jQuery(this).click(function() {
			jQuery('#propImages').css("background-image","url("+jQuery(this).attr("src")+")");
			jQuery('#detailImage').attr("href",jQuery(this).attr("src"));
			jQuery('#detailImage').attr("pos",jQuery(this).attr("pos"));
		});
	});
	jQuery("#propHeaderRight").click(function(){
		jQuery("#prop-detail-container").animate({"marginTop": "450"}, "slow");
	});
	jQuery("#propHeaderRightGuest").click(function(){
		jQuery("#prop-detail-container").animate({"marginTop": "200"}, "slow");
	});
	jQuery("#reward-close").click(function(){
		jQuery("#prop-detail-container").animate({"marginTop": "0"}, "slow");
	});
	/* Property Detail Tabs
	==============================================*/
	jQuery("#claim-tabs").tabs();
	jQuery("#propDetailTabs").tabs();
	
	jQuery("div.results-item").each(function(){
		jQuery(this).hover(
			function(){
				jQuery(this).css("background-image","url(/images/img-property-hover.jpg)");
			},
			function(){
				jQuery(this).css("background-image","");
			}
		)
	});
});
/* Property's */
function mainAreaFile(what,where) {
	jQuery('#'+where).html("<div class='loader'><img src='/images/indicator.gif'><br />loading...</div>");
	jQuery.get(what,{},function(data) {
		jQuery('#'+where).html(data);
	});
}
