// JavaScript Document

$(function(){
	
	//unwrap listing and detail entries
	$('.unit-listing, .unit-detail').unwrap().unwrap().unwrap().unwrap();
	
	//fancybox calls
	$('.site-map').fancybox();
	$('.photo-gallery a').fancybox({
		cyclic: true
	});
	
	//datepicker calls
	$('input.date').datepicker();
	
	//simpleSlider calls
	$('#slider').simpleSlider({
		pauseOnHover: false	,
		intervalTimer: 7000
	});
	
	//resize floorplan images
	/*$('.floorplans img').each(function(){
		var imgWidth = $(this).attr('width');
		var imgHeight = $(this).attr('height');
		var imgProportion = imgWidth / imgHeight;
		
		if(imgProportion <= 1.629){
			$(this).width('100%')
		} else {
			$(this).height('100%');	
		}
	});*/
	
	//unit detail image gallery
	$('.image-gallery .thumbs img').click(function(){
		var imgSrc = $(this).attr('src');
		$('.main-image').attr('src', imgSrc);
	});
	
	//enable lot type on rental rate = monthly
	/*$('input[name="rentalrate"]').change(function(){
		var rentalrate = $(this).val();
		if(rentalrate == "rentalratemonthly"){
			$('#rentaltype').removeAttr('disabled');
		} else {
			$('#rentaltype').attr('disabled','disabled');	
		}
	});*/
	
});
