var t1;
var t2;
var t3;
var t4;
function clearSubNav1(){
	$("#New_Yachts_Subnav").slideUp(100);
}
function clearSubNav2(){
	$("#About_Subnav").slideUp(100);
}
function clearSubNav3(){
	$("#Sell_Subnav").slideUp(100);
}

var slideI = 0;
function slideShowMove(){
	var numMax = $("#Slideshow").children().length - 3;
	if(slideI < numMax){
		$("#Slideshow").animate({
			left: "-=561"
		},750);
		slideI++;
	}
	else{
		/*$("#Slideshow").animate({
			left: '-371'
		},750);*/
		$("#Slideshow").css("left", "-371px");
		slideI = 0;
	}
	t1 = setTimeout("slideShowMove()", 5000);
}

function showBlock(id){
	var fullBlockId = "#" + id + "FULL";
	var shortBlockId = "#" + id + "SHORT";
	
	$(shortBlockId).css('display','none');
	$(fullBlockId).css('display','block');
}
function hideBlock(id){
	var fullBlockId = "#" + id + "FULL";
	var shortBlockId = "#" + id + "SHORT";
	
	$(fullBlockId).css('display','none');
	$(shortBlockId).css('display','block');
}
	

$(document).ready(function() {
		
	$("#Slideshow").hover(
		function() {
			clearTimeout(t1);
		},
		function() {
			t1 = setTimeout("slideShowMove()", 5000);
		}
	);
		
	$("#NEWYACHTS").hover(
		function() {
			clearTimeout(t2);
			$("#New_Yachts_Subnav").slideDown("fast");
		},
		function() {
			t2 = setTimeout("clearSubNav1()", 100);
		}
	);
	$("#New_Yachts_Subnav").hover(
		function() {
			clearTimeout(t2);
		},
		function() {
			t2 = setTimeout("clearSubNav1()", 100);
		}
	);
		
	$("#ABOUT").hover(
		function() {
			clearTimeout(t3);
			$("#About_Subnav").slideDown("fast");
		},
		function() {
			t3 = setTimeout("clearSubNav2()", 100);
		}
	);
	$("#About_Subnav").hover(
		function() {
			clearTimeout(t3);
		},
		function() {
			t3 = setTimeout("clearSubNav2()", 100);
		}
	);
		
	$("#SELL").hover(
		function() {
			clearTimeout(t4);
			$("#Sell_Subnav").slideDown("fast");
		},
		function() {
			t4 = setTimeout("clearSubNav3()", 100);
		}
	);
	$("#Sell_Subnav").hover(
		function() {
			clearTimeout(t4);
		},
		function() {
			t4 = setTimeout("clearSubNav3()", 100);
		}
	);
	
	$("#Top_Links").hover(
		function() {
			$("#Top_Links_Hint").fadeIn("fast");
		},
		function() {
			$("#Top_Links_Hint").fadeOut("fast");
		}
	);
	
	$("#Facebook_Btn").hover(
		function() {
			$("#Top_Links_Hint").append("Join us on Facebook");
		},
		function() {
			$("#Top_Links_Hint").empty();
		}
	);
	
	$("#Contact_Btn").hover(
		function() {
			$("#Top_Links_Hint").append("Send us a message");
		},
		function() {
			$("#Top_Links_Hint").empty();
		}
	);
	
	$("#Schedule_Btn").hover(
		function() {
			$("#Top_Links_Hint").append("Events and Promotions");
		},
		function() {
			$("#Top_Links_Hint").empty();
		}
	);
	
	$("#Home_Btn").hover(
		function() {
			$("#Top_Links_Hint").append("Return to home page");
		},
		function() {
			$("#Top_Links_Hint").empty();
		}
	);
	
	/*$("#Flags").toggle(
		function() {
			$("#Translate_Box").fadeIn("fast");
			$("#Flags").html("<img src=\"images/close.png\" alt=\"Close\" title=\"Close\">");
		},
		function() {
			$("#Translate_Box").fadeOut("fast");
			$("#Flags").html("<img src=\"images/flags.gif\" alt=\"Translate This Site\" title=\"Translate This Site\">");
		}
	);
	
	$("#FROMLENGTH").change(
		function() {
			var fromLengthVal = $("#FROMLENGTH").val();
			if(parseInt(fromLengthVal) < 40 || !fromLengthVal){
				$("#FROMLENGTH").val('40');
			}
		}
	);*/
	
});
