﻿function getScrollerWidth() {
    var curWidth = document.body.clientWidth;

    document.body.style.overflow = 'hidden';
    var width = document.body.clientWidth;

    if (curWidth != width && (typeof (window.innerWidth) == 'number')) {
        document.body.style.overflow = 'scroll';
        width -= document.body.clientWidth;

        if (!width) width = document.body.offsetWidth - document.body.clientWidth;
        document.body.style.overflow = '';

        return width;
    } else {
        document.body.style.overflow = '';
        return 0;
    }
}

function BannerFix() {
    WindowArea = windowSize();

    WindowArea.Width -= getScrollerWidth();

    document.getElementById(BannerArea).getElementsByTagName("img")[0].style.width = WindowArea.Width + "px";
    document.getElementById(BannerArea).style.width = WindowArea.Width + "px";

    document.getElementById(BannerArea).getElementsByTagName("img")[0].style.height = (WindowArea.Width * 143 / 1280) + "px";
    document.getElementById(BannerArea).style.height = (WindowArea.Width * 143 / 1280) + "px";
    document.getElementById(BannerArea).parentNode.style.height = (WindowArea.Width * 143 / 1280) + "px";

    setCookie("PageWidth", WindowArea.Width, null, "/", null, null);
    setCookie("PageHeight", WindowArea.Height, null, "/", null, null);
}
BannerFix();