$(document).ready(function(){
    $("#headerRight #callback img").live('click', function() {
        if ($("#callbacklayer").width() === 0) {
            $("#callbacklayer").animate({
                width: 380
            }, 1500 );
        }else {
            $("#callbacklayer").animate({
                width: 0
            }, 1500 );
        }
    });

    if ($(".errormessage").length) {
        $("#callbacklayer").animate({
            width: 380
        }, 1500 );
    }

    if (!$("#mailform").length) {
        $("#callbacklayer").animate({
            width: 380
        }, 1500 );
    }
});

$(function() {
    $.support.placeholder = false;
    var inpEl = document.createElement('input');
    if('placeholder' in inpEl){
        $.support.placeholder = true;
    }
});

$(function() {
    if(!$.support.placeholder) {
        var active = document.activeElement;
        $('#contentRightWrapper :text').focus(function () {
            if ($(this).attr('placeholder') !== '' && $(this).val() === $(this).attr('placeholder')) {
                $(this).val('').removeClass('hasPlaceholder');
            }
        }).blur(function () {
            if ($(this).attr('placeholder') !== '' && ($(this).val() === '' || $(this).val() === $(this).attr('placeholder'))) {
                $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
            }
        });
        $('#contentRightWrapper :text').blur();
        $(active).focus();
        $('#contentRightWrapper form').submit(function () {
            $(this).find('.hasPlaceholder').each(function() {
                $(this).val('');
            });
        });
    }
});
