(function(){var ENV,sourceCache={"net.protocols.delimited":{src:"jsio('import net.interfaces');\n\nexports.DelimitedProtocol = Class(net.interfaces.Protocol, function(supr) {\n\n\tthis.init = function(delimiter) {\n\t\tif (!delimiter) {\n\t\t\tdelimiter = '\\r\\n'\n\t\t}\n\t\tthis.delimiter = delimiter;\n\t\tthis.buffer = \"\"\n\t}\n\n\tthis.connectionMade = function() {\n\t\tlogger.debug('connectionMade');\n\t}\n\t\n\tthis.dataReceived = function(data) {\n\t\tif (!data) { return; }\n\t\tlogger.debug('dataReceived:(' + data.length + ')', data);\n\t\tlogger.debug('last 2:', data.slice(data.length-2));\n\t\tthis.buffer += data;\n\t\tlogger.debug('index', this.buffer.indexOf(this.delimiter));\n\t\tvar i;\n\t\twhile ((i = this.buffer.indexOf(this.delimiter)) != -1) {\n\t\t\tvar line = this.buffer.slice(0, i);\n\t\t\tthis.buffer = this.buffer.slice(i + this.delimiter.length);\n\t\t\tthis.lineReceived(line);\n\t\t}\n\t}\n\n\tthis.lineReceived = function(line) {\n\t\tlogger.debug('Not implemented, lineReceived:', line);\n\t}\n\tthis.sendLine = function(line) {\n\t\tlogger.debug('WRITE:', line + this.delimiter);\n\t\tthis.transport.write(line + this.delimiter);\n\t}\n\tthis.connectionLost = function() {\n\t\tlogger.debug('connectionLost');\n\t}\n});\n\n",filePath:"jsio/net/protocols/delimited.js"},"net.env":{src:"function getObj(objectName, transportName, envName) {\n\ttry {\n\t\tjsio('from .env.' + (envName || jsio.__env.name) + '.' + transportName + ' import ' + objectName + ' as result');\n\t} catch(e) {\n\t\tthrow logger.error('Invalid transport (', transportName, ') or environment (', envName, ')');\n\t}\n\treturn result;\n}\n\nexports.getListener = bind(this, getObj, 'Listener');\nexports.getConnector = bind(this, getObj, 'Connector');\n",filePath:"jsio/net/env.js"},"std.base64":{src:"/*\n\"URL-safe\" Base64 Codec, by Jacob Rus\n\nThis library happily strips off as many trailing '=' as are included in the\ninput to 'decode', and doesn't worry whether its length is an even multiple\nof 4. It does not include trailing '=' in its own output. It uses the\n'URL safe' base64 alphabet, where the last two characters are '-' and '_'.\n\n--------------------\n\nCopyright (c) 2009 Jacob Rus\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n\nvar alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\nvar pad = '=';\nvar padChar = alphabet.charAt(alphabet.length - 1);\n\nvar shorten = function (array, number) {\n\t// remove 'number' characters from the end of 'array', in place (no return)\n\tfor (var i = number; i > 0; i--){ array.pop(); };\n};\n\nvar decode_map = {};\nfor (var i=0, n=alphabet.length; i < n; i++) {\n\tdecode_map[alphabet.charAt(i)] = i;\n};\n\n\n// use this regexp in the decode function to sniff out invalid characters.\nvar alphabet_inverse = new RegExp('[^' + alphabet.replace('-', '\\\\-') + ']');\n\n\n\nvar Base64CodecError = exports.Base64CodecError = function (message) { \n\tthis.message = message;\n};\nBase64CodecError.prototype.toString = function () {\n  return 'Base64CodecError' + (this.message ? ': ' + this.message : '');\n};\n\nvar assertOrBadInput = function (exp, message) {\n\tif (!exp) { throw new Base64CodecError(message) };\n};\n\nexports.encode = function (bytes) {\n\tassertOrBadInput(!(/[^\\x00-\\xFF]/.test(bytes)), // disallow two-byte chars\n\t\t'Input contains out-of-range characters.');\n\tvar padding = '\\x00\\x00\\x00'.slice((bytes.length % 3) || 3);\n\tbytes += padding; // pad with null bytes\n\tvar out_array = [];\n\tfor (var i=0, n=bytes.length; i < n; i+=3) {\n\t\tvar newchars = (\n\t\t\t(bytes.charCodeAt(i)   << 020) +\n\t\t\t(bytes.charCodeAt(i+1) << 010) +\n\t\t\t(bytes.charCodeAt(i+2)));\n\t\tout_array.push(\n\t\t\talphabet.charAt((newchars >> 18) & 077),\n\t\t\talphabet.charAt((newchars >> 12) & 077),\n\t\t\talphabet.charAt((newchars >> 6)  & 077), \n\t\t\talphabet.charAt((newchars)\t   & 077));\t  \n\t};\n\tshorten(out_array, padding.length);\n\treturn out_array.join('');\n};\n\nexports.decode = function (b64text) {\n\tlogger.debug('decode', b64text);\n\tb64text = b64text.replace(/\\s/g, '') // kill whitespace\n\t// strip trailing pad characters from input; // XXX maybe some better way?\n\tvar i = b64text.length; while (b64text.charAt(--i) === pad) {}; b64text = b64text.slice(0, i + 1);\n\tassertOrBadInput(!alphabet_inverse.test(b64text), 'Input contains out-of-range characters.');\n\tvar padding = Array(5 - ((b64text.length % 4) || 4)).join(padChar);\n\tb64text += padding; // pad with last letter of alphabet\n\tvar out_array = [];\n\tfor (var i=0, n=b64text.length; i < n; i+=4) {\n\t\tnewchars = (\n\t\t\t(decode_map[b64text.charAt(i)]   << 18) +\n\t\t\t(decode_map[b64text.charAt(i+1)] << 12) +\n\t\t\t(decode_map[b64text.charAt(i+2)] << 6)  +\n\t\t\t(decode_map[b64text.charAt(i+3)]));\n\t\tout_array.push(\n\t\t\t(newchars >> 020) & 0xFF,\n\t\t\t(newchars >> 010) & 0xFF, \n\t\t\t(newchars)\t\t& 0xFF);\n\t};\n\tshorten(out_array, padding.length);\n\tvar result = String.fromCharCode.apply(String, out_array);\n\tlogger.debug('decoded', result);\n\treturn result;\n};\n",filePath:"jsio/std/base64.js"},"net.csp.errors":{src:'var makeErrorClass = function(name, _code) {\n\tvar out = function(message, code) {\n\t\tthis.message = message;\n\t\tthis.code = code || _code;\n\t}\n\tout.prototype.toString = function() {\n\t\treturn name + (this.message ? \': \' + this.message : \'\');\n\t}\n\treturn out;\n}\n\nexports.ReadyStateError = makeErrorClass("ReadyStateError");\nexports.InvalidEncodingError = makeErrorClass("InvalidEncodingError");\n\nexports.HandshakeTimeout = makeErrorClass("HandshakeTimeout", 100);\nexports.SessionTimeout = makeErrorClass("HandshakeTimeout", 101);\n\nexports.ServerProtocolError = makeErrorClass("ServerProtocolError", 200);\n\nexports.ServerClosedConnection = makeErrorClass("ServerClosedConnection", 301);\nexports.ConnectionClosedCleanly = makeErrorClass("ConnectionClosedCleanly", 300);',filePath:"jsio/net/csp/errors.js"},"net.env.browser.csp":{src:"jsio('import net.interfaces');\njsio('from net.csp.client import CometSession');\njsio('import std.utf8 as utf8');\n\nexports.Connector = Class(net.interfaces.Connector, function() {\n\tthis.connect = function() {\n\t\tvar conn = new CometSession();\n\t\tconn.onconnect = bind(this, function() {\n\t\t\tlogger.debug('conn has opened');\n\t\t\tthis.onConnect(new Transport(conn));\n\t\t});\n\t\tconn.ondisconnect = bind(this, function(code) {\n\t\t\tthis.onConnectFailure('csp');\n\t\t});\n\t\tlogger.debug('open the conection');\n\t\tthis._opts.encoding = 'plain';\n\t\tvar url = this._opts.url;\n\t\tdelete this._opts.url;\n\t\tconn.connect(url, this._opts);//{encoding: 'plain'});\n\t}\n});\n\nvar Transport = Class(net.interfaces.Transport, function() {\n\tthis.init = function(conn) {\n\t\tthis._conn = conn;\n\t}\n\t\n\tthis.makeConnection = function(protocol) {\n\t\tthis._conn.onread = bind(protocol, 'dataReceived');\n\t\tthis._conn.ondisconnect = bind(protocol, 'connectionLost'); // TODO: map error codes\n\t}\n\t\n\tthis.write = function(data) {\n\t\t\n\t\tif (this._encoding == 'utf8') {\n\t\t\tthis._conn.write(utf8.encode(data));\n\t\t} else {\n\t\t\tthis._conn.write(data);\n\t\t} \n\t}\n\t\n\tthis.loseConnection = function(protocol) {\n\t\tthis._conn.close();\n\t}\n});\n",filePath:"jsio/net/env/browser/csp.js"},"std.JSON":{src:"// Based on json2.js (version 2009-09-29) http://www.JSON.org/json2.js\n// exports createGlobal, stringify, parse, stringifyDate\n\n/**\n * if a global JSON object doesn't exist, create one\n */\nexports.createGlobal = function() {\n\tif(typeof JSON == 'undefined') { JSON = {}; }\n\tif(typeof JSON.stringify !== 'function') {\n\t\tJSON.stringify = exports.stringify;\n\t}\n\tif(typeof JSON.parse !== 'function') {\n\t\tJSON.parse = exports.parse;\n\t}\n};\n\n;(function() {\n\tvar cx = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n\t\tescapable = /[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,\n\t\tgap,\n\t\tindent,\n\t\tmeta = {\t// table of character substitutions\n\t\t\t'\\b': '\\\\b',\n\t\t\t'\\t': '\\\\t',\n\t\t\t'\\n': '\\\\n',\n\t\t\t'\\f': '\\\\f',\n\t\t\t'\\r': '\\\\r',\n\t\t\t'\"' : '\\\\\"',\n\t\t\t'\\\\': '\\\\\\\\'\n\t\t},\n\t\trep;\n\t\n\tfunction quote(string) {\n\t\t// quote the string if it doesn't contain control characters, quote characters, and backslash characters\n\t\t// otherwise, replace those characters with safe escape sequences\n\t\tescapable.lastIndex = 0;\n\t\treturn escapable.test(string)\n\t\t\t? '\"' + string.replace(escapable, function (a) {\n\t\t\t\t\tvar c = meta[a];\n\t\t\t\t\treturn typeof c === 'string' ? c : '\\\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n\t\t\t\t}) + '\"'\n\t\t\t: '\"' + string + '\"';\n\t}\n\t\n\t// Produce a string from holder[key].\n\tfunction str(key, holder) {\n\t\tvar mind = gap, value = holder[key];\n\t\t\n\t\t// If the value has a toJSON method, call it to obtain a replacement value.\n\t\tif (value && typeof value === 'object' && typeof value.toJSON === 'function') {\n\t\t\tvalue = value.toJSON(key);\n\t\t}\n\t\t\n\t\t// If we were called with a replacer function, then call the replacer to\n\t\t// obtain a replacement value.\n\t\tif (typeof rep === 'function') { value = rep.call(holder, key, value); }\n\t\t\n\t\tswitch (typeof value) {\n\t\t\tcase 'string':\n\t\t\t\treturn quote(value);\n\t\t\tcase 'number':\n\t\t\t\t// JSON numbers must be finite\n\t\t\t\treturn isFinite(value) ? String(value) : 'null';\n\t\t\tcase 'boolean':\n\t\t\t\treturn String(value);\n\t\t\tcase 'object': // object, array, date, null\n\t\t\t\tif (value === null) { return 'null'; } // typeof null == 'object'\n\t\t\t\tif (value.constructor === Date) { return exports.stringifyDate(value); }\n\t\t\t\n\t\t\t\tgap += indent;\n\t\t\t\tvar partial = [];\n\t\t\t\t\n\t\t\t\t// Is the value an array?\n\t\t\t\tif (value.constructor === Array) {\n\t\t\t\t\tvar length = value.length;\n\t\t\t\t\tfor (var i = 0; i < length; i += 1) {\n\t\t\t\t\t\tpartial[i] = str(i, value) || 'null';\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t// Join all of the elements together, separated with commas, and wrap them in brackets.\n\t\t\t\t\tvar v = partial.length === 0 ? '[]' :\n\t\t\t\t\t\tgap ? '[\\n' + gap +\n\t\t\t\t\t\t\t\tpartial.join(',\\n' + gap) + '\\n' +\n\t\t\t\t\t\t\t\t\tmind + ']' :\n\t\t\t\t\t\t\t  '[' + partial.join(',') + ']';\n\t\t\t\t\tgap = mind;\n\t\t\t\t\treturn v;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (rep && typeof rep === 'object') { // rep is an array\n\t\t\t\t\tvar length = rep.length;\n\t\t\t\t\tfor (var i = 0; i < length; i += 1) {\n\t\t\t\t\t\tvar k = rep[i];\n\t\t\t\t\t\tif (typeof k === 'string') {\n\t\t\t\t\t\t\tvar v = str(k, value);\n\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\tpartial.push(quote(k) + (gap ? ': ' : ':') + v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else { // iterate through all of the keys in the object.\n\t\t\t\t\tfor (var k in value) {\n\t\t\t\t\t\tif (Object.hasOwnProperty.call(value, k)) {\n\t\t\t\t\t\t\tvar v = str(k, value);\n\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\tpartial.push(quote(k) + (gap ? ': ' : ':') + v);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Join all of the member texts together, separated with commas,\n\t\t\t\t// and wrap them in braces.\n\t\t\t\tvar v = partial.length === 0 ? '{}' :\n\t\t\t\t\tgap ? '{\\n' + gap + partial.join(',\\n' + gap) + '\\n' +\n\t\t\t\t\t\t\tmind + '}' : '{' + partial.join(',') + '}';\n\t\t\t\tgap = mind;\n\t\t\t\treturn v;\n\t\t}\n\t}\n\n\n\t/**\n\t * The stringify method takes a value and an optional replacer, and an optional\n\t * space parameter, and returns a JSON text. The replacer can be a function\n\t * that can replace values, or an array of strings that will select the keys.\n \t * A default replacer method can be provided. Use of the space parameter can\n\t * produce text that is more easily readable.\n\t */\n\texports.stringify = function (value, replacer, space) {\n\t\tgap = '';\n\t\tindent = '';\n\t\t\n\t\t// If the space parameter is a number, make an indent string containing that many spaces.\n\t\tif (typeof space === 'number') {\n\t\t\tfor (var i = 0; i < space; i += 1) {\n\t\t\t\tindent += ' ';\n\t\t\t}\n\t\t} else if (typeof space === 'string') {\n\t\t\tindent = space;\n\t\t}\n\t\t\n\t\t// If there is a replacer, it must be a function or an array.\n\t\trep = replacer;\n\t\tif (replacer && typeof replacer !== 'function' &&\n\t\t\t\t(typeof replacer !== 'object' ||\n\t\t\t\t typeof replacer.length !== 'number')) {\n\t\t\tthrow new Error('JSON stringify: invalid replacer');\n\t\t}\n\t\t\n\t\t// Make a fake root object containing our value under the key of ''.\n\t\t// Return the result of stringifying the value.\n\t\treturn str('', {'': value});\n\t};\n\t\n\texports.stringifyDate = function(d) {\n\t\tvar year = d.getUTCFullYear(),\n\t\t\tmonth = d.getUTCMonth() + 1,\n\t\t\tday = d.getUTCDate(),\n\t\t\thours = d.getUTCHours(),\n\t\t\tminutes = d.getUTCMinutes(),\n\t\t\tseconds = d.getUTCSeconds(),\n\t\t\tms = d.getUTCMilliseconds();\n\t\t\n\t\tif (month < 10) { month = '0' + month; }\n\t\tif (day < 10) { day = '0' + day; }\n\t\tif (hours < 10) { hours = '0' + hours; }\n\t\tif (minutes < 10) { minutes = '0' + minutes; }\n\t\tif (seconds < 10) { seconds = '0' + seconds; }\n\t\tif (ms < 10) { ms = '00' + ms; }\n\t\telse if (ms < 100) { ms = '0' + ms; }\n\n\t\treturn '\"' + year\n\t\t\t+ '-' + month\n\t\t\t+ '-' + day\n\t\t\t+ 'T' + hours\n\t\t\t+ ':' + minutes\n\t\t\t+ ':' + seconds\n\t\t\t+ '.' + ms\n\t\t\t+ 'Z\"';\n\t}\n\t\n\t/**\n\t * The parse method takes a text and an optional reviver function, and returns\n\t * a JavaScript value if the text is a valid JSON text.\n\t */\n\texports.parse = function (text, reviver) {\n\t\t// Parsing happens in four stages. In the first stage, we replace certain\n\t\t// Unicode characters with escape sequences. JavaScript handles many characters\n\t\t// incorrectly, either silently deleting them, or treating them as line endings.\n\t\tcx.lastIndex = 0;\n\t\tif (cx.test(text)) {\n\t\t\ttext = text.replace(cx, function (a) {\n\t\t\t\treturn '\\\\u' +\n\t\t\t\t\t('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n\t\t\t});\n\t\t}\n\t\t\n\t\t// In the second stage, we run the text against regular expressions that look\n\t\t// for non-JSON patterns. We are especially concerned with '()' and 'new'\n\t\t// because they can cause invocation, and '=' because it can cause mutation.\n\t\t// But just to be safe, we want to reject all unexpected forms.\n\n\t\t// We split the second stage into 4 regexp operations in order to work around\n\t\t// crippling inefficiencies in IE's and Safari's regexp engines. First we\n\t\t// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we\n\t\t// replace all simple value tokens with ']' characters. Third, we delete all\n\t\t// open brackets that follow a colon or comma or that begin the text. Finally,\n\t\t// we look to see that the remaining characters are only whitespace or ']' or\n\t\t// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.\n\n\t\tif (/^[\\],:{}\\s]*$/\n\t\t\t\t.test(text.replace(/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')\n\t\t\t\t.replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g, ']')\n\t\t\t\t.replace(/(?:^|:|,)(?:\\s*\\[)+/g, '')))\n\t\t{\n\t\t\tvar j = eval('(' + text + ')');\n\t\t\tif(!reviver) {\n\t\t\t\treturn j;\n\t\t\t} else {\n\t\t\t\t// In the optional fourth stage, we recursively walk the new structure, passing\n\t\t\t\t// each name/value pair to a reviver function for possible transformation.\n\t\t\t\tvar walk = function(holder, key) {\n\t\t\t\t\t// The walk method is used to recursively walk the resulting structure so\n\t\t\t\t\t// that modifications can be made.\n\t\t\t\t\tvar k, v, value = holder[key];\n\t\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\t\tfor (k in value) {\n\t\t\t\t\t\t\tif (Object.hasOwnProperty.call(value, k)) {\n\t\t\t\t\t\t\t\tv = walk(value, k);\n\t\t\t\t\t\t\t\tif (v !== undefined) {\n\t\t\t\t\t\t\t\t\tvalue[k] = v;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tdelete value[k];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn reviver.call(holder, key, value);\n\t\t\t\t}\n\t\t\t\treturn walk({'': j}, '');\n\t\t\t}\n\t\t}\n\n\t\t// If the text is not JSON parseable, then a SyntaxError is thrown.\n\t\tthrow new SyntaxError('JSON.parse');\n\t};\n}());",filePath:"jsio/std/JSON.js"},"net.env.browser.websocket":{src:"jsio('import net.interfaces');\njsio('import std.utf8 as utf8');\n\nexports.Connector = Class(net.interfaces.Connector, function() {\n\tthis.connect = function() {\n\t\tvar url = this._opts.url;\n\t\t\n\t\tvar constructor = this._opts.wsConstructor || window.WebSocket;\n\t\tlogger.info('this._opts', this._opts);\n\t\tvar ws = new constructor(url);\n//\t\tvar ws = new constructor(url);\n//\t\tJK = constructor;\n//\t\tXKCDA = ws;\n\t\tws.onopen = bind(this, function() {\n\t\t\tthis.onConnect(new Transport(ws));\n\t\t});\n\t\tws.onclose = bind(this, function(code) {\n\t\t\tthis.onConnectFailure('websocket');\n\t\t\tlogger.debug('conn closed without opening, code:', code);\n\t\t});\n\t}\n});\n\nvar Transport = Class(net.interfaces.Transport, function() {\n\t\n\tthis.init = function(ws) {\n\t\tthis._ws = ws;\n\t}\n\t\n\tthis.makeConnection = function(protocol) {\n\t\tthis._ws.onmessage = function(data) {\n\t\t\tvar payload = utf8.encode(data.data);\n\t\t\tprotocol.dataReceived(payload);\n\t\t}\n\t\tthis._ws.onclose = bind(protocol, 'connectionLost'); // TODO: map error codes\n\t}\n\t\n\tthis.write = function(data, encoding) {\n\t\tif (this._encoding == 'plain') {\n\t\t\tresult = utf8.decode(data);\n\t\t\tdata = result[0];\n\t\t}\n\t\tthis._ws.send(data);\n\t}\n\t\n\tthis.loseConnection = function(protocol) {\n\t\tthis._ws.close();\n\t}\n});\n",filePath:"jsio/net/env/browser/websocket.js"},"net.protocols.rtjp":{src:'jsio(\'import net.interfaces\');\njsio(\'from net.protocols.delimited import DelimitedProtocol\');\n\nexports.RTJPProtocol = Class(DelimitedProtocol, function(supr) {\n\tthis.init = function() {\n\t\tvar delimiter = \'\\r\\n\';\n\t\tsupr(this, \'init\', [delimiter]);\n\t\tthis.frameId = 0;\n\t}\n\n\tthis.connectionMade = function() {\n\t\tlogger.debug("connectionMade");\n\t}\n\t\n\tvar error = function(e) {\n\t\tlogger.error(e);\n\t}\n\t\n\t// Inherit and overwrite\n\tthis.frameReceived = function(id, name, args) {\n\t}\n\n\t// Public\n\tthis.sendFrame = function(name, args) {\n\t\tif (!args) {\n\t\t\targs = {}\n\t\t}\n\t\tlogger.debug(\'sendFrame\', name, args);\n\t\tthis.sendLine(JSON.stringify([++this.frameId, name, args]));\n\t\treturn this.frameId;\n\t}\n\n\tthis.lineReceived = function(line) {\n\t\ttry {\n\t\t\tvar frame = JSON.parse(line);\n\t\t\tif (frame.length != 3) {\n\t\t\t\treturn error.call(this, "Invalid frame length");\n\t\t\t}\n\t\t\tif (typeof(frame[0]) != "number") {\n\t\t\t\treturn error.call(this, "Invalid frame id");\n\t\t\t}\n\t\t\tif (typeof(frame[1]) != "string") {\n\t\t\t\treturn error.call(this, "Invalid frame name");\n\t\t\t}\n\t\t\tlogger.debug("frameReceived:", frame[0], frame[1], frame[2]);\n\t\t\tthis.frameReceived(frame[0], frame[1], frame[2]);\n\t\t} catch(e) {\n\t\t\terror.call(this, e);\n\t\t}\n\t}\n\n\tthis.connectionLost = function() {\n\t\tlogger.debug(\'conn lost\');\n\t}\n});\n\n\n\n',filePath:"jsio/net/protocols/rtjp.js"},"net.csp.client":{src:"jsio('import std.base64 as base64');\njsio('import std.utf8 as utf8');\njsio('import std.uri as uri'); \njsio('import .errors');\njsio('import .transports');\n\nvar READYSTATE = exports.READYSTATE = {\n\tINITIAL: 0,\n\tCONNECTING: 1,\n\tCONNECTED: 2,\n\tDISCONNECTING: 3,\n\tDISCONNECTED:  4\n};\n\n\nexports.CometSession = Class(function(supr) {\n\tvar id = 0;\n\tvar kDefaultBackoff = 50;\n\tvar kDefaultTimeoutInterval = 45000;\n\tvar kDefaultHandshakeTimeout = 10000;\n\tthis.init = function() {\n\t\tthis._id = ++id;\n\t\tthis._url = null;\n\t\tthis.readyState = READYSTATE.INITIAL;\n\t\tthis._sessionKey = null;\n\t\tthis._transport = null;\n\t\tthis._options = null;\n\t\t\n\t\tthis._utf8ReadBuffer = \"\";\n\t\tthis._writeBuffer = \"\";\n\t\t\n\t\tthis._packetsInFlight = null;\n\t\tthis._lastEventId = null;\n\t\tthis._lastSentId = null;\n\t\t\n\t\tthis._handshakeLater = null;\n\t\tthis._handshakeBackoff = kDefaultBackoff;\n\t\tthis._handshakeRetryTimer = null;\n\t\tthis._handshakeTimeoutTimer = null;\n\n\t\tthis._timeoutTimer = null;\n\n\t\t\n\t\tthis._writeBackoff = kDefaultBackoff;\n\t\tthis._cometBackoff = kDefaultBackoff;\n\t\t\n\t\tthis._nullInBuffer = false;\n\t\tthis._nullInFlight= false;\n\t\tthis._nullSent = false;\n\t\tthis._nullReceived = false;\n\t}\n\t\n\t\n\tthis.setEncoding = function(encoding) {\n\t\tif (encoding == this._options.encoding) { \n\t\t\treturn; \n\t\t}\n\t\tif (encoding != 'utf8' && encoding != 'plain') {\n\t\t\tthrow new errors.InvalidEncodingError();\n\t\t}\n\t\tif (encoding == 'plain' && this._buffer) {\n\t\t\tvar buffer = this._utf8ReadBuffer;\n\t\t\tthis._utf8ReadBuffer = \"\";\n\t\t\tthis._doOnRead(buffer);\n\t\t}\n\t\tthis._options.encoding = encoding;\n\t}\n\n\n\tthis.connect = function(url, options) {\n\t\tthis._url = url.replace(/\\/$/,'');\n\t\tthis._options = options || {};\n\t\t\n\t\tthis._options.encoding = this._options.encoding || 'utf8';\n\t\tthis.setEncoding(this._options.encoding); // enforce encoding constraints\n\t\t\n\t\tthis._options.connectTimeout = this._options.connectTimeout || kDefaultHandshakeTimeout;\n\t\t\n\t\tvar transportClass = transports.chooseTransport(url, this._options);\n\t\tthis._transport = new transportClass();\n\t\t\n\t\tthis._transport.handshakeFailure = bind(this, this._handshakeFailure);\n\t\tthis._transport.handshakeSuccess = bind(this, this._handshakeSuccess);\n\t\t\n\t\tthis._transport.cometFailure = bind(this, this._cometFailure);\n\t\tthis._transport.cometSuccess = bind(this, this._cometSuccess);\n\t\t\n\t\tthis._transport.sendFailure = bind(this, this._writeFailure);\n\t\tthis._transport.sendSuccess = bind(this, this._writeSuccess);\n\t\tthis.readyState = READYSTATE.CONNECTING;\n\t\tthis._transport.handshake(this._url, this._options);\n\t\tthis._handshakeTimeoutTimer = $setTimeout(bind(this, this._handshakeTimeout), \n\t\t\tthis._options.connectTimeout);\n\t}\n\n\tthis.write = function(data, encoding) {\n\t\tif (this.readyState != READYSTATE.CONNECTED) {\n\t\t\tthrow new errors.ReadyStateError();\n\t\t}\n\t\tencoding = encoding || this._options.encoding || 'utf8';\n\t\tif (encoding == 'utf8') {\n\t\t\tdata = utf8.encode(data);\n\t\t}\n\t\tthis._writeBuffer += data;\n\t\tthis._doWrite();\n\t}\n\t\n\t// Close due to protocol error\n\tthis._protocolError = function(msg) {\n\t\tlogger.debug('_protocolError', msg);\n\t\t// Immediately fire the onclose\n\t\t// send a null packet to the server\n\t\t// don't wait for a null packet back.\n\t\tthis.readyState = READYSTATE.DISCONNECTED;\n\t\tthis._doWrite(true);\n\t\tthis._doOnDisconnect(new errors.ServerProtocolError(msg));\n\t}\n\t\n\tthis._receivedNullPacket = function() {\n\t\tlogger.debug('_receivedNullPacket');\n\t\t// send a null packet back to the server\n\t\tthis._receivedNull = true;\n\t\t\n\t\t// send our own null packet back. (maybe)\n\t\tif (!(this._nullInFlight || this._nullInBuffer || this._nullSent)) {\n\t\t\tthis.readyState = READYSTATE.DISCONNECTING;\n\t\t\tthis._doWrite(true);\n\t\t}\n\t\telse {\n\t\t\tthis.readyState = READYSTATE.DISCONNECTED;\n\t\t}\n\t\t\n\t\t// fire an onclose\n\t\tthis._doOnDisconnect(new errors.ConnectionClosedCleanly());\n\n\t}\n\t\n\tthis._sentNullPacket = function() {\n\t\tlogger.debug('_sentNullPacket');\n\t\tthis._nullSent = true;\n\t\tif (this._nullSent && this._nullReceived) {\n\t\t\tthis.readyState = READYSTATE.DISCONNECTED;\n\t\t}\n\t}\n\t\n\t\n\t// User Calls close\n\tthis.close = function(err) {\n\t\tlogger.debug('close called', err, 'readyState', this.readyState);\n\n\t\t// \n\t\tswitch(this.readyState) {\n\t\t\tcase READYSTATE.CONNECTING:\n\t\t\t\tclearTimeout(this._handshakeRetryTimer);\n\t\t\t\tclearTimeout(this._handshakeTimeoutTimer);\n\t\t\t\tthis.readyState = READYSTATE.DISCONNECTED;\n\t\t\t\tthis._doOnDisconnect(err);\n\t\t\t\tbreak;\n\t\t\tcase READYSTATE.CONNECTED:\n\t\t\t\tthis.readyState = READYSTATE.DISCONNECTING;\n\t\t\t\tthis._doWrite(true);\n\t\t\t\tclearTimeout(this._timeoutTimer);\n\t\t\t\tbreak;\n\t\t\tcase READYSTATE.DISCONNECTED:\n\t\t\t\tthrow new errors.ReadyStateError(\"Session is already disconnected\");\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\tthis._sessionKey = null;\n\t\tthis._opened = false; // what is this used for???\n\t\tthis.readyState = READYSTATE.DISCONNECTED;\n\t\t\n\t\tthis._doOnDisconnect(err);\n\t}\n\n\t\n\tthis._handshakeTimeout = function() {\n\t\tlogger.debug('handshake timeout');\n\t\tthis._handshakeTimeoutTimer = null;\n\t\tthis._doOnDisconnect(new errors.HandshakeTimeout());\n\t}\n\t\n\tthis._handshakeSuccess = function(d) {\n\t\tlogger.debug('handshake success', d);\n\t\tif (this.readyState != READYSTATE.CONNECTING) { \n\t\t\tlogger.debug('received handshake success in invalid readyState:', this.readyState);\n\t\t\treturn; \n\t\t}\n\t\tclearTimeout(this._handshakeTimeoutTimer);\n\t\tthis._handshakeTimeoutTimer = null;\n\t\tthis._sessionKey = d.session;\n\t\tthis._opened = true;\n\t\tthis.readyState = READYSTATE.CONNECTED;\n\t\tthis._doOnConnect();\n\t\tthis._doConnectComet();\n\t}\n\t\n\tthis._handshakeFailure = function(e) {\n\t\tlogger.debug('handshake failure', e);\n\t\tif (this.readyState != READYSTATE.CONNECTING) { return; }\n\t\t\n\t\tlogger.debug('trying again in ', this._handshakeBackoff);\n\t\tthis._handshakeRetryTimer = $setTimeout(bind(this, function() {\n\t\t\tthis._handshakeRetryTimer = null;\n\t\t\tthis._transport.handshake(this._url, this._options);\n\t\t}), this._handshakeBackoff);\n\t\t\n\t\tthis._handshakeBackoff *= 2;\n\t}\n\t\n\tthis._writeSuccess = function() {\n\t\tif (this.readyState != READYSTATE.CONNECTED && this.readyState != READYSTATE.DISCONNECTING) {\n\t\t\treturn; \n\t\t}\n\t\tif (this._nullInFlight) {\n\t\t\treturn this._sentNullPacket();\n\t\t}\n\t\tthis._resetTimeoutTimer();\n\t\tthis.writeBackoff = kDefaultBackoff;\n\t\tthis._packetsInFlight = null;\n\t\tif (this._writeBuffer || this._nullInBuffer) {\n\t\t\tthis._doWrite(this._nullInBuffer);\n\t\t}\n\t}\n\t\n\tthis._writeFailure = function() {\n\t\tif (this.readyState != READYSTATE.CONNECTED && this.READYSTATE != READYSTATE.DISCONNECTING) { return; }\n\t\tthis._writeTimer = $setTimeout(bind(this, function() {\n\t\t\tthis._writeTimer = null;\n\t\t\tthis.__doWrite(this._nullInBuffer);\n\t\t}), this._writeBackoff);\n\t\tthis._writeBackoff *= 2;\n\t}\t\n\n\tthis._doWrite = function(sendNull) {\n\t\tif (this._packetsInFlight) {\n\t\t\tif (sendNull) {\n\t\t\t\tthis._nullInBuffer = true;\n\t\t\t\treturn; \n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis.__doWrite(sendNull);\n\t}\n\t\n\tthis.__doWrite = function(sendNull) {\n\t\tlogger.debug('_writeBuffer:', this._writeBuffer);\n\t\tif (!this._packetsInFlight && this._writeBuffer) {\n\t\t\tthis._packetsInFlight = [this._transport.encodePacket(++this._lastSentId, this._writeBuffer, this._options)];\n\t\t\tthis._writeBuffer = \"\";\n\t\t}\n\t\tif (sendNull && !this._writeBuffer) {\n\t\t\tif (!this._packetsInFlight) {\n\t\t\t\tthis._packetsInFlight = [];\n\t\t\t}\n\t\t\tthis._packetsInFlight.push([++this._lastSentId, 0, null]);\n\t\t\tthis._nullInFlight = true;\n\t\t}\n\t\tif (!this._packetsInFlight) {\n\t\t\tlogger.debug(\"no packets to send\");\n\t\t\treturn;\n\t\t}\n\t\tlogger.debug('sending packets:', JSON.stringify(this._packetsInFlight));\n\t\tthis._transport.send(this._url, this._sessionKey, this._lastEventId || 0, JSON.stringify(this._packetsInFlight), this._options);\n\t}\n\t\n\tthis._doConnectComet = function() {\n\t\tlogger.debug('_doConnectComet');\n//\t\treturn;\n\t\tthis._transport.comet(this._url, this._sessionKey, this._lastEventId || 0, this._options);\n\t}\n\n\tthis._cometFailure = function(status, message) {\n\t\tif (this.readyState != READYSTATE.CONNECTED) { return; }\n\t\tif (status == 404 && message == 'Session not found') {\n\t\t\treturn this.close();\n\t\t}\n\t\tthis._cometTimer = $setTimeout(bind(this, function() {\n\t\t\tthis._doConnectComet();\n\t\t}), this._cometBackoff);\n\t\tthis._cometBackoff *= 2;\n\t}\n\t\n\tthis._cometSuccess = function(packets) {\n\t\tif (this.readyState != READYSTATE.CONNECTED && this.readyState != READYSTATE.DISCONNECTING) { return; }\n\t\tlogger.debug('comet Success:', packets);\n\t\tthis._cometBackoff = kDefaultBackoff;\n\t\tthis._resetTimeoutTimer();\n\t\tfor (var i = 0, packet; (packet = packets[i]) || i < packets.length; i++) {\n\t\t\tlogger.debug('process packet:', packet);\n\t\t\tif (packet === null) {\n\t\t\t\treturn self.close();\n\t\t\t}\n\t\t\tlogger.debug('process packet', packet);\n\t\t\tvar ackId = packet[0];\n\t\t\tvar encoding = packet[1];\n\t\t\tvar data = packet[2];\n\t\t\tif (typeof(this._lastEventId) == 'number' && ackId <= this._lastEventId) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (typeof(this._lastEventId) == 'number' && ackId != this._lastEventId+1) {\n\t\t\t\treturn this._protocolError(\"Ack id too high\");\n\t\t\t}\n\t\t\tthis._lastEventId = ackId;\n\t\t\tif (data == null) {\n\t\t\t\treturn this._receivedNullPacket();\n\t\t\t}\n\t\t\tif (encoding == 1) { // base64 encoding\n\t\t\t\ttry {\n\t\t\t\t\tlogger.debug('before base64 decode:', data);\n\t\t\t\t\tdata = base64.decode(data);\n\t\t\t\t\tlogger.debug('after base64 decode:', data);\n\t\t\t\t} catch(e) {\n\t\t\t\t\treturn this._protocolError(\"Unable to decode base64 payload\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._options.encoding == 'utf8') {\n\t\t\t\t// TODO: need an incremental utf8 decoder for this stuff.\n\t\t\t\tthis._utf8ReadBuffer += data;\n\t\t\t\tlogger.debug('before utf8 decode, _utf8ReadBuffer:', this._utf8ReadBuffer);\n\t\t\t\tvar result = utf8.decode(this._utf8ReadBuffer);\n\t\t\t\tdata = result[0];\n\t\t\t\tthis._utf8ReadBuffer = this._utf8ReadBuffer.slice(result[1]);\n\t\t\t\tlogger.debug('after utf8 decode, _utf8ReadBuffer:', this._utf8ReadBuffer, 'data:', data );\n\t\t\t}\n\t\t\tlogger.debug('dispatching data:', data);\n\t\t\ttry {\n\t\t\t\tthis._doOnRead(data);\n\t\t\t} catch(e) {\n\t\t\t\tlogger.error('application code threw an error. (re-throwing in timeout):', e);\n\t\t\t\t// throw the error later\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tlogger.debug('timeout fired, throwing error', e);\n\t\t\t\t\tthrow e;\n\t\t\t\t}, 0);\n\t\t\t}\n\t\t}\n\t\t// reconnect comet last, after we process all of the packet ids\n\t\tthis._doConnectComet();\n\t\t\n\t}\n\n\tthis._doOnRead = function(data) {\n\t\tif (typeof(this.onread) == 'function') {\n\t\t\tlogger.debug('call onread function', data);\n\t\t\tthis.onread(data);\n\t\t}\n\t\telse {\n\t\t\tlogger.debug('skipping onread callback (function missing)');\n\t\t}\n\t}\n\t\n\tthis._doOnDisconnect = function(err) {\n\t\tif (typeof(this.ondisconnect) == 'function') {\n\t\t\tlogger.debug('call ondisconnect function', err);\n\t\t\tthis.ondisconnect(err);\n\t\t}\n\t\telse {\n\t\t\tlogger.debug('skipping ondisconnect callback (function missing)');\n\t\t}\n\t}\n\t\n\tthis._doOnConnect = function() {\n\t\tif (typeof(this.onconnect) == 'function') {\n\t\t\tlogger.debug('call onconnect function');\n\t\t\ttry {\n\t\t\t\tthis.onconnect();\n\t\t\t} catch(e) {\n\t\t\t\tlogger.debug('onconnect caused errror', e);\n\t\t\t\t// throw error later\n\t\t\t\tsetTimeout(function() { throw e }, 0);\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tlogger.debug('skipping onconnect callback (function missing)');\n\t\t}\n\t}\n\n\tthis._resetTimeoutTimer = function() {\n\t\tclearTimeout(this._timeoutTimer);\n\t\tthis._timeoutTimer = $setTimeout(bind(this, function() {\n\t\t\tlogger.debug('connection timeout expired');\n\t\t\tthis.close(new errors.SessionTimeout())\n\t\t}), this._getTimeoutInterval())\n\t}\n\t\n\tthis._getTimeoutInterval = function() {\n\t\treturn kDefaultTimeoutInterval;\n\t}\n\n});\n",filePath:"jsio/net/csp/client.js"},"net.interfaces":{src:"// Sort of like a twisted protocol\njsio('import net');\n\nvar ctx = jsio.__env.global;\n\nexports.Protocol = Class(function() {\n\tthis.connectionMade = function(isReconnect) {}\n\tthis.dataReceived = function(data) {}\n\tthis.connectionLost = function(reason) {}\n\tthis.connectionFailed = function(transportName) {}\n});\n\nexports.Client = Class(function() {\n\tthis.init = function(protocol) {\n\t\tthis._protocol = protocol;\n\t}\n\t\n\tthis.connect = function(transportName, opts) {\n\t\tthis._remote = new this._protocol();\n\t\tthis._remote._client = this;\n\t\tnet.connect(this._remote, transportName, opts);\n\t}\n});\n\n// Sort of like a twisted factory\nexports.Server = Class(function() {\n\tthis.init = function(protocolClass) {\n\t\tthis._protocolClass = protocolClass;\n\t}\n\n\tthis.buildProtocol = function() {\n\t\treturn new this._protocolClass();\n\t}\n\t\n\tthis.listen = function(how, port) {\n\t\treturn net.listen(this, how, port);\n\t}\n});\n\nexports.Transport = Class(function() {\n\tthis._encoding = 'plain'\n\tthis.write = function(data, encoding) {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\tthis.getPeer = function() {\n\t\tthrow new Error(\"Not implemented\");\n\t}\n\tthis.setEncoding = function(encoding) {\n\t\tthis._encoding = encoding;\n\t}\n\tthis.getEncoding = function() {\n\t\treturn this._encoding;\n\t}\n});\n\nexports.Listener = Class(function() {\n\tthis.init = function(server, opts) {\n\t\tthis._server = server;\n\t\tthis._opts = opts || {};\n\t}\n\t\n\tthis.onConnect = function(transport) {\n\t\ttry {\n\t\t\tvar p = this._server.buildProtocol();\n\t\t\tp.transport = transport;\n\t\t\tp.server = this._server;\n\t\t\ttransport.protocol = p;\n\t\t\ttransport.makeConnection(p);\n\t\t\tp.connectionMade();\n\t\t} catch(e) {\n\t\t\tlogger.error(e);\n\t\t}\n\t}\n\t\n\tthis.listen = function() { throw new Error('Abstract class'); }\n\tthis.stop = function() {}\n});\n\nexports.Connector = Class(function() {\n\tthis.init = function(protocol, opts) {\n\t\tthis._protocol = protocol;\n\t\tthis._opts = opts;\n\t}\n\t\n\tthis.onConnect = function(transport) {\n\t\ttransport.makeConnection(this._protocol);\n\t\tthis._protocol.transport = transport;\n\t\ttry {\n\t\t\tthis._protocol.connectionMade();\n\t\t} catch(e) {\n\t\t\tthrow logger.error(e);\n\t\t}\n\t}\n\t\n\tthis.onDisconnect = function() {\n\t\ttry {\n\t\t\tthis._protocol.connectionLost();\n\t\t} catch(e) {\n\t\t\tthrow logger.error(e);\n\t\t}\n\t}\n\t\n\tthis.onConnectFailure = function(transportName) {\n\t\ttry {\n\t\t\tthis._protocol.connectionFailed(transportName);\n\t\t} catch(e) {\n\t\t\tthrow logger.error(e);\n\t\t}\n\t}\n\tthis.getProtocol = function() { return this._protocol; }\n});\n",filePath:"jsio/net/interfaces.js"},base:{src:"exports.log = jsio.__env.log;\nexports.GLOBAL = jsio.__env.global;\n\nexports.bind = function(context, method /*, VARGS*/) {\n\tif(arguments.length > 2) {\n\t\tvar args = Array.prototype.slice.call(arguments, 2);\n\t\treturn typeof method == 'string'\n\t\t\t? function() {\n\t\t\t\tif (context[method]) {\n\t\t\t\t\treturn context[method].apply(context, args.concat(Array.prototype.slice.call(arguments, 0)));\n\t\t\t\t} else {\n\t\t\t\t\tthrow logger.error('No method:', method, 'for context', context);\n\t\t\t\t}\n\t\t\t}\n\t\t\t: function() { return method.apply(context, args.concat(Array.prototype.slice.call(arguments, 0))); }\n\t} else {\n\t\treturn typeof method == 'string'\n\t\t\t? function() {\n\t\t\t\tif (context[method]) {\n\t\t\t\t\treturn context[method].apply(context, arguments);\n\t\t\t\t} else {\n\t\t\t\t\tthrow logger.error('No method:', method, 'for context', context);\n\t\t\t\t}\n\t\t\t}\n\t\t\t: function() { return method.apply(context, arguments); }\n\t}\n}\n\nexports.Class = function(parent, proto) {\n\tif(!parent) { throw new Error('parent or prototype not provided'); }\n\tif(!proto) { proto = parent; }\n\telse if(parent instanceof Array) { // multiple inheritance, use at your own risk =)\n\t\tproto.prototype = {};\n\t\tfor(var i = 0, p; p = parent[i]; ++i) {\n\t\t\tfor(var item in p.prototype) {\n\t\t\t\tif(!(item in proto.prototype)) {\n\t\t\t\t\tproto.prototype[item] = p.prototype[item];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tparent = parent[0]; \n\t} else {\n\t\tproto.prototype = parent.prototype;\n\t}\n\n\tvar cls = function() { if(this.init) { return this.init.apply(this, arguments); }}\n\tcls.prototype = new proto(function(context, method, args) {\n\t\tvar args = args || [];\n\t\tvar target = proto;\n\t\twhile(target = target.prototype) {\n\t\t\tif(target[method]) {\n\t\t\t\treturn target[method].apply(context, args);\n\t\t\t}\n\t\t}\n\t\tthrow new Error('method ' + method + ' does not exist');\n\t});\n\tcls.prototype.constructor = cls;\n\treturn cls;\n}\n\nexports.$setTimeout = function(f, t/*, VARGS */) {\n\tvar args = Array.prototype.slice.call(arguments, 2);\n\treturn setTimeout(function() {\n\t\ttry {\n\t\t\tf.apply(this, args);\n\t\t} catch(e) {\n\t\t\t// log?\n\t\t}\n\t}, t)\n}\n\nexports.$setInterval = function(f, t/*, VARGS */) {\n\tvar args = Array.prototype.slice.call(arguments, 2);\n\treturn setInterval(function() {\n\t\ttry {\n\t\t\tf.apply(this, args);\n\t\t} catch(e) {\n\t\t\t// log?\n\t\t}\n\t}, t)\n}\n\n// node doesn't let you call clearTimeout(null)\nexports.$clearTimeout = function (timer) { return timer ? clearTimeout(timer) : null; };\nexports.$clearInterval = function (timer) { return timer ? clearInterval(timer) : null; };\n\n// keep logging local variables out of other closures in this file!\nexports.logging = (function() {\n\t\n\t// logging namespace, this is what is exported\n\tvar logging = {\n\t\tDEBUG: 1,\n\t\tLOG: 2,\n\t\tINFO: 3,\n\t\tWARN: 4,\n\t\tERROR: 5\n\t};\n\n\t// effectively globals - all loggers and a global production state\n\tvar loggers = {}\n\tvar production = false;\n\n\tlogging.setProduction = function(prod) { production = !!prod; }\n\tlogging.get = function(name) {\n\t\treturn loggers.hasOwnProperty(name) ? loggers[name]\n\t\t\t: (loggers[name] = new Logger(name));\n\t}\n\tlogging.set = function(name, _logger) {\n\t\tloggers[name] = _logger;\n\t}\n\t\n\tlogging.getAll = function() { return loggers; }\n\n\tlogging.__create = function(pkg, ctx) { ctx.logger = logging.get(pkg); }\n\t\n\tvar Logger = exports.Class(function() {\n\t\tthis.init = function(name, level) {\n\t\t\tthis._name = name;\n\t\t\tthis._level = level || logging.LOG;\n\t\t}\n\t\t\n\t\tthis.setLevel = function(level) { this._level = level; }\n\t\n\t\tvar slice = Array.prototype.slice;\n\t\tvar log = exports.log;\n\t\tfunction makeLogFunction(level, type) {\n\t\t\treturn function() {\n\t\t\t\tif (!production && level >= this._level) {\n\t\t\t\t\treturn log.apply(log, [type, this._name].concat(slice.call(arguments, 0)));\n\t\t\t\t}\n\t\t\t\treturn arguments[0];\n\t\t\t}\n\t\t}\n\t\n\t\tthis.debug = makeLogFunction(logging.DEBUG, \"DEBUG\");\n\t\tthis.log = makeLogFunction(logging.LOG, \"LOG\");\n\t\tthis.info = makeLogFunction(logging.INFO, \"INFO\");\n\t\tthis.warn = makeLogFunction(logging.WARN, \"WARN\");\n\t\tthis.error = makeLogFunction(logging.ERROR, \"ERROR\");\n\t});\n\n\treturn logging;\n})();\n\nvar logger = exports.logging.get('jsiocore');\n",filePath:"jsio/base.js"},hookbox:{src:"jsio('from net import connect as jsioConnect');\njsio('from net.protocols.rtjp import RTJPProtocol');\n\nexports.logging = logging\n\n\nexports.connect = function(url, cookieString) {\n\tif (!url.match('/$')) {\n\t\turl = url + '/';\n\t}\n\tvar p = new HookBoxProtocol(url, cookieString);\n\tif (window.WebSocket) {\n\t\tjsioConnect(p, 'websocket', {url: url.replace('http://', 'ws://') + 'ws' });\n\t}\n\telse {\n\t\tjsioConnect(p, 'csp', {url: url + 'csp'})\n\t}\n\treturn p;\n}\n\nvar Subscription = Class(function(supr) {\n\n\n\tthis.init = function(args) {\n\t\tthis.channelName = args.channel_name;\n\t\tthis.history = args.history;\n\t\tthis.historySize = args.history_size;\n\t\tthis.state = args.state;\n\t\tthis.presence = args.presence;\n\t\tthis.canceled = false;\n\t}\n\n\tthis.onPublish = function(frame) { }\n\tthis.onSubscribe = function(frame) {}\n\tthis.onUnsubscribe = function(frame) {}\n\tthis.onState = function(frame) {}\n\n\tthis.frame = function(name, args) {\n\t\tlogger.debug('received frame', name, args);\n\t\tswitch(name) {\n\t\t\tcase 'PUBLISH':\n\t\t\t\tif (this.historySize) { \n\t\t\t\t\tthis.history.push([\"PUBLISH\", { user: args.user, payload: args.payload}]) \n\t\t\t\t\twhile (this.history.length > this.historySize) { \n\t\t\t\t\t\tthis.history.shift(); \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.onPublish(args);\n\t\t\t\tbreak;\n\t\t\tcase 'UNSUBSCRIBE':\n\t\t\t\tif (this.historySize) { \n\t\t\t\t\tthis.history.push([\"UNSUBSCRIBE\", { user: args.user}]) \n\t\t\t\t\twhile (this.history.length > this.historySize) { \n\t\t\t\t\t\tthis.history.shift(); \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor (var i = 0, user; user = this.presence[i]; ++i) {\n\t\t\t\t\tif (user == args.user) {\n\t\t\t\t\t\tthis.presence.splice(i, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.onUnsubscribe(args);\n\t\t\t\tbreak;\n\t\t\tcase 'SUBSCRIBE':\n\t\t\t\tif (this.historySize) { \n\t\t\t\t\tthis.history.push([\"SUBSCRIBE\", { user: args.user}]) \n\t\t\t\t\twhile (this.history.length > this.historySize) { \n\t\t\t\t\t\tthis.history.shift(); \n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.presence.push(args.user);\n\t\t\t\tthis.onSubscribe(args);\n\t\t\t\tbreak;\n\t\t\tcase 'STATE_UPDATE':\n\t\t\t\tfor (var i = 0, key; key = args.deletes[i]; ++i) {\n\t\t\t\t\tdelete this.state[key];\n\t\t\t\t}\n\t\t\t\tfor (key in args.updates) {\n\t\t\t\t\tthis.state[key] = args.updates[key];\n\t\t\t\t}\n\t\t\t\tthis.onState(args);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tthis.cancel = function() {\n\t\tif (!this.canceled) {\n\t\t\tlogger.debug('calling this._onCancel()');\n\t\t\tthis._onCancel();\n\t\t}\n\t}\n\n\n\tthis._onCancel = function() { }\n\n\n})\n\nHookBoxProtocol = Class([RTJPProtocol], function(supr) {\n\n\tthis.onOpen = function() { }\n\tthis.onClose = function() { }\n\tthis.onError = function() { }\n\tthis.onSubscribed = function() { }\n\tthis.onUnsubscribed = function() { }\n\tthis.init = function(url, cookieString) {\n\t\tsupr(this, 'init', []);\n\t\tthis.url = url;\n\t\ttry {\n\t\t\tthis.cookieString = cookieString || document.cookie;\n\t\t} catch(e) {\n\t\t\tthis.cookieString = \"\";\n\t\t}\n\t\tthis.connected = false;\n\n\t\tthis._subscriptions = {}\n\t\tthis._buffered_subs = []\n\t\tthis._publishes = []\n\t\tthis._errors = {}\n\t\tthis.username = null;\n\t}\n\n\tthis.subscribe = function(channel_name) {\n\t\tif (!this.connected) {\n\t\t\tthis._buffered_subs.push(channel_name);\n\t\t}\n\t\telse {\n\t\t\tvar fId = this.sendFrame('SUBSCRIBE', {channel_name: channel_name});\n\t\t}\n\t}\n\n\tthis.publish = function(channel_name, data) {\n\t\tif (this.connected) {\n\t\t\tthis.sendFrame('PUBLISH', { channel_name: channel_name, payload: JSON.stringify(data) });\n\t\t} else {\n\t\t\tthis._publishes.push([channel_name, data]);\n\t\t}\n\n\t}\n\n\tthis.connectionMade = function() {\n\t\tlogger.debug('connectionMade');\n\t\tthis.transport.setEncoding('utf8');\n\t\tthis.sendFrame('CONNECT', { cookie_string: this.cookieString });\n\t}\n\n\tthis.frameReceived = function(fId, fName, fArgs) {\n\t\tswitch(fName) {\n\t\t\tcase 'CONNECTED':\n\t\t\t\tthis.connected = true;\n\t\t\t\tthis.username = fArgs.name;\n\t\t\t\twhile (this._buffered_subs.length) {\n\t\t\t\t\tvar chan = this._buffered_subs.shift();\n\t\t\t\t\tthis.sendFrame('SUBSCRIBE', {channel_name: chan});\n\t\t\t\t}\n\t\t\t\twhile (this._publishes.length) {\n\t\t\t\t\tvar pub = this._publishes.splice(0, 1)[0];\n\t\t\t\t\tthis.publish.apply(this, pub);\n\t\t\t\t}\n\t\t\t\tthis.onOpen();\n\t\t\t\tbreak;\n\t\t\tcase 'SUBSCRIBE':\n\t\t\t\tif (fArgs.user == this.username) {\n\t\t\t\t\tvar s = new Subscription(fArgs);\n\t\t\t\t\tthis._subscriptions[fArgs.channel_name] = s;\n\t\t\t\t\ts._onCancel = bind(this, function() {\n\t\t\t\t\t\tthis.sendFrame('UNSUBSCRIBE', {\n\t\t\t\t\t\t\tchannel_name: fArgs.channel_name\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\tthis.onSubscribed(fArgs.channel_name, s);\n\t\t\t\t\tK = s;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis._subscriptions[fArgs.channel_name].frame(fName, fArgs);\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\tcase 'STATE_UPDATE':\n\t\t\t\n\t\t\tcase 'PUBLISH':\n\t\t\t\n\t\t\t\tvar sub = this._subscriptions[fArgs.channel_name];\n\t\t\t\tsub.frame(fName, fArgs);\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 'UNSUBSCRIBE':\n\t\t\t\tvar sub = this._subscriptions[fArgs.channel_name];\n\t\t\t\tsub.canceled = true;\n\t\t\t\tsub.frame(fName, fArgs);\n\t\t\t\tif (fArgs.user == this.username) {\n\t\t\t\t\tdelete this._subscriptions[fArgs.channel_name];\n\t\t\t\t\tthis.onUnsubscribed(sub, fArgs);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'ERROR':\n\t\t\t\tthis.onError(fArgs);\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\tcase 'SET_COOKIE':\n\t\t\t\tdocument.cookie = fArgs.cookie;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tthis.connectionLost = function() {\n\t\tlogger.debug('connectionLost');\n\t\tthis.connected = false;\n\t\tthis.onClose();\n\t}\n\n\tthis.connectionFailed = function(transportName) {\n\t\tlogger.debug('connectionFailed', transportName)\n\t\tif (transportName == 'websocket') {\n\t\t\tlogger.debug('retry with csp');\n\t\t\tjsioConnect(this, 'csp', {url: this.url + 'csp'})\n\t\t}\n\t}\n\t\n\tthis.disconnect = function() {\n\t\tthis.transport.loseConnection();\n\t}\n\n})\n",filePath:"hookbox.js"},"std.uri":{src:'var attrs = [ \n\t"source",\n\t"protocol",\n\t"authority",\n\t"userInfo",\n\t"user",\n\t"password",\n\t"host",\n\t"port",\n\t"relative",\n\t"path",\n\t"directory",\n\t"file",\n\t"query",\n\t"anchor"\n];\n\nexports.Uri = Class(function(supr) {\n\tthis.init = function(url, isStrict) {\n\t\tvar uriData = exports.parse(url, isStrict)\n\t\tfor (attr in uriData) {\n\t\t\tthis[\'_\' + attr] = uriData[attr];\n\t\t};\n\t};\n  \n\tfor (var i = 0, attr; attr = attrs[i]; ++i) {\n\t\t(function(attr) {\n\t\t\tvar fNameSuffix = attr.charAt(0).toUpperCase() + attr.slice(1);\n\t\t\tthis[\'get\' + fNameSuffix] = function() {\n\t\t\t\treturn this[\'_\' + attr];\n\t\t\t};\n\t\t\tthis[\'set\' + fNameSuffix] = function(val) {\n\t\t\t\tthis[\'_\' + attr] = val;\n\t\t\t};\n\t\t}).call(this, attr);\n\t};\n\n\tthis.toString = this.render = function() {\n\t\t// XXX TODO: This is vaguely reasonable, but not complete. fix it...\n\t\tvar a = this._protocol ? this._protocol + "://" : ""\n\t\tvar b = this._host ? this._host + ((this._port || 80) == 80 ? "" : ":" + this._port) : "";\n\t\tvar c = this._path;\n\t\tvar d = this._query ? \'?\' + this._query : \'\';\n\t\tvar e = this._anchor ? \'#\' + this._anchor : \'\';\n\t\treturn a + b + c + d + e;\n\t};\n});\n\nexports.buildQuery = function(kvp) {\n\tvar pairs = [];\n\tfor (key in kvp) {\n\t\tpairs.push(encodeURIComponent(key) + \'=\' + encodeURIComponent(kvp[key]));\n\t}\n\treturn pairs.join(\'&\');\n}\n\nexports.parseQuery = function(str) {\n\tvar pairs = str.split(\'&\'),\n\t\tn = pairs.length,\n\t\tdata = {};\n\tfor (var i = 0; i < n; ++i) {\n\t\tvar pair = pairs[i].split(\'=\'),\n\t\t\tkey = decodeURIComponent(pair[0]);\n\t\tif (key) { data[key] = decodeURIComponent(pair[1]); }\n\t}\n\treturn data;\n}\n\n// Regexs are based on parseUri 1.2.2\n// Original: (c) Steven Levithan <stevenlevithan.com>\n// Original: MIT License\n\nvar strictRegex = /^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/;\nvar looseRegex = /^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;\nvar queryStringRegex = /(?:^|&)([^&=]*)=?([^&]*)/g;\n\nexports.parse = function(str, isStrict) {\n\tvar regex = isStrict ? strictRegex : looseRegex;\n\tvar result = {};\n\tvar match = regex.exec(str);\n\tfor (var i = 0, attr; attr = attrs[i]; ++i) {\n\t\tresult[attr] = match[i] || "";\n\t}\n\t\n\tvar qs = result[\'queryKey\'] = {};\n\tresult[\'query\'].replace(queryStringRegex, function(check, key, val) {\n\t\tif (check) {\n\t\t\tqs[key] = val;\n\t\t}\n\t});\n\t\n\treturn result;\n}\n\nexports.isSameDomain = function(urlA, urlB) {\n\tvar a = exports.parse(urlA);\n\tvar b = exports.parse(urlB);\n\treturn ((a.port == b.port ) && (a.host == b.host) && (a.protocol == b.protocol));\n};\n',filePath:"jsio/std/uri.js"},"net.csp.transports":{src:"jsio('import std.uri as uri'); \njsio('import std.base64 as base64');\njsio('import .errors');\njsio('from util.browserdetect import BrowserDetect');\n\n;(function() {\n\tvar doc;\n\texports.getDoc = function() {\n\t\tif (doc) { return doc; }\n\t\ttry {\n\t\t\tdoc = window.ActiveXObject && new ActiveXObject('htmlfile');\n\t\t\tif (doc) {\n\t\t\t\tdoc.open().write('<html></html>');\n\t\t\t\tdoc.close();\n\t\t\t\twindow.attachEvent('onunload', function() {\n\t\t\t\t\ttry { doc.body.innerHTML = ''; } catch(e) {}\n\t\t\t\t\tdoc = null;\n\t\t\t\t});\n\t\t\t}\n\t\t} catch(e) {}\n\t\t\n\t\tif (!doc) { doc = document; }\n\t\treturn doc;\n\t};\n\n\texports.XHR = function() {\n\t\tvar win = window,\n\t\t\tdoc = exports.getDoc();\n\t\tif (doc.parentWindow) { win = doc.parentWindow; }\n\t\t\n\t\treturn new (exports.XHR = win.XDomainRequest ? win.XDomainRequest\n\t\t\t: win.XMLHttpRequest ? win.XMLHttpRequest\n\t\t\t: function() { return win.ActiveXObject && new win.ActiveXObject('Msxml2.XMLHTTP') || null; });\n\t}\n\t\n\texports.createXHR = function() { return new exports.XHR(); }\n\n})();\n\nfunction isLocalFile(url) { return /^file:\\/\\//.test(url); }\nfunction isWindowDomain(url) { return uri.isSameDomain(url, window.location.href); }\n\nfunction canUseXHR(url) {\n\t// always use jsonp for local files\n\tif (isLocalFile(url)) { return false; }\n\t\n\t// try to create an XHR using the same function the XHR transport uses\n\tvar xhr = new exports.XHR();\n\tif (!xhr) { return false; }\n\t\n\t// if the URL requested is the same domain as the window,\n\t// then we can use same-domain XHRs\n\tif (isWindowDomain(url)) { return true; }\n\t\n\t// if the URL requested is a different domain than the window,\n\t// then we need to check for cross-domain support\n\tif (window.XMLHttpRequest\n\t\t\t&& (xhr.__proto__ == XMLHttpRequest.prototype // WebKit Bug 25205\n\t\t\t\t|| xhr instanceof window.XMLHttpRequest)\n\t\t\t&& xhr.withCredentials !== undefined\n\t\t|| window.XDomainRequest \n\t\t\t&& xhr instanceof window.XDomainRequest) {\n\t\treturn true;\n\t}\n};\n\nvar transports = exports.transports = {};\n\nexports.chooseTransport = function(url, options) {\n\tswitch(options.preferredTransport) {\n\t\tcase 'jsonp':\n\t\t\treturn transports.jsonp;\n\t\tcase 'xhr':\n\t\tdefault:\n\t\t\tif (canUseXHR(url)) { return transports.xhr; };\n\t\t\treturn transports.jsonp;\n\t}\n};\n\n// TODO: would be nice to use these somewhere...\n\nvar PARAMS = {\n\t'xhrstream':   {\"is\": \"1\", \"bs\": \"\\n\"},\n\t'xhrpoll':     {\"du\": \"0\"},\n\t'xhrlongpoll': {},\n\t'sselongpoll': {\"bp\": \"data: \", \"bs\": \"\\r\\n\", \"se\": \"1\"},\n\t'ssestream':   {\"bp\": \"data: \", \"bs\": \"\\r\\n\", \"se\": \"1\", \"is\": \"1\"}\n};\n\nexports.Transport = Class(function(supr) {\n\tthis.handshake = function(url, options) {\n\t\tthrow new Error(\"handshake Not Implemented\"); \n\t};\n\tthis.comet = function(url, sessionKey, lastEventId, options) { \n\t\tthrow new Error(\"comet Not Implemented\"); \n\t};\n\tthis.send = function(url, sessionKey, data, options) { \n\t\tthrow new Error(\"send Not Implemented\");\n\t};\n\tthis.encodePacket = function(packetId, data, options) { \n\t\tthrow new Error(\"encodePacket Not Implemented\"); \n\t};\n\tthis.abort = function() { \n\t\tthrow new Error(\"abort Not Implemented\"); \n\t};\n});\n\nvar baseTransport = Class(exports.Transport, function(supr) {\n\tthis.init = function() {\n\t\tthis._aborted = false;\n\t\tthis._handshakeArgs = {\n\t\t\td:'{}',\n\t\t\tct:'application/javascript'\n\t\t};\n\t};\n\t\n\tthis.handshake = function(url, options) {\n\t\tlogger.debug('handshake:', url, options);\n\t\tthis._makeRequest('send', url + '/handshake', \n\t\t\t\t\t\t  this._handshakeArgs, \n\t\t\t\t\t\t  this.handshakeSuccess, \n\t\t\t\t\t\t  this.handshakeFailure);\n\t};\n\t\n\tthis.comet = function(url, sessionKey, lastEventId, options) {\n\t\tlogger.debug('comet:', url, sessionKey, lastEventId, options);\n\t\targs = {\n\t\t\ts: sessionKey,\n\t\t\ta: lastEventId\n\t\t};\n\t\tthis._makeRequest('comet', url + '/comet', \n\t\t\t\t\t\t  args, \n\t\t\t\t\t\t  this.cometSuccess, \n\t\t\t\t\t\t  this.cometFailure);\n\t};\n\t\n\tthis.send = function(url, sessionKey, lastEventId, data, options) {\n\t\tlogger.debug('send:', url, sessionKey, data, options);\n\t\targs = {\n\t\t\td: data,\n\t\t\ts: sessionKey,\n\t\t\ta: lastEventId\n\t\t};\n\t\tthis._makeRequest('send', url + '/send', \n\t\t\t\t\t\t  args, \n\t\t\t\t\t\t  this.sendSuccess, \n\t\t\t\t\t\t  this.sendFailure);\n\t};\n});\n\ntransports.xhr = Class(baseTransport, function(supr) {\n\t\n\tthis.init = function() {\n\t\tsupr(this, 'init');\n\t\n\t\tthis._xhr = {\n\t\t\t'send': new exports.XHR(),\n\t\t\t'comet': new exports.XHR()\n\t\t};\n\t};\n\n\tthis.abort = function() {\n\t\tthis._aborted = true;\n\t\tfor(var i in this._xhr) {\n\t\t\tif(this._xhr.hasOwnProperty(i)) {\n\t\t\t\tthis._abortXHR(i);\n\t\t\t}\n\t\t}\n\t};\n\t\n\tthis._abortXHR = function(type) {\n\t\tlogger.debug('aborting XHR');\n\n\t\tvar xhr = this._xhr[type];\n\t\ttry {\n\t\t\tif('onload' in xhr) {\n\t\t\t\txhr.onload = xhr.onerror = xhr.ontimeout = null;\n\t\t\t} else if('onreadystatechange' in xhr) {\n\t\t\t\txhr.onreadystatechange = null;\n\t\t\t}\n\t\t\tif(xhr.abort) { xhr.abort(); }\n\t\t} catch(e) {\n\t\t\tlogger.debug('error aborting xhr', e);\n\t\t}\n\t\t\n\t\t// do not reuse aborted XHRs\n\t\tthis._xhr[type] = new exports.XHR();\n\t};\n\t\n\tvar mustEncode = !(exports.createXHR().sendAsBinary);\n\tthis.encodePacket = function(packetId, data, options) {\n\t\t// we don't need to base64 encode things unless there's a null character in there\n\t\treturn mustEncode ? [ packetId, 1, base64.encode(data) ] : [ packetId, 0, data ];\n\t};\n\n\tthis._onReadyStateChange = function(rType, cb, eb) {\n\t\t\n\t\tvar response = '';\n\t\ttry {\n\t\t\tvar xhr = this._xhr[rType];\n\t\t\tif(xhr.readyState != 4) { return; }\n\t\t\t\n\t\t\tvar response = eval(xhr.responseText);\n\t\t\t\n\t\t\tif(xhr.status != 200) { \n\t\t\t\tlogger.debug('XHR failed with status ', xhr.status);\n\t\t\t\teb(xhr.status, response);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t\n\t\t\tlogger.debug('XHR data received');\n\t\t} catch(e) {\n\t\t\tvar xhr = this._xhr[rType];\n\t\t\tlogger.debug('Error in XHR::onReadyStateChange', e);\n\t\t\teb(xhr.status, response);\n\t\t\tthis._abortXHR(rType);\n\t\t\tlogger.debug('done handling XHR error');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tcb(response);\n\t};\n\n\t/**\n\t * even though we encode the POST body as in application/x-www-form-urlencoded\n\t */\n\tthis._makeRequest = function(rType, url, args, cb, eb) {\n\t\tif (this._aborted) {\n\t\t\treturn;\n\t\t}\n\t\tvar xhr = this._xhr[rType], data = args.d || null;\n\t\tif('d' in args) { delete args.d; }\n\t\txhr.open('POST', url + '?' + uri.buildQuery(args)); // must open XHR first\n\t\txhr.setRequestHeader('Content-Type', 'text/plain'); // avoid preflighting\n\t\tif('onload' in xhr) {\n\t\t\txhr.onload = bind(this, '_onReadyStateChange', rType, cb, eb);\n\t\t\txhr.onerror = xhr.ontimeout = eb;\n\t\t} else if('onreadystatechange' in xhr) {\n\t\t\txhr.onreadystatechange = bind(this, '_onReadyStateChange', rType, cb, eb);\n\t\t}\n\t\t// NOTE WELL: Firefox (and probably everyone else) likes to encode our nice\n\t\t//\t\t\t\t\t\tbinary strings as utf8. Don't let them! Say no to double utf8\n\t\t//\t\t\t\t\t\tencoding. Once is good, twice isn't better.\n\t\tsetTimeout(bind(xhr, xhr.sendAsBinary ? 'sendAsBinary' : 'send', data), 0);\n\t};\n});\n\nvar EMPTY_FUNCTION = function() {},\n\tSLICE = Array.prototype.slice;\n\ntransports.jsonp = Class(baseTransport, function(supr) {\n\tvar doc;\n\t\n\tvar createIframe = function() {\n\t\tvar doc = exports.getDoc();\n\t\tif (!doc.body) { return false; }\n\t\t\n\t\tvar i = doc.createElement(\"iframe\");\n\t\twith(i.style) { display = 'block'; width = height = border = margin = padding = '0'; overflow = visibility = 'hidden'; position = 'absolute'; top = left = '-999px'; }\n\t\ti.cbId = 0;\n\t\tdoc.body.appendChild(i);\n\t\ti.src = 'javascript:var d=document;d.open();d.write(\"<html><body></body></html>\");d.close();';\n\t\treturn i;\n\t};\n\n\tvar cleanupIframe = function(ifr) {\n\t\tvar win = ifr.contentWindow, doc = win.document;\n\t\tlogger.debug('removing script tags');\n\t\t\n\t\tvar scripts = doc.getElementsByTagName('script');\n\t\tfor (var i = scripts.length - 1; i >= 0; --i) {\n\t\t\tdoc.body.removeChild(scripts[i]);\n\t\t}\n\t\t\n\t\tlogger.debug('deleting iframe callbacks');\n\t\twin['cb' + ifr.cbId] = win['eb' + ifr.cbId] = EMPTY_FUNCTION;\n\t};\n\n\tvar removeIframe = function(ifr) {\n\t\t$setTimeout(function() {\n\t\t\tif(ifr && ifr.parentNode) { ifr.parentNode.removeChild(ifr); }\n\t\t}, 60000);\n\t};\n\n\tthis.init = function() {\n\t\tsupr(this, 'init');\n\n\t\tthis._onReady = [];\n\t\tthis._isReady = false;\n\n\t\tthis._createIframes();\n\t};\n\n\tthis._createIframes = function() {\n\t\tthis._ifr = {\n\t\t\tsend: createIframe(),\n\t\t\tcomet: createIframe()\n\t\t};\n\t\t\n\t\tif(this._ifr.send === false) { return $setTimeout(bind(this, '_createIframes'), 100); }\n\t\t\n\t\tthis._isReady = true;\n\n\t\tvar readyArgs = this._onReady;\n\t\tthis._onReady = [];\n\t\tfor(var i = 0, args; args = readyArgs[i]; ++i) {\n\t\t\tthis._makeRequest.apply(this, args);\n\t\t}\n\t};\n\n\tthis.encodePacket = function(packetId, data, options) {\n\t\treturn [ packetId, 1, base64.encode(data) ];\n\t};\n\n\tthis.abort = function() {\n\t\tthis._aborted = true;\n\t\tfor(var i in this._ifr) {\n\t\t\tif(this._ifr.hasOwnProperty(i)) {\n\t\t\t\tvar ifr = this._ifr[i];\n\t\t\t\tcleanupIframe(ifr);\n\t\t\t\tremoveIframe(ifr);\n\t\t\t}\n\t\t}\n\t};\n\t\n\tthis._makeRequest = function(rType, url, args, cb, eb) {\n\t\tif(!this._isReady) { return this._onReady.push(arguments); }\n\t\t\n\t\tvar ifr = this._ifr[rType],\n\t\t\tid = ++ifr.cbId,\n\t\t\treq = {\n\t\t\t\ttype: rType,\n\t\t\t\tid: id,\n\t\t\t\tcb: cb,\n\t\t\t\teb: eb,\n\t\t\t\tcbName: 'cb' + id,\n\t\t\t\tebName: 'eb' + id,\n\t\t\t\tcompleted: false\n\t\t\t};\n\t\t\n\t\targs.n = Math.random();\t\n\t\tswitch(rType) {\n\t\t\tcase 'send': args.rs = ';'; args.rp = req.cbName; break;\n\t\t\tcase 'comet': args.bs = ';'; args.bp = req.cbName; break;\n\t\t}\n\t\t\n\t\treq.url = url + '?' + uri.buildQuery(args)\n\t\t\n\t\t$setTimeout(bind(this, '_request', req), 0);\n\t}\n\t\n\tthis._request = function(req) {\n\t\tvar ifr = this._ifr[req.type],\n\t\t\twin = ifr.contentWindow,\n\t\t\tdoc = win.document,\n\t\t\tbody = doc.body;\n\n\t\twin[req.ebName] = bind(this, checkForError, req);\n\t\twin[req.cbName] = bind(this, onSuccess, req);\n\t\t\n\t\tif(BrowserDetect.isWebKit) {\n\t\t\t// this will probably cause loading bars in Safari -- might want to rethink?\n\t\t\tdoc.open();\n\t\t\tdoc.write('<scr'+'ipt src=\"'+req.url+'\"></scr'+'ipt><scr'+'ipt>'+ebName+'(false)</scr'+'ipt>');\n\t\t\tdoc.close();\n\t\t} else {\n\t\t\tvar s = doc.createElement('script');\n\t\t\ts.src = req.url;\n\t\t\t\n\t\t\t// IE\n\t\t\tif(s.onreadystatechange === null) { s.onreadystatechange = bind(this, onReadyStateChange, req, s); }\n\t\t\tbody.appendChild(s);\n\t\t\t\n\t\t\tif(!BrowserDetect.isIE) {\n\t\t\t\tvar s = doc.createElement('script');\n\t\t\t\ts.innerHTML = req.ebName+'(false)';\n\t\t\t\tbody.appendChild(s);\n\t\t\t}\n\t\t}\n\t\t\n\t\tkillLoadingBar();\n\t};\n\t\n\tfunction onSuccess(req) {\n\t\tvar args = SLICE.call(arguments, 1);\n\t\tlogger.debug('successful: ', req.url, args);\n\t\t\n\t\treq.completed = true;\n\t\t\n\t\tlogger.debug('calling the cb');\n\t\treq.cb.apply(GLOBAL, args);\n\t\tlogger.debug('cb called');\n\t}\n\t\n\t// IE6/7 onReadyStateChange\n\tfunction onReadyStateChange(req, scriptTag) {\n\t\tif (scriptTag && scriptTag.readyState != 'loaded') { return; }\n\t\tscriptTag.onreadystatechange = function() {};\n\t\tcheckForError.call(this, req);\n\t}\n\n\tfunction checkForError(req) {\n\t\tcleanupIframe(this._ifr[req.type]);\n\t\t\n\t\tif (!req.completed) {\n\t\t\tvar args = SLICE.call(arguments, 3);\n\t\t\tlogger.debug('error making request:', req.url, args);\n\t\t\tlogger.debug('calling eb');\n\t\t\treq.eb.apply(GLOBAL, args);\n\t\t}\n\t}\n\t\n\tvar killLoadingBar = BrowserDetect.isFirefox ? function() {\n\t\tvar b = document.body;\n\t\tif (!b) { return; }\n\t\t\n\t\tif (!killLoadingBar.iframe) { killLoadingBar.iframe = document.createElement('iframe'); }\n\t\tb.insertBefore(killLoadingBar.iframe, b.firstChild);\n\t\tb.removeChild(killLoadingBar.iframe);\n\t} : function() {};\n});\n\t\n",filePath:"jsio/net/csp/transports.js"},net:{src:"jsio('import net.env');\njsio('import std.JSON as JSON');\n\nJSON.createGlobal(); // create the global JSON object if it doesn't already exist\n\nexports.listen = function(server, transportName, opts) {\n\tif (!transportName) {\n\t\tthrow logger.error('No transport provided for net.listen');\n\t}\n\tvar listenerClass = net.env.getListener(transportName);\n\tvar listener = new listenerClass(server, opts);\n\tlistener.listen();\n\treturn listener;\n}\n\nexports.connect = function(protocolInstance, transportName, opts) {\n\tvar connector = new (net.env.getConnector(transportName))(protocolInstance, opts);\n\tconnector.connect();\n\treturn connector;\n}\n\nexports.quickServer = function(protocolClass) {\n\tjsio('import net.interfaces');\n\treturn new net.interfaces.Server(protocolClass);\n}\n",filePath:"jsio/net.js"},"util.browserdetect":{src:'exports.BrowserDetect = new function() {\n\tvar versionSearchString;\n\tvar dataBrowser = [\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "Chrome"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "OmniWeb",\n\t\t\tversionSearch: "OmniWeb/"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.vendor,\n\t\t\tsubString: "Apple",\n\t\t\tidentity: "Safari",\n\t\t\tversionSearch: "Version"\n\t\t},\n\t\t{\n\t\t\tprop: window.opera,\n\t\t\tidentity: "Opera"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.vendor,\n\t\t\tsubString: "iCab"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.vendor,\n\t\t\tsubString: "KDE",\n\t\t\tidentity: "Konqueror"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "Firefox"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.vendor,\n\t\t\tsubString: "Camino"\n\t\t},\n\t\t{\t\t// for newer Netscapes (6+)\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "Netscape"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "MSIE",\n\t\t\tidentity: "IE",\n\t\t\tversionSearch: "MSIE"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "Gecko",\n\t\t\tidentity: "Mozilla",\n\t\t\tversionSearch: "rv"\n\t\t},\n\t\t{ \t\t// for older Netscapes (4-)\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "Mozilla",\n\t\t\tidentity: "Netscape",\n\t\t\tversionSearch: "Mozilla"\n\t\t}\n\t];\n\t\n\tvar dataOS = [\n\t\t{\n\t\t\tstring: navigator.platform,\n\t\t\tsubString: "Win",\n\t\t\tidentity: "Windows"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.platform,\n\t\t\tsubString: "Mac"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.userAgent,\n\t\t\tsubString: "iPhone",\n\t\t\tidentity: "iPhone/iPod"\n\t\t},\n\t\t{\n\t\t\tstring: navigator.platform,\n\t\t\tsubString: "Linux"\n\t\t}\n\t];\n\t\n\tfunction searchString(data) {\n\t\tfor (var i=0,item;item=data[i];i++)\t{\n\t\t\tvar dataString = item.string;\n\t\t\tvar dataProp = item.prop;\n\t\t\titem.identity = item.identity || item.subString;\n\t\t\tversionSearchString = item.versionSearch || item.identity;\n\t\t\tif (dataString) {\n\t\t\t\tif (dataString.indexOf(item.subString) != -1)\n\t\t\t\t\treturn item.identity;\n\t\t\t} else if (dataProp)\n\t\t\t\treturn item.identity;\n\t\t}\n\t}\n\t\n\tfunction searchVersion(dataString) {\n\t\tvar index = dataString.indexOf(versionSearchString);\n\t\tif (index == -1) return;\n\t\treturn parseFloat(dataString.substring(index+versionSearchString.length+1));\n\t}\n\t\n\tthis.browser = searchString(dataBrowser) || "unknown";\n\tthis.version = searchVersion(navigator.userAgent)\n\t\t|| searchVersion(navigator.appVersion)\n\t\t|| "unknown";\n\tthis.OS = searchString(dataOS) || "unknown";\n\tthis.isWebKit = RegExp(" AppleWebKit/").test(navigator.userAgent);\n\tthis[\'is\'+this.browser] = this.version;\n};',filePath:"jsio/util/browserdetect.js"},"std.utf8":{src:"/*\nFast incremental JavaScript UTF-8 encoder/decoder, by Jacob Rus.\n\nAPI for decode from Orbited: as far as I know, the first incremental\nJavaScript UTF-8 decoder.\n\nInspired by the observation by Johan Sundstr\u00f6m published at:\nhttp://ecmanaut.blogspot.com/2006/07/encoding-decoding-utf8-in-javascript.html\n\nNote that this code throws an error for invalid UTF-8. Because it is so much\nfaster than previous implementations, the recommended way to do lenient\nparsing is to first try this decoder, and then fall back on a slower lenient\ndecoder if necessary for the particular use case.\n\n--------------------\n\nCopyright (c) 2009 Jacob Rus\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n//var utf8 = this.utf8 = exports;\n\nexports.UnicodeCodecError = function (message) { \n\tthis.message = message; \n};\n\nvar UnicodeCodecError = exports.UnicodeCodecError;\n\nUnicodeCodecError.prototype.toString = function () {\n\treturn 'UnicodeCodecError' + (this.message ? ': ' + this.message : '');\n};\n\nexports.encode = function (unicode_string) {\n\t// Unicode encoder: Given an arbitrary unicode string, returns a string\n\t// of characters with code points in range 0x00 - 0xFF corresponding to\n\t// the bytes of the utf-8 representation of those characters.\n\ttry {\n\t\treturn unescape(encodeURIComponent(unicode_string));\n\t}\n\tcatch (err) {\n\t\tthrow new UnicodeCodecError('invalid input string');\n\t};\n};\nexports.decode = function (bytes) {\n\t// Unicode decoder: Given a string of characters with code points in\n\t// range 0x00 - 0xFF, which, when interpreted as bytes, are valid UTF-8,\n\t// returns the corresponding Unicode string, along with the number of\n\t// bytes in the input string which were successfully parsed.\n\t//\n\t// Unlike most JavaScript utf-8 encode/decode implementations, properly\n\t// deals with partial multi-byte characters at the end of the byte string.\n\tif (/[^\\x00-\\xFF]/.test(bytes)) {\n\t\tthrow new UnicodeCodecError('invalid utf-8 bytes');\n\t};\n\tvar len, len_parsed;\n\tlen = len_parsed = bytes.length;\n\tvar last = len - 1;\n\t// test for non-ascii final byte. if last byte is ascii (00-7F) we're done.\n\tif (bytes.charCodeAt(last) >= 0x80) {\n\t\t// loop through last 3 bytes looking for first initial byte of unicode\n\t\t// multi-byte character. If the initial byte is 4th from the end, we'll\n\t\t// parse the whole string.\n\t\tfor (var i = 1; i <= 3; i++) {\n\t\t\t// initial bytes are in range C0-FF\n\t\t\tif (bytes.charCodeAt(len - i) >= 0xC0) {\n\t\t\t\tlen_parsed = len - i;\n\t\t\t\tbreak;\n\t\t\t};\n\t\t};\n\t\ttry {\n\t\t\t// if the last few bytes are a complete multi-byte character, parse\n\t\t\t// everything (by setting len_parsed)\n\t\t\tdecodeURIComponent(escape(bytes.slice(len_parsed)));\n\t\t\tlen_parsed = len;\n\t\t}\n\t\tcatch (err) { /* pass */ };\n\t};\n\ttry {\n\t\treturn [\n\t\t\tdecodeURIComponent(escape(bytes.slice(0, len_parsed))),\n\t\t\tlen_parsed\n\t\t];\n\t}\n\tcatch (err) {\n\t\tthrow new UnicodeCodecError('invalid utf-8 bytes');\n\t};\n};\n",filePath:"jsio/std/utf8.js"}};
function bind(context,method){var args=Array.prototype.slice.call(arguments,2);return function(){method=(typeof method=="string"?context[method]:method);return method.apply(context,args.concat(Array.prototype.slice.call(arguments,0)))
}}jsio=bind(this,importer,null,"");jsio.__filename="jsio.js";jsio.modules=[];jsio.setCachedSrc=function(pkg,filePath,src){sourceCache[pkg]={filePath:filePath,src:src}};jsio.path={};jsio.setPath=function(path){jsio.path.__default__=typeof path=="string"?[path]:path
};jsio.setEnv=function(env){if(ENV&&(env==ENV||env==ENV.name)){return}if(typeof env=="string"){switch(env){case"node":ENV=new ENV_node();break;case"browser":default:ENV=new ENV_browser();break}ENV.name=env
}else{ENV=env}jsio.__env=ENV;jsio.__dir=ENV.getCwd();if(!jsio.path.__default__){jsio.setPath(ENV.getPath())}};if(typeof process!=="undefined"&&process.version){jsio.setEnv("node")}else{if(typeof XMLHttpRequest!="undefined"||typeof ActiveXObject!="undefined"){jsio.setEnv("browser")
}}function ENV_node(){var fs=require("fs"),sys=require("sys");this.global=GLOBAL;this.getCwd=process.cwd;this.log=function(){var msg;try{sys.error(msg=Array.prototype.map.call(arguments,function(a){if((a instanceof Error)&&a.message){return"Error:"+a.message+"\nStack:"+a.stack+"\nArguments:"+a.arguments
}return typeof a=="string"?a:JSON.stringify(a)}).join(" "))}catch(e){sys.error(msg=Array.prototype.join.call(arguments," ")+"\n")}return msg};this.getPath=function(){var segments=__filename.split("/");
segments.pop();return segments.join("/")||"."};this.eval=process.compile;this.findModule=function(possibilities){for(var i=0,possible;possible=possibilities[i];++i){try{possible.src=fs.readFileSync(possible.filePath);
return possible}catch(e){}}return false};this.require=require;this.include=include}function ENV_browser(){var XHR=window.XMLHttpRequest||function(){return new ActiveXObject("Msxml2.XMLHTTP")};this.global=window;
this.global.jsio=jsio;var SLICE=Array.prototype.slice;this.log=function(){var args=SLICE.call(arguments,0);if(typeof console!="undefined"&&console.log){if(console.log.apply){console.log.apply(console,arguments)
}else{console.log(args)}}return args.join(" ")};var cwd=null,path=null;this.getCwd=function(){if(!cwd){var location=window.location.toString();cwd=location.substring(0,location.lastIndexOf("/")+1)}return cwd
};this.getPath=function(){if(!path){try{var filename=new RegExp("(.*?)"+jsio.__filename+"(\\?.*)?$");var scripts=document.getElementsByTagName("script");for(var i=0,script;script=scripts[i];++i){var result=script.src.match(filename);
if(result){path=result[1];if(/^[A-Za-z]*:\/\//.test(path)){path=makeRelativePath(path,this.getCwd())}break}}}catch(e){}if(!path){path="."}}return path};var rawEval=typeof eval("(function(){})")=="undefined"?function(src,path){return(new Function("return "+src))()
}:function(src,path){var src=src+"\n//@ sourceURL="+path;return window.eval(src)};this.eval=function(code,path){try{return rawEval(code,path)}catch(e){if(e instanceof SyntaxError){e.message="a syntax error is preventing execution of "+path;
e.type="syntax_error";try{var cb=function(){var el=document.createElement("iframe");el.style.cssText="position:absolute;top:-999px;left:-999px;width:1px;height:1px;visibility:hidden";el.src='javascript:document.open();document.write("<scr"+"ipt src=\''+path+'\'></scr"+"ipt>")';
setTimeout(function(){try{document.body.appendChild(el)}catch(e){}},0)};if(document.body){cb()}else{window.addEventListener("load",cb,false)}}catch(f){}}throw e}};this.findModule=function(possibilities){for(var i=0,possible;
possible=possibilities[i];++i){var xhr=new XHR();try{xhr.open("GET",possible.filePath,false);xhr.send(null)}catch(e){ENV.log("e:",e);continue}if(xhr.status==404||xhr.status==-1100||false){continue}possible.src=xhr.responseText;
return possible}return false}}function ensureHasTrailingSlash(str){return str.length&&str.replace(/([^\/])$/,"$1/")||str}function removeTrailingSlash(str){return str.replace(/\/$/,"")}function guessModulePath(pathString){if(pathString.charAt(0)=="."){var i=0;
while(pathString.charAt(i+1)=="."){++i}var prefix=removeTrailingSlash(ENV.getCwd());if(i){prefix=prefix.split("/").slice(0,-i).join("/")}return[{filePath:prefix+"/"+pathString.substring(i+1).split(".").join("/")+".js"}]
}var pathSegments=pathString.split("."),baseMod=pathSegments[0],modPath=pathSegments.join("/");if(baseMod in jsio.path){return[{filePath:ensureHasTrailingSlash(jsio.path[baseMod])+modPath+".js"}]}var out=[];
var paths=typeof jsio.path.__default__=="string"?[jsio.path.__default__]:jsio.path.__default__;for(var i=0,len=paths.length;i<len;++i){var path=ensureHasTrailingSlash(paths[i]);out.push({filePath:path+modPath+".js",baseMod:baseMod,basePath:path})
}return out}function loadModule(pathString){var possibilities=guessModulePath(pathString),module=ENV.findModule(possibilities);if(!module){var paths=[];for(var i=0,p;p=possibilities[i];++i){paths.push(p.filePath)
}throw new Error("Module not found: "+pathString+" (looked in "+paths.join(", ")+")")}if(!(module.baseMod in jsio.path)){jsio.path[module.baseMod]=module.basePath}return module}function execModule(context,module){var code="(function(_){with(_){delete _;(function(){"+module.src+"\n}).call(this)}})";
var fn=ENV.eval(code,module.filePath);try{fn.call(context.exports,context)}catch(e){if(e.type=="syntax_error"){throw new Error("error importing module: "+e.message)}else{if(e.type=="stack_overflow"){ENV.log("Stack overflow in",module.filePath,":",e)
}else{ENV.log("ERROR LOADING",module.filePath,":",e)}}throw e}}function resolveRelativePath(pkg,path,pathSep){if(!path||(pathSep=pathSep||".")!=pkg.charAt(0)){return pkg}var i=1;while(pkg.charAt(i)==pathSep){++i
}path=path.split(pathSep).slice(0,-i);if(path.length){path=path.join(pathSep);if(path.charAt(path.length-1)!=pathSep){path+=pathSep}}return path+pkg.substring(i)}function resolveImportRequest(path,request){var match,imports=[];
if((match=request.match(/^(from|external)\s+([\w.$]+)\s+import\s+(.*)$/))){imports[0]={from:resolveRelativePath(match[2],path),external:match[1]=="external","import":{}};match[3].replace(/\s*([\w.$*]+)(?:\s+as\s+([\w.$]+))?/g,function(_,item,as){imports[0]["import"][item]=as||item
})}else{if((match=request.match(/^import\s+(.*)$/))){match[1].replace(/\s*([\w.$]+)(?:\s+as\s+([\w.$]+))?,?/g,function(_,pkg,as){fullPkg=resolveRelativePath(pkg,path);imports[imports.length]=as?{from:fullPkg,as:as}:{from:fullPkg,as:pkg}
})}else{var msg="Invalid jsio request: jsio('"+request+"')";throw SyntaxError?new SyntaxError(msg):new Error(msg)}}return imports}function makeContext(pkgPath,filePath){var ctx={exports:{},global:ENV.global};
ctx.jsio=bind(this,importer,ctx,pkgPath);if(pkgPath!="base"){ctx.jsio("from base import *");ctx.logging.__create(pkgPath,ctx)}var cwd=ENV.getCwd();var i=filePath.lastIndexOf("/");ctx.jsio.__env=jsio.__env;
ctx.jsio.__dir=i>0?makeRelativePath(filePath.substring(0,i),cwd):"";ctx.jsio.__filename=i>0?filePath.substring(i):filePath;ctx.jsio.__path=pkgPath;return ctx}function makeRelativePath(path,relativeTo){var i=path.match("^"+relativeTo);
if(i&&i[0]==relativeTo){var offset=path[relativeTo.length]=="/"?1:0;return path.slice(relativeTo.length+offset)}return path}function importer(context,path,request,altContext){context=context||ENV.global;
var imports=resolveImportRequest(path,request);for(var i=0,item,len=imports.length;(item=imports[i])||i<len;++i){var pkg=item.from;var modules=jsio.modules;if(!(pkg in modules)){try{var module=sourceCache[pkg]||loadModule(pkg)
}catch(e){ENV.log("\nError executing '",request,"': could not load module",pkg,"\n\tpath:",path,"\n\trequest:",request,"\n");throw e}if(!item.external){var newContext=makeContext(pkg,module.filePath);execModule(newContext,module);
modules[pkg]=newContext.exports}else{var newContext={};for(var j in item["import"]){newContext[j]=undefined}execModule(newContext,module);modules[pkg]=newContext;for(var j in item["import"]){if(newContext[j]===undefined){newContext[j]=ENV.global[j]
}}}}var c=altContext||context;if(item.as){var segments=item.as.match(/^\.*(.*?)\.*$/)[1].split(".");for(var k=0,slen=segments.length-1,segment;(segment=segments[k])&&k<slen;++k){if(!segment){continue}if(!c[segment]){c[segment]={}
}c=c[segment]}c[segments[slen]]=modules[pkg]}else{if(item["import"]){if(item["import"]["*"]){for(var k in modules[pkg]){c[k]=modules[pkg][k]}}else{try{for(var k in item["import"]){c[item["import"][k]]=modules[pkg][k]
}}catch(e){ENV.log("module: ",modules);throw e}}}}}}})();jsio("import hookbox as hookbox");/*
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Sat Feb 13 22:33:48 2010 -0500
 */
(function(aM,C){var a=function(aY,aZ){return new a.fn.init(aY,aZ)
},n=aM.jQuery,R=aM.$,ab=aM.document,X,P=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,aW=/^.[^:#\[\.,]*$/,ax=/\S/,M=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,e=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,b=navigator.userAgent,u,K=false,ad=[],aG,at=Object.prototype.toString,ap=Object.prototype.hasOwnProperty,g=Array.prototype.push,F=Array.prototype.slice,s=Array.prototype.indexOf;
a.fn=a.prototype={init:function(aY,a1){var a0,a2,aZ,a3;if(!aY){return this}if(aY.nodeType){this.context=this[0]=aY;this.length=1;return this}if(aY==="body"&&!a1){this.context=ab;this[0]=ab.body;this.selector="body";
this.length=1;return this}if(typeof aY==="string"){a0=P.exec(aY);if(a0&&(a0[1]||!a1)){if(a0[1]){a3=(a1?a1.ownerDocument||a1:ab);aZ=e.exec(aY);if(aZ){if(a.isPlainObject(a1)){aY=[ab.createElement(aZ[1])];
a.fn.attr.call(aY,a1,true)}else{aY=[a3.createElement(aZ[1])]}}else{aZ=J([a0[1]],[a3]);aY=(aZ.cacheable?aZ.fragment.cloneNode(true):aZ.fragment).childNodes}return a.merge(this,aY)}else{a2=ab.getElementById(a0[2]);
if(a2){if(a2.id!==a0[2]){return X.find(aY)}this.length=1;this[0]=a2}this.context=ab;this.selector=aY;return this}}else{if(!a1&&/^\w+$/.test(aY)){this.selector=aY;this.context=ab;aY=ab.getElementsByTagName(aY);
return a.merge(this,aY)}else{if(!a1||a1.jquery){return(a1||X).find(aY)}else{return a(a1).find(aY)}}}}else{if(a.isFunction(aY)){return X.ready(aY)}}if(aY.selector!==C){this.selector=aY.selector;this.context=aY.context
}return a.makeArray(aY,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(aY){return aY==null?this.toArray():(aY<0?this.slice(aY)[0]:this[aY])
},pushStack:function(aZ,a1,aY){var a0=a();if(a.isArray(aZ)){g.apply(a0,aZ)}else{a.merge(a0,aZ)}a0.prevObject=this;a0.context=this.context;if(a1==="find"){a0.selector=this.selector+(this.selector?" ":"")+aY
}else{if(a1){a0.selector=this.selector+"."+a1+"("+aY+")"}}return a0},each:function(aZ,aY){return a.each(this,aZ,aY)},ready:function(aY){a.bindReady();if(a.isReady){aY.call(ab,a)}else{if(ad){ad.push(aY)
}}return this},eq:function(aY){return aY===-1?this.slice(aY):this.slice(aY,+aY+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))
},map:function(aY){return this.pushStack(a.map(this,function(a0,aZ){return aY.call(a0,aZ,a0)}))},end:function(){return this.prevObject||a(null)},push:g,sort:[].sort,splice:[].splice};a.fn.init.prototype=a.fn;
a.extend=a.fn.extend=function(){var a3=arguments[0]||{},a2=1,a1=arguments.length,a5=false,a6,a0,aY,aZ;if(typeof a3==="boolean"){a5=a3;a3=arguments[1]||{};a2=2}if(typeof a3!=="object"&&!a.isFunction(a3)){a3={}
}if(a1===a2){a3=this;--a2}for(;a2<a1;a2++){if((a6=arguments[a2])!=null){for(a0 in a6){aY=a3[a0];aZ=a6[a0];if(a3===aZ){continue}if(a5&&aZ&&(a.isPlainObject(aZ)||a.isArray(aZ))){var a4=aY&&(a.isPlainObject(aY)||a.isArray(aY))?aY:a.isArray(aZ)?[]:{};
a3[a0]=a.extend(a5,a4,aZ)}else{if(aZ!==C){a3[a0]=aZ}}}}}return a3};a.extend({noConflict:function(aY){aM.$=R;if(aY){aM.jQuery=n}return a},isReady:false,ready:function(){if(!a.isReady){if(!ab.body){return setTimeout(a.ready,13)
}a.isReady=true;if(ad){var aZ,aY=0;while((aZ=ad[aY++])){aZ.call(ab,a)}ad=null}if(a.fn.triggerHandler){a(ab).triggerHandler("ready")}}},bindReady:function(){if(K){return}K=true;if(ab.readyState==="complete"){return a.ready()
}if(ab.addEventListener){ab.addEventListener("DOMContentLoaded",aG,false);aM.addEventListener("load",a.ready,false)}else{if(ab.attachEvent){ab.attachEvent("onreadystatechange",aG);aM.attachEvent("onload",a.ready);
var aY=false;try{aY=aM.frameElement==null}catch(aZ){}if(ab.documentElement.doScroll&&aY){x()}}}},isFunction:function(aY){return at.call(aY)==="[object Function]"},isArray:function(aY){return at.call(aY)==="[object Array]"
},isPlainObject:function(aZ){if(!aZ||at.call(aZ)!=="[object Object]"||aZ.nodeType||aZ.setInterval){return false}if(aZ.constructor&&!ap.call(aZ,"constructor")&&!ap.call(aZ.constructor.prototype,"isPrototypeOf")){return false
}var aY;for(aY in aZ){}return aY===C||ap.call(aZ,aY)},isEmptyObject:function(aZ){for(var aY in aZ){return false}return true},error:function(aY){throw aY},parseJSON:function(aY){if(typeof aY!=="string"||!aY){return null
}aY=a.trim(aY);if(/^[\],:{}\s]*$/.test(aY.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){return aM.JSON&&aM.JSON.parse?aM.JSON.parse(aY):(new Function("return "+aY))()
}else{a.error("Invalid JSON: "+aY)}},noop:function(){},globalEval:function(a0){if(a0&&ax.test(a0)){var aZ=ab.getElementsByTagName("head")[0]||ab.documentElement,aY=ab.createElement("script");aY.type="text/javascript";
if(a.support.scriptEval){aY.appendChild(ab.createTextNode(a0))}else{aY.text=a0}aZ.insertBefore(aY,aZ.firstChild);aZ.removeChild(aY)}},nodeName:function(aZ,aY){return aZ.nodeName&&aZ.nodeName.toUpperCase()===aY.toUpperCase()
},each:function(a1,a5,a0){var aZ,a2=0,a3=a1.length,aY=a3===C||a.isFunction(a1);if(a0){if(aY){for(aZ in a1){if(a5.apply(a1[aZ],a0)===false){break}}}else{for(;a2<a3;){if(a5.apply(a1[a2++],a0)===false){break
}}}}else{if(aY){for(aZ in a1){if(a5.call(a1[aZ],aZ,a1[aZ])===false){break}}}else{for(var a4=a1[0];a2<a3&&a5.call(a4,a2,a4)!==false;a4=a1[++a2]){}}}return a1},trim:function(aY){return(aY||"").replace(M,"")
},makeArray:function(a0,aZ){var aY=aZ||[];if(a0!=null){if(a0.length==null||typeof a0==="string"||a.isFunction(a0)||(typeof a0!=="function"&&a0.setInterval)){g.call(aY,a0)}else{a.merge(aY,a0)}}return aY
},inArray:function(a0,a1){if(a1.indexOf){return a1.indexOf(a0)}for(var aY=0,aZ=a1.length;aY<aZ;aY++){if(a1[aY]===a0){return aY}}return -1},merge:function(a2,a0){var a1=a2.length,aZ=0;if(typeof a0.length==="number"){for(var aY=a0.length;
aZ<aY;aZ++){a2[a1++]=a0[aZ]}}else{while(a0[aZ]!==C){a2[a1++]=a0[aZ++]}}a2.length=a1;return a2},grep:function(aZ,a3,aY){var a0=[];for(var a1=0,a2=aZ.length;a1<a2;a1++){if(!aY!==!a3(aZ[a1],a1)){a0.push(aZ[a1])
}}return a0},map:function(aZ,a4,aY){var a0=[],a3;for(var a1=0,a2=aZ.length;a1<a2;a1++){a3=a4(aZ[a1],a1,aY);if(a3!=null){a0[a0.length]=a3}}return a0.concat.apply([],a0)},guid:1,proxy:function(a0,aZ,aY){if(arguments.length===2){if(typeof aZ==="string"){aY=a0;
a0=aY[aZ];aZ=C}else{if(aZ&&!a.isFunction(aZ)){aY=aZ;aZ=C}}}if(!aZ&&a0){aZ=function(){return a0.apply(aY||this,arguments)}}if(a0){aZ.guid=a0.guid=a0.guid||aZ.guid||a.guid++}return aZ},uaMatch:function(aZ){aZ=aZ.toLowerCase();
var aY=/(webkit)[ \/]([\w.]+)/.exec(aZ)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(aZ)||/(msie) ([\w.]+)/.exec(aZ)||!/compatible/.test(aZ)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(aZ)||[];return{browser:aY[1]||"",version:aY[2]||"0"}
},browser:{}});u=a.uaMatch(b);if(u.browser){a.browser[u.browser]=true;a.browser.version=u.version}if(a.browser.webkit){a.browser.safari=true}if(s){a.inArray=function(aY,aZ){return s.call(aZ,aY)}}X=a(ab);
if(ab.addEventListener){aG=function(){ab.removeEventListener("DOMContentLoaded",aG,false);a.ready()}}else{if(ab.attachEvent){aG=function(){if(ab.readyState==="complete"){ab.detachEvent("onreadystatechange",aG);
a.ready()}}}}function x(){if(a.isReady){return}try{ab.documentElement.doScroll("left")}catch(aY){setTimeout(x,1);return}a.ready()}function aV(aY,aZ){if(aZ.src){a.ajax({url:aZ.src,async:false,dataType:"script"})
}else{a.globalEval(aZ.text||aZ.textContent||aZ.innerHTML||"")}if(aZ.parentNode){aZ.parentNode.removeChild(aZ)}}function an(aY,a6,a4,a0,a3,a5){var aZ=aY.length;if(typeof a6==="object"){for(var a1 in a6){an(aY,a1,a6[a1],a0,a3,a4)
}return aY}if(a4!==C){a0=!a5&&a0&&a.isFunction(a4);for(var a2=0;a2<aZ;a2++){a3(aY[a2],a6,a0?a4.call(aY[a2],a2,a3(aY[a2],a6)):a4,a5)}return aY}return aZ?a3(aY[0],a6):C}function aP(){return(new Date).getTime()
}(function(){a.support={};var a4=ab.documentElement,a3=ab.createElement("script"),aY=ab.createElement("div"),aZ="script"+aP();aY.style.display="none";aY.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
var a6=aY.getElementsByTagName("*"),a5=aY.getElementsByTagName("a")[0];if(!a6||!a6.length||!a5){return}a.support={leadingWhitespace:aY.firstChild.nodeType===3,tbody:!aY.getElementsByTagName("tbody").length,htmlSerialize:!!aY.getElementsByTagName("link").length,style:/red/.test(a5.getAttribute("style")),hrefNormalized:a5.getAttribute("href")==="/a",opacity:/^0.55$/.test(a5.style.opacity),cssFloat:!!a5.style.cssFloat,checkOn:aY.getElementsByTagName("input")[0].value==="on",optSelected:ab.createElement("select").appendChild(ab.createElement("option")).selected,parentNode:aY.removeChild(aY.appendChild(ab.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};
a3.type="text/javascript";try{a3.appendChild(ab.createTextNode("window."+aZ+"=1;"))}catch(a1){}a4.insertBefore(a3,a4.firstChild);if(aM[aZ]){a.support.scriptEval=true;delete aM[aZ]}try{delete a3.test}catch(a1){a.support.deleteExpando=false
}a4.removeChild(a3);if(aY.attachEvent&&aY.fireEvent){aY.attachEvent("onclick",function a7(){a.support.noCloneEvent=false;aY.detachEvent("onclick",a7)});aY.cloneNode(true).fireEvent("onclick")}aY=ab.createElement("div");
aY.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var a0=ab.createDocumentFragment();a0.appendChild(aY.firstChild);a.support.checkClone=a0.cloneNode(true).cloneNode(true).lastChild.checked;
a(function(){var a8=ab.createElement("div");a8.style.width=a8.style.paddingLeft="1px";ab.body.appendChild(a8);a.boxModel=a.support.boxModel=a8.offsetWidth===2;ab.body.removeChild(a8).style.display="none";
a8=null});var a2=function(a8){var ba=ab.createElement("div");a8="on"+a8;var a9=(a8 in ba);if(!a9){ba.setAttribute(a8,"return;");a9=typeof ba[a8]==="function"}ba=null;return a9};a.support.submitBubbles=a2("submit");
a.support.changeBubbles=a2("change");a4=a3=aY=a6=a5=null})();a.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};
var aI="jQuery"+aP(),aH=0,aT={};a.extend({cache:{},expando:aI,noData:{embed:true,object:true,applet:true},data:function(a0,aZ,a2){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;
var a3=a0[aI],aY=a.cache,a1;if(!a3&&typeof aZ==="string"&&a2===C){return null}if(!a3){a3=++aH}if(typeof aZ==="object"){a0[aI]=a3;a1=aY[a3]=a.extend(true,{},aZ)}else{if(!aY[a3]){a0[aI]=a3;aY[a3]={}}}a1=aY[a3];
if(a2!==C){a1[aZ]=a2}return typeof aZ==="string"?a1[aZ]:a1},removeData:function(a0,aZ){if(a0.nodeName&&a.noData[a0.nodeName.toLowerCase()]){return}a0=a0==aM?aT:a0;var a2=a0[aI],aY=a.cache,a1=aY[a2];if(aZ){if(a1){delete a1[aZ];
if(a.isEmptyObject(a1)){a.removeData(a0)}}}else{if(a.support.deleteExpando){delete a0[a.expando]}else{if(a0.removeAttribute){a0.removeAttribute(a.expando)}}delete aY[a2]}}});a.fn.extend({data:function(aY,a0){if(typeof aY==="undefined"&&this.length){return a.data(this[0])
}else{if(typeof aY==="object"){return this.each(function(){a.data(this,aY)})}}var a1=aY.split(".");a1[1]=a1[1]?"."+a1[1]:"";if(a0===C){var aZ=this.triggerHandler("getData"+a1[1]+"!",[a1[0]]);if(aZ===C&&this.length){aZ=a.data(this[0],aY)
}return aZ===C&&a1[1]?this.data(a1[0]):aZ}else{return this.trigger("setData"+a1[1]+"!",[a1[0],a0]).each(function(){a.data(this,aY,a0)})}},removeData:function(aY){return this.each(function(){a.removeData(this,aY)
})}});a.extend({queue:function(aZ,aY,a1){if(!aZ){return}aY=(aY||"fx")+"queue";var a0=a.data(aZ,aY);if(!a1){return a0||[]}if(!a0||a.isArray(a1)){a0=a.data(aZ,aY,a.makeArray(a1))}else{a0.push(a1)}return a0
},dequeue:function(a1,a0){a0=a0||"fx";var aY=a.queue(a1,a0),aZ=aY.shift();if(aZ==="inprogress"){aZ=aY.shift()}if(aZ){if(a0==="fx"){aY.unshift("inprogress")}aZ.call(a1,function(){a.dequeue(a1,a0)})}}});
a.fn.extend({queue:function(aY,aZ){if(typeof aY!=="string"){aZ=aY;aY="fx"}if(aZ===C){return a.queue(this[0],aY)}return this.each(function(a1,a2){var a0=a.queue(this,aY,aZ);if(aY==="fx"&&a0[0]!=="inprogress"){a.dequeue(this,aY)
}})},dequeue:function(aY){return this.each(function(){a.dequeue(this,aY)})},delay:function(aZ,aY){aZ=a.fx?a.fx.speeds[aZ]||aZ:aZ;aY=aY||"fx";return this.queue(aY,function(){var a0=this;setTimeout(function(){a.dequeue(a0,aY)
},aZ)})},clearQueue:function(aY){return this.queue(aY||"fx",[])}});var ao=/[\n\t]/g,S=/\s+/,av=/\r/g,aQ=/href|src|style/,d=/(button|input)/i,z=/(button|input|object|select|textarea)/i,j=/^(a|area)$/i,I=/radio|checkbox/;
a.fn.extend({attr:function(aY,aZ){return an(this,aY,aZ,true,a.attr)},removeAttr:function(aY,aZ){return this.each(function(){a.attr(this,aY,"");if(this.nodeType===1){this.removeAttribute(aY)}})},addClass:function(a5){if(a.isFunction(a5)){return this.each(function(a8){var a7=a(this);
a7.addClass(a5.call(this,a8,a7.attr("class")))})}if(a5&&typeof a5==="string"){var aY=(a5||"").split(S);for(var a1=0,a0=this.length;a1<a0;a1++){var aZ=this[a1];if(aZ.nodeType===1){if(!aZ.className){aZ.className=a5
}else{var a2=" "+aZ.className+" ",a4=aZ.className;for(var a3=0,a6=aY.length;a3<a6;a3++){if(a2.indexOf(" "+aY[a3]+" ")<0){a4+=" "+aY[a3]}}aZ.className=a.trim(a4)}}}}return this},removeClass:function(a3){if(a.isFunction(a3)){return this.each(function(a7){var a6=a(this);
a6.removeClass(a3.call(this,a7,a6.attr("class")))})}if((a3&&typeof a3==="string")||a3===C){var a4=(a3||"").split(S);for(var a0=0,aZ=this.length;a0<aZ;a0++){var a2=this[a0];if(a2.nodeType===1&&a2.className){if(a3){var a1=(" "+a2.className+" ").replace(ao," ");
for(var a5=0,aY=a4.length;a5<aY;a5++){a1=a1.replace(" "+a4[a5]+" "," ")}a2.className=a.trim(a1)}else{a2.className=""}}}}return this},toggleClass:function(a1,aZ){var a0=typeof a1,aY=typeof aZ==="boolean";
if(a.isFunction(a1)){return this.each(function(a3){var a2=a(this);a2.toggleClass(a1.call(this,a3,a2.attr("class"),aZ),aZ)})}return this.each(function(){if(a0==="string"){var a4,a3=0,a2=a(this),a5=aZ,a6=a1.split(S);
while((a4=a6[a3++])){a5=aY?a5:!a2.hasClass(a4);a2[a5?"addClass":"removeClass"](a4)}}else{if(a0==="undefined"||a0==="boolean"){if(this.className){a.data(this,"__className__",this.className)}this.className=this.className||a1===false?"":a.data(this,"__className__")||""
}}})},hasClass:function(aY){var a1=" "+aY+" ";for(var a0=0,aZ=this.length;a0<aZ;a0++){if((" "+this[a0].className+" ").replace(ao," ").indexOf(a1)>-1){return true}}return false},val:function(a5){if(a5===C){var aZ=this[0];
if(aZ){if(a.nodeName(aZ,"option")){return(aZ.attributes.value||{}).specified?aZ.value:aZ.text}if(a.nodeName(aZ,"select")){var a3=aZ.selectedIndex,a6=[],a7=aZ.options,a2=aZ.type==="select-one";if(a3<0){return null
}for(var a0=a2?a3:0,a4=a2?a3+1:a7.length;a0<a4;a0++){var a1=a7[a0];if(a1.selected){a5=a(a1).val();if(a2){return a5}a6.push(a5)}}return a6}if(I.test(aZ.type)&&!a.support.checkOn){return aZ.getAttribute("value")===null?"on":aZ.value
}return(aZ.value||"").replace(av,"")}return C}var aY=a.isFunction(a5);return this.each(function(ba){var a9=a(this),bb=a5;if(this.nodeType!==1){return}if(aY){bb=a5.call(this,ba,a9.val())}if(typeof bb==="number"){bb+=""
}if(a.isArray(bb)&&I.test(this.type)){this.checked=a.inArray(a9.val(),bb)>=0}else{if(a.nodeName(this,"select")){var a8=a.makeArray(bb);a("option",this).each(function(){this.selected=a.inArray(a(this).val(),a8)>=0
});if(!a8.length){this.selectedIndex=-1}}else{this.value=bb}}})}});a.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(aZ,aY,a4,a7){if(!aZ||aZ.nodeType===3||aZ.nodeType===8){return C
}if(a7&&aY in a.attrFn){return a(aZ)[aY](a4)}var a0=aZ.nodeType!==1||!a.isXMLDoc(aZ),a3=a4!==C;aY=a0&&a.props[aY]||aY;if(aZ.nodeType===1){var a2=aQ.test(aY);if(aY==="selected"&&!a.support.optSelected){var a5=aZ.parentNode;
if(a5){a5.selectedIndex;if(a5.parentNode){a5.parentNode.selectedIndex}}}if(aY in aZ&&a0&&!a2){if(a3){if(aY==="type"&&d.test(aZ.nodeName)&&aZ.parentNode){a.error("type property can't be changed")}aZ[aY]=a4
}if(a.nodeName(aZ,"form")&&aZ.getAttributeNode(aY)){return aZ.getAttributeNode(aY).nodeValue}if(aY==="tabIndex"){var a6=aZ.getAttributeNode("tabIndex");return a6&&a6.specified?a6.value:z.test(aZ.nodeName)||j.test(aZ.nodeName)&&aZ.href?0:C
}return aZ[aY]}if(!a.support.style&&a0&&aY==="style"){if(a3){aZ.style.cssText=""+a4}return aZ.style.cssText}if(a3){aZ.setAttribute(aY,""+a4)}var a1=!a.support.hrefNormalized&&a0&&a2?aZ.getAttribute(aY,2):aZ.getAttribute(aY);
return a1===null?C:a1}return a.style(aZ,aY,a4)}});var aC=/\.(.*)$/,A=function(aY){return aY.replace(/[^\w\s\.\|`]/g,function(aZ){return"\\"+aZ})};a.event={add:function(a1,a5,ba,a3){if(a1.nodeType===3||a1.nodeType===8){return
}if(a1.setInterval&&(a1!==aM&&!a1.frameElement)){a1=aM}var aZ,a9;if(ba.handler){aZ=ba;ba=aZ.handler}if(!ba.guid){ba.guid=a.guid++}var a6=a.data(a1);if(!a6){return}var bb=a6.events=a6.events||{},a4=a6.handle,a4;
if(!a4){a6.handle=a4=function(){return typeof a!=="undefined"&&!a.event.triggered?a.event.handle.apply(a4.elem,arguments):C}}a4.elem=a1;a5=a5.split(" ");var a8,a2=0,aY;while((a8=a5[a2++])){a9=aZ?a.extend({},aZ):{handler:ba,data:a3};
if(a8.indexOf(".")>-1){aY=a8.split(".");a8=aY.shift();a9.namespace=aY.slice(0).sort().join(".")}else{aY=[];a9.namespace=""}a9.type=a8;a9.guid=ba.guid;var a0=bb[a8],a7=a.event.special[a8]||{};if(!a0){a0=bb[a8]=[];
if(!a7.setup||a7.setup.call(a1,a3,aY,a4)===false){if(a1.addEventListener){a1.addEventListener(a8,a4,false)}else{if(a1.attachEvent){a1.attachEvent("on"+a8,a4)}}}}if(a7.add){a7.add.call(a1,a9);if(!a9.handler.guid){a9.handler.guid=ba.guid
}}a0.push(a9);a.event.global[a8]=true}a1=null},global:{},remove:function(bd,a8,aZ,a4){if(bd.nodeType===3||bd.nodeType===8){return}var bg,a3,a5,bb=0,a1,a6,a9,a2,a7,aY,bf,bc=a.data(bd),a0=bc&&bc.events;if(!bc||!a0){return
}if(a8&&a8.type){aZ=a8.handler;a8=a8.type}if(!a8||typeof a8==="string"&&a8.charAt(0)==="."){a8=a8||"";for(a3 in a0){a.event.remove(bd,a3+a8)}return}a8=a8.split(" ");while((a3=a8[bb++])){bf=a3;aY=null;a1=a3.indexOf(".")<0;
a6=[];if(!a1){a6=a3.split(".");a3=a6.shift();a9=new RegExp("(^|\\.)"+a.map(a6.slice(0).sort(),A).join("\\.(?:.*\\.)?")+"(\\.|$)")}a7=a0[a3];if(!a7){continue}if(!aZ){for(var ba=0;ba<a7.length;ba++){aY=a7[ba];
if(a1||a9.test(aY.namespace)){a.event.remove(bd,bf,aY.handler,ba);a7.splice(ba--,1)}}continue}a2=a.event.special[a3]||{};for(var ba=a4||0;ba<a7.length;ba++){aY=a7[ba];if(aZ.guid===aY.guid){if(a1||a9.test(aY.namespace)){if(a4==null){a7.splice(ba--,1)
}if(a2.remove){a2.remove.call(bd,aY)}}if(a4!=null){break}}}if(a7.length===0||a4!=null&&a7.length===1){if(!a2.teardown||a2.teardown.call(bd,a6)===false){ag(bd,a3,bc.handle)}bg=null;delete a0[a3]}}if(a.isEmptyObject(a0)){var be=bc.handle;
if(be){be.elem=null}delete bc.events;delete bc.handle;if(a.isEmptyObject(bc)){a.removeData(bd)}}},trigger:function(aY,a2,a0){var a7=aY.type||aY,a1=arguments[3];if(!a1){aY=typeof aY==="object"?aY[aI]?aY:a.extend(a.Event(a7),aY):a.Event(a7);
if(a7.indexOf("!")>=0){aY.type=a7=a7.slice(0,-1);aY.exclusive=true}if(!a0){aY.stopPropagation();if(a.event.global[a7]){a.each(a.cache,function(){if(this.events&&this.events[a7]){a.event.trigger(aY,a2,this.handle.elem)
}})}}if(!a0||a0.nodeType===3||a0.nodeType===8){return C}aY.result=C;aY.target=a0;a2=a.makeArray(a2);a2.unshift(aY)}aY.currentTarget=a0;var a3=a.data(a0,"handle");if(a3){a3.apply(a0,a2)}var a8=a0.parentNode||a0.ownerDocument;
try{if(!(a0&&a0.nodeName&&a.noData[a0.nodeName.toLowerCase()])){if(a0["on"+a7]&&a0["on"+a7].apply(a0,a2)===false){aY.result=false}}}catch(a5){}if(!aY.isPropagationStopped()&&a8){a.event.trigger(aY,a2,a8,true)
}else{if(!aY.isDefaultPrevented()){var a4=aY.target,aZ,a9=a.nodeName(a4,"a")&&a7==="click",a6=a.event.special[a7]||{};if((!a6._default||a6._default.call(a0,aY)===false)&&!a9&&!(a4&&a4.nodeName&&a.noData[a4.nodeName.toLowerCase()])){try{if(a4[a7]){aZ=a4["on"+a7];
if(aZ){a4["on"+a7]=null}a.event.triggered=true;a4[a7]()}}catch(a5){}if(aZ){a4["on"+a7]=aZ}a.event.triggered=false}}}},handle:function(aY){var a6,a0,aZ,a1,a7;aY=arguments[0]=a.event.fix(aY||aM.event);aY.currentTarget=this;
a6=aY.type.indexOf(".")<0&&!aY.exclusive;if(!a6){aZ=aY.type.split(".");aY.type=aZ.shift();a1=new RegExp("(^|\\.)"+aZ.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}var a7=a.data(this,"events"),a0=a7[aY.type];
if(a7&&a0){a0=a0.slice(0);for(var a3=0,a2=a0.length;a3<a2;a3++){var a5=a0[a3];if(a6||a1.test(a5.namespace)){aY.handler=a5.handler;aY.data=a5.data;aY.handleObj=a5;var a4=a5.handler.apply(this,arguments);
if(a4!==C){aY.result=a4;if(a4===false){aY.preventDefault();aY.stopPropagation()}}if(aY.isImmediatePropagationStopped()){break}}}}return aY.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a1){if(a1[aI]){return a1
}var aZ=a1;a1=a.Event(aZ);for(var a0=this.props.length,a3;a0;){a3=this.props[--a0];a1[a3]=aZ[a3]}if(!a1.target){a1.target=a1.srcElement||ab}if(a1.target.nodeType===3){a1.target=a1.target.parentNode}if(!a1.relatedTarget&&a1.fromElement){a1.relatedTarget=a1.fromElement===a1.target?a1.toElement:a1.fromElement
}if(a1.pageX==null&&a1.clientX!=null){var a2=ab.documentElement,aY=ab.body;a1.pageX=a1.clientX+(a2&&a2.scrollLeft||aY&&aY.scrollLeft||0)-(a2&&a2.clientLeft||aY&&aY.clientLeft||0);a1.pageY=a1.clientY+(a2&&a2.scrollTop||aY&&aY.scrollTop||0)-(a2&&a2.clientTop||aY&&aY.clientTop||0)
}if(!a1.which&&((a1.charCode||a1.charCode===0)?a1.charCode:a1.keyCode)){a1.which=a1.charCode||a1.keyCode}if(!a1.metaKey&&a1.ctrlKey){a1.metaKey=a1.ctrlKey}if(!a1.which&&a1.button!==C){a1.which=(a1.button&1?1:(a1.button&2?3:(a1.button&4?2:0)))
}return a1},guid:100000000,proxy:a.proxy,special:{ready:{setup:a.bindReady,teardown:a.noop},live:{add:function(aY){a.event.add(this,aY.origType,a.extend({},aY,{handler:V}))},remove:function(aZ){var aY=true,a0=aZ.origType.replace(aC,"");
a.each(a.data(this,"events").live||[],function(){if(a0===this.origType.replace(aC,"")){aY=false;return false}});if(aY){a.event.remove(this,aZ.origType,V)}}},beforeunload:{setup:function(a0,aZ,aY){if(this.setInterval){this.onbeforeunload=aY
}return false},teardown:function(aZ,aY){if(this.onbeforeunload===aY){this.onbeforeunload=null}}}}};var ag=ab.removeEventListener?function(aZ,aY,a0){aZ.removeEventListener(aY,a0,false)}:function(aZ,aY,a0){aZ.detachEvent("on"+aY,a0)
};a.Event=function(aY){if(!this.preventDefault){return new a.Event(aY)}if(aY&&aY.type){this.originalEvent=aY;this.type=aY.type}else{this.type=aY}this.timeStamp=aP();this[aI]=true};function aR(){return false
}function f(){return true}a.Event.prototype={preventDefault:function(){this.isDefaultPrevented=f;var aY=this.originalEvent;if(!aY){return}if(aY.preventDefault){aY.preventDefault()}aY.returnValue=false},stopPropagation:function(){this.isPropagationStopped=f;
var aY=this.originalEvent;if(!aY){return}if(aY.stopPropagation){aY.stopPropagation()}aY.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=f;this.stopPropagation()
},isDefaultPrevented:aR,isPropagationStopped:aR,isImmediatePropagationStopped:aR};var Q=function(aZ){var aY=aZ.relatedTarget;try{while(aY&&aY!==this){aY=aY.parentNode}if(aY!==this){aZ.type=aZ.data;a.event.handle.apply(this,arguments)
}}catch(a0){}},ay=function(aY){aY.type=aY.data;a.event.handle.apply(this,arguments)};a.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(aZ,aY){a.event.special[aZ]={setup:function(a0){a.event.add(this,aY,a0&&a0.selector?ay:Q,aZ)
},teardown:function(a0){a.event.remove(this,aY,a0&&a0.selector?ay:Q)}}});if(!a.support.submitBubbles){a.event.special.submit={setup:function(aZ,aY){if(this.nodeName.toLowerCase()!=="form"){a.event.add(this,"click.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;
if((a0==="submit"||a0==="image")&&a(a1).closest("form").length){return aA("submit",this,arguments)}});a.event.add(this,"keypress.specialSubmit",function(a2){var a1=a2.target,a0=a1.type;if((a0==="text"||a0==="password")&&a(a1).closest("form").length&&a2.keyCode===13){return aA("submit",this,arguments)
}})}else{return false}},teardown:function(aY){a.event.remove(this,".specialSubmit")}}}if(!a.support.changeBubbles){var aq=/textarea|input|select/i,aS,i=function(aZ){var aY=aZ.type,a0=aZ.value;if(aY==="radio"||aY==="checkbox"){a0=aZ.checked
}else{if(aY==="select-multiple"){a0=aZ.selectedIndex>-1?a.map(aZ.options,function(a1){return a1.selected}).join("-"):""}else{if(aZ.nodeName.toLowerCase()==="select"){a0=aZ.selectedIndex}}}return a0},O=function O(a0){var aY=a0.target,aZ,a1;
if(!aq.test(aY.nodeName)||aY.readOnly){return}aZ=a.data(aY,"_change_data");a1=i(aY);if(a0.type!=="focusout"||aY.type!=="radio"){a.data(aY,"_change_data",a1)}if(aZ===C||a1===aZ){return}if(aZ!=null||a1){a0.type="change";
return a.event.trigger(a0,arguments[1],aY)}};a.event.special.change={filters:{focusout:O,click:function(a0){var aZ=a0.target,aY=aZ.type;if(aY==="radio"||aY==="checkbox"||aZ.nodeName.toLowerCase()==="select"){return O.call(this,a0)
}},keydown:function(a0){var aZ=a0.target,aY=aZ.type;if((a0.keyCode===13&&aZ.nodeName.toLowerCase()!=="textarea")||(a0.keyCode===32&&(aY==="checkbox"||aY==="radio"))||aY==="select-multiple"){return O.call(this,a0)
}},beforeactivate:function(aZ){var aY=aZ.target;a.data(aY,"_change_data",i(aY))}},setup:function(a0,aZ){if(this.type==="file"){return false}for(var aY in aS){a.event.add(this,aY+".specialChange",aS[aY])
}return aq.test(this.nodeName)},teardown:function(aY){a.event.remove(this,".specialChange");return aq.test(this.nodeName)}};aS=a.event.special.change.filters}function aA(aZ,a0,aY){aY[0].type=aZ;return a.event.handle.apply(a0,aY)
}if(ab.addEventListener){a.each({focus:"focusin",blur:"focusout"},function(a0,aY){a.event.special[aY]={setup:function(){this.addEventListener(a0,aZ,true)},teardown:function(){this.removeEventListener(a0,aZ,true)
}};function aZ(a1){a1=a.event.fix(a1);a1.type=aY;return a.event.handle.call(this,a1)}})}a.each(["bind","one"],function(aZ,aY){a.fn[aY]=function(a5,a6,a4){if(typeof a5==="object"){for(var a2 in a5){this[aY](a2,a6,a5[a2],a4)
}return this}if(a.isFunction(a6)){a4=a6;a6=C}var a3=aY==="one"?a.proxy(a4,function(a7){a(this).unbind(a7,a3);return a4.apply(this,arguments)}):a4;if(a5==="unload"&&aY!=="one"){this.one(a5,a6,a4)}else{for(var a1=0,a0=this.length;
a1<a0;a1++){a.event.add(this[a1],a5,a3,a6)}}return this}});a.fn.extend({unbind:function(a2,a1){if(typeof a2==="object"&&!a2.preventDefault){for(var a0 in a2){this.unbind(a0,a2[a0])}}else{for(var aZ=0,aY=this.length;
aZ<aY;aZ++){a.event.remove(this[aZ],a2,a1)}}return this},delegate:function(aY,aZ,a1,a0){return this.live(aZ,a1,a0,aY)},undelegate:function(aY,aZ,a0){if(arguments.length===0){return this.unbind("live")}else{return this.die(aZ,null,a0,aY)
}},trigger:function(aY,aZ){return this.each(function(){a.event.trigger(aY,aZ,this)})},triggerHandler:function(aY,a0){if(this[0]){var aZ=a.Event(aY);aZ.preventDefault();aZ.stopPropagation();a.event.trigger(aZ,a0,this[0]);
return aZ.result}},toggle:function(a0){var aY=arguments,aZ=1;while(aZ<aY.length){a.proxy(a0,aY[aZ++])}return this.click(a.proxy(a0,function(a1){var a2=(a.data(this,"lastToggle"+a0.guid)||0)%aZ;a.data(this,"lastToggle"+a0.guid,a2+1);
a1.preventDefault();return aY[a2].apply(this,arguments)||false}))},hover:function(aY,aZ){return this.mouseenter(aY).mouseleave(aZ||aY)}});var aw={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};
a.each(["live","die"],function(aZ,aY){a.fn[aY]=function(a7,a4,a9,a2){var a8,a5=0,a6,a1,ba,a3=a2||this.selector,a0=a2?this:a(this.context);if(a.isFunction(a4)){a9=a4;a4=C}a7=(a7||"").split(" ");while((a8=a7[a5++])!=null){a6=aC.exec(a8);
a1="";if(a6){a1=a6[0];a8=a8.replace(aC,"")}if(a8==="hover"){a7.push("mouseenter"+a1,"mouseleave"+a1);continue}ba=a8;if(a8==="focus"||a8==="blur"){a7.push(aw[a8]+a1);a8=a8+a1}else{a8=(aw[a8]||a8)+a1}if(aY==="live"){a0.each(function(){a.event.add(this,m(a8,a3),{data:a4,selector:a3,handler:a9,origType:a8,origHandler:a9,preType:ba})
})}else{a0.unbind(m(a8,a3),a9)}}return this}});function V(aY){var a8,aZ=[],bb=[],a7=arguments,ba,a6,a9,a1,a3,a5,a2,a4,bc=a.data(this,"events");if(aY.liveFired===this||!bc||!bc.live||aY.button&&aY.type==="click"){return
}aY.liveFired=this;var a0=bc.live.slice(0);for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a9.origType.replace(aC,"")===aY.type){bb.push(a9.selector)}else{a0.splice(a3--,1)}}a6=a(aY.target).closest(bb,aY.currentTarget);
for(a5=0,a2=a6.length;a5<a2;a5++){for(a3=0;a3<a0.length;a3++){a9=a0[a3];if(a6[a5].selector===a9.selector){a1=a6[a5].elem;ba=null;if(a9.preType==="mouseenter"||a9.preType==="mouseleave"){ba=a(aY.relatedTarget).closest(a9.selector)[0]
}if(!ba||ba!==a1){aZ.push({elem:a1,handleObj:a9})}}}}for(a5=0,a2=aZ.length;a5<a2;a5++){a6=aZ[a5];aY.currentTarget=a6.elem;aY.data=a6.handleObj.data;aY.handleObj=a6.handleObj;if(a6.handleObj.origHandler.apply(a6.elem,a7)===false){a8=false;
break}}return a8}function m(aZ,aY){return"live."+(aZ&&aZ!=="*"?aZ+".":"")+aY.replace(/\./g,"`").replace(/ /g,"&")}a.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(aZ,aY){a.fn[aY]=function(a0){return a0?this.bind(aY,a0):this.trigger(aY)
};if(a.attrFn){a.attrFn[aY]=true}});if(aM.attachEvent&&!aM.addEventListener){aM.attachEvent("onunload",function(){for(var aZ in a.cache){if(a.cache[aZ].handle){try{a.event.remove(a.cache[aZ].handle.elem)
}catch(aY){}}}});
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
}(function(){var a9=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,ba=0,bc=Object.prototype.toString,a4=false,a3=true;
[0,0].sort(function(){a3=false;return 0});var a0=function(bl,bg,bo,bp){bo=bo||[];var br=bg=bg||ab;if(bg.nodeType!==1&&bg.nodeType!==9){return[]}if(!bl||typeof bl!=="string"){return bo}var bm=[],bi,bt,bw,bh,bk=true,bj=a1(bg),bq=bl;
while((a9.exec(""),bi=a9.exec(bq))!==null){bq=bi[3];bm.push(bi[1]);if(bi[2]){bh=bi[3];break}}if(bm.length>1&&a5.exec(bl)){if(bm.length===2&&a6.relative[bm[0]]){bt=bd(bm[0]+bm[1],bg)}else{bt=a6.relative[bm[0]]?[bg]:a0(bm.shift(),bg);
while(bm.length){bl=bm.shift();if(a6.relative[bl]){bl+=bm.shift()}bt=bd(bl,bt)}}}else{if(!bp&&bm.length>1&&bg.nodeType===9&&!bj&&a6.match.ID.test(bm[0])&&!a6.match.ID.test(bm[bm.length-1])){var bs=a0.find(bm.shift(),bg,bj);
bg=bs.expr?a0.filter(bs.expr,bs.set)[0]:bs.set[0]}if(bg){var bs=bp?{expr:bm.pop(),set:a8(bp)}:a0.find(bm.pop(),bm.length===1&&(bm[0]==="~"||bm[0]==="+")&&bg.parentNode?bg.parentNode:bg,bj);bt=bs.expr?a0.filter(bs.expr,bs.set):bs.set;
if(bm.length>0){bw=a8(bt)}else{bk=false}while(bm.length){var bv=bm.pop(),bu=bv;if(!a6.relative[bv]){bv=""}else{bu=bm.pop()}if(bu==null){bu=bg}a6.relative[bv](bw,bu,bj)}}else{bw=bm=[]}}if(!bw){bw=bt}if(!bw){a0.error(bv||bl)
}if(bc.call(bw)==="[object Array]"){if(!bk){bo.push.apply(bo,bw)}else{if(bg&&bg.nodeType===1){for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&(bw[bn]===true||bw[bn].nodeType===1&&a7(bg,bw[bn]))){bo.push(bt[bn])
}}}else{for(var bn=0;bw[bn]!=null;bn++){if(bw[bn]&&bw[bn].nodeType===1){bo.push(bt[bn])}}}}}else{a8(bw,bo)}if(bh){a0(bh,br,bo,bp);a0.uniqueSort(bo)}return bo};a0.uniqueSort=function(bh){if(bb){a4=a3;bh.sort(bb);
if(a4){for(var bg=1;bg<bh.length;bg++){if(bh[bg]===bh[bg-1]){bh.splice(bg--,1)}}}}return bh};a0.matches=function(bg,bh){return a0(bg,null,null,bh)};a0.find=function(bn,bg,bo){var bm,bk;if(!bn){return[]
}for(var bj=0,bi=a6.order.length;bj<bi;bj++){var bl=a6.order[bj],bk;if((bk=a6.leftMatch[bl].exec(bn))){var bh=bk[1];bk.splice(1,1);if(bh.substr(bh.length-1)!=="\\"){bk[1]=(bk[1]||"").replace(/\\/g,"");
bm=a6.find[bl](bk,bg,bo);if(bm!=null){bn=bn.replace(a6.match[bl],"");break}}}}if(!bm){bm=bg.getElementsByTagName("*")}return{set:bm,expr:bn}};a0.filter=function(br,bq,bu,bk){var bi=br,bw=[],bo=bq,bm,bg,bn=bq&&bq[0]&&a1(bq[0]);
while(br&&bq.length){for(var bp in a6.filter){if((bm=a6.leftMatch[bp].exec(br))!=null&&bm[2]){var bh=a6.filter[bp],bv,bt,bj=bm[1];bg=false;bm.splice(1,1);if(bj.substr(bj.length-1)==="\\"){continue}if(bo===bw){bw=[]
}if(a6.preFilter[bp]){bm=a6.preFilter[bp](bm,bo,bu,bw,bk,bn);if(!bm){bg=bv=true}else{if(bm===true){continue}}}if(bm){for(var bl=0;(bt=bo[bl])!=null;bl++){if(bt){bv=bh(bt,bm,bl,bo);var bs=bk^!!bv;if(bu&&bv!=null){if(bs){bg=true
}else{bo[bl]=false}}else{if(bs){bw.push(bt);bg=true}}}}}if(bv!==C){if(!bu){bo=bw}br=br.replace(a6.match[bp],"");if(!bg){return[]}break}}}if(br===bi){if(bg==null){a0.error(br)}else{break}}bi=br}return bo
};a0.error=function(bg){throw"Syntax error, unrecognized expression: "+bg};var a6=a0.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bg){return bg.getAttribute("href")
}},relative:{"+":function(bm,bh){var bj=typeof bh==="string",bl=bj&&!/\W/.test(bh),bn=bj&&!bl;if(bl){bh=bh.toLowerCase()}for(var bi=0,bg=bm.length,bk;bi<bg;bi++){if((bk=bm[bi])){while((bk=bk.previousSibling)&&bk.nodeType!==1){}bm[bi]=bn||bk&&bk.nodeName.toLowerCase()===bh?bk||false:bk===bh
}}if(bn){a0.filter(bh,bm,true)}},">":function(bm,bh){var bk=typeof bh==="string";if(bk&&!/\W/.test(bh)){bh=bh.toLowerCase();for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){var bj=bl.parentNode;
bm[bi]=bj.nodeName.toLowerCase()===bh?bj:false}}}else{for(var bi=0,bg=bm.length;bi<bg;bi++){var bl=bm[bi];if(bl){bm[bi]=bk?bl.parentNode:bl.parentNode===bh}}if(bk){a0.filter(bh,bm,true)}}},"":function(bj,bh,bl){var bi=ba++,bg=be;
if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();bg=aY}bg("parentNode",bh,bi,bj,bk,bl)},"~":function(bj,bh,bl){var bi=ba++,bg=be;if(typeof bh==="string"&&!/\W/.test(bh)){var bk=bh=bh.toLowerCase();
bg=aY}bg("previousSibling",bh,bi,bj,bk,bl)}},find:{ID:function(bh,bi,bj){if(typeof bi.getElementById!=="undefined"&&!bj){var bg=bi.getElementById(bh[1]);return bg?[bg]:[]}},NAME:function(bi,bl){if(typeof bl.getElementsByName!=="undefined"){var bh=[],bk=bl.getElementsByName(bi[1]);
for(var bj=0,bg=bk.length;bj<bg;bj++){if(bk[bj].getAttribute("name")===bi[1]){bh.push(bk[bj])}}return bh.length===0?null:bh}},TAG:function(bg,bh){return bh.getElementsByTagName(bg[1])}},preFilter:{CLASS:function(bj,bh,bi,bg,bm,bn){bj=" "+bj[1].replace(/\\/g,"")+" ";
if(bn){return bj}for(var bk=0,bl;(bl=bh[bk])!=null;bk++){if(bl){if(bm^(bl.className&&(" "+bl.className+" ").replace(/[\t\n]/g," ").indexOf(bj)>=0)){if(!bi){bg.push(bl)}}else{if(bi){bh[bk]=false}}}}return false
},ID:function(bg){return bg[1].replace(/\\/g,"")},TAG:function(bh,bg){return bh[1].toLowerCase()},CHILD:function(bg){if(bg[1]==="nth"){var bh=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(bg[2]==="even"&&"2n"||bg[2]==="odd"&&"2n+1"||!/\D/.test(bg[2])&&"0n+"+bg[2]||bg[2]);
bg[2]=(bh[1]+(bh[2]||1))-0;bg[3]=bh[3]-0}bg[0]=ba++;return bg},ATTR:function(bk,bh,bi,bg,bl,bm){var bj=bk[1].replace(/\\/g,"");if(!bm&&a6.attrMap[bj]){bk[1]=a6.attrMap[bj]}if(bk[2]==="~="){bk[4]=" "+bk[4]+" "
}return bk},PSEUDO:function(bk,bh,bi,bg,bl){if(bk[1]==="not"){if((a9.exec(bk[3])||"").length>1||/^\w/.test(bk[3])){bk[3]=a0(bk[3],null,null,bh)}else{var bj=a0.filter(bk[3],bh,bi,true^bl);if(!bi){bg.push.apply(bg,bj)
}return false}}else{if(a6.match.POS.test(bk[0])||a6.match.CHILD.test(bk[0])){return true}}return bk},POS:function(bg){bg.unshift(true);return bg}},filters:{enabled:function(bg){return bg.disabled===false&&bg.type!=="hidden"
},disabled:function(bg){return bg.disabled===true},checked:function(bg){return bg.checked===true},selected:function(bg){bg.parentNode.selectedIndex;return bg.selected===true},parent:function(bg){return !!bg.firstChild
},empty:function(bg){return !bg.firstChild},has:function(bi,bh,bg){return !!a0(bg[3],bi).length},header:function(bg){return/h\d/i.test(bg.nodeName)},text:function(bg){return"text"===bg.type},radio:function(bg){return"radio"===bg.type
},checkbox:function(bg){return"checkbox"===bg.type},file:function(bg){return"file"===bg.type},password:function(bg){return"password"===bg.type},submit:function(bg){return"submit"===bg.type},image:function(bg){return"image"===bg.type
},reset:function(bg){return"reset"===bg.type},button:function(bg){return"button"===bg.type||bg.nodeName.toLowerCase()==="button"},input:function(bg){return/input|select|textarea|button/i.test(bg.nodeName)
}},setFilters:{first:function(bh,bg){return bg===0},last:function(bi,bh,bg,bj){return bh===bj.length-1},even:function(bh,bg){return bg%2===0},odd:function(bh,bg){return bg%2===1},lt:function(bi,bh,bg){return bh<bg[3]-0
},gt:function(bi,bh,bg){return bh>bg[3]-0},nth:function(bi,bh,bg){return bg[3]-0===bh},eq:function(bi,bh,bg){return bg[3]-0===bh}},filter:{PSEUDO:function(bm,bi,bj,bn){var bh=bi[1],bk=a6.filters[bh];if(bk){return bk(bm,bj,bi,bn)
}else{if(bh==="contains"){return(bm.textContent||bm.innerText||aZ([bm])||"").indexOf(bi[3])>=0}else{if(bh==="not"){var bl=bi[3];for(var bj=0,bg=bl.length;bj<bg;bj++){if(bl[bj]===bm){return false}}return true
}else{a0.error("Syntax error, unrecognized expression: "+bh)}}}},CHILD:function(bg,bj){var bm=bj[1],bh=bg;switch(bm){case"only":case"first":while((bh=bh.previousSibling)){if(bh.nodeType===1){return false
}}if(bm==="first"){return true}bh=bg;case"last":while((bh=bh.nextSibling)){if(bh.nodeType===1){return false}}return true;case"nth":var bi=bj[2],bp=bj[3];if(bi===1&&bp===0){return true}var bl=bj[0],bo=bg.parentNode;
if(bo&&(bo.sizcache!==bl||!bg.nodeIndex)){var bk=0;for(bh=bo.firstChild;bh;bh=bh.nextSibling){if(bh.nodeType===1){bh.nodeIndex=++bk}}bo.sizcache=bl}var bn=bg.nodeIndex-bp;if(bi===0){return bn===0}else{return(bn%bi===0&&bn/bi>=0)
}}},ID:function(bh,bg){return bh.nodeType===1&&bh.getAttribute("id")===bg},TAG:function(bh,bg){return(bg==="*"&&bh.nodeType===1)||bh.nodeName.toLowerCase()===bg},CLASS:function(bh,bg){return(" "+(bh.className||bh.getAttribute("class"))+" ").indexOf(bg)>-1
},ATTR:function(bl,bj){var bi=bj[1],bg=a6.attrHandle[bi]?a6.attrHandle[bi](bl):bl[bi]!=null?bl[bi]:bl.getAttribute(bi),bm=bg+"",bk=bj[2],bh=bj[4];return bg==null?bk==="!=":bk==="="?bm===bh:bk==="*="?bm.indexOf(bh)>=0:bk==="~="?(" "+bm+" ").indexOf(bh)>=0:!bh?bm&&bg!==false:bk==="!="?bm!==bh:bk==="^="?bm.indexOf(bh)===0:bk==="$="?bm.substr(bm.length-bh.length)===bh:bk==="|="?bm===bh||bm.substr(0,bh.length+1)===bh+"-":false
},POS:function(bk,bh,bi,bl){var bg=bh[2],bj=a6.setFilters[bg];if(bj){return bj(bk,bi,bh,bl)}}}};var a5=a6.match.POS;for(var a2 in a6.match){a6.match[a2]=new RegExp(a6.match[a2].source+/(?![^\[]*\])(?![^\(]*\))/.source);
a6.leftMatch[a2]=new RegExp(/(^(?:.|\r|\n)*?)/.source+a6.match[a2].source.replace(/\\(\d+)/g,function(bh,bg){return"\\"+(bg-0+1)}))}var a8=function(bh,bg){bh=Array.prototype.slice.call(bh,0);if(bg){bg.push.apply(bg,bh);
return bg}return bh};try{Array.prototype.slice.call(ab.documentElement.childNodes,0)[0].nodeType}catch(bf){a8=function(bk,bj){var bh=bj||[];if(bc.call(bk)==="[object Array]"){Array.prototype.push.apply(bh,bk)
}else{if(typeof bk.length==="number"){for(var bi=0,bg=bk.length;bi<bg;bi++){bh.push(bk[bi])}}else{for(var bi=0;bk[bi];bi++){bh.push(bk[bi])}}}return bh}}var bb;if(ab.documentElement.compareDocumentPosition){bb=function(bh,bg){if(!bh.compareDocumentPosition||!bg.compareDocumentPosition){if(bh==bg){a4=true
}return bh.compareDocumentPosition?-1:1}var bi=bh.compareDocumentPosition(bg)&4?-1:bh===bg?0:1;if(bi===0){a4=true}return bi}}else{if("sourceIndex" in ab.documentElement){bb=function(bh,bg){if(!bh.sourceIndex||!bg.sourceIndex){if(bh==bg){a4=true
}return bh.sourceIndex?-1:1}var bi=bh.sourceIndex-bg.sourceIndex;if(bi===0){a4=true}return bi}}else{if(ab.createRange){bb=function(bj,bh){if(!bj.ownerDocument||!bh.ownerDocument){if(bj==bh){a4=true}return bj.ownerDocument?-1:1
}var bi=bj.ownerDocument.createRange(),bg=bh.ownerDocument.createRange();bi.setStart(bj,0);bi.setEnd(bj,0);bg.setStart(bh,0);bg.setEnd(bh,0);var bk=bi.compareBoundaryPoints(Range.START_TO_END,bg);if(bk===0){a4=true
}return bk}}}}function aZ(bg){var bh="",bj;for(var bi=0;bg[bi];bi++){bj=bg[bi];if(bj.nodeType===3||bj.nodeType===4){bh+=bj.nodeValue}else{if(bj.nodeType!==8){bh+=aZ(bj.childNodes)}}}return bh}(function(){var bh=ab.createElement("div"),bi="script"+(new Date).getTime();
bh.innerHTML="<a name='"+bi+"'/>";var bg=ab.documentElement;bg.insertBefore(bh,bg.firstChild);if(ab.getElementById(bi)){a6.find.ID=function(bk,bl,bm){if(typeof bl.getElementById!=="undefined"&&!bm){var bj=bl.getElementById(bk[1]);
return bj?bj.id===bk[1]||typeof bj.getAttributeNode!=="undefined"&&bj.getAttributeNode("id").nodeValue===bk[1]?[bj]:C:[]}};a6.filter.ID=function(bl,bj){var bk=typeof bl.getAttributeNode!=="undefined"&&bl.getAttributeNode("id");
return bl.nodeType===1&&bk&&bk.nodeValue===bj}}bg.removeChild(bh);bg=bh=null})();(function(){var bg=ab.createElement("div");bg.appendChild(ab.createComment(""));if(bg.getElementsByTagName("*").length>0){a6.find.TAG=function(bh,bl){var bk=bl.getElementsByTagName(bh[1]);
if(bh[1]==="*"){var bj=[];for(var bi=0;bk[bi];bi++){if(bk[bi].nodeType===1){bj.push(bk[bi])}}bk=bj}return bk}}bg.innerHTML="<a href='#'></a>";if(bg.firstChild&&typeof bg.firstChild.getAttribute!=="undefined"&&bg.firstChild.getAttribute("href")!=="#"){a6.attrHandle.href=function(bh){return bh.getAttribute("href",2)
}}bg=null})();if(ab.querySelectorAll){(function(){var bg=a0,bi=ab.createElement("div");bi.innerHTML="<p class='TEST'></p>";if(bi.querySelectorAll&&bi.querySelectorAll(".TEST").length===0){return}a0=function(bm,bl,bj,bk){bl=bl||ab;
if(!bk&&bl.nodeType===9&&!a1(bl)){try{return a8(bl.querySelectorAll(bm),bj)}catch(bn){}}return bg(bm,bl,bj,bk)};for(var bh in bg){a0[bh]=bg[bh]}bi=null})()}(function(){var bg=ab.createElement("div");bg.innerHTML="<div class='test e'></div><div class='test'></div>";
if(!bg.getElementsByClassName||bg.getElementsByClassName("e").length===0){return}bg.lastChild.className="e";if(bg.getElementsByClassName("e").length===1){return}a6.order.splice(1,0,"CLASS");a6.find.CLASS=function(bh,bi,bj){if(typeof bi.getElementsByClassName!=="undefined"&&!bj){return bi.getElementsByClassName(bh[1])
}};bg=null})();function aY(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];break}if(bg.nodeType===1&&!bo){bg.sizcache=bl;
bg.sizset=bj}if(bg.nodeName.toLowerCase()===bm){bk=bg;break}bg=bg[bh]}bp[bj]=bk}}}function be(bh,bm,bl,bp,bn,bo){for(var bj=0,bi=bp.length;bj<bi;bj++){var bg=bp[bj];if(bg){bg=bg[bh];var bk=false;while(bg){if(bg.sizcache===bl){bk=bp[bg.sizset];
break}if(bg.nodeType===1){if(!bo){bg.sizcache=bl;bg.sizset=bj}if(typeof bm!=="string"){if(bg===bm){bk=true;break}}else{if(a0.filter(bm,[bg]).length>0){bk=bg;break}}}bg=bg[bh]}bp[bj]=bk}}}var a7=ab.compareDocumentPosition?function(bh,bg){return !!(bh.compareDocumentPosition(bg)&16)
}:function(bh,bg){return bh!==bg&&(bh.contains?bh.contains(bg):true)};var a1=function(bg){var bh=(bg?bg.ownerDocument||bg:0).documentElement;return bh?bh.nodeName!=="HTML":false};var bd=function(bg,bn){var bj=[],bk="",bl,bi=bn.nodeType?[bn]:bn;
while((bl=a6.match.PSEUDO.exec(bg))){bk+=bl[0];bg=bg.replace(a6.match.PSEUDO,"")}bg=a6.relative[bg]?bg+"*":bg;for(var bm=0,bh=bi.length;bm<bh;bm++){a0(bg,bi[bm],bj)}return a0.filter(bk,bj)};a.find=a0;a.expr=a0.selectors;
a.expr[":"]=a.expr.filters;a.unique=a0.uniqueSort;a.text=aZ;a.isXMLDoc=a1;a.contains=a7;return;aM.Sizzle=a0})();var N=/Until$/,Y=/^(?:parents|prevUntil|prevAll)/,aL=/,/,F=Array.prototype.slice;var ai=function(a1,a0,aY){if(a.isFunction(a0)){return a.grep(a1,function(a3,a2){return !!a0.call(a3,a2,a3)===aY
})}else{if(a0.nodeType){return a.grep(a1,function(a3,a2){return(a3===a0)===aY})}else{if(typeof a0==="string"){var aZ=a.grep(a1,function(a2){return a2.nodeType===1});if(aW.test(a0)){return a.filter(a0,aZ,!aY)
}else{a0=a.filter(a0,aZ)}}}}return a.grep(a1,function(a3,a2){return(a.inArray(a3,a0)>=0)===aY})};a.fn.extend({find:function(aY){var a0=this.pushStack("","find",aY),a3=0;for(var a1=0,aZ=this.length;a1<aZ;
a1++){a3=a0.length;a.find(aY,this[a1],a0);if(a1>0){for(var a4=a3;a4<a0.length;a4++){for(var a2=0;a2<a3;a2++){if(a0[a2]===a0[a4]){a0.splice(a4--,1);break}}}}}return a0},has:function(aZ){var aY=a(aZ);return this.filter(function(){for(var a1=0,a0=aY.length;
a1<a0;a1++){if(a.contains(this,aY[a1])){return true}}})},not:function(aY){return this.pushStack(ai(this,aY,false),"not",aY)},filter:function(aY){return this.pushStack(ai(this,aY,true),"filter",aY)},is:function(aY){return !!aY&&a.filter(aY,this).length>0
},closest:function(a7,aY){if(a.isArray(a7)){var a4=[],a6=this[0],a3,a2={},a0;if(a6&&a7.length){for(var a1=0,aZ=a7.length;a1<aZ;a1++){a0=a7[a1];if(!a2[a0]){a2[a0]=a.expr.match.POS.test(a0)?a(a0,aY||this.context):a0
}}while(a6&&a6.ownerDocument&&a6!==aY){for(a0 in a2){a3=a2[a0];if(a3.jquery?a3.index(a6)>-1:a(a6).is(a3)){a4.push({selector:a0,elem:a6});delete a2[a0]}}a6=a6.parentNode}}return a4}var a5=a.expr.match.POS.test(a7)?a(a7,aY||this.context):null;
return this.map(function(a8,a9){while(a9&&a9.ownerDocument&&a9!==aY){if(a5?a5.index(a9)>-1:a(a9).is(a7)){return a9}a9=a9.parentNode}return null})},index:function(aY){if(!aY||typeof aY==="string"){return a.inArray(this[0],aY?a(aY):this.parent().children())
}return a.inArray(aY.jquery?aY[0]:aY,this)},add:function(aY,aZ){var a1=typeof aY==="string"?a(aY,aZ||this.context):a.makeArray(aY),a0=a.merge(this.get(),a1);return this.pushStack(y(a1[0])||y(a0[0])?a0:a.unique(a0))
},andSelf:function(){return this.add(this.prevObject)}});function y(aY){return !aY||!aY.parentNode||aY.parentNode.nodeType===11}a.each({parent:function(aZ){var aY=aZ.parentNode;return aY&&aY.nodeType!==11?aY:null
},parents:function(aY){return a.dir(aY,"parentNode")},parentsUntil:function(aZ,aY,a0){return a.dir(aZ,"parentNode",a0)},next:function(aY){return a.nth(aY,2,"nextSibling")},prev:function(aY){return a.nth(aY,2,"previousSibling")
},nextAll:function(aY){return a.dir(aY,"nextSibling")},prevAll:function(aY){return a.dir(aY,"previousSibling")},nextUntil:function(aZ,aY,a0){return a.dir(aZ,"nextSibling",a0)},prevUntil:function(aZ,aY,a0){return a.dir(aZ,"previousSibling",a0)
},siblings:function(aY){return a.sibling(aY.parentNode.firstChild,aY)},children:function(aY){return a.sibling(aY.firstChild)},contents:function(aY){return a.nodeName(aY,"iframe")?aY.contentDocument||aY.contentWindow.document:a.makeArray(aY.childNodes)
}},function(aY,aZ){a.fn[aY]=function(a2,a0){var a1=a.map(this,aZ,a2);if(!N.test(aY)){a0=a2}if(a0&&typeof a0==="string"){a1=a.filter(a0,a1)}a1=this.length>1?a.unique(a1):a1;if((this.length>1||aL.test(a0))&&Y.test(aY)){a1=a1.reverse()
}return this.pushStack(a1,aY,F.call(arguments).join(","))}});a.extend({filter:function(a0,aY,aZ){if(aZ){a0=":not("+a0+")"}return a.find.matches(a0,aY)},dir:function(a0,aZ,a2){var aY=[],a1=a0[aZ];while(a1&&a1.nodeType!==9&&(a2===C||a1.nodeType!==1||!a(a1).is(a2))){if(a1.nodeType===1){aY.push(a1)
}a1=a1[aZ]}return aY},nth:function(a2,aY,a0,a1){aY=aY||1;var aZ=0;for(;a2;a2=a2[a0]){if(a2.nodeType===1&&++aZ===aY){break}}return a2},sibling:function(a0,aZ){var aY=[];for(;a0;a0=a0.nextSibling){if(a0.nodeType===1&&a0!==aZ){aY.push(a0)
}}return aY}});var T=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,H=/(<([\w:]+)[^>]*?)\/>/g,al=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,c=/<([\w:]+)/,t=/<tbody/i,L=/<|&#?\w+;/,E=/<script|<object|<embed|<option|<style/i,l=/checked\s*(?:[^=]|=\s*.checked.)/i,p=function(aZ,a0,aY){return al.test(aY)?aZ:a0+"></"+aY+">"
},ac={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};
ac.optgroup=ac.option;ac.tbody=ac.tfoot=ac.colgroup=ac.caption=ac.thead;ac.th=ac.td;if(!a.support.htmlSerialize){ac._default=[1,"div<div>","</div>"]}a.fn.extend({text:function(aY){if(a.isFunction(aY)){return this.each(function(a0){var aZ=a(this);
aZ.text(aY.call(this,a0,aZ.text()))})}if(typeof aY!=="object"&&aY!==C){return this.empty().append((this[0]&&this[0].ownerDocument||ab).createTextNode(aY))}return a.text(this)},wrapAll:function(aY){if(a.isFunction(aY)){return this.each(function(a0){a(this).wrapAll(aY.call(this,a0))
})}if(this[0]){var aZ=a(aY,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){aZ.insertBefore(this[0])}aZ.map(function(){var a0=this;while(a0.firstChild&&a0.firstChild.nodeType===1){a0=a0.firstChild
}return a0}).append(this)}return this},wrapInner:function(aY){if(a.isFunction(aY)){return this.each(function(aZ){a(this).wrapInner(aY.call(this,aZ))})}return this.each(function(){var aZ=a(this),a0=aZ.contents();
if(a0.length){a0.wrapAll(aY)}else{aZ.append(aY)}})},wrap:function(aY){return this.each(function(){a(this).wrapAll(aY)})},unwrap:function(){return this.parent().each(function(){if(!a.nodeName(this,"body")){a(this).replaceWith(this.childNodes)
}}).end()},append:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.appendChild(aY)}})},prepend:function(){return this.domManip(arguments,true,function(aY){if(this.nodeType===1){this.insertBefore(aY,this.firstChild)
}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this)})}else{if(arguments.length){var aY=a(arguments[0]);aY.push.apply(aY,this.toArray());
return this.pushStack(aY,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(aZ){this.parentNode.insertBefore(aZ,this.nextSibling)})}else{if(arguments.length){var aY=this.pushStack(this,"after",arguments);
aY.push.apply(aY,a(arguments[0]).toArray());return aY}}},remove:function(aY,a1){for(var aZ=0,a0;(a0=this[aZ])!=null;aZ++){if(!aY||a.filter(aY,[a0]).length){if(!a1&&a0.nodeType===1){a.cleanData(a0.getElementsByTagName("*"));
a.cleanData([a0])}if(a0.parentNode){a0.parentNode.removeChild(a0)}}}return this},empty:function(){for(var aY=0,aZ;(aZ=this[aY])!=null;aY++){if(aZ.nodeType===1){a.cleanData(aZ.getElementsByTagName("*"))
}while(aZ.firstChild){aZ.removeChild(aZ.firstChild)}}return this},clone:function(aZ){var aY=this.map(function(){if(!a.support.noCloneEvent&&!a.isXMLDoc(this)){var a1=this.outerHTML,a0=this.ownerDocument;
if(!a1){var a2=a0.createElement("div");a2.appendChild(this.cloneNode(true));a1=a2.innerHTML}return a.clean([a1.replace(T,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(Z,"")],a0)[0]}else{return this.cloneNode(true)
}});if(aZ===true){q(this,aY);q(this.find("*"),aY.find("*"))}return aY},html:function(a0){if(a0===C){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(T,""):null}else{if(typeof a0==="string"&&!E.test(a0)&&(a.support.leadingWhitespace||!Z.test(a0))&&!ac[(c.exec(a0)||["",""])[1].toLowerCase()]){a0=a0.replace(H,p);
try{for(var aZ=0,aY=this.length;aZ<aY;aZ++){if(this[aZ].nodeType===1){a.cleanData(this[aZ].getElementsByTagName("*"));this[aZ].innerHTML=a0}}}catch(a1){this.empty().append(a0)}}else{if(a.isFunction(a0)){this.each(function(a4){var a3=a(this),a2=a3.html();
a3.empty().append(function(){return a0.call(this,a4,a2)})})}else{this.empty().append(a0)}}}return this},replaceWith:function(aY){if(this[0]&&this[0].parentNode){if(a.isFunction(aY)){return this.each(function(a1){var a0=a(this),aZ=a0.html();
a0.replaceWith(aY.call(this,a1,aZ))})}if(typeof aY!=="string"){aY=a(aY).detach()}return this.each(function(){var a0=this.nextSibling,aZ=this.parentNode;a(this).remove();if(a0){a(a0).before(aY)}else{a(aZ).append(aY)
}})}else{return this.pushStack(a(a.isFunction(aY)?aY():aY),"replaceWith",aY)}},detach:function(aY){return this.remove(aY,true)},domManip:function(a4,a9,a8){var a1,a2,a7=a4[0],aZ=[],a3,a6;if(!a.support.checkClone&&arguments.length===3&&typeof a7==="string"&&l.test(a7)){return this.each(function(){a(this).domManip(a4,a9,a8,true)
})}if(a.isFunction(a7)){return this.each(function(bb){var ba=a(this);a4[0]=a7.call(this,bb,a9?ba.html():C);ba.domManip(a4,a9,a8)})}if(this[0]){a6=a7&&a7.parentNode;if(a.support.parentNode&&a6&&a6.nodeType===11&&a6.childNodes.length===this.length){a1={fragment:a6}
}else{a1=J(a4,this,aZ)}a3=a1.fragment;if(a3.childNodes.length===1){a2=a3=a3.firstChild}else{a2=a3.firstChild}if(a2){a9=a9&&a.nodeName(a2,"tr");for(var a0=0,aY=this.length;a0<aY;a0++){a8.call(a9?a5(this[a0],a2):this[a0],a0>0||a1.cacheable||this.length>1?a3.cloneNode(true):a3)
}}if(aZ.length){a.each(aZ,aV)}}return this;function a5(ba,bb){return a.nodeName(ba,"table")?(ba.getElementsByTagName("tbody")[0]||ba.appendChild(ba.ownerDocument.createElement("tbody"))):ba}}});function q(a0,aY){var aZ=0;
aY.each(function(){if(this.nodeName!==(a0[aZ]&&a0[aZ].nodeName)){return}var a5=a.data(a0[aZ++]),a4=a.data(this,a5),a1=a5&&a5.events;if(a1){delete a4.handle;a4.events={};for(var a3 in a1){for(var a2 in a1[a3]){a.event.add(this,a3,a1[a3][a2],a1[a3][a2].data)
}}}})}function J(a3,a1,aZ){var a2,aY,a0,a4=(a1&&a1[0]?a1[0].ownerDocument||a1[0]:ab);if(a3.length===1&&typeof a3[0]==="string"&&a3[0].length<512&&a4===ab&&!E.test(a3[0])&&(a.support.checkClone||!l.test(a3[0]))){aY=true;
a0=a.fragments[a3[0]];if(a0){if(a0!==1){a2=a0}}}if(!a2){a2=a4.createDocumentFragment();a.clean(a3,a4,a2,aZ)}if(aY){a.fragments[a3[0]]=a0?a2:1}return{fragment:a2,cacheable:aY}}a.fragments={};a.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(aY,aZ){a.fn[aY]=function(a0){var a3=[],a6=a(a0),a5=this.length===1&&this[0].parentNode;
if(a5&&a5.nodeType===11&&a5.childNodes.length===1&&a6.length===1){a6[aZ](this[0]);return this}else{for(var a4=0,a1=a6.length;a4<a1;a4++){var a2=(a4>0?this.clone(true):this).get();a.fn[aZ].apply(a(a6[a4]),a2);
a3=a3.concat(a2)}return this.pushStack(a3,aY,a6.selector)}}});a.extend({clean:function(a0,a2,a9,a4){a2=a2||ab;if(typeof a2.createElement==="undefined"){a2=a2.ownerDocument||a2[0]&&a2[0].ownerDocument||ab
}var ba=[];for(var a8=0,a3;(a3=a0[a8])!=null;a8++){if(typeof a3==="number"){a3+=""}if(!a3){continue}if(typeof a3==="string"&&!L.test(a3)){a3=a2.createTextNode(a3)}else{if(typeof a3==="string"){a3=a3.replace(H,p);
var bb=(c.exec(a3)||["",""])[1].toLowerCase(),a1=ac[bb]||ac._default,a7=a1[0],aZ=a2.createElement("div");aZ.innerHTML=a1[1]+a3+a1[2];while(a7--){aZ=aZ.lastChild}if(!a.support.tbody){var aY=t.test(a3),a6=bb==="table"&&!aY?aZ.firstChild&&aZ.firstChild.childNodes:a1[1]==="<table>"&&!aY?aZ.childNodes:[];
for(var a5=a6.length-1;a5>=0;--a5){if(a.nodeName(a6[a5],"tbody")&&!a6[a5].childNodes.length){a6[a5].parentNode.removeChild(a6[a5])}}}if(!a.support.leadingWhitespace&&Z.test(a3)){aZ.insertBefore(a2.createTextNode(Z.exec(a3)[0]),aZ.firstChild)
}a3=aZ.childNodes}}if(a3.nodeType){ba.push(a3)}else{ba=a.merge(ba,a3)}}if(a9){for(var a8=0;ba[a8];a8++){if(a4&&a.nodeName(ba[a8],"script")&&(!ba[a8].type||ba[a8].type.toLowerCase()==="text/javascript")){a4.push(ba[a8].parentNode?ba[a8].parentNode.removeChild(ba[a8]):ba[a8])
}else{if(ba[a8].nodeType===1){ba.splice.apply(ba,[a8+1,0].concat(a.makeArray(ba[a8].getElementsByTagName("script"))))}a9.appendChild(ba[a8])}}}return ba},cleanData:function(aZ){var a2,a0,aY=a.cache,a5=a.event.special,a4=a.support.deleteExpando;
for(var a3=0,a1;(a1=aZ[a3])!=null;a3++){a0=a1[a.expando];if(a0){a2=aY[a0];if(a2.events){for(var a6 in a2.events){if(a5[a6]){a.event.remove(a1,a6)}else{ag(a1,a6,a2.handle)}}}if(a4){delete a1[a.expando]}else{if(a1.removeAttribute){a1.removeAttribute(a.expando)
}}delete aY[a0]}}}});var ar=/z-?index|font-?weight|opacity|zoom|line-?height/i,U=/alpha\([^)]*\)/,aa=/opacity=([^)]*)/,ah=/float/i,az=/-([a-z])/ig,v=/([A-Z])/g,aO=/^-?\d+(?:px)?$/i,aU=/^-?\d/,aK={position:"absolute",visibility:"hidden",display:"block"},W=["Left","Right"],aE=["Top","Bottom"],ak=ab.defaultView&&ab.defaultView.getComputedStyle,aN=a.support.cssFloat?"cssFloat":"styleFloat",k=function(aY,aZ){return aZ.toUpperCase()
};a.fn.css=function(aY,aZ){return an(this,aY,aZ,true,function(a1,a0,a2){if(a2===C){return a.curCSS(a1,a0)}if(typeof a2==="number"&&!ar.test(a0)){a2+="px"}a.style(a1,a0,a2)})};a.extend({style:function(a2,aZ,a3){if(!a2||a2.nodeType===3||a2.nodeType===8){return C
}if((aZ==="width"||aZ==="height")&&parseFloat(a3)<0){a3=C}var a1=a2.style||a2,a4=a3!==C;if(!a.support.opacity&&aZ==="opacity"){if(a4){a1.zoom=1;var aY=parseInt(a3,10)+""==="NaN"?"":"alpha(opacity="+a3*100+")";
var a0=a1.filter||a.curCSS(a2,"filter")||"";a1.filter=U.test(a0)?a0.replace(U,aY):aY}return a1.filter&&a1.filter.indexOf("opacity=")>=0?(parseFloat(aa.exec(a1.filter)[1])/100)+"":""}if(ah.test(aZ)){aZ=aN
}aZ=aZ.replace(az,k);if(a4){a1[aZ]=a3}return a1[aZ]},css:function(a1,aZ,a3,aY){if(aZ==="width"||aZ==="height"){var a5,a0=aK,a4=aZ==="width"?W:aE;function a2(){a5=aZ==="width"?a1.offsetWidth:a1.offsetHeight;
if(aY==="border"){return}a.each(a4,function(){if(!aY){a5-=parseFloat(a.curCSS(a1,"padding"+this,true))||0}if(aY==="margin"){a5+=parseFloat(a.curCSS(a1,"margin"+this,true))||0}else{a5-=parseFloat(a.curCSS(a1,"border"+this+"Width",true))||0
}})}if(a1.offsetWidth!==0){a2()}else{a.swap(a1,a0,a2)}return Math.max(0,Math.round(a5))}return a.curCSS(a1,aZ,a3)},curCSS:function(a4,aZ,a0){var a7,aY=a4.style,a1;if(!a.support.opacity&&aZ==="opacity"&&a4.currentStyle){a7=aa.test(a4.currentStyle.filter||"")?(parseFloat(RegExp.$1)/100)+"":"";
return a7===""?"1":a7}if(ah.test(aZ)){aZ=aN}if(!a0&&aY&&aY[aZ]){a7=aY[aZ]}else{if(ak){if(ah.test(aZ)){aZ="float"}aZ=aZ.replace(v,"-$1").toLowerCase();var a6=a4.ownerDocument.defaultView;if(!a6){return null
}var a8=a6.getComputedStyle(a4,null);if(a8){a7=a8.getPropertyValue(aZ)}if(aZ==="opacity"&&a7===""){a7="1"}}else{if(a4.currentStyle){var a3=aZ.replace(az,k);a7=a4.currentStyle[aZ]||a4.currentStyle[a3];if(!aO.test(a7)&&aU.test(a7)){var a2=aY.left,a5=a4.runtimeStyle.left;
a4.runtimeStyle.left=a4.currentStyle.left;aY.left=a3==="fontSize"?"1em":(a7||0);a7=aY.pixelLeft+"px";aY.left=a2;a4.runtimeStyle.left=a5}}}}return a7},swap:function(a1,a0,a2){var aY={};for(var aZ in a0){aY[aZ]=a1.style[aZ];
a1.style[aZ]=a0[aZ]}a2.call(a1);for(var aZ in a0){a1.style[aZ]=aY[aZ]}}});if(a.expr&&a.expr.filters){a.expr.filters.hidden=function(a1){var aZ=a1.offsetWidth,aY=a1.offsetHeight,a0=a1.nodeName.toLowerCase()==="tr";
return aZ===0&&aY===0&&!a0?true:aZ>0&&aY>0&&!a0?false:a.curCSS(a1,"display")==="none"};a.expr.filters.visible=function(aY){return !a.expr.filters.hidden(aY)}}var af=aP(),aJ=/<script(.|\s)*?\/script>/gi,o=/select|textarea/i,aB=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,r=/=\?(&|$)/,D=/\?/,aX=/(\?|&)_=.*?(&|$)/,B=/^(\w+:)?\/\/([^\/?#]+)/,h=/%20/g,w=a.fn.load;
a.fn.extend({load:function(a0,a3,a4){if(typeof a0!=="string"){return w.call(this,a0)}else{if(!this.length){return this}}var a2=a0.indexOf(" ");if(a2>=0){var aY=a0.slice(a2,a0.length);a0=a0.slice(0,a2)}var a1="GET";
if(a3){if(a.isFunction(a3)){a4=a3;a3=null}else{if(typeof a3==="object"){a3=a.param(a3,a.ajaxSettings.traditional);a1="POST"}}}var aZ=this;a.ajax({url:a0,type:a1,dataType:"html",data:a3,complete:function(a6,a5){if(a5==="success"||a5==="notmodified"){aZ.html(aY?a("<div />").append(a6.responseText.replace(aJ,"")).find(aY):a6.responseText)
}if(a4){aZ.each(a4,[a6.responseText,a5,a6])}}});return this},serialize:function(){return a.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?a.makeArray(this.elements):this
}).filter(function(){return this.name&&!this.disabled&&(this.checked||o.test(this.nodeName)||aB.test(this.type))}).map(function(aY,aZ){var a0=a(this).val();return a0==null?null:a.isArray(a0)?a.map(a0,function(a2,a1){return{name:aZ.name,value:a2}
}):{name:aZ.name,value:a0}}).get()}});a.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(aY,aZ){a.fn[aZ]=function(a0){return this.bind(aZ,a0)}});a.extend({get:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;
a1=a0;a0=null}return a.ajax({type:"GET",url:aY,data:a0,success:a1,dataType:aZ})},getScript:function(aY,aZ){return a.get(aY,null,aZ,"script")},getJSON:function(aY,aZ,a0){return a.get(aY,aZ,a0,"json")},post:function(aY,a0,a1,aZ){if(a.isFunction(a0)){aZ=aZ||a1;
a1=a0;a0={}}return a.ajax({type:"POST",url:aY,data:a0,success:a1,dataType:aZ})},ajaxSetup:function(aY){a.extend(a.ajaxSettings,aY)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:aM.XMLHttpRequest&&(aM.location.protocol!=="file:"||!aM.ActiveXObject)?function(){return new aM.XMLHttpRequest()
}:function(){try{return new aM.ActiveXObject("Microsoft.XMLHTTP")}catch(aY){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(bd){var a8=a.extend(true,{},a.ajaxSettings,bd);
var bi,bc,bh,bj=bd&&bd.context||a8,a0=a8.type.toUpperCase();if(a8.data&&a8.processData&&typeof a8.data!=="string"){a8.data=a.param(a8.data,a8.traditional)}if(a8.dataType==="jsonp"){if(a0==="GET"){if(!r.test(a8.url)){a8.url+=(D.test(a8.url)?"&":"?")+(a8.jsonp||"callback")+"=?"
}}else{if(!a8.data||!r.test(a8.data)){a8.data=(a8.data?a8.data+"&":"")+(a8.jsonp||"callback")+"=?"}}a8.dataType="json"}if(a8.dataType==="json"&&(a8.data&&r.test(a8.data)||r.test(a8.url))){bi=a8.jsonpCallback||("jsonp"+af++);
if(a8.data){a8.data=(a8.data+"").replace(r,"="+bi+"$1")}a8.url=a8.url.replace(r,"="+bi+"$1");a8.dataType="script";aM[bi]=aM[bi]||function(bk){bh=bk;a3();a6();aM[bi]=C;try{delete aM[bi]}catch(bl){}if(a1){a1.removeChild(bf)
}}}if(a8.dataType==="script"&&a8.cache===null){a8.cache=false}if(a8.cache===false&&a0==="GET"){var aY=aP();var bg=a8.url.replace(aX,"$1_="+aY+"$2");a8.url=bg+((bg===a8.url)?(D.test(a8.url)?"&":"?")+"_="+aY:"")
}if(a8.data&&a0==="GET"){a8.url+=(D.test(a8.url)?"&":"?")+a8.data}if(a8.global&&!a.active++){a.event.trigger("ajaxStart")}var bb=B.exec(a8.url),a2=bb&&(bb[1]&&bb[1]!==location.protocol||bb[2]!==location.host);
if(a8.dataType==="script"&&a0==="GET"&&a2){var a1=ab.getElementsByTagName("head")[0]||ab.documentElement;var bf=ab.createElement("script");bf.src=a8.url;if(a8.scriptCharset){bf.charset=a8.scriptCharset
}if(!bi){var ba=false;bf.onload=bf.onreadystatechange=function(){if(!ba&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){ba=true;a3();a6();bf.onload=bf.onreadystatechange=null;
if(a1&&bf.parentNode){a1.removeChild(bf)}}}}a1.insertBefore(bf,a1.firstChild);return C}var a5=false;var a4=a8.xhr();if(!a4){return}if(a8.username){a4.open(a0,a8.url,a8.async,a8.username,a8.password)}else{a4.open(a0,a8.url,a8.async)
}try{if(a8.data||bd&&bd.contentType){a4.setRequestHeader("Content-Type",a8.contentType)}if(a8.ifModified){if(a.lastModified[a8.url]){a4.setRequestHeader("If-Modified-Since",a.lastModified[a8.url])}if(a.etag[a8.url]){a4.setRequestHeader("If-None-Match",a.etag[a8.url])
}}if(!a2){a4.setRequestHeader("X-Requested-With","XMLHttpRequest")}a4.setRequestHeader("Accept",a8.dataType&&a8.accepts[a8.dataType]?a8.accepts[a8.dataType]+", */*":a8.accepts._default)}catch(be){}if(a8.beforeSend&&a8.beforeSend.call(bj,a4,a8)===false){if(a8.global&&!--a.active){a.event.trigger("ajaxStop")
}a4.abort();return false}if(a8.global){a9("ajaxSend",[a4,a8])}var a7=a4.onreadystatechange=function(bk){if(!a4||a4.readyState===0||bk==="abort"){if(!a5){a6()}a5=true;if(a4){a4.onreadystatechange=a.noop
}}else{if(!a5&&a4&&(a4.readyState===4||bk==="timeout")){a5=true;a4.onreadystatechange=a.noop;bc=bk==="timeout"?"timeout":!a.httpSuccess(a4)?"error":a8.ifModified&&a.httpNotModified(a4,a8.url)?"notmodified":"success";
var bm;if(bc==="success"){try{bh=a.httpData(a4,a8.dataType,a8)}catch(bl){bc="parsererror";bm=bl}}if(bc==="success"||bc==="notmodified"){if(!bi){a3()}}else{a.handleError(a8,a4,bc,bm)}a6();if(bk==="timeout"){a4.abort()
}if(a8.async){a4=null}}}};try{var aZ=a4.abort;a4.abort=function(){if(a4){aZ.call(a4)}a7("abort")}}catch(be){}if(a8.async&&a8.timeout>0){setTimeout(function(){if(a4&&!a5){a7("timeout")}},a8.timeout)}try{a4.send(a0==="POST"||a0==="PUT"||a0==="DELETE"?a8.data:null)
}catch(be){a.handleError(a8,a4,null,be);a6()}if(!a8.async){a7()}function a3(){if(a8.success){a8.success.call(bj,bh,bc,a4)}if(a8.global){a9("ajaxSuccess",[a4,a8])}}function a6(){if(a8.complete){a8.complete.call(bj,a4,bc)
}if(a8.global){a9("ajaxComplete",[a4,a8])}if(a8.global&&!--a.active){a.event.trigger("ajaxStop")}}function a9(bl,bk){(a8.context?a(a8.context):a.event).trigger(bl,bk)}return a4},handleError:function(aZ,a1,aY,a0){if(aZ.error){aZ.error.call(aZ.context||aZ,a1,aY,a0)
}if(aZ.global){(aZ.context?a(aZ.context):a.event).trigger("ajaxError",[a1,aZ,a0])}},active:0,httpSuccess:function(aZ){try{return !aZ.status&&location.protocol==="file:"||(aZ.status>=200&&aZ.status<300)||aZ.status===304||aZ.status===1223||aZ.status===0
}catch(aY){}return false},httpNotModified:function(a1,aY){var a0=a1.getResponseHeader("Last-Modified"),aZ=a1.getResponseHeader("Etag");if(a0){a.lastModified[aY]=a0}if(aZ){a.etag[aY]=aZ}return a1.status===304||a1.status===0
},httpData:function(a3,a1,a0){var aZ=a3.getResponseHeader("content-type")||"",aY=a1==="xml"||!a1&&aZ.indexOf("xml")>=0,a2=aY?a3.responseXML:a3.responseText;if(aY&&a2.documentElement.nodeName==="parsererror"){a.error("parsererror")
}if(a0&&a0.dataFilter){a2=a0.dataFilter(a2,a1)}if(typeof a2==="string"){if(a1==="json"||!a1&&aZ.indexOf("json")>=0){a2=a.parseJSON(a2)}else{if(a1==="script"||!a1&&aZ.indexOf("javascript")>=0){a.globalEval(a2)
}}}return a2},param:function(aY,a1){var aZ=[];if(a1===C){a1=a.ajaxSettings.traditional}if(a.isArray(aY)||aY.jquery){a.each(aY,function(){a3(this.name,this.value)})}else{for(var a2 in aY){a0(a2,aY[a2])}}return aZ.join("&").replace(h,"+");
function a0(a4,a5){if(a.isArray(a5)){a.each(a5,function(a7,a6){if(a1||/\[\]$/.test(a4)){a3(a4,a6)}else{a0(a4+"["+(typeof a6==="object"||a.isArray(a6)?a7:"")+"]",a6)}})}else{if(!a1&&a5!=null&&typeof a5==="object"){a.each(a5,function(a7,a6){a0(a4+"["+a7+"]",a6)
})}else{a3(a4,a5)}}}function a3(a4,a5){a5=a.isFunction(a5)?a5():a5;aZ[aZ.length]=encodeURIComponent(a4)+"="+encodeURIComponent(a5)}}});var G={},ae=/toggle|show|hide/,au=/^([+-]=)?([\d+-.]+)(.*)$/,aF,aj=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];
a.fn.extend({show:function(aZ,a7){if(aZ||aZ===0){return this.animate(aD("show",3),aZ,a7)}else{for(var a4=0,a1=this.length;a4<a1;a4++){var aY=a.data(this[a4],"olddisplay");this[a4].style.display=aY||"";
if(a.css(this[a4],"display")==="none"){var a6=this[a4].nodeName,a5;if(G[a6]){a5=G[a6]}else{var a0=a("<"+a6+" />").appendTo("body");a5=a0.css("display");if(a5==="none"){a5="block"}a0.remove();G[a6]=a5}a.data(this[a4],"olddisplay",a5)
}}for(var a3=0,a2=this.length;a3<a2;a3++){this[a3].style.display=a.data(this[a3],"olddisplay")||""}return this}},hide:function(a3,a4){if(a3||a3===0){return this.animate(aD("hide",3),a3,a4)}else{for(var a2=0,aZ=this.length;
a2<aZ;a2++){var aY=a.data(this[a2],"olddisplay");if(!aY&&aY!=="none"){a.data(this[a2],"olddisplay",a.css(this[a2],"display"))}}for(var a1=0,a0=this.length;a1<a0;a1++){this[a1].style.display="none"}return this
}},_toggle:a.fn.toggle,toggle:function(a0,aZ){var aY=typeof a0==="boolean";if(a.isFunction(a0)&&a.isFunction(aZ)){this._toggle.apply(this,arguments)}else{if(a0==null||aY){this.each(function(){var a1=aY?a0:a(this).is(":hidden");
a(this)[a1?"show":"hide"]()})}else{this.animate(aD("toggle",3),a0,aZ)}}return this},fadeTo:function(aY,a0,aZ){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:a0},aY,aZ)},animate:function(a2,aZ,a1,a0){var aY=a.speed(aZ,a1,a0);
if(a.isEmptyObject(a2)){return this.each(aY.complete)}return this[aY.queue===false?"each":"queue"](function(){var a5=a.extend({},aY),a7,a6=this.nodeType===1&&a(this).is(":hidden"),a3=this;for(a7 in a2){var a4=a7.replace(az,k);
if(a7!==a4){a2[a4]=a2[a7];delete a2[a7];a7=a4}if(a2[a7]==="hide"&&a6||a2[a7]==="show"&&!a6){return a5.complete.call(this)}if((a7==="height"||a7==="width")&&this.style){a5.display=a.css(this,"display");
a5.overflow=this.style.overflow}if(a.isArray(a2[a7])){(a5.specialEasing=a5.specialEasing||{})[a7]=a2[a7][1];a2[a7]=a2[a7][0]}}if(a5.overflow!=null){this.style.overflow="hidden"}a5.curAnim=a.extend({},a2);
a.each(a2,function(a9,bd){var bc=new a.fx(a3,a5,a9);if(ae.test(bd)){bc[bd==="toggle"?a6?"show":"hide":bd](a2)}else{var bb=au.exec(bd),be=bc.cur(true)||0;if(bb){var a8=parseFloat(bb[2]),ba=bb[3]||"px";if(ba!=="px"){a3.style[a9]=(a8||1)+ba;
be=((a8||1)/bc.cur(true))*be;a3.style[a9]=be+ba}if(bb[1]){a8=((bb[1]==="-="?-1:1)*a8)+be}bc.custom(be,a8,ba)}else{bc.custom(be,bd,"")}}});return true})},stop:function(aZ,aY){var a0=a.timers;if(aZ){this.queue([])
}this.each(function(){for(var a1=a0.length-1;a1>=0;a1--){if(a0[a1].elem===this){if(aY){a0[a1](true)}a0.splice(a1,1)}}});if(!aY){this.dequeue()}return this}});a.each({slideDown:aD("show",1),slideUp:aD("hide",1),slideToggle:aD("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(aY,aZ){a.fn[aY]=function(a0,a1){return this.animate(aZ,a0,a1)
}});a.extend({speed:function(a0,a1,aZ){var aY=a0&&typeof a0==="object"?a0:{complete:aZ||!aZ&&a1||a.isFunction(a0)&&a0,duration:a0,easing:aZ&&a1||a1&&!a.isFunction(a1)&&a1};aY.duration=a.fx.off?0:typeof aY.duration==="number"?aY.duration:a.fx.speeds[aY.duration]||a.fx.speeds._default;
aY.old=aY.complete;aY.complete=function(){if(aY.queue!==false){a(this).dequeue()}if(a.isFunction(aY.old)){aY.old.call(this)}};return aY},easing:{linear:function(a0,a1,aY,aZ){return aY+aZ*a0},swing:function(a0,a1,aY,aZ){return((-Math.cos(a0*Math.PI)/2)+0.5)*aZ+aY
}},timers:[],fx:function(aZ,aY,a0){this.options=aY;this.elem=aZ;this.prop=a0;if(!aY.orig){aY.orig={}}}});a.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)
}(a.fx.step[this.prop]||a.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(aZ){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]
}var aY=parseFloat(a.css(this.elem,this.prop,aZ));return aY&&aY>-10000?aY:parseFloat(a.curCSS(this.elem,this.prop))||0},custom:function(a2,a1,a0){this.startTime=aP();this.start=a2;this.end=a1;this.unit=a0||this.unit||"px";
this.now=this.start;this.pos=this.state=0;var aY=this;function aZ(a3){return aY.step(a3)}aZ.elem=this.elem;if(aZ()&&a.timers.push(aZ)&&!aF){aF=setInterval(a.fx.tick,13)}},show:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);
this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());a(this.elem).show()},hide:function(){this.options.orig[this.prop]=a.style(this.elem,this.prop);this.options.hide=true;
this.custom(this.cur(),0)},step:function(a1){var a6=aP(),a2=true;if(a1||a6>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;
for(var a3 in this.options.curAnim){if(this.options.curAnim[a3]!==true){a2=false}}if(a2){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;var a0=a.data(this.elem,"olddisplay");
this.elem.style.display=a0?a0:this.options.display;if(a.css(this.elem,"display")==="none"){this.elem.style.display="block"}}if(this.options.hide){a(this.elem).hide()}if(this.options.hide||this.options.show){for(var aY in this.options.curAnim){a.style(this.elem,aY,this.options.orig[aY])
}}this.options.complete.call(this.elem)}return false}else{var aZ=a6-this.startTime;this.state=aZ/this.options.duration;var a4=this.options.specialEasing&&this.options.specialEasing[this.prop];var a5=this.options.easing||(a.easing.swing?"swing":"linear");
this.pos=a.easing[a4||a5](this.state,aZ,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};a.extend(a.fx,{tick:function(){var aZ=a.timers;for(var aY=0;
aY<aZ.length;aY++){if(!aZ[aY]()){aZ.splice(aY--,1)}}if(!aZ.length){a.fx.stop()}},stop:function(){clearInterval(aF);aF=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(aY){a.style(aY.elem,"opacity",aY.now)
},_default:function(aY){if(aY.elem.style&&aY.elem.style[aY.prop]!=null){aY.elem.style[aY.prop]=(aY.prop==="width"||aY.prop==="height"?Math.max(0,aY.now):aY.now)+aY.unit}else{aY.elem[aY.prop]=aY.now}}}});
if(a.expr&&a.expr.filters){a.expr.filters.animated=function(aY){return a.grep(a.timers,function(aZ){return aY===aZ.elem}).length}}function aD(aZ,aY){var a0={};a.each(aj.concat.apply([],aj.slice(0,aY)),function(){a0[this]=aZ
});return a0}if("getBoundingClientRect" in ab.documentElement){a.fn.offset=function(a7){var a0=this[0];if(a7){return this.each(function(a8){a.offset.setOffset(this,a7,a8)})}if(!a0||!a0.ownerDocument){return null
}if(a0===a0.ownerDocument.body){return a.offset.bodyOffset(a0)}var a2=a0.getBoundingClientRect(),a6=a0.ownerDocument,a3=a6.body,aY=a6.documentElement,a1=aY.clientTop||a3.clientTop||0,a4=aY.clientLeft||a3.clientLeft||0,a5=a2.top+(self.pageYOffset||a.support.boxModel&&aY.scrollTop||a3.scrollTop)-a1,aZ=a2.left+(self.pageXOffset||a.support.boxModel&&aY.scrollLeft||a3.scrollLeft)-a4;
return{top:a5,left:aZ}}}else{a.fn.offset=function(a9){var a3=this[0];if(a9){return this.each(function(ba){a.offset.setOffset(this,a9,ba)})}if(!a3||!a3.ownerDocument){return null}if(a3===a3.ownerDocument.body){return a.offset.bodyOffset(a3)
}a.offset.initialize();var a0=a3.offsetParent,aZ=a3,a8=a3.ownerDocument,a6,a1=a8.documentElement,a4=a8.body,a5=a8.defaultView,aY=a5?a5.getComputedStyle(a3,null):a3.currentStyle,a7=a3.offsetTop,a2=a3.offsetLeft;
while((a3=a3.parentNode)&&a3!==a4&&a3!==a1){if(a.offset.supportsFixedPosition&&aY.position==="fixed"){break}a6=a5?a5.getComputedStyle(a3,null):a3.currentStyle;a7-=a3.scrollTop;a2-=a3.scrollLeft;if(a3===a0){a7+=a3.offsetTop;
a2+=a3.offsetLeft;if(a.offset.doesNotAddBorder&&!(a.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(a3.nodeName))){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0
}aZ=a0,a0=a3.offsetParent}if(a.offset.subtractsBorderForOverflowNotVisible&&a6.overflow!=="visible"){a7+=parseFloat(a6.borderTopWidth)||0;a2+=parseFloat(a6.borderLeftWidth)||0}aY=a6}if(aY.position==="relative"||aY.position==="static"){a7+=a4.offsetTop;
a2+=a4.offsetLeft}if(a.offset.supportsFixedPosition&&aY.position==="fixed"){a7+=Math.max(a1.scrollTop,a4.scrollTop);a2+=Math.max(a1.scrollLeft,a4.scrollLeft)}return{top:a7,left:a2}}}a.offset={initialize:function(){var aY=ab.body,aZ=ab.createElement("div"),a2,a4,a3,a5,a0=parseFloat(a.curCSS(aY,"marginTop",true))||0,a1="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";
a.extend(aZ.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});aZ.innerHTML=a1;aY.insertBefore(aZ,aY.firstChild);a2=aZ.firstChild;a4=a2.firstChild;
a5=a2.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(a4.offsetTop!==5);this.doesAddBorderForTableAndCells=(a5.offsetTop===5);a4.style.position="fixed",a4.style.top="20px";this.supportsFixedPosition=(a4.offsetTop===20||a4.offsetTop===15);
a4.style.position=a4.style.top="";a2.style.overflow="hidden",a2.style.position="relative";this.subtractsBorderForOverflowNotVisible=(a4.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(aY.offsetTop!==a0);
aY.removeChild(aZ);aY=aZ=a2=a4=a3=a5=null;a.offset.initialize=a.noop},bodyOffset:function(aY){var a0=aY.offsetTop,aZ=aY.offsetLeft;a.offset.initialize();if(a.offset.doesNotIncludeMarginInBodyOffset){a0+=parseFloat(a.curCSS(aY,"marginTop",true))||0;
aZ+=parseFloat(a.curCSS(aY,"marginLeft",true))||0}return{top:a0,left:aZ}},setOffset:function(a3,aZ,a0){if(/static/.test(a.curCSS(a3,"position"))){a3.style.position="relative"}var a2=a(a3),a5=a2.offset(),aY=parseInt(a.curCSS(a3,"top",true),10)||0,a4=parseInt(a.curCSS(a3,"left",true),10)||0;
if(a.isFunction(aZ)){aZ=aZ.call(a3,a0,a5)}var a1={top:(aZ.top-a5.top)+aY,left:(aZ.left-a5.left)+a4};if("using" in aZ){aZ.using.call(a3,a1)}else{a2.css(a1)}}};a.fn.extend({position:function(){if(!this[0]){return null
}var a0=this[0],aZ=this.offsetParent(),a1=this.offset(),aY=/^body|html$/i.test(aZ[0].nodeName)?{top:0,left:0}:aZ.offset();a1.top-=parseFloat(a.curCSS(a0,"marginTop",true))||0;a1.left-=parseFloat(a.curCSS(a0,"marginLeft",true))||0;
aY.top+=parseFloat(a.curCSS(aZ[0],"borderTopWidth",true))||0;aY.left+=parseFloat(a.curCSS(aZ[0],"borderLeftWidth",true))||0;return{top:a1.top-aY.top,left:a1.left-aY.left}},offsetParent:function(){return this.map(function(){var aY=this.offsetParent||ab.body;
while(aY&&(!/^body|html$/i.test(aY.nodeName)&&a.css(aY,"position")==="static")){aY=aY.offsetParent}return aY})}});a.each(["Left","Top"],function(aZ,aY){var a0="scroll"+aY;a.fn[a0]=function(a3){var a1=this[0],a2;
if(!a1){return null}if(a3!==C){return this.each(function(){a2=am(this);if(a2){a2.scrollTo(!aZ?a3:a(a2).scrollLeft(),aZ?a3:a(a2).scrollTop())}else{this[a0]=a3}})}else{a2=am(a1);return a2?("pageXOffset" in a2)?a2[aZ?"pageYOffset":"pageXOffset"]:a.support.boxModel&&a2.document.documentElement[a0]||a2.document.body[a0]:a1[a0]
}}});function am(aY){return("scrollTo" in aY&&aY.document)?aY:aY.nodeType===9?aY.defaultView||aY.parentWindow:false}a.each(["Height","Width"],function(aZ,aY){var a0=aY.toLowerCase();a.fn["inner"+aY]=function(){return this[0]?a.css(this[0],a0,false,"padding"):null
};a.fn["outer"+aY]=function(a1){return this[0]?a.css(this[0],a0,false,a1?"margin":"border"):null};a.fn[a0]=function(a1){var a2=this[0];if(!a2){return a1==null?null:this}if(a.isFunction(a1)){return this.each(function(a4){var a3=a(this);
a3[a0](a1.call(this,a4,a3[a0]()))})}return("scrollTo" in a2&&a2.document)?a2.document.compatMode==="CSS1Compat"&&a2.document.documentElement["client"+aY]||a2.document.body["client"+aY]:(a2.nodeType===9)?Math.max(a2.documentElement["client"+aY],a2.body["scroll"+aY],a2.documentElement["scroll"+aY],a2.body["offset"+aY],a2.documentElement["offset"+aY]):a1===C?a.css(a2,a0):this.css(a0,typeof a1==="string"?a1:a1+"px")
}});aM.jQuery=aM.$=a})(window);/*
 * Depend Class v0.1b : attach class based on first class in list of current element
 * Copyright (c) 2009 Egor Hmelyoff, hmelyoff@gmail.com
 */
(function(a){a.baseClass=function(b){b=a(b);return b[0].className.match(/([^ ]+)/)[1]
};a.fn.addDependClass=function(d,b){var c={delimiter:b?b:"-"};return this.each(function(){var e=a.baseClass(this);if(e){a(this).addClass(e+c.delimiter+d)}})};a.fn.removeDependClass=function(d,b){var c={delimiter:b?b:"-"};
return this.each(function(){var e=a.baseClass(this);if(e){a(this).removeClass(e+c.delimiter+d)}})};a.fn.toggleDependClass=function(d,b){var c={delimiter:b?b:"-"};return this.each(function(){var e=a.baseClass(this);
if(e){if(a(this).is("."+e+c.delimiter+d)){a(this).removeClass(e+c.delimiter+d)}else{a(this).addClass(e+c.delimiter+d)}}})}})(jQuery);/*
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
jQuery.cookieDefaults={path:"/",domain:".colorillo.com",expires:365};
jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}m.expires=m.expires||jQuery.cookieDefaults.expires;var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;
if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}m.path=m.path||jQuery.cookieDefaults.path;var l=m.path?"; path="+m.path:"";
m.domain=m.domain||jQuery.cookieDefaults.domain;var g=m.domain?"; domain="+m.domain:"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");
for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};/*
 * copyright alexander kirk 2009
 * some code (normalizeColor) adapted from emile.js
 */
(function(b){b.fn.extend({drawable:function(c){return this.each(function(){new b.drawableCanvas(b(this),c)})}});
b.drawableCanvas=function(ax,W){var u=ax[0],O=false,j=1,S=false,E=false,aq=[];if(typeof u.getContext=="undefined"){G_vmlCanvasManager.initElement(u)}function az(d){if(typeof d=="undefined"){d=5}var c=b("<canvas>");
b("body").append(c);c.css({position:"absolute",top:ar.top+"px",left:ar.left+"px",backgroundColor:"transparent",zIndex:d});c[0].width=c.width()||800;c[0].height=c.height()||500;return c}if(navigator.mimeTypes["application/x-wacom-tablet"]){b("body").append('<embed name="wacom-plugin" id="wacom-plugin" type="application/x-wacom-tablet" HIDDEN="TRUE"></embed>');
O=document.embeds["wacom-plugin"]}var ar=ax.offset();u.width=ax.width()||800;u.height=ax.height()||500;var aw=az(10);var A=aw[0];if(typeof A.getContext=="undefined"){G_vmlCanvasManager.initElement(A)}var N=A.getContext("2d");
var at=false,n=false;var m={},G={},ae={},an={};var R;if(W.zoom>1){R=u.width/W.zoom}var af=u.getContext("2d");var C=Math.PI*2;var ac=[];var L="pen";var T=false;var o={},J=false,ak=[],aa=false;var Q,t,P,p,w=0;
var f=false,F=[];function al(e,d,s){return e.substr(d,s||1)}var g={};u.normalizeColor=function(aE,aB){if(typeof aE=="undefined"){return false}if(typeof aB=="undefined"){aB=false}var aA=2,e=3,s,d=[],aC=[];
var aD=String(aE)+(aB?"A"+aB:"");if(!b.isArray(aE)){if(typeof g[aD]!="undefined"){return g[aD]}}if(b.isArray(aE)&&aE.length==3){d=aE;aD=false}else{if(al(aE,0)=="r"){aE=aE.match(/\d+/g);while(e--){d.unshift(~~aE[e])
}}else{if(aE.length==4){aE="#"+al(aE,1)+al(aE,1)+al(aE,2)+al(aE,2)+al(aE,3)+al(aE,3)}while(e--){d.unshift(parseInt(al(aE,1+e*2,2),16))}}}if(!aB){return g[aD]="#"+(d[0]<16?"0":"")+d[0].toString(16)+(d[1]<16?"0":"")+d[1].toString(16)+(d[2]<16?"0":"")+d[2].toString(16)
}d.push(aB);return g[aD]="rgba("+d.join(", ")+")"};var h="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";var ad=function(d){var c="";for(var e=Math.floor(Math.log(d)/Math.log(64));e>=0;
e--){a=Math.floor(d/Math.pow(64,e));c+=h.substr(a,1);d-=(a*Math.pow(64,e))}return c};var v=function(d){if(!d){return false}out=0;for(var e=0,c=d.length-1;e<=c;e++){out+=h.indexOf(d.substr(e,1))*Math.pow(64,c-e)
}return out};u.compressColor=function(d){if(d.substr(0,1)=="#"){d=d.substr(1)}var e=ad(parseInt(d,16));while(e.length<4){e="0"+e}return e};u.decompressColor=function(e){var d=v(e).toString(16);while(d.length<6){d="0"+d
}return d};u.compressNumber=function(d){var e=ad(d);while(e.length<2){e="0"+e}return e};u.decompressNumber=function(e){var d=v(e);return d};var Y=null,r=null,ay={};u.startPlayback=function(){if(!Y){r=az(15);
r.addClass("readonly");Y=r[0].getContext("2d")}var d=function(){Y.fillStyle="#fff";Y.fillRect(0,0,u.width,u.height)};ay={};var c=true;return{clear:d,deleteSnapshots:function(){ay={}},line:function(aC){if(typeof aC=="undefined"){return
}if(c){d();c=false}var aD="#"+u.decompressColor(aC.substr(0,4));var aB=u.decompressNumber(aC.substr(4,2));var s=u.decompressNumber(aC.substr(6,2));var aA=[];var e=null,aE;for(i=8,l=aC.length;i<l;i+=2){aE=u.decompressNumber(aC.substr(i,2))-50;
if(e!==null){aA.push([e,aE]);e=null;continue}e=aE}return ah(Y,aA,s,aD,aB)},store:function(e){if(typeof Y.getImageData=="undefined"){return false}if(typeof ay[e]!="undefined"){return true}ay[e]=Y.getImageData(0,0,u.width,u.height);
return true},restore:function(e){if(typeof ay[e]=="undefined"){return false}Y.putImageData(ay[e],0,0);return true}}};u.stopPlayback=function(){r.remove();r=null;Y=null;ay={}};var X=function(e,c,aA,s){if(typeof e=="undefined"){e=N
}if(typeof c=="undefined"){c=W.lineWidth}if(typeof aA=="undefined"){aA=W.lineColor}if(typeof s=="undefined"){s=W.opacity}var d=u.normalizeColor(aA,(s/100).toFixed(2));e.strokeStyle=d;e.fillStyle=d;e.lineWidth=c;
e.lineCap=W.zoom==1?"round":"square";e.lineJoin=W.zoom==1?"round":"miter";return d};u.setWacomMode=function(c){switch(c){case"nothing":j=false;break;case"opacity":j=2;break;case"thickness":default:j=1;
break}};var ap=function(){if(!O||j!==1){return false}try{var d=O.pressure;if(typeof d=="undefined"||d==1){return false}else{if(d==0){return 1}else{return Math.max(1,Math.ceil(170*Math.pow(d,3)-250*Math.pow(d,2)+120*d-15))
}}}catch(c){}return false};var I=function(){if(!O||j!==2){return false}try{var d=O.pressure;if(typeof d=="undefined"||d==1){return 100}else{if(d==0){return 20}else{return Math.min(100,Math.floor(2+8*d)*10)
}}}catch(c){}return false};var V=function(){if(!O){return false}try{if(O.isEraser){E=W.lineColor;W.lineColor="#ffffff"}return W.lineColor}catch(c){}return false};var ab=function(aE){if(!aE.button&&!aE.which){return false
}switch(L){case"pen":break;case"eyeDropper":return H(aE)}var aG=(aE.touches?aE.touches[0].pageX:aE.pageX)-ar.left;var aD=Math.floor(aG/W.zoom);var aF=(aE.touches?aE.touches[0].pageY:aE.pageY)-ar.top;var aI=Math.floor(aF/W.zoom);
var s=I();if(s!==false){W.opacity=s}var aA=af;if(W.opacity<100){B(N);aA=N}var aH=ap();if(aH!==false){W.lineWidth=aH}V();J=[];aA.beginPath();if(W.zoom>1){if(false){var d=af.getImageData(aD*W.zoom,aI*W.zoom,1,1).data;
var aC=u.normalizeColor([d[0],d[1],d[2]]);var c=aI*R+aD;if(aC==u.normalizeColor(u.lineColor())&&typeof aq[c]!="undefined"){X(aA,1,aq[c])}else{aq[c]=aC;X(aA,1)}}X(aA,1);aA.fillRect(aD*W.zoom,aI*W.zoom,W.lineWidth*W.zoom,W.lineWidth*W.zoom)
}else{X(aA);if(aE.shiftKey&&t){aA.moveTo(t,p);var aB=J[J.length-1];if(!aB||aB[0]!=t||aB[1]!=p){J.push([t,p])}t=aG;p=aF}else{aA.moveTo(aG,aF)}aA.lineTo(aG,aF)}aA.stroke();Q=t=aG;P=p=aF;var aB=J[J.length-1];
if(!aB||aB[0]!=aD||aB[1]!=aI){J.push([aD,aI])}ak=J};var M=function(d,s,c,e){return Math.sqrt(Math.pow(d-c,2)+Math.pow(s-e,2))};var av=function(aM){if(!J){return false}var aE,aD,aO,aB;var aC=[aM.pageX],aK=[aM.pageY];
var aL,aJ;if(aM.touches){for(aL=0,aJ=aM.touches.length;aL<aJ;aL++){aC[aL]=aM.touches[aL].pageX;aK[aL]=aM.touches[aL].pageY}}var d=J[J.length-1];var aA=d?d[0]:-1;var s=d?d[1]:-1;var c=false;for(aL=0,aJ=aC.length;
aL<aJ;aL++){aO=aE=aC[aL]-ar.left;aB=aD=aK[aL]-ar.top;if(aM.shiftKey){switch(w){case 0:w=Math.abs(Q-aE)-Math.abs(P-aD);w=w>0?1:w<0?2:0;break}switch(w){case 1:aD=P;break;case 2:aE=Q;break}}if(aE==aA&&aD==s){continue
}if(W.zoom>1){aO=Math.floor(aE/W.zoom);aB=Math.floor(aD/W.zoom);var d=J[J.length-1];if(d&&d[0]!=aO&&d[1]!=aB){J.push([d[0],aB]);ak.push([d[0],aB])}}var d=J[J.length-1];if(!d||d[0]!=aO||d[1]!=aB){J.push([aO,aB]);
ak.push([aO,aB])}aA=aE;s=aD;c=true}t=aE;p=aD;if(!c&&J.length>1){return}var aH=I();if(aH!==false&&W.opacity!=aH){Z(aM);W.opacity=aH;ab(aM);if(J.length==0){J=aF.slice()}av(aM);return true}var aF,aN=af;if(W.opacity<100){B(N);
aN=N;aF=J}else{aF=J.slice(J.length-3)}var aG=ap(),aI=W.lineWidth;if(aG!==false&&W.lineWidth==aG||aG==0){aG=false}if(aG!==false&&W.lineWidth!=aG){W.lineWidth=aG}ah(aN,aF);if(aG!==false){Z(aM);W.lineWidth=aG;
ab(aM);if(J.length==0){J=aF.slice()}av(aM)}if(aI==W.lineWidth){aj()}else{U()}return false};var ah=function(s,e,d,aB,aA){if(typeof d=="undefined"){d=W.lineWidth}if(typeof aB=="undefined"){aB=W.lineColor
}if(typeof aA=="undefined"){aA=W.opacity}if(aB<0){B(s);var aC=aB<-1?"rgba(255, 255, 255, .8)":"rgba(0, 0, 0, .8)";N.strokeStyle=aC;N.fillStyle=aC;N.fillRect(0,0,u.width,u.height);N.globalCompositeOperation="xor";
X(s,d*W.zoom,aB<-1?"#000000":"#ffffff",aA)}else{X(s,d*W.zoom,aB,aA)}s.beginPath();for(i=0,l=e.length;i<l;i++){x=e[i][0];y=e[i][1];if(W.zoom>1){if(l==1){s.fillRect(x*W.zoom,y*W.zoom,d*W.zoom,d*W.zoom);break
}x=(x+d/2)*W.zoom;y=(y+d/2)*W.zoom}if(i==0){s.moveTo(x,y)}s.lineTo(x,y)}if(!f){F.push([e,d,aB,aA])}s.stroke();if(aB<0){N.globalCompositeOperation="source-over";return}if(aA==100&&W.zoom==1){var c=Math.floor(d/2);
for(i=0,l=e.length;i<l;i++){x=e[i][0];y=e[i][1];s.beginPath();s.arc(x,y,c,0,C,true);s.closePath();s.fill()}}};var ag=null;var U=function(c){if(!J){return}if(typeof c=="undefined"){c=false}if(ag){ag=null
}if(typeof W.onLineDraw=="function"){var d=ak;if((at||W.opacity<100)&&c){d=J}W.onLineDraw(d,W.lineWidth,W.lineColor,W.opacity,c);ak=c?[]:[ak.pop()]}};var aj=function(){if(ag){return}ag=setTimeout(function(){U()
},100)};var Z=function(c){if(!J){return}if(W.opacity<100){B(N);ah(af,J)}w=0;U(true);if(E){W.lineColor=E;E=false}J=false};u.currentTool=function(){return L};u.changeTool=function(c){switch(c){case"eyeDropper":if(typeof af.getImageData=="undefined"){alert("Unfortunately the eyedropper tool is not available on your browser.");
return false}case"pen":L=c;break;default:return false}if(typeof W.onChangePen=="function"){W.onChangePen(L)}};u.isDarkColor=function(e){var aD;e=String(e);if(e.substr(0,1)!="#"){e="#"+e}if(e.length==7){aD=[parseInt(e.substring(1,3),16),parseInt(e.substring(3,5),16),parseInt(e.substring(5,7),16)]
}else{if(e.length==4){aD=[parseInt(e.substring(1,2),16),parseInt(e.substring(2,3),16),parseInt(e.substring(3,4),16)]}}var aA,aF,aG,aB,aH,d;var c=aD[0],aC=aD[1],aE=aD[2];aA=Math.min(c,Math.min(aC,aE));aF=Math.max(c,Math.max(aC,aE));
return(aA+aF)<255};var H=function(aA){if(typeof af.getImageData=="undefined"){alert("Unfortunately the eyedropper tool is not available on your browser.");return false}var c,aB;c=(aA.touches?aA.touches[0].pageX:aA.pageX)-ar.left;
aB=(aA.touches?aA.touches[0].pageY:aA.pageY)-ar.top;var s=af.getImageData(c,aB,1,1).data;var d=u.normalizeColor([s[0],s[1],s[2]]);if(d==u.normalizeColor(u.lineColor())){return false}u.lineColor(d,false);
if(typeof W.onChangePen=="function"){W.onChangePen("eyeDropper",W.lineColor,W.opacity)}};u.lineWidth=function(c,d){if(typeof c=="undefined"){return Number(W.lineWidth)}if(typeof d=="undefined"){d=true}if(W.zoom>1){c=Math.min(c,4)
}if(W.lineWidth==c){return false}W.lineWidth=c;b.cookie("w",c);X();if(d&&typeof W.onChangePen=="function"){W.onChangePen(W.lineWidth,W.lineColor,W.opacity)}};u.opacity=function(c,d){if(typeof c=="undefined"){return Number(W.opacity)
}if(typeof d=="undefined"){d=true}if(W.opacity==c){return false}W.opacity=c;b.cookie("o",c);X();if(d&&typeof W.onChangePen=="function"){W.onChangePen("nochange",W.lineColor,W.opacity)}};var k=false;u.lineColor=function(d,s,c){if(typeof d=="undefined"){return W.lineColor
}if(typeof s=="undefined"){s=true}if(typeof c=="undefined"){c=false}if(d=="prev"){d=k}var e=u.normalizeColor(d);var aA=u.normalizeColor(W.lineColor);if(aA==e){return false}W.lineColor=e;if(!c){k=aA}b.cookie("c",colorillo.compressColor(e));
X();if(s&&typeof W.onChangePen=="function"){W.onChangePen(W.lineWidth,W.lineColor,W.opacity)}};u.drawPolyLine=function(aA,d,c,aB,s,e){ac.push([aA,d,c,aB,s,e]);am()};u.highLightLastLine=function(e){if(typeof e=="undefined"){e=false
}if(!e){return B(N)}if(!o[e]){return false}var d=o[e];var c=d[1];var s=d[2];d=d[0];s=u.isDarkColor(s)?-2:-1;ah(N,d,Math.max(Number(c),2),s,100)};var am=function(){if(aa){return setTimeout(am,100)}aa=true;
var d=ac.pop();var aA=d[0];var s=d[4];var e=d[5];if(o[aA]){var c=o[aA];if(c[3]){o[aA]=[[],d[2],d[3],false]}}else{o[aA]=[[],d[2],d[3],false]}o[aA][0]=o[aA][0].concat(d[1]);if(e){o[aA][3]=true}if(s==100){ah(af,d[1],d[2],d[3],s)
}else{if(typeof G[aA]=="undefined"){G[aA]=[];m[aA]=az();ae[aA]=m[aA][0].getContext("2d")}an[aA]=+new Date;if(e){B(ae[aA]);ah(af,d[1],d[2],d[3],s);G[aA]=[]}else{G[aA]=G[aA].concat(d[1]);B(ae[aA]);ah(ae[aA],G[aA],d[2],d[3],s)
}}aa=false};var B=function(c){c.clearRect(0,0,u.width,u.height)};W.lineColor=W.lineColor||"#000000";W.lineWidth=W.lineWidth||5;W.opacity=W.opacity||100;N.lineCap="round";N.lineJoin="round";af.lineCap="round";
af.lineJoin="round";if(W.bg){var q=function(){f=true;W.bg.loaded=true;af.drawImage(W.bg,0,0);for(var c=0,e=F.length;c<e;c++){ah(af,F[c][0],F[c][1],F[c][2],F[c][3])}F=false;var d=document.getElementById("loading");
if(d){d.style.display="none"}};W.bg.onload=W.bg.onerror=W.bg.onloaderror=q;if(typeof W.bg.loaded!="undefined"&&W.bg.loaded){q()}}else{f=true;F=false}if(typeof W.onChangePen=="function"){W.onChangePen("pen",W.lineColor,W.opacity)
}X();if(!W.readonly){var ai=function(c){if(n){aw.unbind("mousedown").unbind("mousemove").unbind("mouseup");b(document).unbind("mouseup");n=false}c.preventDefault();c.button=1;return ab(c)};var z=function(c){c.preventDefault();
return av(c)};var K=function(c){c.preventDefault();return Z(c)};do{try{document.createEvent("ManipulateEvent");aw[0].addEventListener("touchdown",ai,false);aw[0].addEventListener("touchmove",z,false);aw[0].addEventListener("touchup",K,false);
at=true;break}catch(au){}try{document.createEvent("TouchEvent");aw[0].addEventListener("touchstart",ai,false);aw[0].addEventListener("touchmove",z,false);aw[0].addEventListener("touchend",K,false);aw[0].addEventListener("touchcancel",K,false);
at=true;break}catch(au){}if(navigator.userAgent.match(/SLBrowser/)||navigator.userAgent.match(/QtLauncher/)||navigator.userAgent.match(/Starlight/)){aw[0].addEventListener("touchdown",ai,false);aw[0].addEventListener("touchmove",z,false);
aw[0].addEventListener("touchup",K,false);at=true;break}}while(false);n=true;aw.mousedown(ab).mousemove(av).mouseup(Z);b(document).mouseup(Z);var ao=null;var D=function(){if(ao){clearTimeout(ao)}var c=(+new Date)-10000;
for(var d in an){if(an[d]<c&&an[d]){m[d].remove();delete m[d];delete G[d];delete ae[d];delete an[d]}}ao=setTimeout(D,5000)};ao=setTimeout(D,5000)}}})(jQuery);/*
 * Stylish Select 0.3 - $ plugin to replace a select drop down box with a stylable unordered list
 * http://scottdarby.com/
 * Copyright (c) 2009 Scott Darby, 2010 Alexander Kirk
 * Licensed under the GPL license: http:// www.gnu.org/licenses/gpl.html
 */
(function(a){Array.prototype.indexOf=function(c,d){for(var b=(d||0);
b<this.length;b++){if(this[b]==c){return b}}};a.fn.dropdown=function(b){return this.each(function(){var i={defaultText:"",animationSpeed:0,ddMaxHeight:""};var l=a.extend(i,b),e=a(this),j=a('<div class="selectedTxt"></div>'),s=a('<div class="dropdownSelected"></div>'),A=a('<ul class="dropdown"></ul>'),u=-1,d=-1,m=[],x=false,o="",w=false;
s.insertAfter(e);j.prependTo(s);A.appendTo(s);e.hide();if(e.children("optgroup").length==0){e.children().each(function(B){var C=a(this).text();m.push(C.charAt(0).toLowerCase());if(a(this).is(":selected")){l.defaultText=C;
d=B}o+="<li>"+C+"</li>"});A.html(o);o="";var y=A.children()}else{e.children("optgroup").each(function(D){var B=a(this).attr("label"),E=a('<li class="dropdownOptionTitle">'+B+"</li>");E.appendTo(A);var C=a("<ul></ul>");
C.appendTo(E);a(this).children().each(function(){u+=1;var F=a(this).text();m.push(F.charAt(0).toLowerCase());if(a(this).attr("selected")==true){l.defaultText=F;d=u}o+="<li>"+F+"</li>"});C.html(o);o=""});
var y=A.find("ul li")}var p=A.height()+3,n=s.height()+3,z=y.length;if(d!=-1){h(d,true)}else{j.text(l.defaultText)}function q(){var C=s.offset().top,B=jQuery(window).height(),D=jQuery(window).scrollTop();
if(p>parseInt(l.ddMaxHeight,10)){p=parseInt(l.ddMaxHeight,10)}C=C-D;if(C+p>=B){A.css({top:" - "+p+"px",height:p});e.onTop=true}else{A.css({top:n+"px",height:p});e.onTop=false}}q();a(window).resize(function(){q()
});a(window).scroll(function(){q()});function t(){s.css("position","relative")}function c(){s.css("position","static")}j.click(function(){if(A.is(":visible")){A.hide();c();return false}s.focus();A.slideDown(l.animationSpeed);
t();A.scrollTop(e.liOffsetTop)});y.hover(function(C){var B=a(C.target);B.addClass("dropdownHover")},function(C){var B=a(C.target);B.removeClass("dropdownHover")});y.click(function(C){var B=a(C.target);
d=y.index(B);w=true;h(d);A.hide();s.css("position","static")});function h(D,F){var B=s.offset().top,G=y.eq(D).offset().top,C=A.scrollTop();if(e.onTop==true){e.liOffsetTop=(((G-B)-n)+C)+parseInt(l.ddMaxHeight,10)
}else{e.liOffsetTop=((G-B)-n)+C}A.scrollTop(e.liOffsetTop);y.removeClass("hiLite").eq(D).addClass("hiLite");var E=y.eq(D).text();if(F==true){e.val(E);j.text(E);return false}e.val(E).change();j.text(E)}e.change(function(B){$targetInput=a(B.target);
if(w==true){w=false;return false}$currentOpt=$targetInput.find(":selected");d=$targetInput.find("option").index($currentOpt);h(d,true)});function r(B){B.onkeydown=function(F){if(F==null){var D=event.keyCode
}else{var D=F.which}w=true;switch(D){case 40:case 39:v();return false;case 38:case 37:k();return false;case 33:case 36:g();return false;case 34:case 35:f();return false;case 13:case 27:A.hide();c();return false
}var E=String.fromCharCode(D).toLowerCase();var C=m.indexOf(E);if(typeof C!="undefined"){d+=1;d=m.indexOf(E,d);if(d==-1||d==null||x!=E){d=m.indexOf(E)}h(d);x=E;return false}}}function v(){if(d<(z-1)){d+=1;
h(d)}}function k(){if(d>0){--d;h(d)}}function g(){d=0;h(d)}function f(){d=z-1;h(d)}s.click(function(){r(this)});s.focus(function(){a(this).addClass("dropdownSelFocus");r(this)});s.blur(function(){a(this).removeClass("dropdownSelFocus");
A.hide();c()});j.hover(function(C){var B=a(C.target);B.parent().addClass("dropdownSelHover")},function(C){var B=a(C.target);B.parent().removeClass("dropdownSelHover")});A.css("left","0").hide()})}})(jQuery);/*
 * jQuery UI 1.8rc2
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(b){var a=b.browser.mozilla&&(parseFloat(b.browser.version)<1.9);
b.ui={version:"1.8rc2",plugin:{add:function(d,e,g){var f=b.ui[d].prototype;for(var c in g){f.plugins[c]=f.plugins[c]||[];f.plugins[c].push([e,g[c]])}},call:function(c,e,d){var g=c.plugins[e];if(!g||!c.element[0].parentNode){return
}for(var f=0;f<g.length;f++){if(c.options[g[f][0]]){g[f][1].apply(c.element,d)}}}},contains:function(d,c){return document.compareDocumentPosition?d.compareDocumentPosition(c)&16:d!==c&&d.contains(c)},hasScroll:function(f,d){if(b(f).css("overflow")=="hidden"){return false
}var c=(d&&d=="left")?"scrollLeft":"scrollTop",e=false;if(f[c]>0){return true}f[c]=1;e=(f[c]>0);f[c]=0;return e},isOverAxis:function(d,c,e){return(d>c)&&(d<(c+e))},isOver:function(h,d,g,f,c,e){return b.ui.isOverAxis(h,g,c)&&b.ui.isOverAxis(d,f,e)
},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};
b.fn.extend({_focus:b.fn.focus,focus:function(c,d){return typeof c==="number"?this.each(function(){var e=this;setTimeout(function(){b(e).focus();(d&&d.call(e))},c)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")
},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var c;if((b.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){c=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(b.curCSS(this,"position",1))&&(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))
}).eq(0)}else{c=this.parents().filter(function(){return(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!c.length?b(document):c
},zIndex:function(f){if(f!==undefined){return this.css("zIndex",f)}if(this.length){var d=b(this[0]),c,e;while(d.length&&d[0]!==document){c=d.css("position");if(c=="absolute"||c=="relative"||c=="fixed"){e=parseInt(d.css("zIndex"));
if(!isNaN(e)&&e!=0){return e}}d=d.parent()}}return 0}});b.extend(b.expr[":"],{data:function(e,d,c){return !!b.data(e,c[3])},focusable:function(d){var e=d.nodeName.toLowerCase(),c=b.attr(d,"tabindex");return(/input|select|textarea|button|object/.test(e)?!d.disabled:"a"==e||"area"==e?d.href||!isNaN(c):!isNaN(c))&&!b(d)["area"==e?"parents":"closest"](":hidden").length
},tabbable:function(d){var c=b.attr(d,"tabindex");return(isNaN(c)||c>=0)&&b(d).is(":focusable")}})})(jQuery);/*
 * jQuery UI Widget 1.8rc2
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b){var a=b.fn.remove;
b.fn.remove=function(c,d){return this.each(function(){if(!d){if(!c||b.filter(c,[this]).length){b("*",this).add(this).each(function(){b(this).triggerHandler("remove")})}}return a.call(b(this),c,d)})};b.widget=function(d,f,c){var e=d.split(".")[0],h;
d=d.split(".")[1];h=e+"-"+d;if(!c){c=f;f=b.Widget}b.expr[":"][h]=function(i){return !!b.data(i,d)};b[e]=b[e]||{};b[e][d]=function(i,j){if(arguments.length){this._createWidget(i,j)}};var g=new f();g.options=b.extend({},g.options);
b[e][d].prototype=b.extend(true,g,{namespace:e,widgetName:d,widgetEventPrefix:b[e][d].prototype.widgetEventPrefix||d,widgetBaseClass:h},c);b.widget.bridge(d,b[e][d])};b.widget.bridge=function(d,c){b.fn[d]=function(g){var e=typeof g==="string",f=Array.prototype.slice.call(arguments,1),h=this;
g=!e&&f.length?b.extend.apply(null,[true,g].concat(f)):g;if(e&&g.substring(0,1)==="_"){return h}if(e){this.each(function(){var i=b.data(this,d),j=i&&b.isFunction(i[g])?i[g].apply(i,f):i;if(j!==i&&j!==undefined){h=j;
return false}})}else{this.each(function(){var i=b.data(this,d);if(i){if(g){i.option(g)}i._init()}else{b.data(this,d,new c(g,this))}})}return h}};b.Widget=function(c,d){if(arguments.length){this._createWidget(c,d)
}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(d,e){this.element=b(e).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(e)[this.widgetName],d);
var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);
this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled")},widget:function(){return this.element},option:function(e,f){var d=e,c=this;
if(arguments.length===0){return b.extend({},c.options)}if(typeof e==="string"){if(f===undefined){return this.options[e]}d={};d[e]=f}b.each(d,function(g,h){c._setOption(g,h)});return c},_setOption:function(c,d){this.options[c]=d;
if(c==="disabled"){this.widget()[d?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",d)}return this},enable:function(){return this._setOption("disabled",false)
},disable:function(){return this._setOption("disabled",true)},_trigger:function(d,e,f){var h=this.options[d];e=b.Event(e);e.type=(d===this.widgetEventPrefix?d:this.widgetEventPrefix+d).toLowerCase();f=f||{};
if(e.originalEvent){for(var c=b.event.props.length,g;c;){g=b.event.props[--c];e[g]=e.originalEvent[g]}}this.element.trigger(e,f);return !(b.isFunction(h)&&h.call(this.element[0],e,f)===false||e.isDefaultPrevented())
}}})(jQuery);/*
 * jQuery UI Mouse 1.8rc2
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(a){a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;
this.element.bind("mousedown."+this.widgetName,function(c){return b._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(b._preventClickEvent){b._preventClickEvent=false;c.stopImmediatePropagation();
return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(d){d.originalEvent=d.originalEvent||{};if(d.originalEvent.mouseHandled){return
}(this._mouseStarted&&this._mouseUp(d));this._mouseDownEvent=d;var c=this,e=(d.which==1),b=(typeof this.options.cancel=="string"?a(d.target).parents().add(d.target).filter(this.options.cancel).length:false);
if(!e||b||!this._mouseCapture(d)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(d)!==false);
if(!this._mouseStarted){d.preventDefault();return true}}this._mouseMoveDelegate=function(f){return c._mouseMove(f)};this._mouseUpDelegate=function(f){return c._mouseUp(f)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);
(a.browser.safari||d.preventDefault());d.originalEvent.mouseHandled=true;return true},_mouseMove:function(b){if(a.browser.msie&&!b.button){return this._mouseUp(b)}if(this._mouseStarted){this._mouseDrag(b);
return b.preventDefault()}if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,b)!==false);(this._mouseStarted?this._mouseDrag(b):this._mouseUp(b))
}return !this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;
this._preventClickEvent=(b.target==this._mouseDownEvent.target);this._mouseStop(b)}return false},_mouseDistanceMet:function(b){return(Math.max(Math.abs(this._mouseDownEvent.pageX-b.pageX),Math.abs(this._mouseDownEvent.pageY-b.pageY))>=this.options.distance)
},_mouseDelayMet:function(b){return this.mouseDelayMet},_mouseStart:function(b){},_mouseDrag:function(b){},_mouseStop:function(b){},_mouseCapture:function(b){return true}})})(jQuery);(function(b){var a=5;b.widget("ui.slider",b.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var c=this,d=this.options;
this._keySliding=false;this._mouseSliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");
if(d.disabled){this.element.addClass("ui-slider-disabled ui-disabled")}this.range=b([]);if(d.range){if(d.range===true){this.range=b("<div></div>");if(!d.values){d.values=[this._valueMin(),this._valueMin()]
}if(d.values.length&&d.values.length!=2){d.values=[d.values[0],d.values[0]]}}else{this.range=b("<div></div>")}this.range.appendTo(this.element).addClass("ui-slider-range");if(d.range=="min"||d.range=="max"){this.range.addClass("ui-slider-range-"+d.range)
}this.range.addClass("ui-widget-header")}if(b(".ui-slider-handle",this.element).length==0){b('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")}if(d.values&&d.values.length){while(b(".ui-slider-handle",this.element).length<d.values.length){b('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle")
}}this.handles=b(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(e){e.preventDefault()
}).hover(function(){if(!d.disabled){b(this).addClass("ui-state-hover")}},function(){b(this).removeClass("ui-state-hover")}).focus(function(){if(!d.disabled){b(".ui-slider .ui-state-focus").removeClass("ui-state-focus");
b(this).addClass("ui-state-focus")}else{b(this).blur()}}).blur(function(){b(this).removeClass("ui-state-focus")});this.handles.each(function(e){b(this).data("index.ui-slider-handle",e)});this.handles.keydown(function(j){var g=true;
var f=b(this).data("index.ui-slider-handle");if(c.options.disabled){return}switch(j.keyCode){case b.ui.keyCode.HOME:case b.ui.keyCode.END:case b.ui.keyCode.PAGE_UP:case b.ui.keyCode.PAGE_DOWN:case b.ui.keyCode.UP:case b.ui.keyCode.RIGHT:case b.ui.keyCode.DOWN:case b.ui.keyCode.LEFT:g=false;
if(!c._keySliding){c._keySliding=true;b(this).addClass("ui-state-active");c._start(j,f)}break}var h,e,i=c._step();if(c.options.values&&c.options.values.length){h=e=c.values(f)}else{h=e=c.value()}switch(j.keyCode){case b.ui.keyCode.HOME:e=c._valueMin();
break;case b.ui.keyCode.END:e=c._valueMax();break;case b.ui.keyCode.PAGE_UP:e=h+((c._valueMax()-c._valueMin())/a);break;case b.ui.keyCode.PAGE_DOWN:e=h-((c._valueMax()-c._valueMin())/a);break;case b.ui.keyCode.UP:case b.ui.keyCode.RIGHT:if(h==c._valueMax()){return
}e=h+i;break;case b.ui.keyCode.DOWN:case b.ui.keyCode.LEFT:if(h==c._valueMin()){return}e=h-i;break}c._slide(j,f,e);return g}).keyup(function(f){var e=b(this).data("index.ui-slider-handle");if(c._keySliding){c._stop(f,e);
c._change(f,e);c._keySliding=false;b(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();return this},_mouseCapture:function(e){var f=this.options;if(f.disabled){return false}this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();
var i={x:e.pageX,y:e.pageY};var k=this._normValueFromMouse(i);var d=this._valueMax()-this._valueMin()+1,g;var l=this,j;this.handles.each(function(m){var n=Math.abs(k-l.values(m));if(d>n){d=n;g=b(this);
j=m}});if(f.range==true&&this.values(1)==f.min){g=b(this.handles[++j])}this._start(e,j);this._mouseSliding=true;l._handleIndex=j;g.addClass("ui-state-active").focus();var h=g.offset();var c=!b(e.target).parents().andSelf().is(".ui-slider-handle");
this._clickOffset=c?{left:0,top:0}:{left:e.pageX-h.left-(g.width()/2),top:e.pageY-h.top-(g.height()/2)-(parseInt(g.css("borderTopWidth"),10)||0)-(parseInt(g.css("borderBottomWidth"),10)||0)+(parseInt(g.css("marginTop"),10)||0)};
k=this._normValueFromMouse(i);this._slide(e,j,k);this._animateOff=true;return true},_mouseStart:function(c){return true},_mouseDrag:function(e){var c={x:e.pageX,y:e.pageY};var d=this._normValueFromMouse(c);
this._slide(e,this._handleIndex,d);return false},_mouseStop:function(c){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(c,this._handleIndex);this._change(c,this._handleIndex);
this._handleIndex=null;this._clickOffset=null;this._animateOff=false;return false},_detectOrientation:function(){this.orientation=this.options.orientation=="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(e){var d,i;
if("horizontal"==this.orientation){d=this.elementSize.width;i=e.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{d=this.elementSize.height;i=e.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)
}var g=(i/d);if(g>1){g=1}if(g<0){g=0}if("vertical"==this.orientation){g=1-g}var f=this._valueMax()-this._valueMin(),j=g*f,c=j%this.options.step,h=this._valueMin()+j-c;if(c>(this.options.step/2)){h+=this.options.step
}return parseFloat(h.toFixed(5))},_start:function(e,d){var c={handle:this.handles[d],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(d);c.values=this.values()
}this._trigger("start",e,c)},_slide:function(g,f,e){var h=this.handles[f];if(this.options.values&&this.options.values.length){var c=this.values(f?0:1);if((this.options.values.length==2&&this.options.range===true)&&((f==0&&e>c)||(f==1&&e<c))){e=c
}if(e!=this.values(f)){var d=this.values();d[f]=e;var i=this._trigger("slide",g,{handle:this.handles[f],value:e,values:d});var c=this.values(f?0:1);if(i!==false){this.values(f,e,true)}}}else{if(e!=this.value()){var i=this._trigger("slide",g,{handle:this.handles[f],value:e});
if(i!==false){this.value(e)}}}},_stop:function(e,d){var c={handle:this.handles[d],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(d);c.values=this.values()}this._trigger("stop",e,c)
},_change:function(e,d){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[d],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(d);c.values=this.values()
}this._trigger("change",e,c)}},value:function(c){if(arguments.length){this.options.value=this._trimValue(c);this._refreshValue()}return this._value()},values:function(e,h){if(arguments.length>1){this.options.values[e]=this._trimValue(h);
this._refreshValue();this._change(null,e)}if(arguments.length){if(b.isArray(arguments[0])){var g=this.options.values,d=arguments[0];for(var f=0,c=g.length;f<c;f++){g[f]=this._trimValue(d[f]);this._change(null,f)
}this._refreshValue()}else{if(this.options.values&&this.options.values.length){return this._values(e)}else{return this.value()}}}else{return this._values()}},_setOption:function(c,d){b.Widget.prototype._setOption.apply(this,arguments);
switch(c){case"disabled":if(d){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");
this.element.removeClass("ui-disabled")}case"orientation":this._detectOrientation();this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();
break;case"value":this._animateOff=true;this._refreshValue();this._animateOff=false;break;case"values":this._animateOff=true;this._refreshValue();this._animateOff=false;break}},_step:function(){var c=this.options.step;
return c},_value:function(){var c=this.options.value;c=this._trimValue(c);return c},_values:function(d){if(arguments.length){var g=this.options.values[d];g=this._trimValue(g);return g}else{var f=this.options.values.slice();
for(var e=0,c=f.length;e<c;e++){f[e]=this._trimValue(f[e])}return f}},_trimValue:function(c){if(c<this._valueMin()){c=this._valueMin()}if(c>this._valueMax()){c=this._valueMax()}return c},_valueMin:function(){var c=this.options.min;
return c},_valueMax:function(){var c=this.options.max;return c},_refreshValue:function(){var g=this.options.range,e=this.options,m=this;var d=(!this._animateOff)?e.animate:false;if(this.options.values&&this.options.values.length){var j,i;
this.handles.each(function(q,o){var p=(m.values(q)-m._valueMin())/(m._valueMax()-m._valueMin())*100;var n={};n[m.orientation=="horizontal"?"left":"bottom"]=p+"%";b(this).stop(1,1)[d?"animate":"css"](n,e.animate);
if(m.options.range===true){if(m.orientation=="horizontal"){(q==0)&&m.range.stop(1,1)[d?"animate":"css"]({left:p+"%"},e.animate);(q==1)&&m.range[d?"animate":"css"]({width:(p-lastValPercent)+"%"},{queue:false,duration:e.animate})
}else{(q==0)&&m.range.stop(1,1)[d?"animate":"css"]({bottom:(p)+"%"},e.animate);(q==1)&&m.range[d?"animate":"css"]({height:(p-lastValPercent)+"%"},{queue:false,duration:e.animate})}}lastValPercent=p})}else{var k=this.value(),h=this._valueMin(),l=this._valueMax(),f=l!=h?(k-h)/(l-h)*100:0;
var c={};c[m.orientation=="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[d?"animate":"css"](c,e.animate);(g=="min")&&(this.orientation=="horizontal")&&this.range.stop(1,1)[d?"animate":"css"]({width:f+"%"},e.animate);
(g=="max")&&(this.orientation=="horizontal")&&this.range[d?"animate":"css"]({width:(100-f)+"%"},{queue:false,duration:e.animate});(g=="min")&&(this.orientation=="vertical")&&this.range.stop(1,1)[d?"animate":"css"]({height:f+"%"},e.animate);
(g=="max")&&(this.orientation=="vertical")&&this.range[d?"animate":"css"]({height:(100-f)+"%"},{queue:false,duration:e.animate})}}});b.extend(b.ui.slider,{version:"1.8rc2"})})(jQuery);/*
 * Originally bubble
 * Copyright 2010 Drew Wilson, adapted by Alexander Kirk 2010
 * www.drewwilson.com
 * code.drewwilson.com/entry/bubble-jquery-plugin
 */
(function(a){a.fn.bubble=function(h,j){var e={maxWidth:"270px",edgeOffset:3,ok:false,okText:"ok",reply:false,link:false,linkText:false};
var b=a.extend(e,j);var i=false,g=false;if(a("#bubble_holder").length<=0){var f=a('<div id="bubble_holder" style="max-width:'+b.maxWidth+';"></div>');var c=a('<div id="bubble_content"><div class="text"></div><div class="links"><span class="reply">reply</span> <span class="ok">ok</span></div></div>');
var d=a('<div id="bubble_arrow"></div>');a("body").append(f.html(c).prepend(d.html('<div id="bubble_arrow_inner"></div>')))}else{var f=a("#bubble_holder");var c=a("#bubble_content");var d=a("#bubble_arrow")
}f.find("span").hide();if(b.okText){f.find("span.ok").text(b.okText)}if(b.ok){f.find("span.ok").unbind("click").click(b.ok).show()}if(b.reply){f.find("span.reply").unbind("click").click(b.reply).show()
}if(!h){f.hide().closest("div.user").removeAttr("style");return this}return this.each(function(){var n=a(this);var o=n.closest("div.user");f.hide().closest("div.user").removeAttr("style");f.removeAttr("class").css("margin","0");
var u=c.find("div.text").text(h+" ");if(b.link){if(!b.linkText){b.linkText=b.link}u.append(a("<a>").attr("href",b.link).text(b.linkText))}d.removeAttr("style");var m=Math.round;var q=parseInt(n.outerWidth());
var k=f.outerWidth();var s=f.outerHeight();var r=m((q-k)/2);var p=m(k-12)/2;var v=s-5;var l=m(top-(s+5+b.edgeOffset))+5;d.css({"margin-left":p+"px","margin-top":v+"px"});f.css({"margin-top":-s+"px"});o.css({"margin-top":s+"px"});
f.prependTo(o).show()})}})(jQuery);/*
    http://www.JSON.org/json2.js
    2009-09-29

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html
*/
if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n
}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){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(key){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":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;
function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)
})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)
}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;
partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";
gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);
if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;
gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")
}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);
if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.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")}}}());/*
 * Farbtastic Color Picker 1.2
 * © 2008 Steven Wittens
 * Adaptations by Alexander Kirk 2010
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
jQuery.fn.farbtastic=function(a){$.farbtastic(this,a);
return this};jQuery.farbtastic=function(a,b){var a=$(a).get(0);return a.farbtastic||(a.farbtastic=new jQuery._farbtastic(a,b))};jQuery._farbtastic=function(a,c){var b=this;$(a).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
var d=$(".farbtastic",a);b.wheel=$(".wheel",a).get(0);b.radius=42;b.square=50;b.width=97;if(navigator.appVersion.match(/MSIE [0-6]\./)){$("*",d).each(function(){if(this.currentStyle.backgroundImage!="none"){var e=this.currentStyle.backgroundImage;
e=this.currentStyle.backgroundImage.substring(5,e.length-2);$(this).css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+e+"')"})
}})}b.linkTo=function(g){if(typeof b.callbacks!="object"||typeof b.callbacks.length=="undefined"){b.callbacks=[]}for(var f=0,e=b.callbacks.length;f<e;f++){callback=b.callbacks[f];if(typeof callback=="object"){$(callback).unbind("keyup",b.updateValue)
}}b.color=null;if(typeof g!="object"||typeof g.length=="undefined"){g=[g]}for(var f=0,e=g.length;f<e;f++){callback=g[f];if(typeof callback=="function"){}else{if(typeof callback=="object"||typeof callback=="string"){callback=$(callback);
if(callback.length){callback.bind("keyup",b.updateValue);if(callback.get(0).value){b.setColor(callback.get(0).value)}}}}g[f]=callback}b.callbacks=g;return this};b.updateValue=function(g){var f=(g==null)?event.keyCode:g.which;
switch(f){case 27:this.value=b.color;break}if(this.value&&this.value!=b.color&&this.value.length==7){b.setColor(this.value)}};b.setColor=function(e){var f=b.unpack(e);if(b.color!=e&&f){b.color=e;b.rgb=f;
b.hsl=b.RGBToHSL(b.rgb);b.updateDisplay()}return this};b.setHSL=function(e){b.hsl=e;b.rgb=b.HSLToRGB(e);b.color=b.pack(b.rgb);b.updateDisplay();return this};b.widgetCoords=function(i){var g,m;var h=i.target||i.srcElement;
var f=b.wheel;if(typeof i.offsetX!="undefined"){var l={x:i.offsetX,y:i.offsetY};var j=h;while(j){j.mouseX=l.x;j.mouseY=l.y;l.x+=j.offsetLeft;l.y+=j.offsetTop;j=j.offsetParent}var j=f;var k={x:0,y:0};while(j){if(typeof j.mouseX!="undefined"){g=j.mouseX-k.x;
m=j.mouseY-k.y;break}k.x+=j.offsetLeft;k.y+=j.offsetTop;j=j.offsetParent}j=h;while(j){j.mouseX=undefined;j.mouseY=undefined;j=j.offsetParent}}else{var l=b.absolutePosition(f);g=(i.pageX||0*(i.clientX+$("html").get(0).scrollLeft))-l.x;
m=(i.pageY||0*(i.clientY+$("html").get(0).scrollTop))-l.y}return{x:g-b.width/2,y:m-b.width/2}};b.mousedown=function(e){if(!document.dragging){$(document).bind("mousemove",b.mousemove).bind("mouseup",b.mouseup);
document.dragging=true}var f=b.widgetCoords(e);b.circleDrag=Math.max(Math.abs(f.x),Math.abs(f.y))*2>b.square;b.mousemove(e);return false};b.mousemove=function(h){var i=b.widgetCoords(h);if(b.circleDrag){var g=Math.atan2(i.x,-i.y)/6.28;
if(g<0){g+=1}b.setHSL([g,b.hsl[1],b.hsl[2]])}else{var f=Math.max(0,Math.min(1,-(i.x/b.square)+0.5));var e=Math.max(0,Math.min(1,-(i.y/b.square)+0.5));b.setHSL([b.hsl[0],f,e])}return false};b.mouseup=function(){$(document).unbind("mousemove",b.mousemove);
$(document).unbind("mouseup",b.mouseup);document.dragging=false};b.updateDisplay=function(){var g=b.hsl[0]*6.28;$(".h-marker",d).css({left:Math.round(Math.sin(g)*b.radius+b.width/2)+"px",top:Math.round(-Math.cos(g)*b.radius+b.width/2)+"px"});
$(".sl-marker",d).css({left:Math.round(b.square*(0.5-b.hsl[1])+b.width/2)+"px",top:Math.round(b.square*(0.5-b.hsl[2])+b.width/2)+"px"});$(".color",d).css("backgroundColor",b.pack(b.HSLToRGB([b.hsl[0],1,0.5])));
if(typeof b.callbacks!="object"||typeof b.callbacks.length=="undefined"){b.callbacks=[]}for(var f=0,e=b.callbacks.length;f<e;f++){callback=b.callbacks[f];if(typeof callback=="object"){$(callback).css({backgroundColor:b.color,color:b.hsl[2]>0.5?"#000":"#fff"});
$(callback).each(function(){if(this.value&&this.value!=b.color){this.value=b.color}})}else{if(typeof callback=="function"){callback.call(b,b.color)}}}};b.absolutePosition=function(f){var g={x:f.offsetLeft,y:f.offsetTop};
if(f.offsetParent){var e=b.absolutePosition(f.offsetParent);g.x+=e.x;g.y+=e.y}return g};b.pack=function(f){var i=Math.round(f[0]*255);var h=Math.round(f[1]*255);var e=Math.round(f[2]*255);return"#"+(i<16?"0":"")+i.toString(16)+(h<16?"0":"")+h.toString(16)+(e<16?"0":"")+e.toString(16)
};b.unpack=function(e){if(e.length==7){return[parseInt(e.substring(1,3),16)/255,parseInt(e.substring(3,5),16)/255,parseInt(e.substring(5,7),16)/255]}else{if(e.length==4){return[parseInt(e.substring(1,2),16)/15,parseInt(e.substring(2,3),16)/15,parseInt(e.substring(3,4),16)/15]
}}};b.HSLToRGB=function(m){var o,n,e,j,k;var i=m[0],p=m[1],f=m[2];n=(f<=0.5)?f*(p+1):f+p-f*p;o=f*2-n;return[this.hueToRGB(o,n,i+0.33333),this.hueToRGB(o,n,i),this.hueToRGB(o,n,i-0.33333)]};b.hueToRGB=function(f,e,g){g=(g<0)?g+1:((g>1)?g-1:g);
if(g*6<1){return f+(e-f)*g*6}if(g*2<1){return e}if(g*3<2){return f+(e-f)*(0.66666-g)*6}return f};b.RGBToHSL=function(m){var i,o,p,j,q,f;var e=m[0],k=m[1],n=m[2];i=Math.min(e,Math.min(k,n));o=Math.max(e,Math.max(k,n));
p=o-i;f=(i+o)/2;q=0;if(f>0&&f<1){q=p/(f<0.5?(2*f):(2-2*f))}j=0;if(p>0){if(o==e&&o!=k){j+=(k-n)/p}if(o==k&&o!=n){j+=(2+(n-e)/p)}if(o==n&&o!=e){j+=(4+(e-k)/p)}j/=6}return[j,q,f]};$("*",d).mousedown(b.mousedown);
b.setColor("#000000");if(c){b.linkTo(c)}};var eyeDropperWithAlt=false;if(typeof colorillo=="undefined"){colorillo={}}setTimeout(function(){location.reload()},86400000);colorillo.colorArrows=function(b,a){if(typeof b=="undefined"){b=$("#vote")}if(typeof a=="undefined"){a=current_vote
}$("div.up, div.down",b).removeClass("vote voted").addClass(function(){var c=$(this).hasClass("up")?1:-1;return a==c?"voted":"vote"})};colorillo.startApp=function(){$("div.button.eyeDropper").click(function(){colorillo.changeTool("eyeDropper")
});$("a[href^='http:']").not("[href*='colorillo.com']").attr("target","_blank");$("p.bubble-help").click(function(){$(this).hide();return false});$("a#help").click(function(){var c=$("p.bubble-help,div.help-message");
c.filter(".news-recalc").css("marginTop",$("#news").is(":visible")?$("#news").height()+20:0);c.is(":visible")?c.hide():c.show();return false});$("a#close-messages,div.help-message div.close").click(function(){$("p.bubble-help,div.help-message").hide();
return false});if($().dropdown){if(typeof colorswitch!="undefined"&&colorswitch){$("#colorswitchx").hide();$(colorswitch).dropdown().change(function(){var c="#"+$(this).find(":selected")[0].className;$("#simplecolors, #advancedcolors, #colorlists").not(c).hide();
$(c).show()}).change()}$("#sidebarswitchx").hide();$("#sidebarswitch").dropdown().change(function(){var c="#"+$(this).find(":selected")[0].className;$("div#moreinfo div.sidebars").not(c).hide();$(c).show();
if(c=="full-chat"){$("#chatinput").focus()}}).change()}if(navigator.mimeTypes["application/x-wacom-tablet"]){$.get("/stats.php?wacom");$("#pressuresensitivity").show();$("#pressure_controls").dropdown().change(function(){var c=$(this).find(":selected")[0].className;
if(c=="thickness"){$.cookie("pp",null)}else{$.cookie("pp",c)}colorillo.setWacomMode(c)});var a=$.cookie("pp");if(a){colorillo.setWacomMode(a)}}$("#create-button").click(function(c){$("p.bubble-help,div.help-message").hide();
colorillo.startNewPicture(c)});$("#playback div.playbutton").click(function(){$("div.help-message").hide();colorillo.playback()});$("#playback div.buttons div.slow").click(colorillo.playbackSpeed);$("#playback div.close").click(colorillo.quitPlayback);
$("#exportvideo, a.download-movie").click(colorillo.exportVideo);$("#keep-in-gallery").click(function(){var d=$(this);if(d.hasClass("nolink")){return false}var c=$("form#create-form");$("input#fork").attr("checked","checked");
$.post(c[0].action+"?js=1",c.serialize(),function(f){var e=d.text();d.addClass("nolink").text("Thank you! The picture has been submitted to the gallery");setTimeout(function(){d.removeClass("nolink");d.text(e)
},10000)});return false});$("#news div.more a").click(function(){var d=$("#news div.title").not("div.newstitle"),c=$("#news div.news");newsItem=(newsItem+1)%news.length;d.html(news[newsItem].title);c.html(news[newsItem].text);
return false});$("#news div.close").click(function(){$("#news").hide();$.cookie("n",news[newsItem].id)});$("#lock-drawing").change(function(){var e=$(this);var c=e.is(":checked");var d=e.closest("form");
$.post(d[0].action,d.serialize(),function(f){if(f=="locked"){alert("The drawing is now locked.");return}else{if(f=="unlocked"){alert("The drawing is now unlocked");return}}alert("An error occured when trying to "+(c?"lock":"unlock")+" the drawing")
})});$(document).keyup(function(g){var f=$(g.target);if(f.is("input,select,textarea")&&f.is(":visible")){return true}var d=(g==null)?event.keyCode:g.which;switch(d){case 13:if(noFocus){return true}var c=$("#sidebarswitch").find(":selected")[0].className;
if(c=="full-chat"){$("#chatinput").focus();return false}return colorillo.queryChatMessage();case 27:return colorillo.showNextChatMessage(true);case 18:if(eyeDropperWithAlt){eyeDropperWithAlt=false;return colorillo.changeTool("pen")
}break}return true});$(document).keydown(function(n){if(n.metaKey||n.ctrlKey){return true}var o=$(n.target);var u=(n==null)?event.keyCode:n.which;if(u==27){if(!$("div#shade").is(":visible")&&playback_data){if(playback_running){colorillo.playbackRun(false)
}else{colorillo.quitPlayback()}return}$("div#shade").hide();$("div.messagebox").hide();$(window).focus()}if(o.is("input,select,textarea")&&o.is(":visible")){return true}var f=String.fromCharCode(u).toLowerCase();
var k=true;var r=false;var q=1;switch(u){case 18:eyeDropperWithAlt=true;return colorillo.changeTool("eyeDropper");case 37:if(playback_data&&!playback_running){q=-1}case 39:if(playback_data&&!playback_running){if(n.shiftKey){q*=100
}colorillo.seekPlayback(playback_pos+q,true);return false}break;case 219:case 188:q=-1;case 221:case 190:var g=colorillo.lineWidth();if($(colorswitch).val()==$(colorswitch).find("option.simplecolors").text()){for(var m=0,j=colorillo.simpleBrushSizes.length;
m<j;m++){if(colorillo.simpleBrushSizes[m]>g){g=colorillo.simpleBrushSizes[Math.max(0,m-1)]}if(colorillo.simpleBrushSizes[m]==g){g=colorillo.simpleBrushSizes[Math.min(Math.max(0,m+q),colorillo.simpleBrushSizes.length-1)];
break}}}else{g+=q}if(g>30){w=30}else{if(g<1){w=1}}colorillo.lineWidth(g);return colorillo.changeTool("pen")}switch(f){case" ":if(playback_data){return colorillo.playbackRun(!playback_running)}else{return colorillo.playback()
}break;case"i":return colorillo.changeTool("eyeDropper");case"b":if(colorillo.currentTool()!="eyeDropper"){var d,h=$("div.palette div.button.tool.selected");if(!h.length){h=$("div.palette div.button.tool").eq(0)
}if(n.shiftKey){d=h.prev();if(k&&d.length==0){d=h.siblings().last()}}else{d=h.next();if(k&&d.length==0){d=h.siblings().first()}}if(d.length){colorillo.lineWidth(Number(d[0].id.substr(4)))}}return colorillo.changeTool("pen");
case"p":var d,h=$("#pressure_controls option:selected");if(!h.length){h=$("#pressure_controls option").eq(0)}d=h.next();if(d.length==0){d=h.siblings().first()}if(d.length){$("#pressure_controls").val(d.text()).change()
}return true;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"0":var t=Number(f)*10;if(t==0){t=100}t=colorillo.opacity(t);$(colorswitch).val($(colorswitch).find("option.advancedcolors").text()).change();
return t;case"o":var t=colorillo.opacity();var x=(n.shiftKey)?-5:5;t=Math.max(0,Math.min(100,t+x));t=colorillo.opacity(t);$(colorswitch).val($(colorswitch).find("option.advancedcolors").text()).change();
return t;case"x":return colorillo.lineColor("prev");case"d":var p=colorillo.lineColor();p=(p=="#000000")?"#ffffff":"#000000";return colorillo.lineColor(p,true,true);case"a":r="advancedcolors";break;case"s":r="simplecolors";
break;case"h":if($(colorswitch).find("option:selected")[0].className=="colorlists"){var d,h=$("div.button.history.selected");if(h.length==0){d=$("div.button.history").eq(0)}else{if(n.shiftKey){d=h.prev();
if(d.length==0){d=h.siblings();d=d.eq(d.length-1)}}else{d=h.next();if(d.length==0){d=h.siblings().eq(0)}}}if(d.length){d.click()}}else{r="colorlists"}break}if(r){$(colorswitch).val($(colorswitch).find("option."+r).text()).change()
}return true});var b=$("#worldmap").position();if(b){mapx=Number(b.left);mapy=Number(b.top)}};colorillo.lastHistoryColor=false;colorillo.addHistoryColor=function(d){d=colorillo.normalizeColor(d).substr(1);
if(colorillo.lastHistoryColor==d){return}if(colorInHistory[d]){for(var b=0,a=colorhistory.length;b<a;b++){if(colorhistory[b]==d){break}}colorhistory.splice(b,1)}colorInHistory[d]=true;colorhistory.unshift(d);
colorillo.highlightColorButton("#"+d);while(colorhistory.length>$("#colorhistory div").length){delete colorInHistory[colorhistory.pop()]}var c="";for(var b=0,a=colorhistory.length;b<a;b++){c+=colorillo.compressColor(colorhistory[b])
}$.cookie("h",c);colorillo.lastHistoryColor=d;colorillo.updateColorHistory()};colorillo.updateColorHistory=function(){$("div.button.history").each(function(a){if(!colorhistory[a]){return false}var b=colorhistory[a];
var c=colorillo.normalizeColor(this.style.backgroundColor).substr(1);if(colorillo.isDarkColor("#"+b)){$(this).addClass("dark")}else{$(this).removeClass("dark")}$(this).removeClass("color-"+c).addClass("color-"+b).css({backgroundColor:"#"+b}).attr({title:"#"+b})
})};colorillo.rotatezIndex=function(){var d=$("div.coord");var a=d.length;var b={};d.each(function(){var c=5+(Number(this.style.zIndex)-4)%a;if(typeof b[c]!="undefined"){for(var e=0;e<=a;e++){if(typeof b[e]!="undefined"){continue
}c=e}}b[c]=true;this.style.zIndex=c})};var noFocus=false;$(window).focusout(function(){noFocus=true}).focus(function(){if(finishChatTimeout){noFocus=true;clearTimeout(finishChatTimeout);colorillo.showNextChatMessage(true)
}noFocus=false});var chatMessageQueue=[],finishChatTimeout=null,showingChatMessage=false;var msgDuration=10000;var finishedShowingChatMessage=function(){if(finishChatTimeout){clearTimeout(finishChatTimeout)
}if(noFocus){return finishChatTimeout=setTimeout(finishedShowingChatMessage,msgDuration)}showingChatMessage=false;$("#bubble_holder").hide().closest("div.user").removeAttr("style");return colorillo.showNextChatMessage()
};colorillo.showNextChatMessage=function(d){if(typeof d=="undefined"){d=false}if(showingChatMessage){if(d){return finishedShowingChatMessage()}return}var a=chatMessageQueue.shift();if(!a||!a[1]){return false
}var c=$("#user_"+a[0]+"");if(!c.length){return finishedShowingChatMessage()}showingChatMessage=a[0];var b=false;if(!c.is(".me")){b=function(){finishedShowingChatMessage();colorillo.queryChatMessage()}
}c=c.find("div.button").eq(0);c.bubble(a[1],{ok:finishedShowingChatMessage,reply:b});if(finishChatTimeout){clearTimeout(finishChatTimeout)}finishChatTimeout=setTimeout(finishedShowingChatMessage,msgDuration);
return true};var userList={};$("span.ignore").live("click",function(){var d=$(this);var h=d.text()=="ignore"?"ignore":"unignore";var g=$(this).closest("div.user").data("ident");userList[g]["ignore"]=(h=="ignore");
colorillo.updateUserlist(g,true);var f=false,j=$.cookie("x")||"";j=j.split(",");if(j[0]==""){j.pop()}for(var b=0,a=j.length;b<a;b++){if(j[b]!=g){continue}if(h=="ignore"){return}f=b}if(h=="ignore"){j.push(g)
}else{if(f!==false){j.splice(f,1)}}var e={};e[h]=g;$.post("/ignore.php",e);$.cookie("x",j.join(","))});var highlightingLine=false;$("#userlist div.tool, #worldmap div.coord").live("click",function(){var a=(this.className=="coord")?this.id.substr(6):$(this).closest("div.user").data("ident");
if(highlightingLine==a){a=false}colorillo.highLightLastLine(a);highlightingLine=a}).filter("#userlist div.tool").live("mouseout",function(){colorillo.highLightLastLine();highlightingLine=false});colorillo.startNewPicture=function(g){var f=$("#create-new");
var d=f.find("form");if(playback_data){colorillo.playbackRun(false);$("#playback-startline").val(playback_info.f);$("#playback-no").val(playback_pos)}if(g.metaKey){$("input#fork").attr("checked",true);
if(playback_data){$("#playback-startline, #playback-no").attr("checked",true)}d.attr("target","_blank").submit();d.removeAttr("target");return true}d.removeAttr("target");var a=function(){f.hide();$("div#shade").hide();
$(window).focus()};var c=$("div#invite-userlist").html("");$("#userlist>div.user").clone().appendTo(c);c.find("div.me, div.usertext span").not("span.username").remove();if(c.children().length){c.show().find("div.user div.buttonholder").prepend("<input type=checkbox value=1 checked=false>");
c.find("input").attr("name",function(){return"invite["+$(this).closest("div.user").attr("id").substr(5)+"]"});c.find("div.user").die("click").live("click",function(e){if($(e.target).is("input")){return true
}$(this).find("input").attr("checked",function(){return this.checked?false:"checked"})}).click();f.find("div.invite").show()}else{f.find("div.invite").hide()}f.find("div.close").unbind("click").click(a).end().find("form").unbind("submit").submit(a).end().find("textarea").val("I'm going to start with a new picture. Click this link to follow me:").end().find("ul.selector li").unbind("click").click(function(){var e=$(this);
e.addClass("selected").siblings().removeClass("selected");$("input#fork").attr("checked",(e.index()>=1));$("#playback-startline, #playback-no").attr("checked",(e.index()==2))}).dblclick(function(h){if(h.metaKey){d.attr("target","_blank")
}d.submit();d.removeAttr("target")});var b=f.find("ul.selector li.invite-playback");if(playback_data){b.show().click();colorillo.playbackRun(false);$("#playback-startline").val(playback_info.f);$("#playback-no").val(playback_pos)
}else{b.hide()}colorillo.showCentered(f);colorillo.showShade(f)};var newPrivatePage=false,inputBoxSizes=false;colorillo.inviteFriends=function(c){var j=false;var f=/http:\/\/colorillo.com\/?([a-z0-9]{4}\?)?([a-z0-9]{4,8})?/;
var p=location.pathname.substr(1)+(location.search?location.search:"");p=p.replace(/[&?]error=[a-z +]+/,"");var b="I'm on Colorillo right now. Join me and draw together with me at the same time at http://colorillo.com/";
b=b.replace(f,"http://colorillo.com/"+p);$("#invite_to").val(p);var n=$("#invitetext");var e=$("#invite");var q=function(){e.hide();$("div#shade").hide();$(window).focus()};var i=function(){var r=140-n.val().length;
$("#invite_status").text("For a twitter message you still have "+r+" letter"+((r!=1)?"s":"")+" left.")};var a=function(){var r=$("form#create-form");$("input#fork").attr("checked",false);$.post(r[0].action+"?js=1",r.serialize(),function(s){if(!s){alert("Unfortunately there was an error determining the URL of the private page.");
newPrivatePage=""}else{newPrivatePage=s}g(1)})};var h=function(){var r=$("form#create-form");$("input#fork").attr("checked","checked");$.post(r[0].action+"?js=1",r.serialize(),function(s){if(!s){alert("Unfortunately there was an error determining the URL of the private page.");
j=""}else{j=s}g(2)})};var g=function(s){var r=$("#invitetext").val();if(r.indexOf("colorillo.com")==-1){r+=" http://colorillo.com/"}switch(s){case 0:$("#invite_to").val(p);r=r.replace(f,"http://colorillo.com/"+p);
break;case 1:if(newPrivatePage!==false){r=r.replace(f,"http://colorillo.com/"+newPrivatePage);$("#invite_to").val(newPrivatePage);break}$("#invite_status").html('<img src="/img/p.gif" /> Determining new page url...');
a();break;case 2:if(j!==false){r=r.replace(f,"http://colorillo.com/"+j);$("#invite_to").val(j);break}$("#invite_status").html('<img src="/img/p.gif" /> Determining new page url...');h();break}$("#invitetext").val(r);
i()};n.val(b).keyup(i);i();var k=function(){if(typeof FB=="undefined"){return setTimeout(k,100)}var r={method:"stream.publish",message:$("#invitetext").val(),attachment:{name:"Colorillo - real-time action painting",href:"http://colorillo.com/"+$("#invite_to").val(),description:"A collaborative drawing web application. Watch your friends as they draw or draw together with them at the same time."},action_links:[{text:"Draw with me",href:"http://colorillo.com/"+$("#invite_to").val()}],user_message_prompt:"We suggest the following message:"};
FB.ui(r,function(s){if(!s){return colorillo.messageBox("Your friends could not be invited","There was an error communicating with facebook: "+exception)}q();if($("#invite_to").val()==""){return colorillo.messageBox("Your friends have been invited","The message was sent to Facebook, let's see if your friends arrive soon.")
}$.cookie("msg","friends_invited_facebook");location.href=$("#invite_to").val()})};e.find("div.close").unbind("click").click(q).end().find("ul.selector li").unbind("click").click(function(){var r=$(this);
r.addClass("selected").siblings().removeClass("selected");g(r.index())}).end().find("form").unbind("submit").submit(function(){if(this.action){return true}alert("Please select a service where you want to invite your friends from.");
return false}).end().find(".invitebutton").unbind("click").click(function(){switch($(this).parent().index()){case 0:$(this).closest("form").attr("action","/twitter.php").submit();break;case 1:k();break;
case 2:break;case 3:location.href="http://www.stumbleupon.com/submit?url=http://colorillo.com/"+escape($("#invite_to").val())+"&title="+escape($("#invitetext").val());break}});if(!inputBoxSizes){e.show();
var o=$("<tester/>").css({position:"absolute",top:-9999,left:-9999,width:"auto",display:"block",whiteSpace:"nowrap"});$("input.copypaste").css("width",$("span#copypastesize").width()+"px").unbind("click").click(function(r){$(r.target).focus().select();
return false}).each(function(){var r=$(this);o.css({fontSize:r.css("fontSize"),fontFamily:r.css("fontFamily"),fontWeight:r.css("fontWeight"),letterSpacing:r.css("letterSpacing")}).insertAfter(r).text(r.val());
r.width(o.width()+10)});o.remove()}colorillo.showCentered(e);colorillo.showShade(e);if(inputBoxSizes){return}var m=document.getElementsByTagName("head")[0];var l=document.createElement("script");l.id="facebook";
l.type="text/javascript";l.src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php";m.appendChild(l);var d=function(){if(typeof FB=="undefined"){return setTimeout(d,100)}FB.init(c,"xd_receiver.htm")
};d();inputBoxSizes=true};colorillo.requestInvitation=function(b,a){$.post("/rsvp.php",{drawing:a,host:b},function(d){var e={};if(d){e=JSON.parse(d)}if(typeof e.link!="undefined"&&e.link){var c=$("#user_"+b+"");
if(!c.length){c=$("#userlist div.user.me")}c=c.find("div.button").eq(0);c.bubble(e.text,{ok:finishedShowingChatMessage,link:e.link,linkText:e.linktext,okText:"no thanks"});if(finishChatTimeout){clearTimeout(finishChatTimeout)
}finishChatTimeout=setTimeout(finishedShowingChatMessage,msgDuration*3)}$("#user_"+b).data("lastAction",0)})};var playback_data=false,playback_len=false,playback_info=false,playback_pos=0,playback_slider_pos=0,playback_slider_inc=false,playback_running=false,playback_callback=false,playback_finished_callback=false,playback_timeout=10,playback_loading=false,seekTimeout=null,seekThroughTimeout=null,lastSeek=false,playback_was_running=false,playback_seeking=false;
var run_playback=function(){if(!playback_running){return}playback_pos+=1;playback_slider_pos+=playback_slider_inc;if($().slider){$("#seekbar").slider("value",Math.ceil(playback_slider_pos))}if(playback_pos<playback_len){playback_callback.line(playback_data[playback_pos]);
if(playback_pos>0&&playback_pos%1000==0){playback_callback.store(playback_pos)}setTimeout(run_playback,playback_timeout)}else{$("#playback div.playbutton").addClass("play").removeClass("pause");playback_running=false;
if(playback_finished_callback&&typeof playback_finished_callback=="function"){playback_finished_callback()}}};colorillo.playbackRun=function(a){if(typeof a=="undefined"){a=true}if(a){playback_running=true;
$("#playback div.playbutton").addClass("pause").removeClass("play");return run_playback()}playback_running=false;$("#playback div.playbutton").addClass("play").removeClass("pause")};colorillo.quitPlayback=function(){$("#canvasbg").removeClass("playback").unbind("click");
playback_running=false;colorillo.stopPlayback();playback_data=false;playback_loading=false;playback_callback=false;$("#playback div.close").css("visibility","hidden");$("#playbackinfo").hide();if($().slider){$("#seekbar").slider("value",10000)
}$("#playback div.playbutton").addClass("play").removeClass("pause")};colorillo.playback=function(d,b){if(playback_data){if(playback_running){colorillo.playbackRun(false);return}if(playback_pos>=playback_len){playback_callback.clear();
playback_pos=-1;playback_slider_pos=0}colorillo.playbackRun();return}if(playback_loading){return}playback_loading=true;if(b&&typeof b=="function"){playback_finished_callback=b}playback_callback=colorillo.startPlayback();
var a=function(j){var i=playback_info.e-playback_info.s;var j=Math.floor(i/86400);var g=Math.floor((i%86400)/3600);var e=Math.floor((i%3600)/60);var f=i%60;i="";if(j){i+=j+" day"+(j==1?" ":"s ")}if(g){i+=g+" hr"+(g==1?" ":"s ")
}if(!j&&e){i+=e+" min"+(e==1?" ":"s ")}if(!j&&!g){i+=f+"s"}if(playback_info.d){$("#playbackinfo").find("div.info").html("started on <strong>"+playback_info.n+"</strong>, drawn with <strong>"+playback_len+" line"+(playback_len==1?"":"s")+"</strong> by <strong>"+playback_info.d+" "+(playback_info.d==1?"person":"people")+"</strong> in <strong>"+i+"</strong>")
}};var c=function(e,f){if(typeof e=="number"&&e){e="&more="+e}else{e=""}playback_was_running=playback_running;colorillo.playbackRun(false);$("#loading_text").text("Loading playback data...");$("#loading").css("width","170px").show();
$.post("/playback.php?drawing="+colorillo.drawing+e,{},function(g){if(!e){playback_data=[]}g=g.split(/!/);var h=$.parseJSON(g.pop());playback_data=g.concat(playback_data);playback_len=playback_data.length;
playback_info.len=playback_len;if(e){if(h.f){playback_info.f=h.f;playback_info.n=h.n;playback_info.s=h.s}}else{playback_info=h}if(h.f){a(playback_info)}$("#loadmoreplayback").unbind("click").click(function(){if($(this).hasClass("nolink")){return false
}playback_running=true;c(playback_info.f);return false}).text("Load earlier data");var i=!playback_seeking;if(e){playback_callback.deleteSnapshots();if(h.f==0){$("#loadmoreplayback").addClass("nolink").text("No earlier data available");
i=false}}else{$("#loadmoreplayback").removeClass("nolink").show()}$("#exportvideo").removeClass("nolink").show();playback_slider_inc=10000/playback_len;$("#loading").hide();$("#playbackinfo").show();$("#canvasbg").addClass("playback").unbind("click").click(colorillo.quitPlayback);
$("#playback div.close").css("visibility","visible");if(f&&typeof f=="function"){return f()}if(i){playback_pos=-1;playback_slider_pos=0;if($().slider){$("#seekbar").slider("value",0)}playback_callback.clear()
}if(playback_was_running){colorillo.playbackRun()}})};playback_running=true;c(false,d)};colorillo.seekPlayback=function(a,c){if(typeof c=="undefined"){c=false}if(Math.ceil(playback_slider_pos)==a){return
}if(lastSeek==a){return}playback_seeking=true;playback_was_running=playback_running;playback_running=false;var b=function(){var g,h=false,e=playback_pos;playback_pos=c?a:Math.floor(a/playback_slider_inc);
playback_slider_pos=playback_pos*playback_slider_inc;if(c){a=playback_slider_pos}lastSeek=a;var d=c?100:1000;if(e<playback_pos&&Math.floor(e/1000)==Math.floor(playback_pos/1000)){g=false}else{g=Math.floor(playback_pos/d)*d;
while(g>0){h=playback_callback.restore(g);if(h){break}g-=d}}if(g===false){}else{if(h){e=g+1}else{if(g==0||e>playback_pos){playback_callback.clear();e=0}}}if(playback_pos-e>200){$("#loading_text").text("Seeking...");
$("#loading").css("width","100px").show()}var f=function(j,k){if(seekThroughTimeout){clearTimeout(seekThroughTimeout)}for(;j<=k;j++){if(lastSeek!=a){return}playback_callback.line(playback_data[j]);if(j>0&&j%d==0){playback_callback.store(j)
}if(j>0&&j%1000==0){return setTimeout(function(){f(j+1,k)},10)}}$("#loading").hide();if(c&&$().slider){$("#seekbar").slider("value",Math.ceil(playback_slider_pos))}playback_pos=k;if(playback_was_running){colorillo.playbackRun()
}playback_seeking=false};if(seekThroughTimeout){clearTimeout(seekThroughTimeout)}seekThroughTimeout=f(e,playback_pos)};if(!playback_data){colorillo.playback(b);return}if(seekTimeout){clearTimeout(seekTimeout)
}seekTimeout=setTimeout(b,10)};colorillo.playbackSpeed=function(b){var a=$(this);enable=a.hasClass("disabled");if(enable){a.removeClass("disabled").addClass("enabled")}else{a.removeClass("enabled").addClass("disabled")
}playback_timeout=enable?200:10};var info_data=false;colorillo.exportVideo=function(){var t,n;if(!playback_data&&!info_data){$("#loading_text").text("Fetching line data...");$("#loading").css("width","130px").show();
$.post("/info.php?drawing="+colorillo.drawing,{},function(i){$("#loading").hide();info_data=i;colorillo.exportVideo()},"json");return false}else{if(playback_info){t=playback_info;n=playback_len}else{if(info_data){t=info_data;
n=info_data.t}else{alert("Could not load the necessary data");return false}}}colorillo.playbackRun(false);var h=$("#video");var a=h.find("form");var m=false;var e=function(){h.hide();if(m){clearTimeout(m)
}$("div#shade").hide();$(window).focus();return false};var j=3,c=[5,10,15],s,q=Math.ceil(n/25);var r=60,f=10,d=60;if(q>5){f=30;r=q*2;if(q<60){f=10;r*=2}if(q<30){f=5;r*=2}d=2*f}for(s=Math.min(30,15+f),r=r-f;
s<r;s+=f){c.push(s);if(s<q&&s+d>q){c.push(q);s+=d}}c.push(r+f);var p=function(A,y){var l=c[y.value];var i=Math.floor(l/60);var x=l%60;var u=[];if(i){u.push(i+" min"+(x?"":("ute"+(i==1?"":"s"))))}if(x){u.push(x+" s"+(i?"":"econds"))
}var z=(n/l).toFixed(1);u.push("("+z+" lines per second)");h.find(".selected-video-length").text(u.join(" "))};if($().slider){h.find("#video-length").slider({value:j,min:0,max:c.length-1,step:1,change:function(l,i){h.find(".video-duration").val(c[i.value])
},slide:p})}p(false,{value:j});h.find("input.video-duration").val(c[j]).end().find("span.lines-drawn").text(n).end().find("input.video-from").val(t.f).end().find("input.video-to").val(t.l);function b(){if(m){clearTimeout(m)
}var u=h.find("div.download");u.show().siblings(":not(ul)").hide();var l=a.find("input").eq(0);l.attr("name","mp4");var i="/download.php?"+a.serialize();l.attr("name","drawing");u.find("a")[0].href=i;location.href=i
}function o(){$.post("/progress.php",a.serialize(),k)}function k(u){var l;if(u=="done"){return b()}else{if(u=="queue"){l=h.find("div.status-notstarted");l.show().siblings(":not(ul)").hide();var v=new Date;
l.find("span.time").text((v.getHours()<10?"0":"")+v.getHours()+":"+(v.getMinutes()<10?"0":"")+v.getMinutes()+":"+(v.getSeconds()<10?"0":"")+v.getSeconds())}else{l=h.find("div.status");l.show().siblings(":not(ul)").hide();
var i=u.split(":");l.find("span.processed").text(i[0]);l.find("span.total").text(i[1]);l.find("span.percent").text((i[0]/i[1]*100).toFixed(1))}}if(m){clearTimeout(m)}m=setTimeout(o,1000)}a.unbind("submit").submit(function(){h.find("ul.selector").addClass("nolink").find("li.selected").siblings().hide();
colorillo.showCentered(h);$.post("/video.php",a.serialize(),function(i){if(m){clearTimeout(m)}if(i=="ok"){return b()}k(i)});return false});var g=["full","ipod","youtube"];h.find(".close").unbind("click").click(e).end().find("div.settings").show().siblings(":not(ul)").hide().end().end().find("ul.selector").removeClass("nolink").find("li").show().unbind("click").click(function(){if($(this).hasClass("nolink")){return false
}var u=$(this),l=u.index();u.addClass("selected").siblings().removeClass("selected");a.find("input").eq(1).val(g[l]).end().last().val(l<2?"Download":"Export")});colorillo.showCentered(h);colorillo.showShade(h);
return false};colorillo.newLineDrawn=function(a){if(typeof a=="undefined"){return false}if(colorillo.drawers!==false){if(typeof colorillo.drawers[a]=="undefined"){colorillo.drawers[a]=true;colorillo.drawerList.push(a)
}}colorillo.lines+=1;colorillo.updateDrawingInfo()};colorillo.updateDrawingInfo=function(){if(colorillo.drawers){$("span.drawers").text(colorillo.drawerList.length);$("span.drawer-noun").text(colorillo.drawerList.length==1?"person":"people")
}$("span.lines-drawn").text(colorillo.lines)};var waiting={},timeout={};var showStatus=function(b,a,c){if(typeof a=="undefined"){a="ok"}if(timeout[b]){clearTimeout(timeout[b])}if(typeof c=="undefined"||waiting[b]==c){$("#"+b).closest("td").find("div.loading div.img").hide()
}else{return}if(a=="ok"){$("#status_"+b).text(a)[0].className="green"}else{$("#status_"+b).text(a)[0].className="red"}};if(typeof colorillo=="undefined"){colorillo={}}colorillo.isEmail=function(a){var b=/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/;
return b.test(a)};colorillo.isTwitter=function(a){var b=/^[a-zA-Z0-9_-]+$/;return b.test(a)};colorillo.errorBox=function(c,b,a){return colorillo.messageBox(c,b,a,"error")};colorillo.showShade=function(b){var a=$("div#shade");
a.unbind("click").click(function(){b.hide();a.hide()}).show()};colorillo.showCentered=function(f,e,d){if(typeof f=="undefined"){return false}var a=$(f),g={};if(typeof e=="undefined"){e=a.innerWidth()}else{g["min-width"]=e+"px"
}if(typeof d=="undefined"){d=a.innerHeight()}else{g["min-height"]=d+"px"}g.top=Math.floor(20+(500-d)/2)+"px";g.left=Math.floor(100+(800-e)/2)+"px";a.css(g).show().find("ul.c").each(function(){var c=0,b=0;
$(this).find("li:visible").each(function(){c+=$(this).outerWidth(true);b=Math.max(b,$(this).outerHeight(true))});if(c){this.style.width=c+"px"}if(b){this.style.height=b+"px"}})};colorillo.messageBox=function(f,e,a,c){if(typeof a=="undefined"||a<10){a=80
}if(typeof c=="undefined"){c=""}var d=$("#messagebox");if(d.length==0){$("#drawingarea").prepend('<div id="messagebox" class="messagebox"><div class="close">X</div><div class="title"></div><div class="text"></div></div>');
d=$("#messagebox")}if($("div#shade").length==0){$("body").append('<div id="shade"></div>')}var b=function(){d.hide();$("div#shade").hide();$(window).focus()};d[0].className="messagebox";if(c){d.addClass(c)
}if(c=="error"){d.css("cursor","pointer").one("click",b)}else{d.css("cursor","auto").find("div.close").one("click",b)}d.find("div.title").text(f).end().find("div.text").html(e).end();colorillo.showCentered(d,400,a)
};colorillo.promptBox=function(e,f,a,c){if(typeof a=="undefined"){a=""}if(typeof c=="undefined"){c=100}var d=$("#promptbox");if(d.length==0){$("#drawingarea").prepend('<div id="promptbox" class="messagebox"><div class="title"></div><input type="text" id="prompt" value="" /><div class="buttons"><div class="cancel">Cancel</div><div class="ok">OK</div></div></div>');
d=$("#promptbox")}if($("div#shade").length==0){$("body").append('<div id="shade"></div>')}var b=function(){d.hide();$("div#shade").hide();$(window).focus()};d.find("div.title").text(e).end().find("div.cancel").unbind("click").click(b).end().find("div.ok").unbind("click").click(function(g){b();
f(d.find("input#prompt").val());f=null;return true}).end().find("input#prompt").attr("maxlength",c).val(a).unbind("keyup").keyup(function(h){if(h.metaKey||h.ctrlKey){return true}if($(h.target).is(":hidden")){return true
}var g=(h==null)?event.keyCode:h.which;if(g==13){d.find("div.ok").click();return false}return true});colorillo.showCentered(d,300,80);colorillo.showShade(d);$(window).focus();d.find("input#prompt").select().focus()
};colorillo.updateTimeLeft=function(a){function a(h,c){if(typeof c=="undefined"){c=true}var e=false;if(h<0){h=-h;e=true}var b,j,g=[];if(h>=86400){j=Math.floor(h/86400);b=j+" d"+(c?"":"ay");if(!c&&j>1){b+="s"
}g.push(b);h-=j*86400}if(h>=3600){j=Math.floor(h/3600);b=j+" h"+(c?"r":"our");if(j>1){b+="s"}g.push(b);h-=j*3600}if(h>=60){j=Math.floor(h/60);b=j+" min"+(c?"":"ute");if(j>1){b+="s"}g.push(b);h-=j*60}if(g.length==0){if(!h){g.push("just before")
}else{g.push(parseInt(h,10)+"s")}}var d="";j="";for(var f=g.length-1;f>=0;f--){d=g[f]+j+d;j=(c||j)?", ":" and "}return d+(e?" ago":"")}$("span.timeLeft").each(function(){var e=$(this);var b=e.attr("t").split(",");
var d=new Date;d.setUTCHours(parseInt(b[3],10));d.setUTCMinutes(parseInt(b[4],10));d.setUTCSeconds(parseInt(b[5],10));d.setUTCMonth(0);d.setUTCFullYear(b[0]);d.setUTCDate(parseInt(b[2],10));d.setUTCMonth(parseInt(b[1],10)-1);
var c=(d.getTime()-new Date)/1000;$(this).text(a(c,!e.hasClass("long")))})};setInterval(colorillo.updateTimeLeft,30000);colorillo.highlightColorButton=function(d){var b=[],a=0;if(d){var c=colorillo.normalizeColor(d);
b=$("div.color-"+c.substr(1));if(b.length){b.addClass("selected").siblings().removeClass("selected").end().each(function(e){if($(this).closest("#simplecolors").length){a|=1;return}if($(this).closest("#colorhistory").length){a|=2;
return}})}}if(b.length==0){$("#simplecolors div, #colorhistory div").removeClass("selected")}return a};if(typeof colorillo.startApp=="undefined"){colorillo.startApp=function(){$("div.button.eyeDropper").click(function(){colorillo.changeTool("eyeDropper")
})}}colorillo.updateToolInterface=function(b,f,d){var c=true;switch(b){case"eyeDropper":$("div.button.eyeDropper").addClass("selected");$("div.button.lineWidth").removeClass("selected");c=typeof f!="undefined";
break;case"nochange":break;case"pen":c=false;b=colorillo.lineWidth();default:$("#size"+b).addClass("selected").siblings().removeClass("selected");$("div.button.eyeDropper").removeClass("selected");break
}if(f){var a=colorillo.highlightColorButton(f)&1;if(typeof colorswitch!="undefined"&&colorswitch){if(!a&&$(colorswitch).find("option:selected")[0].className=="simplecolors"){$(colorswitch).val($(colorswitch).find("option.advancedcolors").text()).change()
}}var e=colorillo.normalizeColor(f);if(typeof farbtastic=="object"){farbtastic.setColor(e)}}if(b&&$().slider){$("#brushsize").slider("value",b)}if(d){$("#currentcolor").css("opacity",(d/100).toFixed(2));
if($().slider){$("#opacity").slider("value",d)}}return c};
