jQuery(document).ready(function($){
		var deviceAgent = navigator.userAgent.toLowerCase();			
	var agentID = deviceAgent.match(/(iphone|ipod|ipad|andriod|webos)/i);
    if (agentID) {
 				  positionFooter();
			//alert("I'm a "+deviceAgent);
	}
		 else {
								
	$(window).bind("load", function() { 
	
		  positionFooter();
				   
	
	}).load();
	
	   $(window).scroll(positionFooter).resize(positionFooter);
		 }

});

	 var footerHeight = 0,
	   footerTop = 0;
	
		   
	
		   function positionFooter() {
				$footer = jQuery("#footer-container");
				$window = jQuery(window);

					footerHeight = $footer.height();
					footerTop = ($window.scrollTop()+$window.height()-footerHeight);
				
			   	debug("positionFooter:running - footerTop = "+footerTop+', windoww:height='+$window.height()+", footerHeight = "+footerHeight);
					
				   if ( (jQuery(document.body).height()+footerHeight-10) < $window.height()) {
					   $footer.css({
							position: "fixed"
					   }).css({
							bottom: "0px"
					   })

					   jQuery("#content-container").height(footerTop-325)
					   
				   } else {
					   $footer.css({
							position: "static"
					   })
					   //jQuery("#content-container").height('auto')
				   }
	
		   }
	

