$(document).ready(function(){
	$("ul.tabs").tabs("div.panes > div");
	/*$(".scrollable").scrollable();*/
	/* Optional Forms Toggle */
	$(".optional-fields legend").toggle(
		     function(){
			$(this).addClass('active');
			$(this).parent('.optional-fields').addClass('active');
			$(this).siblings('.hide').show();
		     },
		     function(){
		     	$(this).removeClass('active');
			$(this).parent('.optional-fields').removeClass('active');
			$(this).siblings('.hide').hide();
		     }
	)
	
	$("a.anchorSlide").anchorAnimate()
	$('.thumbnail  a').lightBox();
	$('.forsale-property').hover(
		function(){
			$(this).addClass('active');	
		},
		function(){
			$(this).removeClass('active');
		}
	)
	$.simpleWeather({
	location: 'austin, texas',
	unit: 'f',
	success: function(weather) {
		$("#weather").append('<div class="details" style="background-image:url('+weather.image+')"><div class="top-bar">'+weather.currently+'</div><div class="main-bar">'+weather.temp+'&deg; '+weather.units.temp+'</div><div class="bottom-bar"><span class="small">High:</span> <strong>'+weather.high+'&deg;'+weather.units.temp+'</strong> <span class="small">Low:</span> <strong>'+weather.low+'&deg;'+weather.units.temp+'</strong> <span class="small">Humidity:</span> <strong>'+weather.humidity+'%</strong></div></div>');
		$("#weather").append('<div class="extra small"><a href="'+weather.link+'">View forecast at Yahoo! Weather</a></div>');
	},
	error: function(error) {
		$("#weather").html("<p>"+error+"</p>");
	}
});
});
/**
Anchor Slider by Cedric Dugas 
Http://www.position-absolute.com 
**/
$.fn.anchorAnimate = function(settings) {
 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}