// Shared Javascript code across the entire Go Fit Now Network.

// =============================================================================
$(document).ready(function() {

    // Message box closing behavior.
    // -------------------------------------------------------------------------
    $(".dialog").each( function( ix, boxElem ) {
    
        $(".button.close", boxElem).each( function( ix, btnElem ) {
            
            $(btnElem).click( function( event ) { $(boxElem).slideUp(500); } );
        });
    });

});


// =============================================================================
// Create an error reporter object. This is avoids Dojo in case the problem lies
// within Dojo itself.

// TODO: get this implemented, and create a very simple database to track the 
// reports (or look into prebuilt alternatives).

window.GFN_ErrorReporter = {

    _DEFAULT_CONTACT_EMAIL: "",
    contactEmail: this._DEFAULT_CONTACT_EMAIL,

    // Change the contact e-mail address to send the notification to.
    // -------------------------------------------------------------------------
    setContactAddress: function( address ) {

        this.contactEmail = address;
    },

    // Show the error reporting widget to the user.
    // The userMessage will be displayed, while the debugMessage will be passed
    // with the registered report.
    // -------------------------------------------------------------------------
    showReportWidget: function( userMessage, debugMessage ) {

        // TODO: Implement this!!
        console.log("Go Fit Now Network : Error Encountered");
        console.log("User Message:\n" + userMessage);
        console.log("Debug Message:\n" + debugMessage);
    }

}; // END GFN_ErrorReporter



