// JavaScript Document

// Setup and initiate News Box scroller
jQuery(document).ready(function() {
	$('#newsapp02').css("overflow","hidden");
	$('#newsapp03').css("overflow","hidden");
    jQuery('#na-scroller').jcarousel({
        scroll: 1
    });
	
});


// Setup and initiate Homepage slides
$(document).ready(function(){	
		$(function() {	
			$('.carousel').cycle({
				fx:     'fade',
				speed:  1000,
				timeout: 3000,
				pager:  '.pager',
				slideExpr: 'img'
			});
		});	
	});

	
// Setup and initiate mega menus
jQuery(document).ready(function(){
	if (window.Touch){
		// jQuery(".megamenu").megamenu({ 'enable_js_shadow':false, 'activate_action':'click' });
	} else {
		jQuery(".megamenu").megamenu({ 'enable_js_shadow':false });
	}
});
	  
// Setup and initiate mega menus sub-menu overs  on/off version
/*$(document).ready(function(){
	$('#txt-dd-vc0').show();
	$('#pic-dd-vc1').show();
	$('.ddmenu ul li a').mouseover(function() {	
		var i = $(this).attr('id');
		$('#txt-dd-vc0').hide();
		$('#pic-dd-vc1').hide();
		$('#txt-'+i).show();
		$('#pic-'+i).show();
	});
	$('.ddmenu ul li a').mouseout(function() {
		var i = $(this).attr('id');	
		$('#txt-'+i).hide();
		$('#pic-'+i).hide();
		$('#txt-dd-vc0').show();
		$('#pic-dd-vc1').show();
	});
}); */

// Setup and initiate mega menus sub-menu overs
$(document).ready(function(){
	$('.ddtxt .default').show();
	$('.ddpic .default').show();
	// For boats
	$('.ddmenu ul li a').mouseover(function() {	
		var i = $(this).attr('id');
		$('.ddpic div').hide();
		$('.ddtxt div').hide();
		$(".ddmenu ul li a").css("background","url(/includes/css/images/dd-butbg.gif) no-repeat 0px 0px"); 
		$('#txt-'+i).show();
		$('#pic-'+i).show();
		$("#"+i).css("background","url(/includes/css/images/dd-butbg.gif) no-repeat -76px 0px"); 
	});
	// For experience
	$('.ddmenuexp ul li a').mouseover(function() {	
		var i = $(this).attr('id');
		$('.ddpic div').hide();
		$('.ddtxt div').hide();
		if ($(this).hasClass('fix4fr')) {
			$(".fr .ddmenuexp ul li a").css("background","url(/includes/css/images/dd-bigexp-butbg-fr.gif) no-repeat 0px 0px");
		} else {
			$(".ddmenuexp ul li a").css("background","url(/includes/css/images/dd-bigexp-butbg.gif) no-repeat 0px 0px"); 
		}
		$('#txt-'+i).show();
		$('#pic-'+i).show();
		if ($(this).hasClass('fix4fr')) {
			$("#"+i).css("background","url(/includes/css/images/dd-bigexp-butbg-fr.gif) no-repeat -205px 0px"); 
		} else {
			$("#"+i).css("background","url(/includes/css/images/dd-bigexp-butbg.gif) no-repeat -175px 0px"); 
		}
	});
	// For news
	$('.ddmenunews ul li a').mouseover(function() {	
		var i = $(this).attr('id');
		$('.ddpic div').hide();
		$('.ddtxt div').hide();
		$(".ddmenunews ul li a").css("background","url(/includes/css/images/dd-exp-butbg.gif) no-repeat 0px 0px"); 
		$('#txt-'+i).show();
		$('#pic-'+i).show();
		$("#"+i).css("background","url(/includes/css/images/dd-exp-butbg.gif) no-repeat -111px 0px"); 
	});
});

// Setup and initiate language select menu
$(document).ready(function(){
	$('#langselect ul').css("display","none");
	if (window.Touch)
  {
    $('.ls-default a').click(function() {
        $('#langselect ul').animate({width: 'toggle'});
    });
	$('#langselect ul li a').click(function() {
        $('#langselect ul').animate({width: 'toggle'});
    });
  }
  else
  {
    $('#langselect').hover(function() {
        $('#langselect ul').animate({width: 'toggle'});
    });
  }
  	$('.ls-default a').click(function() {
		return false;
    });
	$('#langselect ul li a').mouseover(function() {	
		var i = $(this).attr('class');
		$('#langselect .ls-default').hide();
		$('.'+i+'-show').show();
	});
	$('#langselect ul li a').mouseout(function() {
		var i = $(this).attr('class');	
		$('.'+i+'-show').hide();
		$('#langselect .ls-default').show();
	});
});

// Setup and initiate Content expand for overview page
$(document).ready(function(){
	var originalheight = $('.fwpanellip').height();
	$('.fwpanellip').css("height","355px");
	if (originalheight > 385){
	$('.expandbutton2').css("display","block"); 
		$('#fwpscroll2').toggle( function(){
			$('.fwpanellip').animate({ height: originalheight }, 400 );
			$('#fwpscroll2').attr("class","fwpscrollup2"); 
			return false;
		}, function(){
			$('.fwpanellip').animate({ height: 355 }, 400 );
			$('#fwpscroll2').attr("class","fwpscrolldown2"); 
			return false;
		});
	};
});

// Setup and initiate Content expand for standard +- pages
$(document).ready(function(){
	var originalheight = $('.fwpanel').height();
	$('.fwpanel').css("height","355px");
	if (originalheight > 385){
	$('.expandbutton').css("display","block"); 
		$('#fwpscroll').toggle( function(){
			$('.fwpanel').animate({ height: originalheight }, 400 );
			$('#fwpscroll').attr("class","fwpscrollup"); 
			return false;
		}, function(){
			$('.fwpanel').animate({ height: 355 }, 400 );
			$('#fwpscroll').attr("class","fwpscrolldown"); 
			return false;
		});
	};
});

// Setup and initiate Content expand for News and Events page
$(document).ready(function(){
	var originalheight = $('.fwpanel-news').height();
	$('.fwpanel-news').css("height","301px");
	if (originalheight > 331){
	$('.expandbutton2').css("display","block"); 
		$('#fwpscroll2').toggle( function(){
			$('.fwpanel-news').animate({ height: originalheight }, 400 );
			$('#fwpscroll2').attr("class","fwpscrollup2"); 
			return false;
		}, function(){
			$('.fwpanel-news').animate({ height: 301 }, 400 );
			$('#fwpscroll2').attr("class","fwpscrolldown2"); 
			return false;
		});
	};
});

// Setup and initiate GA slides
$(document).ready(function(){	
		$(function() {	
			$('.gacarousel').cycle({
				fx:     'fade',
				speed:  900,
				timeout: 0,
				pager:  '.ganav',
				pagerAnchorBuilder: function(idx, slide) { 
        			// return selector string for existing anchor 
        			return '.ganav li:eq(' + idx + ') a'; 
    			} 
			});
		});	
	});
