/**********************************************************************************************/
/* Function footer(ftContainerArray,spacingW3C,spacingIE)            													*/
/*                                                                            								*/
/* Takes 3 parameters (prototype required):                                    								*/
/* ftContainerArray: Array of container ids (Required)  																			*/
/* Spacing: (optional) - Used to fix spacing																								  */
/* spacingW3C: spacing Between lowest container and the footer for W3C compliant-browsers     */
/* spacingIE: spacing Between lowest container and the footer for Internet Explorer           */
/*          Defaults to 20px. It can be set to a positive or a negative value                 */
/*																																														*/
/* Site-wide CSS File: Set #ftArea{display:none;position:absolute;} 													*/
/*																																														*/
/*	For a page that contains 2 container divs, call the function as follow in the page:       */
/*        // Pushes The footer below content   																								*/
/*        var ftContainerArray = new Array('mainContent','rightContent');                     */
/*				vent.observe(window, 'load', function(){footer(ftContainerArray);}, false);        */
/*																																														*/
/* Last Modified: August 28, 2006                                             								*/
/* Author: Christian Dumais                                                   								*/
/**********************************************************************************************/
function footer(ftContainerArray,spacingW3C,spacingIE){
	var ft = null;
	var sp_w3c = (spacingW3C==null)?20:spacingW3C;
	var sp_ie = (spacingIE==null)?20:spacingIE;
	if ($('ftArea')!=null){
		ft = $('ftArea');
		/* Finding if one of the container is lower than the Side Nav and by how much */
		isContainerLower = getLower(ftContainerArray);
		/* Side Nav exist and is lower */
		if (!isContainerLower){
	  	ft.style.top = Dom.getBottomY($('sn_wrapper')) + "px";
		}
		/* Side Nav is NOT Lower or may not exist */
		else{
			/* Set the footer below the lowest container */
			ft.style.top = isContainerLower + ((document.all)?sp_ie:sp_w3c) + "px";
		}
		ft.style.display = "block";
	}
}
/* This function will find if the Side Nav exist and if it is the lowest container */
function getLower(arr){
	for (var i=0;i<arr.length;i++){
		if($(arr[i])){
			var biggest = Dom.getBottomY($(arr[i]));
			break;
		}
	}
	if(typeof(biggest) == "undefined") return 0;
	for (var i=0;i<arr.length;i++){
		if($(arr[i]) && Dom.getBottomY($(arr[i]))>biggest){
				biggest = Dom.getBottomY($(arr[i]));
		}
	}
	sny = ($('sn_wrapper'))?Dom.getBottomY($('sn_wrapper')):null;
	if (sny!=null && sny>biggest){
		/* Side Nav exist and is lower */
		return false;
	}
	else{
		/* Side Nav is NOT lower or may not exist, return biggest Y value */
		return biggest;
	}
}