//----------
// Copyright Seb Bodger 2011
// Written for Doi Intanon
//----------

// Hide our main page content straight away if JS is enabled - avoids having to wait for JQuery to load
document.write('<style type="text/css">#body_content{display:none}</style>')
// Run when the DOM is ready
$(function(){
	// Display loading screen while waiting for content to load
	$("<div id='loading_bar' style='text-align: center; padding: 20px'>\
	<img class='loading_bar' src='/images/loading.gif'>\
	<br>Loading...please be patient!\
	</div>").insertBefore("#body_content");
	// Initialise the feedback form
	$('#contact').contactable({subject : 'Doi Intanon - Feedback Form',	
	disclaimer: 'Please feel free to get in touch if you would like some help or have any comments about the website.'});
	// Opacity hover function for the nav menu
	$("#nav ul li a:not(.selected)").css({'opacity': '0.6'}).hover(function() {
		$(this).stop().animate({opacity: '1'}, 300)
		}, function(){
		$(this).stop().animate({opacity: '0.6'}, 500);
	});
	// Tooltip funciton
	 $("#nav ul li").hover(function() {
		$(".tooltip_container", this).stop(true, true).animate({opacity: 'toggle', top: '-52px'}, 300)
		}, function(){
		$(".tooltip_container", this).stop(true, true).animate({opacity: 'toggle', height: 'toggle', top: '-40px'}, 400)
	});
});
// Run when the page content has fully loaded
$(window).load(function(){
	// Remove our loading div
	$("#loading_bar").remove();
	// Show the main body content once loaded
	$("#body_content").fadeIn(800);
});	
