/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch(element) {
    var $active = $(element).find('img.active');

    if ( $active.length == 0 ) $active = $(element).find('img:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $(element).find('img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    var $sibs  = $active.siblings();
    var rndNum = Math.floor(Math.random() * $sibs.length );
    var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 2000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch('#banner-slideshow')", 6000 );
});


$(document).ready(function() { 
	$(".map-main").css("overflow","hidden");
	$(".map-main .map").css("cursor","move");
	
	$(".map-main .map").draggable({ });
	
	//var mapWidth = "-" + $(".map-main .map").width() / 2 + "px";
	//var imgWidth = "-" + $(".map-main .map img").width() / 2 + "px";
	//$(".map-main .map").css("left",mapWidth);

	var cls = $(".nav-map").attr("class");
	
	$(".nav-map a, .nav-map div").hover(
		function () {
			if($(this).attr("class") != "future") {
				$(".nav-map").attr("class","nav-map");
				$(".nav-map").addClass($(this).attr("class"));
			}
		}, 
		function () {
			$(".nav-map").attr("class",cls);
		}
	);
	
	
	
	
		// Match all link elements with href attributes within the content div
	$(".nav-map .stage3[href][title], .nav-map .future[href][title]").qtip({
		content: {
			text: false
		},
		style: { 
//			width: {
//				min: '26px',
//				max: '26px'
//			},
			name: 'dark',
			tip: {
				corner: 'bottomMiddle',
				size: {
					x: 8,
					y: 8
				}
			}
		},
		position: {
			corner: {
				target: 'topMiddle',
                tooltip: 'bottomMiddle'
		  	}
		},
		show: { 
			solo: true,
			delay: 0,
			effect: { 
				length: 0
			}
		}
	});
});
