// JavaScript Document
var intContainerHeight;
var intFooterHeight;

function InitFooter(blSlideFooter) {
	intContainerHeight = $("#divContainer").height();
	intFooterHeight = $("#divFooter").height();
	
	if(blSlideFooter) {
		SlideFooterPosition();
	} else {
		SetFooterPosition();
	}
	
	$(window).resize(function(){
		SetFooterPosition();
	});
}

function SetFooterPosition() {
	//make sure the footer elements always stick to the bottom of the page, but ONLY if the content is less the the window height.
	//also, make sure that the it has a minimum distance from the top
	
	var intWindowHeight = $(window).height();
	
	if(intWindowHeight>(intContainerHeight+intFooterHeight)) {
		//the page is too small, don't bother fixing the bottom position
		$("#divFooter").css({'position':'fixed', 'bottom':0});
		$("#divContainer").css({'marginBottom':(intFooterHeight+80)});
	} else {
		$("#divFooter").css({'position':'relative'});
		$("#divContainer").css({'marginBottom':0});
	}
}
function SlideFooterPosition() {
	//Same as SetFooterPosition, but slide up
	
	var intWindowHeight = $(window).height();
	
	if(intWindowHeight>(intContainerHeight+intFooterHeight)) {
		//the page is too small, don't bother fixing the bottom position
		$("#divFooter").css({'position':'fixed', 'bottom':-150});
		$("#divContainer").css({'marginBottom':(intFooterHeight+80)});
		
		$("#divFooter").animate({
			bottom:0
			}, 3000
		);
		
	} else {
		$("#divFooter").css({'position':'relative'});
		$("#divContainer").css({'marginBottom':0});
	}
}

