text: var util = util || {};
  
  // A cross-browser function to capture a mouse position
  function mouseposition (e, dom) {
      var mx, my;
      //if(e.offsetX) {
          // Chrome
      //    mx = e.offsetX;
      //    my = e.offsetY;
      //} else {
          // Firefox, Safari
          mx = e.pageX - $(dom).offset().left;
          my = e.pageY - $(dom).offset().top;
      //}
      return {'x': parseInt(mx, 10) , 'y': parseInt(my, 10) };
  }
  util.mouseposition = mouseposition;
  
  
  // Object prototype
  // http://www.smipple.net/snippet/insin/jQuery.fn.disableTextSelection
  if (typeof Object.create !== 'function') {
      Object.create = function (o) {
          var F = function () {};
          F.prototype = o;
          return new F();
      };
  }
  
  // Trim function
  // Based on a code on: http://stackoverflow.com/questions/498970/how-do-i-trim-a-string-in-javascript
  if(typeof(String.prototype.trim) === "undefined")
  {
      String.prototype.trim = function()
      {
          return String(this).replace(/^\s+|\s+$/g, '');
      };
  }
  
  // Default Text
  function focusCallback() {
      if ($(this).val() === $(this).attr('title')) {
          /* if the current attribute is the default one, delete it. */
          $(this).val("");
      }
      $(this).removeClass('defaultTextActive');
  }
  
  function blurCallback() {
      if(!$(this).val()) {
          /* do following if the field is empty */
          var msg = $(this).attr('title');
          $(this).val( msg );
  
          $(this).addClass('defaultTextActive');
      }
  }
  
  // Based on a snipped posted by Eric Scheid ("ironclad") on November 17, 2000 at:
  // http://www.evolt.org/article/Javascript_to_Parse_URLs_in_the_Browser/17/14435/
  function getURLParameter(argName) {
      // Get the value of one of the URL parameters.  For example, if this were called
      // with the URL http://your.server.name/foo.html?bar=123 then getURLParameter("bar")
      // would return the string "123".  If the parameter is not found, this will return
      // an empty string, "".
  
      var argString = location.search.slice(1).split('&');
      var r = '';
      for (var i = 0; i < argString.length; i++) {
          if (argString[i].slice(0,argString[i].indexOf('=')) == argName) {
              r = argString[i].slice(argString[i].indexOf('=')+1);
              break;
          }
      }
      r = (r.length > 0  ? unescape(r).split(',') : '');
      r = (r.length == 1 ? r[0] : '')
      return r;
  }
  util.getURLParameter = getURLParameter;
  
  // Array Remove - By John Resig (MIT Licensed)
  // http://stackoverflow.com/questions/500606/javascript-array-delete-elements
  Array.prototype.remove = function(from, to) {
      // var rest = this.slice((to || from) + 1 || this.length);
      var rest = this.slice(parseInt(to || from) + 1 || this.length);
      this.length = from < 0 ? this.length + from : from;
      return this.push.apply(this, rest);
  };
  
  // Array min/max
  // http://stackoverflow.com/questions/1669190/javascript-min-max-array-values
  Array.prototype.max = function() {
      return Math.max.apply(null, this)
  };
  
  Array.prototype.min = function() {
      return Math.min.apply(null, this)
  };
  
  Array.prototype.sum = function () {
      return this.reduce(function(a, b) { return a + b;});
  };
  
  Array.prototype.mean = function () {
      return this.sum() / this.length;
  };
  
  /*
   json2.js
   2011-10-19
  
   Public Domain.
  
   NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
  
   See http://www.JSON.org/js.html
   ...
  
   Check Douglas Crockford's code for a more recent version of json2.js
   https://github.com/douglascrockford/JSON-js/blob/master/json2.js
   */
  if(typeof JSON!=="object"){JSON={}}(function(){"use strict";function f(e){return e<10?"0"+e:e}function quote(e){escapable.lastIndex=0;return escapable.test(e)?'"'+e.replace(escapable,function(e){var t=meta[e];return typeof t==="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];if(a&&typeof a==="object"&&typeof a.toJSON==="function"){a=a.toJSON(e)}if(typeof rep==="function"){a=rep.call(t,e,a)}switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a){return"null"}gap+=indent;u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n<s;n+=1){u[n]=str(n,a)||"null"}i=u.length===0?"[]":gap?"[\n"+gap+u.join(",\n"+gap)+"\n"+o+"]":"["+u.join(",")+"]";gap=o;return i}if(rep&&typeof rep==="object"){s=rep.length;for(n=0;n<s;n+=1){if(typeof rep[n]==="string"){r=rep[n];i=str(r,a);if(i){u.push(quote(r)+(gap?": ":":")+i)}}}}else{for(r in a){if(Object.prototype.hasOwnProperty.call(a,r)){i=str(r,a);if(i){u.push(quote(r)+(gap?": ":":")+i)}}}}i=u.length===0?"{}":gap?"{\n"+gap+u.join(",\n"+gap)+"\n"+o+"}":"{"+u.join(",")+"}";gap=o;return i}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(e){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(e){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;if(typeof JSON.stringify!=="function"){JSON.stringify=function(e,t,n){var r;gap="";indent="";if(typeof n==="number"){for(r=0;r<n;r+=1){indent+=" "}}else if(typeof n==="string"){indent=n}rep=t;if(t&&typeof t!=="function"&&(typeof t!=="object"||typeof t.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":e})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&typeof i==="object"){for(n in i){if(Object.prototype.hasOwnProperty.call(i,n)){r=walk(i,n);if(r!==undefined){i[n]=r}else{delete i[n]}}}}return reviver.call(e,t,i)}var j;text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}})()
  
  
  // Get what browser the user is using.
  // This code was taken from an answer in the following SO page:
  // http://stackoverflow.com/questions/3303858/distinguish-chrome-from-safari-using-jquery-browser
  var userAgent = navigator.userAgent.toLowerCase();
  
  // Figure out what browser is being used
  jQuery.browser = {
      version: (userAgent.match( /.+(?:rv|it|ra|ie|me)[\/: ]([\d.]+)/ ) || [])[1],
      chrome: /chrome/.test( userAgent ),
      safari: /webkit/.test( userAgent ) && !/chrome/.test( userAgent ),
      opera: /opera/.test( userAgent ),
      msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
      mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
  };
  
  /**
   * This method identifies the type of the user's browser
   *
   * @returns {*}
   */
  function getBrowser() {
      // Return a browser name
      var b;
      for (b in $.browser) {
          if($.browser[b] === true) {
              return b;
          }
      }
      return undefined;
  }
  util.getBrowser = getBrowser;
  
  function getBrowserVersion () {
      // Return a browser version
      return $.browser.version;
  }
  util.getBrowserVersion = getBrowserVersion;
  
  function getOperatingSystem () {
      var OSName="Unknown OS";
      if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
      if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
      if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
      if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
      return OSName;
  }
  util.getOperatingSystem = getOperatingSystem;
  
  /**
   * Given an image coordinate (x, y), return a scaled coordinate. For example, to
   * get the cooresponding coordinate in a smaller 512x256 image, use r = 1/26.
   * @param x
   * @param y
   * @param r
   */
  function scaleImageCoordinate(x, y, r) {
      var x_ = x * r;
      var y_ = (3328 - y) * r;
      return {x: x_, y: y_};
  }
  util.scaleImageCoordinate = scaleImageCoordinate;
  
  function sleep(miliseconds) {
      var end = false;
  }
  
  function shuffle(array) {
      // This function returns a shuffled array.
      // Code from http://bost.ocks.org/mike/shuffle/
      var copy = [], n = array.length, i;
  
      // While there remain elements to shuffle…
      while (n) {
  
          // Pick a remaining element…
          i = Math.floor(Math.random() * array.length);
  
          // If not already shuffled, move it to the new array.
          if (i in array) {
              copy.push(array[i]);
              delete array[i];
              n--;
          }
      }
  
      return copy;
  }
  util.shuffle = shuffle;
  
  