(function(){

    function alert (error) {
        var file = error.file;
        var bugLine = error.line;
        var col = error.column;
        var code = error.status;
        var title = '<strong>Error (0x0' + code + ')</strong> Line: <strong>' + bugLine + '</strong> Col: <strong>' + col + '</strong>';
        var footer = '<em>' + file + '</em>';
        var bugFile = file.replace('\\','/').split('/');
        bugFile = bugFile[bugFile.length - 1];

        var fileContents = ugui.helpers.readAFile(file);
        fileContents = fileContents.split('\n');
        var count = fileContents.length;

        var theError = '<span class="num">' + bugLine + ':</span> <span class="text-primary">' + fileContents[(bugLine-1)] + '</span>';
        var errorPreview = theError;
        //Replace tabbed returns with bullet points, and regular returns with <BR>'s
        var errorMessage = error.message
            .replace(/[\r,\n]\s\s/g, '<br /><span class="bullet"></span>')
            .replace(/[\n\r]/g, '<br />')
            .replace(file,'');

        //Make sure there are at least 3 lines in the file and the error isn't on the first or last line
        if (count > 3 && (bugLine-1) !== 0 && (bugLine) !== count) {
            errorPreview =
              //line before the error
              '<span class="num">' + (bugLine-1) + ':</span> ' + fileContents[(bugLine-2)] +
              theError +
              //line after the error
              '<span class="num">' + (bugLine+1) + ':</span> ' + fileContents[bugLine];
        }

        var formmatedError =
            '<div class="panel panel-primary">' +
              '<div class="panel-heading">' +
                '<span class="pull-right glyphicon glyphicon-remove"></span>' +
                '<h3 class="panel-title">' + title + '</h3>' +
              '</div>' +
              '<div class="panel-body">' +
                errorMessage + '<br />' +
                '<strong>' + bugFile + '</strong><br />' +
                '<pre>' +
                  '<code>' +
                    errorPreview +
                  '</code>' +
                '</pre>' +
              '</div>' +
              '<div class="panel-footer">' +
                footer +
              '</div>' +
            '</div>';

        $("#printConsole").prepend(formmatedError);

        $("#printConsole .panel .glyphicon-remove").click( function () {
            $(this).parent().parent().fadeOut(400, "linear", function () {
                $(this).remove();
            });
        });
    }

    function message (message) {
        var folderPathSplit = message.stats.entry.split('\\').join('/').split('/');
        var folderAndFile = folderPathSplit[folderPathSplit.length - 2] + '\\' + folderPathSplit[folderPathSplit.length - 1];
        var time = new Date().timeNow();
        var duration = message.stats.duration + 'ms';
        if (message.stats.duration > 499) {
            duration = (Math.round(x/100)/10) + 'seconds';
        }

        var formattedMessage = '<div class="alert alert-success" role="alert" title="Processed in ' + duration + '">' +
          '<strong>' + time + '</strong> ' +
          folderAndFile +
          '<span class="pull-right glyphicon glyphicon-remove text-success"></span>' +
        '</div>';

        $("#printConsole").prepend(formattedMessage);

        $("#printConsole .alert .glyphicon-remove").click( function () {
            $(this).parent().fadeOut(400, "linear", function () {
                $(this).remove();
            });
        });
    }

    ugui.helpers.alert = alert;
    ugui.helpers.message = message;

})();

@@ -184,23 +184,86 @@
 r ti
-tle = '%3Cstrong%3E
+me = new Date().timeNow();%0A        var title = '%3Cstrong%3E' + time + '%3C/strong%3E 
 Erro
@@ -281,25 +281,18 @@
 ode + ')
-%3C/strong%3E
+ -
  Line: %3C

Clean up error message title