﻿function ResizeMain() {
    var div = $(".homeBG");
    var w = $(window).width();
    var h = $(window).height();

    if (is_iPad()) {
        if (h > w) {
            var t = h;
            h = w;
            w = t;
        }
    }

    var left = 0;

    if (w >= 1900) {
        div.css("width", "1900px");
        div.css("background-position", "0 0");
    }
    else {
        var width = w;
        left = 1900 - w;
        left = left / 2;
        if (left > 470) {
            left = 470;
        }

        if (w < 960)
            width = 960;

        
        div.css("width", width.toString() + "px");
        //div.css("height", "1134px");
        div.css("background-position", "-" + left.toString() + "px 0px");
    }
    div.css("height", "1500px"); // 1350

    SetLeft(".hTopMenu", (682 - left));
    SetLeft(".rightReclame", (1230 - left));
    SetLeft(".banner", (695 - left));
    SetLeft(".snelmenu", (463 - left));
    SetLeft(".sitemap", (458 - left));
    SetLeft(".vanbree", (1230 - left));
    SetLeft(".agenda", (1235 - left));
    SetLeft(".adres", (1235 - left));
    SetLeft(".nieuwsitemcontainer", (470 - left));
    SetLeft(".laatstenieuwscontainer", (470 - left));
    SetLeft(".nieuwsItemMeer", (470 - left));
    SetLeft(".mainClubblad", (485 - left));
    SetLeft(".mainInfoboekje", (615 - left));
    SetLeft(".mainBeleidsplan", (755 - left));
    SetLeft(".mainFuncties", (900 - left));
    SetLeft(".volgons", (1235 - left));
}

function is_iPad() {
    var isiPad = navigator.userAgent.match(/iPad/i) != null;

    return isiPad;
}

function ResizeContent() {
    var div = $(".contentBG");
    var divBottom = $(".contentbottom");
    var divContent = $(".content")
    var w = $(window).width();
    var h = $(window).height();
    var ch = divContent.height();

    var left = 0;
    var bg_width = 470;

    if (w >= 1900) {
        div.css("width", "1900px");
        div.css("background-position", "0 0");
        divBottom.css("width", "1600px");
        divBottom.css("background-position", "0 0");
    }
    else {
        var width = w;
        left = 1900 - w;
        left = left / 2;
        if (left > 470) {
            left = 470;
        }
        bg_width = bg_width - left;

        if (w < 960)
            width = 960;

        div.css("width", width.toString() + "px");
        div.css("background-position", "-" + left.toString() + "px 0px");
        divBottom.css("width", width.toString() + "px");
        divBottom.css("background-position", "-" + left.toString() + "px 0px");
    }

    if (ch < 750)
        ch = 750;
    divBottom.css("top", (ch + 190).toString() + "px");

    SetLeft(".hTopMenu", (670 - left));
    SetLeft(".contentBanner", (695 - left));
    SetLeft(".contentLeft", (455 - left));
    SetLeft(".content", (660 - left));
    SetLeft(".vanbree", (1230 - left));
    SetLeft(".rightReclameContent", (1230 - left));
    //SetLeft(".content_right", (1342 - left));

    //$(".content_left").css("width", (bg_width).toString() + "px");
    //$(".content_left").css("height", (ch + 190).toString() + "px");
    //$(".content_right").css("height", (ch + 190).toString() + "px");
}

function SetLeft(cssClass, left) {
    $(cssClass).css("left", left.toString() + "px");
}

