/*MESSAGE*/

function initForm() {
    $('#form_layer').css('display','none','opacity',0);
    $('#form_line').css('display','none','opacity',0);
    $('#form_box').css('display','none','opacity',0);     
}

function getFormPosition() {
    windowheight = $('#form_layer').height();    
    formheight = $('#form_line').height();
    new_top = (windowheight - formheight) / 2;
    if (new_top >= 0) {
        $('#form_line').css('top',new_top);    
    } else {
        new_top = 10;
        $('#form_line').css('position','absolute');
    }
}

function drawForm() {
    $('#form_layer').css('display','block');
    $('#form_line').css('display','block');
    $('#form_box').css('display','block');
    getFormPosition();
    
    form_text_height = $('#form_box').height() - 69;
    $('#form_box_text').css('height','0');
    $('#form_box_text').fadeTo(0, 0);
    
    $('#form_layer').fadeTo(350, 1);
    $('#form_line').fadeTo(350, 1);
    $('#form_box').fadeTo(50, 1);
      
    $('#form_box_text').animate({height: form_text_height},600);
    $('#form_box_text').fadeTo(600, 1);
}

function hideForm() {
    $('#form_layer').css('display','none');
    $('#form_line').css('display','none');
    $('#form_box').css('display','none');
    
    //Actual message delete from hmtl
    document.getElementById('messagelayer').innerHTML = "";
}

$(document).ready(function(){
    $('#form_caption_close').click(function() {
        $('#form_layer').fadeTo(600, 0);
        $('#form_line').fadeTo(600, 0);
        $('#form_box').fadeTo(600, 0);
        setTimeout("hideForm()",600);
    });
});
