
var homeGalleryStop = false;
function simple_tooltip(target_items, name){
 $(target_items).each(function(i){
		$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
		var my_tooltip = $("#"+name+i);

		$(this).removeAttr("title").mouseover(function(){
				my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		}).mousemove(function(kmouse){
				my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
		}).mouseout(function(){
				my_tooltip.fadeOut(400);
		});
	});
}

function goTo(page){
	window.location = page;
}

$(document).ready(function(){	
	//convert richtext popup full size images to fancybox images
	
	$(".intMiddle img").each(function(){
		var parentA = $(this).parents("a").length;
	    //if(!$(this).parent().is("a"))
	    if(parentA == 0 && !$(this).hasClass("noPop")) 
	        $(this).wrap("<a class='single_image' href='" + $(this).attr("src") + "'></a>");
    });    
    
    //convert richtext popup images to fancybox images
   $(".middleTxt a").each(function(){
        var href = $(this).attr("href");
       if(href != undefined){
            var index = href.indexOf("viewImage");
            if(index > -1){
               href = href.replace("javascript:viewImage('", "");
               href = href.replace("')","");
               $(this).attr("href", href);
               $(this).addClass("single_image"); 
            }
        }
    });
    $("a.single_image").fancybox();
    //end convert richtext popup images to fancybox images

	simple_tooltip(".tip","tooltip");
		
	//Remove Img if it's empty
	$('.intMiddle img').each(function(){
		var imgSrc = $(this).attr("src");
		if(imgSrc == "")
			$(this).parent().remove();
			
	});
	
	$('#features').jshowoff({ 
		controls:false,
		links: true,
		speed:4000,
		hoverPause: false
	}); 
	
	$('.intNavItem').hover(function(){
		$(this).addClass('subnav_hover')
	}, function(){
		$(this).removeClass('subnav_hover')
	});
	
	$('#aDepartures').click(function(){
		$('#departureTitle').show('fast');
		$('#arrivalsTitle').hide('fast');			
		$('#departures').show('fast');
		$('#arrivals').hide('fast');
	});
	$('#aArrivals').click(function(){
		$('#arrivalsTitle').show('fast');
		$('#departureTitle').hide('fast');		
		$('#arrivals').show('fast');
		$('#departures').hide('fast');		
	});

	
	
	$("#current_weather").fancybox({
		'width'				: 575,
		'height'			: 600,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'no'
	});
	
	$("#PrivacyPolicy").fancybox({
		'width'				: 575,
		'height'			: 600,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	$("#TermsOfUsePop").fancybox({
		'width'				: 575,
		'height'			: 600,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	$("#disclaimerPop").fancybox({
		'width'				: 575,
		'height'			: 600,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});
	$("#siteMapPop").fancybox({
		'width'				: 995,
		'height'			: 400,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe'
	});

	$("#fv").fancybox({
		'width'				: 995,
		'height'			: 768,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'no',
		'centerOnScroll'	: false
	
	});
	$(".Videos").fancybox({
		'width'				: 655,
		'height'			: 400,
        'autoScale'     	: false,
        'transitionIn'		: 'elastic',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
		'scrolling'			: 'no',
		'centerOnScroll'	: false
	
	});

});
