var menuTimer = null;
$(document).ready(function() {	
    $('#newsletter_signup_link').click(function() {
        $.blockUI({ message: $('#newsletter_signup'), css:{border: 'none', 
            padding: '15px', 
			cursor: 'default',
            backgroundColor: '#000', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: .9,
			left: "35%",
			width: "28%",
			top: "20%",
            color: '#fff'} });
		jQuery(".blockPage").prepend('<img src="images/close.gif" class="close" />');
		jQuery(".close, input.submit").click(function(){ jQuery.unblockUI(); });
		if(jQuery.browser.msie){jQuery("img.close").css({top:"0",right:"0"});}
    });
	
	$('#nat_map').click(function() {
        $.blockUI({ message: '<div id="Flash"></div>',
			css:{border: 'none', 
            padding: '15px', 
			cursor: 'default',
            backgroundColor: '#000', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: .9,
			left: "50%",
			marginLeft: "-365px",
			width:"700px",
			height:"510px",
			top: "5%",
            color: '#fff'} });
		jQuery(".blockPage").prepend('<img src="images/close.gif" class="close" />');
		jQuery(".close").click(function(){ jQuery.unblockUI(); });
		if(jQuery.browser.msie){jQuery("img.close").css({top:"0",right:"0"});}
		$('#Flash').flash({ src: 'preview2.swf', width: 700, height: 510 }, { version: 10 });
		return false;
	});
	
	$('#registergoogle').click(function() {
        $.blockUI({ message: '<iframe height="458" frameborder="0" width="350" src="http://www.tigermarinecharter.com/include/googlemaps.html"/>',
			css:{border: 'none', 
            padding: '15px', 
			cursor: 'default',
            backgroundColor: '#000', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            opacity: .9,
			left: "50%",
			marginLeft: "-175px",
			width: "350px",
			height:"458px",
			top: "20%",
            color: '#fff'} });
		jQuery(".blockPage").prepend('<img src="images/close.gif" class="close" />');
		jQuery(".close").click(function(){ jQuery.unblockUI(); });
		if(jQuery.browser.msie){jQuery("img.close").css({top:"0",right:"0"});}
		return false;
	});
	

	jQuery("div#menu > ul > li > a").next("ul").hide(); // remove the css hover effect
	jQuery("div#menu > ul > li > a").unbind().hover(function(){
		clearTimeout(menuTimer);
		if(jQuery(this).hasClass("selected")) return;
		jQuery("div#menu > ul > li > a").removeClass("selected").parent().find("ul").hide(); //slideUp("fast");
		jQuery(this).addClass("selected");
		var $ul = jQuery(this).parent().find("ul");
		menuTimer = setTimeout(function(){$ul.slideDown(301);}, 300);
	}, function(){
		clearTimeout(menuTimer);
		var $ul = jQuery(this).parent().find("ul");
		var $a = jQuery(this);
		menuTimer = setTimeout(function(){$ul.slideUp("fast");$a.removeClass("selected");},30);
	});

	jQuery("#menu ul li ul").hover(function(){
		clearTimeout(menuTimer);
	},function(){
		var $ul = jQuery(this);
		menuTimer = setTimeout(function(){$ul.slideUp("fast");$ul.parent("li").find("a:first").removeClass("selected");},30);
	});
	
	// lightBox
	jQuery("#thumbs_container a, #columnsmeetthecrew a").lightBox();
	
	// png fix
	if (jQuery.browser.msie && parseInt(jQuery.browser.version.substr(0, 1)) < 7) DD_belatedPNG.fix("#top_h1,#bottom_h1,#bottom_h1_nopadding,#menu ul li ul");
});