window.onscroll = function(event) {
    var scrollOnePercent = Math.round((getPageHeight() - getVisibleHeight()) / 100);
    var scrollTopPosition = getBodyScrollTop();
    var scrollPercent = Math.round(scrollTopPosition / scrollOnePercent);
    flashScroll(scrollPercent);
}

function getMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
         return window[movieName];
     } else {
         return document[movieName];
    }
}

function flashScroll(scrollPercent) {
    var flash = getMovie('flashContent');
    flash.scrollTo(scrollPercent);
}

function getPageHeight() {
    return (document.body.scrollHeight > document.body.offsetHeight) ?
            document.body.scrollHeight : document.body.offsetHeight;
}

function getVisibleHeight() {
    var height;
    if (typeof window.innerHeight != 'undefined') {
        height = window.innerHeight;
    }  else if (typeof document.documentElement != 'undefined'
                && typeof document.documentElement.clientWidth != 'undefined'
                && document.documentElement.clientWidth != 0) {
        height = document.documentElement.clientHeight;
    }
    return height;
}

function getBodyScrollTop() {
    return self.pageYOffset ||
        (document.documentElement && document.documentElement.scrollTop) ||
        (document.body && document.body.scrollTop);
}
