/*
	Fix footer to bottom of viewport or document, whichever is longer
*/
var oF  = null;
var bA  = false;
var oA  = null;
var iH  = null;

$(window).load(function ()
{
	var bQm = (document.documentElement && (document.documentElement.clientHeight > 0));
	if (document.all)
		oA = (bQm) ? document.documentElement : document.body;
	else
		oA = (bQm) ? document.body.parentNode : document.body;
	bA = ((typeof oA.clientHeight == 'undefined') || (navigator.appVersion.indexOf("Safari") != -1));
	
	oF = jQuery('#footer');
	iH = jQuery('body').height() + oF.height();
	
	assessFooter();
	jQuery(window).resize(assessFooter);

	oF.css('position', 'absolute');
	oF.css('left', 0);
	
	return true;
});

function assessFooter()
{
	var iLh = (bA) ? window.innerHeight : oA.clientHeight;
	oF.css('bottom', ((iH < iLh) ? "0" : "auto"));
}

jQuery(document).ready(function()
{
    jQuery("#optional-referrer-trigger").click(function(event) {
			jQuery("#optional-referrer").css({"visibility":"visible"});
			event.preventDefault();
		});
});
