// <![CDATA[
var highestCol = Math.max($('.specials > div').height());

$(document).ready(function(){

    tb_modal_init('a.modal');//apply custom thickbox to .modal boxes
    tb_pie_init('.pmodal');//apply custom thickbox to .pie pictures
    tb_map_init('.maplink');//apply custom thickbox to #maplink for google popup

    $(".email_input")
        .css("color", "#929292")
        .focus(
            function(){
                if(this.value == 'enter your email address'){
                    $(this).css("color", "#3F3F3F").val("");
                }
            }
        )
        .blur(
            function(){
                if(this.value == ''){
                    $(this).css("color", "#929292").val("enter your email address");
                }
            }
        );
        
    $('.specials > div').height(highestCol);        
    
    $(".specials")
        .find("h5")
        .bind("click", function(){
                $(".specials")
                    .find(".activetab")
                    .removeClass("activetab")
                    .end()
                    .find(".activelist")
                    .addClass("background")
                    .removeClass("activelist");
                $(this)
                    .addClass("activetab")
                    .next("div")
                    .removeClass("background")
                    .addClass("activelist"); 
                    return false;               
            }
        );

    $("div.notice > a")
        .bind("click", function(){
            $(this).nextAll().slideDown("slow");
            return false;
            }
        )
        .mouseout(
            function(){$(this).nextAll().slideUp("slow");}
        );        

    $(".paypal").attr('target','_self');

});

//add thickbox to href & area elements that have a class of .modal
function tb_modal_init(domChunk){
  $(domChunk).click(function(){
  var t = this.title;
  var a = "http://bubbys.com/index.php/main/static/"+this.id+"?height=500&width=450";
  var g = this.rel || false;
  tb_show(t,a,g);
  this.blur();
  return false;
  });
}

function tb_pie_init(domChunk){
  $(domChunk).click(function(){
  var t = $(this).parent().find('h5').attr('id');
  var a = "#TB_inline?height=300&width=350&inlineId="+this.title;
  var g = this.rel || false;
  tb_show(t,a,g);
  this.blur();
  return false;
  });
}

function tb_map_init(domChunk){
  $(domChunk).click(function(){
  var t = "Bubbys Pie Co.";
  var a = "#TB_inline?height=480&width=640&inlineId=map_window";
  var g = this.rel || false;
  tb_show(t,a,g);
  this.blur();
  return false;
  });
}



// ]]>