$(function()
{
    
	var cracked_source = "images/animated_house_cracked.gif";
	var fixed_source = "images/animated_house_fixed.gif";

	$("#XswapX").hover(
		function()
		{
			$("#XswapX").attr("src",fixed_source);
		}, 
		function()
		{
			$("#XswapX").attr("src",cracked_source);
		}
	);
	$("a").hover(
		function()
		{
			$("#XswapX").attr("src",fixed_source);
		}, 
		function()
		{
			$("#XswapX").attr("src",cracked_source);
		}
	);

	$(".header-box, .home-box").each(function(){
		var slide = 0;
		var obj = $(this);
		var gll = obj.find(".gallery-box");
		var total = gll.length;
	
		setInterval(function(){
			var next = slide + 1;
			if (next >= total)
				next = 0;
	
			$(gll[slide]).fadeOut(2000);
			$(gll[next]).fadeIn(2000);

			slide = next;
		}, 5000);
	});


	$('div.marquee marquee').marquee().mouseover(function () {
	  $(this).trigger('stop');
	}).mouseout(function () {
	  $(this).trigger('start');
	}).mousemove(function (event) {
	  if ($(this).data('drag') == true) {
	    this.scrollLeft = $(this).data('scrollX') + ($(this).data('x') - event.clientX);
	  }
	}).mousedown(function (event) {
	  $(this).data('drag', true).data('x', event.clientX).data('scrollX', this.scrollLeft);
	}).mouseup(function () {
	  $(this).data('drag', false);
	});

});

