// (c) 1999-2008 Bright Interactive Limited. All rights reserved.
// http://www.bright-interactive.com | info@bright-interactive.com
// Tel: 0870 240 6520

// Plugin for Jquery

openBkBtnId = null;

$(document).bind("ready",function(){

    $(".bookingpopup").click(function(e){
        var newWindow = window.open(this.href, "newWindow", "width=960,height=600,toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes,titlebar=no");
        if(newWindow.blur){newWindow.focus();};
        e.preventDefault();
    });
    
    $(".accountpopup").click(function(e){
        var newWindow = window.open(this.href, "newWindow", "width=960,height=730,toolbar=no,location=no,status=no,menubar=no,resizable=no,scrollbars=yes,titlebar=no");
        if(newWindow.blur){newWindow.focus();};
        e.preventDefault();
    });
    
    $(".altrow tr:nth-child(even)").addClass('alt');
     
    $(".bk_btn_area").hide();

    if ($.cookie('bk_open')){
        openBkBtnId = $.cookie('bk_open');
        $("#"+openBkBtnId+"_area").show();
        $("#"+openBkBtnId).addClass('active_bk_btn');
        $("#"+openBkBtnId).open = true;
    }
     
     
    $(".bk_btn").click(function(e){

        $(".bk_btn_area").slideUp("fast");
        $(".bk_btn").removeClass('active_bk_btn');
        $(".bk_btn").each(function(){
           $(this).get(0).open = false; 
        });

        if(openBkBtnId != this.id){
            if(!this.open){
                $("#"+this.id+"_area").slideDown("fast");
                $(this).addClass('active_bk_btn');
                this.open = true;
            }else{
                $("#"+this.id+"_area").slideUp("fast");
                $(this).removeClass('active_bk_btn');
                this.open = false;
            }     
            openBkBtnId = this.id;
            $.cookie('bk_open', this.id, { path: '/' });
        }else{
            openBkBtnId = null;
            $.cookie('bk_open', null );
        }

     	e.preventDefault();
     });
     
    $(".logintipLink").click(function(e){
         $("#logintip").toggleClass('showTip');
         e.preventDefault();
    });     
    
});
