// JavaScript Document
function adjFHeight() {
	
	n = $(window).height() - $("#site_body").height()-1;
	document.getElementById('site_footer').style.height = n + "px";
	}
$(window).resize(function() { adjFHeight()});

// contentLoader
$(document).ready(function() {
						   
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #content';
			$('#content').load(toLoad)
		}											
	});

	$('#topMenu li a').click(function(){
								  
		var toLoad = $(this).attr('href')+' #content';
		$('#content').hide('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').show('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});

});


function cch(contentHeight){
	
	
	document.getElementById("content").style.height = contentHeight +"px";
	if(keeper){
	$('#map_canvas').fadeOut('slow');
	setTimeout("$('#slider').fadeIn('slow')", 500);
	//$('#slider').html(keeper);
	keeper="";
	//alert($('#slideShow').html());
    //$('#slider').data('nivoslider').start();
	 }
	
	
	}
	
//MAP
function example_ajax_request() {
  //$('#slideShow').html('<p><img src="/images/ajax-loader.gif" width="220" height="19" /></p>');
  document.getElementById("content").style.height = 600 +"px";
  $('#slider').fadeOut('slow');
  setTimeout("$('#map_canvas').fadeIn('slow')", 500);
  keeper=1;
  //$('#slider').data('nivoslider').stop();
  //keeper=$("#slideShow").html();
  //$('#slider').empty();
  //$('#mCont').load("map.html");
}

function lmLoad(hght, tURL) {
  //$('#content').empty();
  //$('#content').load(tURL);
  $("#content").load(tURL).hide().fadeIn('slow'); 
  cch(hght);
  
}

