$(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=500px,height=600,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;
    })

    $("a[@rel=widget]").click(function(){
           popupWindow = window.open(this.href,this.title,'menu=no,toolbar=no,width=650px,height=430,scrollbars=1,resizable=0,directories=no,location=no,screenX=0,screenY=0,top=48,left=48');
           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();
    });
    
        if (!$("div").hasClass("error")) {
            $("input[@name=primary_opt_in]").attr("checked", "checked");
        }
        
        if (!$("div").hasClass("error")) {
            $("input[@name=opt_in_blast]").attr("checked", "checked");
        }
});       
 
 
 