$(document).ready(function(){

    $('#front-form').submit(function(){
        if($('textarea.limited').val()==''){
            $('.ketchup-error-container-alt').slideDown();
            return false
        }else{
            $('.ketchup-error-container-alt').slideUp();
        }
    })
    $('textarea.limited').maxlength({
        'feedback' : '#left-characters span' // note: looks within the current form
    });
    $('form').ketchup({
        errorContainer: $('<div>', {
            'class': 'ketchup-error-container-alt',
            html: '<ol></ol>'
        }),
        initialPositionContainer: function(errorContainer, field) {
        //errorContainer = the error-container with all childs
        //field = the field that needs to get validated
        },
        positionContainer: function(errorContainer, field) {},
        showContainer: function(errorContainer) {
            errorContainer.slideDown('fast');
        },
        hideContainer: function(errorContainer) {
            errorContainer.slideUp('fast');
        }
    });


});

function getWindowHeight() {
    var windowHeight = 0;
    if (typeof(window.innerHeight) == 'number') {
        windowHeight = window.innerHeight;
    }
    else {
        if (document.documentElement && document.documentElement.clientHeight) {
            windowHeight = document.documentElement.clientHeight;
        }
        else {
            if (document.body && document.body.clientHeight) {
                windowHeight = document.body.clientHeight;
            }
        }
    }
    return windowHeight;
}
function setFooter() {
    if (document.getElementById) {
        var windowHeight = getWindowHeight();
        if (windowHeight > 0) {
            var contentHeight = document.getElementById('wrapper').offsetHeight;
            var footerElement = document.getElementById('footer-wrap');
            var footerHeight  = footerElement.offsetHeight;
            if (windowHeight - (contentHeight + footerHeight) >= 0) {
                footerElement.style.position = 'absolute';
                footerElement.style.top = (windowHeight - footerHeight) + 'px';
            }
            else {
                footerElement.style.position = 'static';
            }
        }
    }
}
window.onload = function() {
   // setFooter();
}
window.onresize = function() {
  //  setFooter();
}

