﻿function PlaceMasterDivs() {
    //main
    $('#divRoot').css('width', $(window).width());
    if ($('body').width() > $('#divRoot').width())
        $('#divRoot').css('width', $('body').width());
    $('#divHeader').css('width', $('body').width());
    $('#divForContent').css('width', $('#divRoot').width());
    $('#divFooter').css('width', $(window).width());
    

    if ($('#divRoot').height() < $(window).height())
        $('#divRoot').css('height', $(window).height());
    else
        $('#divRoot').css('height', '100%');
    
    PositionFooter();
}

function PositionFooter() {
    $("#divFooter").css({ position: "absolute", 'top': $('#divForContent').height() + $('#divHeader').height() + "px" });
    if ($('#divForContent').height() + $('#divHeader').height() + $('#divFooter').height() < $(window).height()) {
        $("#divFooter").css({ position: "absolute", 'top': $(window).height() - $('#divFooter').height() + "px" });
    }
}

function ChangeElementColor(element, color) {
    $('#' + element).css('background-color', color);
}

function ShowHideElement(element, visibility) {
    $('#' + element).css('visibility', visibility);
}

function NoEnter(event) {
    if (event.keyCode == 13) {
        event.preventDefault();
    }
}

function NoChars(event) {
    if (event.keyCode < 65 || event.keyCode > 90)
        if (event.keyCode != 8)
            event.preventDefault();
}
