function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}

function getSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  
  return [ myWidth, myHeight ];
}

    
function vIE()
{
    return (navigator.appName=='Microsoft Internet Explorer') ? parseFloat((new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})")).exec(navigator.userAgent)[1]) : -1;
}    

var isMobileDevice = navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/iPad/i);
var isIOS5 = isMobileDevice && navigator.userAgent.match(/OS 5_0/i);
var IE = vIE();
var isIE6 = (IE > 0) && (IE < 7);

if((isMobileDevice && !isIOS5) || isIE6)
{
    var footer = null;
    
    window.onload = function()
    {
        footer = document.getElementById('fixed-footer');
        if(footer)
        {
            footer.style.position = 'absolute';
            footer.style.bottom = '';  
        }
    }
    
    window.onscroll = function() 
    {
        if(footer)
        {
            var scrollXY = getScrollXY();
            var size = getSize();
            footer.style.top =  ((size[1] -  footer.clientHeight) + scrollXY[1]) + 'px';
            //footer.style.top =  ((window.innerHeight -  footer.clientHeight) + window.pageYOffset) + 'px';
        }
    };
}
