-function debugLog (msg) {
- if (typeof console === "undefined" || typeof console.log === "undefined") {
- alert(msg);
- } else {
- console.log(msg);
+/**
+ * Logs a message if mctx.debug is enabled. This function takes
+ * a variable number of arguments and passes them
+ * to alert or console.log (based on browser support).
+ * @returns {undefined}
+ */
+function debugLog () {
+ if (mctx.debug) {
+ if (typeof console === "undefined" || typeof console.log === "undefined") {
+ for (var i = 0; i < arguments.length; i++) {
+ alert(arguments[i]);
+ }
+ } else {
+ console.log.apply(this, arguments);
+ }