var show_categories_str;
var display_directions; 
var moveMapEventListener;

$(document).ready(function() {

	$.preload([
		"/img/full-bg-5.jpg",
		"/img/full-bg-1.jpg",
		"/img/full-bg-2.jpg",
		"/img/full-bg-4.jpg"
	], {
		init: function(loaded, total) {
			
		},
		loaded: function(img, loaded, total) {
			
		},
		loaded_all: function(loaded, total) {
			setInterval( "slideSwitch()", 6000 );
		}
	});

	
	
});

function slideSwitch() {
		var $active = $('#slideshow IMG.active');

		if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

		var $next =  $active.next().length ? $active.next()
			: $('#slideshow IMG:first');

		$active.addClass('last-active');

		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 1000, function() {
				$active.removeClass('active last-active');
			});
			
			
			
			
			
		//alert ();
	
		$("#outer-home-container-top").css("background-image" , "url(/img/full-bg-"+$next.attr("rel")+".jpg)").fadeIn('fast');
		
			

			
	}

	

(function($) {
	var imgList = [];
	$.extend({
		preload: function(imgArr, option) {
			var setting = $.extend({
				init: function(loaded, total) {},
				loaded: function(img, loaded, total) {},
				loaded_all: function(loaded, total) {}
			}, option);
			var total = imgArr.length;
			var loaded = 0;
			
			setting.init(0, total);
			for(var i in imgArr) {
				imgList.push($("<img />")
					.attr("src", imgArr[i])
					.load(function() {
						loaded++;
						setting.loaded(this, loaded, total);
						if(loaded == total) {
							setting.loaded_all(loaded, total);
						}
					})
				);
			}
			
		}
	});
})(jQuery);
