// Editing Instructions
// 1. Change '#your_div_id' to whatever the ID attribute of your DIV is
// 2. Change '175' to whatever the height of your header is, if you have no header, set to 0

function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}

window.onscroll = function()
{
	var docheight = getDocHeight();
	var bottomheightA = docheight - self.pageYOffset;
	var bottomheightB = docheight - document.documentElement.scrollTop;

    if( window.XMLHttpRequest ) {
        if (document.documentElement.scrollTop > 700 || self.pageYOffset > 700) {
			if (bottomheightA < 642 || bottomheightB < 642) {
				$('#banners_skyscraper_sticky').css('top', '');
				$('#banners_skyscraper_sticky').css('position','fixed');
            	$('#banners_skyscraper_sticky').css('bottom', '62px');
			}
			
			else {
				$('#banners_skyscraper_sticky').css('position','fixed');
            	$('#banners_skyscraper_sticky').css('top','10px');
			}
        } else if (document.documentElement.scrollTop < 700 || self.pageYOffset < 700) {
            $('#banners_skyscraper_sticky').css('position','absolute');
            $('#banners_skyscraper_sticky').css('top','710px');
        }
    }
}
