$(document).ready(function() { 
    
    // activate the modal overlay
    
    $('#modal').jqm({ ajax: '@href',
                      trigger: 'a.modal_trigger',
                      target: '#remote_content' 
    });
                      
    // generate popups for global nav items
                      
    $("a[@rel=popup]").click(function(){
           popupWindow = window.open(this.href,this.title,'menu=no,toolbar=no,width=604px,height=600,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=48,left=48');
           popupWindow.focus()
           return false;
    })
    
    $("a[@rel=popup_widget]").click(function(){
           popupWindow = window.open(this.href,this.title,'menu=no,toolbar=no,width=365px,height=450,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=48,left=48');
           popupWindow.focus()
           return false;
    })

    $("a[@rel=external]").click(function(){
           popupWindow = window.open(this.href,this.title,'width=800,height=600,toolbar=yes,status=yes,location=yes,menubar=yes,directories=yes,resizable=yes,scrollbars=yes');
           popupWindow.focus()
           return false;
    })
    
    // submit user's flash version with the FAQ form
    
    var flash = deconcept.SWFObjectUtil.getPlayerVersion();
    $("input#flash").val(flash.major + '.' + flash.minor + '.' + flash.rev);
    
    // Popup window close button
    
    $("#popup_close_button").css("cursor","pointer");
    
    $("#popup_close_button").click(function() {
        window.close();
    });
    
    // Un-comment for prechecked Opt-ins
    
    /*
        if (!$("div").hasClass("error")) {
            $("input[@name=primary_opt_in]").attr("checked", "checked");
        }
    */
	$('#previous_recipes').find('.details').hide().end().find('h2').click(function() {
		$(this).next().slideToggle(100);
	});
	$('#featured_recipe').find('.details').show().end().find('h2').click(function() {
		$(this).next().slideToggle(100);
	});
});       
 