/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
var $j = jQuery;
$j(document).ready(function(){

    if($j.cookie('baldelliDoNotShow') == '1')return;
    
    var html_en = '<div class="overlay" id="overlay" style="display:none;"></div>'+
    '<div class="box" id="box">'+
    '<a class="boxclose" id="boxclose"></a>'+
    '<h1>Important notices</h1>'+
    '<p>Dear Guests,<br /> we inform you that our Hotel will be re-open on April 6th, 2012<br />'+
    '<label><input type="checkbox" id="doNotRepeat"  /> do not show this message anymore</label></p></div>';

    var html_it = '<div class="overlay" id="overlay" style="display:none;"></div>'+
    '<div class="box" id="box">'+
    '<a class="boxclose" id="boxclose"></a>'+
    '<h1>Avviso importante</h1>'+
    '<p> Gentili Clienti,<br /> Vi comunichiamo che il nostro Hotel riaprirà dal 06.04.2012<br />'+
    '<label><input type="checkbox" id="doNotRepeat"  /> non mostrare pi&ugrave; questo messaggio</label></p></div>';

    var html = (user_language == 'it') ? html_it : html_en;

    $j("body").append(html);
    
    $j('#overlay').fadeIn('fast',function(){
        $j('#box').animate({
            'top':'160px'
        },500);
    });
    

    $j('#boxclose').click(function(){
        $j('#box').animate({
            'top':'-200px'
        },500,function(){
            $j('#overlay').fadeOut('fast');
        });
    });

    $j('#doNotRepeat').change(function(){
        var $el = $j(this);
        var b = $el.is(':checked');

        switch(b){
            case true:
                $j.cookie('baldelliDoNotShow','1', { expires: 7, path: '/' });
                break;

            default:
                $j.cookie('baldelliDoNotShow',null, { expires: 7, path: '/' });
                break;
        }
    });
});


