This repository has been archived on 2018-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
node-task/public/js/ink.min.map

1 line
639 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":"ink.min.js","sources":["../../src/js/Ink/1/lib.js","../../src/js/Ink/Net/Ajax/1/lib.js","../../src/js/Ink/Net/JsonP/1/lib.js","../../src/js/Ink/Dom/Browser/1/lib.js","../../src/js/Ink/Dom/Css/1/lib.js","../../src/js/Ink/Dom/Element/1/lib.js","../../src/js/Ink/Dom/Event/1/lib.js","../../src/js/Ink/Dom/FormSerialize/1/lib.js","../../src/js/Ink/Dom/Loaded/1/lib.js","../../src/js/Ink/Dom/Selector/1/lib.js","../../src/js/Ink/Util/Array/1/lib.js","../../src/js/Ink/Util/BinPack/1/lib.js","../../src/js/Ink/Util/Cookie/1/lib.js","../../src/js/Ink/Util/Date/1/lib.js","../../src/js/Ink/Util/Dumper/1/lib.js","../../src/js/Ink/Util/I18n/1/lib.js","../../src/js/Ink/Util/Json/1/lib.js","../../src/js/Ink/Util/String/1/lib.js","../../src/js/Ink/Util/Url/1/lib.js","../../src/js/Ink/Util/Validator/1/lib.js"],"names":["window","document","paths","modules","modulesLoadOrder","modulesRequested","pendingRMs","modulesWaitingForDeps","apply","Function","prototype","isEmptyObject","o","k","hasOwnProperty","Ink","VERSION","_checkPendingRequireModules","I","F","dep","mod","cb","pRMs","length","left","args","remaining","push","setTimeout","getPath","key","noLib","split","curKey","i","root","path","slice","join","test","setPath","rootURI","replace","loadScript","uri","contentType","indexOf","givenUri","this","Error","scriptEl","createElement","setAttribute","onerror","onreadystatechange","ev","event","type","readyState","error","aHead","getElementsByTagName","appendChild","_loadLater","namespace","ns","returnParentAndKey","levels","nsobj","parent","f","getModule","version","createModule","ver","deps","modFn","modAll","Array","call","arguments","moduleContent","_version","isInkModule","t","requireModules","cbFn","undefined","_moduleRenames","warn","Ink.UI.Aux_1","getModulesLoadOrder","getModuleScripts","mlo","unshift","map","m","getModuleURL","createExt","moduleName","dependencies","bind","fn","context","innerArgs","finalArgs","concat","bindMethod","object","methodName","bindEvent","id","getElementById","ss","rule","from","Dom","Selector","select","s","extendObj","destination","sources","len","property","Object","log","console","Ajax","url","options","init","globalOptions","parameters","requestHeaders","xMLHttpRequestWithCredentials","XMLHttpRequest","userOptions","asynchronous","method","timeout","delay","postBody","onComplete","onSuccess","onFailure","onException","onHeaders","onCreate","onInit","onTimeout","sanitizeJSON","evalJS","xhrProxy","cors","debug","useCredentials","signRequest","globalParameters","paramsObjToStr","safeCall","urlLocation","_locationFromURL","isHTTP","_locationIsHTTP","isCrossDomain","_locationIsCrossDomain","location","requestHasBody","search","transport","getTransport","request","createElementNS","href","protocol","match","widget","host","usingXDomainReq","XDomainRequest","ActiveXObject","e","setHeaders","headers","Accept","Accept-Language","navigator","language","X-Requested-With","X-Ink-Version","headerReqName","overrideMimeType","userAgent","Connection","headerName","setRequestHeader","optParams","p","a","params","toString","isNaN","encodeURIComponent","pop","setParams","getHeader","name","getResponseHeader","getAllHeaders","getAllResponseHeaders","getResponse","r","headerJSON","responseJSON","timeTaken","Date","startTime","requestedUrl","responseText","responseXML","status","statusText","abort","clearTimeout","delayTimeout","stoTimeout","ex","finish","runStateChange","rs","getTime","responseContent","response","curStatus","makeError","isSuccess","headerContentType","evalJSON","mimeType","xmlDoc","DOMParser","parseFromString","xml","destroy","listener","first","rethrow","exception","message","stacktrace","stack","value","nodeType","crossDomain","open","withCredentials","onload","send","code","isJSON","str","strJSON","sanitize","JSON","parse","eval","load","callback","ping","JsonP","failureObj","callbackParam","internalCallback","randVar","parseInt","Math","random","Net","_removeScriptTag","_addScriptTag","_addParamsToGet","hasQuestionMark","sep","pKey","pValue","parts","_getScriptContainer","headEls","scriptEls","rnd_seed","src","scriptCtn","_requestFailed","scriptUri","getAttribute","parentNode","removeChild","Browser","IE","GECKO","OPERA","SAFARI","KONQUEROR","CHROME","model","cssPrefix","domPrefix","detectBrowser","setDimensions","setReferrer","myWidth","myHeight","innerWidth","innerHeight","documentElement","clientWidth","clientHeight","body","windowWidth","windowHeight","referrer","escape","_sniffUserAgent","sAgent","toLowerCase","rVersion","re","RegExp","reVersion","alert","getCs","defaultView","getComputedStyle","Css","addRemoveClassName","elm","className","addRemState","addClassName","removeClassName","classList","add","hasClassName","remove","elmClassName","setClassName","all","has","contains","blinkClass","element","negate","Number","toggleClassName","forceAdd","toggle","setOpacity","val","style","opacity","filter","_camelCase","_","$1","toUpperCase","getStyle","currentStyle","charAt","css","parseFloat","setStyle","cssText","prop","styleFloat","cssFloat","show","forceDisplayProperty","display","hide","showHide","forceShow","_getRefTag","head","firstElementChild","child","firstChild","nextSibling","appendStyleTag","selector","force","styles","oldStyle","l","innerHTML","defStyle","refTag","styleStr","styleSheet","createTextNode","insertBefore","appendStylesheet","media","rel","_loadingCSSFiles","_loadedCSSFiles","appendStylesheetCb","cbs","linkEl","headEl","imgEl","_url","callbacks","decToHex","dec","normalizeTo2","rDec","gDec","g","bDec","b","rgb","hexToDec","hex","substr","getPropertyFromStylesheet","getRuleFromStylesheet","getPropertyFromStylesheet2","rules","getRulesFromStylesheet","x","sheet","ri","rf","styleSheets","si","sf","cssRules","selectorText","res","getPropertiesFromRule","props","steps","pre","pos","substring","borderTopLeftRadius","borderBottomRightRadius","borderTopRightRadius","borderBottomLeftRadius","changeFontSize","delta","op","minVal","maxVal","that","TypeError","el","els","fontSize","rect","elem","dimensions","getBoundingClientRect","top","offsetTop","offsetLeft","createContextualFragmentSupport","createRange","Range","createContextualFragment","deleteThisTbodyToken","browserCreatesTbodies","div","InkElement","isDOMElement","get","create","tag","properties","parEl","scrollTo","scrollIntoView","elmOffset","elmTop","elmLeft","offsetParent","y","offset","positionedOffset","valueTop","valueLeft","tagName","position","doc","ownerDocument","docElem","box","clientTop","clientLeft","scrollTop","pageYOffset","scrollLeft","pageXOffset","scroll","_getPropPx","cs","n","c","getPropertyValue","offset2","hasAttribute","attr","insertAfter","newElm","targetElm","insertTop","insertBottom","textContent","node","text","innerText","lastChild","childNodes","nodeValue","setTextContent","isLink","hasAttributeNS","isAncestorOf","ancestor","compareDocumentPosition","descendantOf","descendant","lastElementChild","previousSibling","nextElementSibling","sibling","previousElementSibling","elementWidth","offsetWidth","elementHeight","offsetHeight","elementLeft","elementTop","elementDimensions","outerDimensions","bbox","right","bottom","inViewport","opts","dims","partial","margin","viewportWidth","viewportHeight","isHidden","w","h","isVisible","clonePosition","cloneTo","cloneFrom","ellipsizeText","overflow","whiteSpace","textOverflow","findUpwardsHaving","boolTest","findUpwardsByClass","tst","cls","findUpwardsByTag","nodeName","findUpwardsById","findUpwardsBySelector","sel","matchesSelector","getChildrenText","removeIt","j","part","nodes","jLen","_trimString","String","data","trim","getSelectValues","selectEl","values","_normalizeData","d","data2","fillSelect","container","skipEmpty","defaultValue","containerEl","optionEl","fillRadios","insertAfterEl","splitEl","inputEl","checked","fillChecks","parentIndexOf","parentEl","childEl","idx","nextSiblings","elements","siblings","children","index","previousSiblings","childElementCount","_wrapElements","TABLE","html","TBODY","THEAD","TFOOT","TR","_getWrapper","wrapper","wrapFunc","tds","tbody","appendHTML","prependHTML","setHTML","wrap","target","nextNode","unwrap","wrapperSelector","replacement","replaceChild","removeTextNodeChildren","prevEl","toRemove","htmlToFragment","range","createDocumentFragment","selectNode","fragment","tempElement","current","InkDomSelector","dataset","attrs","attributes","curAttr","curAttrName","curAttrValue","total","moveCursorTo","setSelectionRange","createTextRange","collapse","moveEnd","moveStart","pageWidth","xScroll","scrollMaxX","scrollWidth","self","pageHeight","yScroll","scrollMaxY","scrollHeight","bean","definition","win","old","namespaceRegex","nameRegex","addEvent","removeEvent","W3C_MODEL","eventSupport","ONE","str2arr","isString","isFunction","standardNativeEvents","w3cNativeEvents","nativeEvents","hash","events","customEvents","isAncestor","check","related","relatedTarget","prefix","mouseenter","base","condition","mouseleave","mousewheel","Event","commonProps","mouseProps","mouseWheelProps","keyProps","textProps","touchProps","messageProps","stateProps","overOutRegex","typeFixers","reg","fix","newEvent","keyCode","which","rightClick","button","pageX","pageY","clientX","clientY","typeFixerMap","isNative","parentWindow","originalEvent","isBean","srcElement","fixer","preventDefault","returnValue","stopPropagation","cancelBubble","stop","stopped","stopImmediatePropagation","isImmediatePropagationStopped","clone","currentTarget","ne","targetElement","RegEntry","wrappedHandler","eargs","findTarget","eventElement","__beanDel","ft","handler","original","namespaces","customType","once","removeListener","eventType","inNamespaces","checkNamespaces","matches","checkElement","checkOriginal","checkHandler","registry","forAll","pfx","list","entries","entry","put","del","splice","removed","selectorEngine","setSelectorEngine","querySelectorAll","rootListener","propertyName","listeners","custom","attachEvent","detachEvent","rm","originalFn","orgType","handlers","delegate","array","fireListener","evt","createEvent","dispatchEvent","fireEvent","createEventObject","off","typeSpec","isTypeStr","on","types","delfn","one","fire","names","beanDel","noConflict","cleanup","CollectGarbage","InkEvent","KEY_BACKSPACE","KEY_TAB","KEY_RETURN","KEY_ESC","KEY_SPACE","KEY_LEFT","KEY_UP","KEY_RIGHT","KEY_DOWN","KEY_DELETE","KEY_HOME","KEY_END","KEY_PAGEUP","KEY_PAGEDOWN","KEY_INSERT","throttle","func","wait","lastCall","throttled","now","timeDiff","delegationTarget","fromElement","toElement","findElement","elmTagName","observe","eventName","callBack","useCapture","addEventListener","observeOnce","onceBack","stopObserving","observeMulti","observeDelegated","cursor","Selector_1","removeEventListener","cancel","stopDefault","pointer","pointerX","pointerY","touches","isLeftClick","isRightClick","isMiddleClick","getCharFromKeyboardEvent","changeCasing","fromCharCode","shiftOn","shiftKey","InkArray","isArrayIsh","obj","isArray","toArray","FormSerialize","serialize","form","out","emptyArrayToken","pairs","asPairs","emptyArray","forEach","pair","_resultsInArray","emit","serializeEl","multiple","didEmit","thisOption","inputs","_isSerialized","fillIn","map2","_objToPairs","_fillInPairs","groupBy","reduce","_fillInOne","firstOne","firstNodeName","firstType","isSelectMulti","_fillInBoolean","min","checkAttr","input","isChecked","inArray","Loaded","_contexts","run","cbQueue","done","checkState","_checkState","poll","_poll","ael","rem","det","wet","csf","alreadyLoaded","frameElement","doScroll","where","_ready","rnative","createCache","cache","keys","Expr","cacheLength","shift","markFunction","expando","assert","Sizzle","results","seed","groups","nid","newContext","newSelector","preferredDoc","setDocument","documentIsHTML","rquickExpr","exec","support","getElementsByClassName","qsa","rbuggyQSA","tokenize","rescape","toSelector","rsibling","qsaError","removeAttribute","rtrim","siblingCheck","cur","diff","sourceIndex","MAX_NEGATIVE","createInputPseudo","createButtonPseudo","createPositionalPseudo","argument","matchIndexes","parseOnly","matched","tokens","soFar","preFilters","cached","tokenCache","preFilter","rcomma","rcombinators","matchExpr","addCombinator","matcher","combinator","dir","checkNonElements","doneName","outerCache","dirkey","dirruns","cachedruns","elementMatcher","matchers","condense","unmatched","newUnmatched","mapped","setMatcher","postFilter","postFinder","postSelector","temp","preMap","postMap","preexisting","elems","multipleContexts","matcherIn","matcherOut","matcherFromTokens","checkContext","leadingRelative","relative","implicitRelative","matchContext","matchAnyContext","outermostContext","matcherFromGroupMatchers","elementMatchers","setMatchers","matcherCachedRuns","bySet","byElement","superMatcher","expandContext","setMatched","matchedCount","outermost","contextBackup","find","dirrunsUnique","uniqueSort","contexts","token","runescape","funescape","compile","setFilters","getText","isXML","recompare","sortInput","rbuggyMatches","classCache","compilerCache","hasDuplicate","sortOrder","strundefined","arr","push_native","whitespace","characterEncoding","identifier","operators","pseudos","rpseudo","ridentifier","ID","CLASS","NAME","TAG","ATTR","PSEUDO","CHILD","needsContext","rinputs","rheader","rattributeQuotes","escaped","high","createComment","getByName","pass","getElementsByName","sortDetached","div1","attrHandle","attrId","getAttributeNode","tmp","mozMatchesSelector","webkitMatchesSelector","oMatchesSelector","msMatchesSelector","disconnectedMatch","adown","bup","compare","aup","ap","bp","expr","ret","specified","msg","duplicates","detectDuplicates","sortStable","sort","selectors","createPseudo",">"," ","+","~","excess","unquoted","pattern","operator","result","what","last","simple","forward","ofType","nodeIndex","start","useCache","pseudo","not","lang","elemLang","focus","activeElement","hasFocus","tabIndex","enabled","disabled","selected","selectedIndex","empty","header","eq","even","odd","lt","gt","radio","checkbox","file","password","image","submit","reset","group","filters","arrayProto","testedObject","outKey","item","latestGroup","initial","sortMulti","constructor","keyValue","aKeys","shuffle","tmp1","rnd","floor","each","filtered","some","intersect","arr1","arr2","shared","J","convert","unique","lastIndexOf","newArr","step","insert","rLen","output","iLen","Packer","fit","blocks","block","findNode","splitNode","used","down","GrowingPacker","growNode","canGrowDown","canGrowRight","shouldGrowRight","shouldGrowDown","growRight","growDown","sorts","area","max","height","msort","width","maxside","criteria","BinPack","binPack","bl","packer","sorter","dims2","fitted","unfitted","filled","Cookie","cookie","_Cookie","aCookie","aItem","decodeURIComponent","set","expires","domain","secure","sName","sExpires","sPath","sDomain","sSecure","oDate","sDate","valueOf","nDate","expiresString","toGMTString","portClean","cookieName","expiresDate","InkDate","_months","_m","_iMonth","month","janeiro","jan","fevereiro","fev","março","mar","abril","abr","maio","mai","junho","jun","julho","jul","agosto","ago","setembro","outubro","novembro","nov","dezembro","dez","_wDays","_d","_iWeek","week","segunda","seg","terça","ter","quarta","qua","quinta","qui","sexta","sex","sábado","sáb","domingo","dom","_daysInMonth","_y","nDays","format","_date","iFormat","escapeChar","jsDate","jsFirstDay","jsThisDay","jsHour","jsDay","getDate","getDay","suffixes","suffix","UTC","getFullYear","getMonth","jsYearStart","days","ceil","jsMonth","getYear","jsYear","getHours","jsMinute","getMinutes","jsSecond","getSeconds","getTimezoneOffset","jsMinZone","jsMinutes","jsDayName","jsMonthName","str_date","mList","objIndex","year","day","dayY","dayW","hour","hourD","sec","msec","ampm","diffM","diffH","date","pattr","_haveDatetime","_haveYear","_haveYDay","_haveDay","_haveMonth","_haveMonthDay","_haveOnlyDay","_haveWDay","_haveWeek","_haveWeekWDay","_haveOnlyWDay","_validDate","_noDate","_haveHour12","_haveHour24","_haveHour","_haveMin","_haveSec","_haveMSec","_haveMoreM","_haveMoreS","_haveDiffM","_haveDiffH","dList","gmt","aux","Dumper","_tab","_formatParam","param","formated","_outputFormat","_getTabs","numberOfTabs","tabs","_i","dim","_typeof","printDump","write","returnDump","alertDump","windowDump","dumperwindow","close","pattrText","funcOrVal","I18n","dict","testMode","append","_dicts","_dict","_testMode","_lang","_gLang","bool","getKey","gLang","langGlobal","_gDict","pars","isObj","$2","$3","ntext","strSin","strPlur","count","ordinal","num","lastDig","ordDict","exceptions","byLastDigit","alias","_gDicts","appendGlobal","twoDigits","function_call","cx","dateToISOString","toISOString","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","toFixed","InkJson","_nativeJSON","_convertToUnicode","_escape","theString","\b","\t","\n","\f","\r","\"","\\","charCodeAt","_toUnicode","unicodeString","inInt","theUnicode","_stringifyValue","isFinite","toJSON","arrayString","objectString","stringify","convertToUnicode","reviver","walk","holder","v","lastIndex","SyntaxError","InkUtilString","_chars","_entities","_accentedChars","_accentedRemovedChars","_htmlUnsafeChars","<","&","'","ucFirst","string","firstWordOnly","replacer","stripTags","allowed","aAllowed","aNewAllowed","cleanedTag","strAllowed","reAllowed","aFoundTags","htmlEntitiesEncode","htmlEntitiesDecode","$0","utf8Encode","utfstring","shortString","words","resultstr","truncateString","utf8Decode","c2","c3","removeAccentedChars","newString","substrCount","haystack","needle","htmlEscapeUnsafe","chars","normalizeWhitespace","toUnicode","unescape","es","hexNum","escapeText","txt","whiteList","txt2","C","escapedCharRegex","unescapeText","strcmp","str1","str2","packetize","maxLen","sz","Url","_keyStr","getUrl","genQueryString","getQueryString","aParams","queryStr","aQueryStr","pairVar","getAnchor","anchor","getAnchorString","anchorStr","aAnchorStr","parseUrl","aURL","scheme","query","re1","re2","re3","regPort","tmpHost1","port","tmpHost2","tmpUserPass","user","urlObj","frag","hostname","currentScriptElement","aScripts","curScript","_debug","Validator","_countryCodes","_internacionalPT","_indicativosPT",21,22,231,232,233,234,235,236,238,239,241,242,243,244,245,249,251,252,253,254,255,256,258,259,261,262,263,265,266,268,269,271,272,273,274,275,276,277,278,279,281,282,283,284,285,286,289,291,292,295,296,91,93,96,92,707,760,800,808,30,"_internacionalCV","_indicativosCV",2,95,97,98,99,"_internacionalAO","_indicativosAO","_internacionalMZ","_indicativosMZ",82,84,"_internacionalTL","_indicativosTL",3,7,"_characterGroups","numbers","asciiAlpha","latin1Alpha","unicodeAlpha","space","dash","underscore","nicknamePunctuation","singleLineWhitespace","newline","asciiPunctuation","latin1Punctuation","unicodePunctuation","createRegExp","checkCharacterGroups","unicode","latin1","ascii","number","numb","inOptions","decimalSep","thousandSep","negative","decimalPlaces","maxDigits","returnNumber","maxExcl","minExcl","_isLeapYear","yearRegExp","_dateParsers","yyyy-mm-dd","parser","yyyy/mm/dd","yy-mm-dd","yy/mm/dd","dd-mm-yyyy","dd/mm/yyyy","dd-mm-yy","dd/mm/yy","_isValidDate","validOneOrTwo","email","emailValido","mail","full","reHTTP","reUrl","isPTPhone","phone","aInd","strInd","re351","reSpecialChars","reInt","reValid","isPortuguesePhone","isCVPhone","re238","isAOPhone","re244","isMZPhone","re258","isTLPhone","re670","isPhone","codPostal","cp1","cp2","returnBothResults","cPostalSep","cPostal4","cPostal3","parserCPostal","cPostal","isDate","dateStr","yearIndex","monthIndex","dayIndex","dateParser","separator","isColor","valid","keyword","hexa","rgba","hsl","hsla","isIP","ipType","_creditCardSpecs","default","luhn","american express","diners club","discover","jcb","maestro","mastercard","visa","_luhn","checksum","dbl","isCreditCard","creditCardType","ccLength"],"mappings":"CAME,SAASA,EAAQC,GAEf,YAGA,MAAI,OAASD,IAAb,CASA,GAAIE,MACAC,KACAC,KACAC,KACAC,KACAC,KAEAC,EAAQC,SAASC,UAAUF,MAG3BG,EAAgB,SAASC,GAEzB,GAAiB,gBAANA,GAAkB,OAAO,CACpC,KAAK,GAAIC,KAAKD,GACV,GAAIA,EAAEE,eAAeD,GACjB,OAAO,CAGf,QAAO,EAOXb,GAAOe,KACH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ink Core.\n * @module Ink_1\n * This module provides the necessary methods to create and load the modules using Ink.\n */\n\n;(function(window, document) {\n\n 'use strict';\n\n // skip redefinition of Ink core\n if ('Ink' in window) { return; }\n\n\n // internal data\n\n /*\n * NOTE:\n * invoke Ink.setPath('Ink', '/Ink/'); before requiring local modules\n */\n var paths = {};\n var modules = {};\n var modulesLoadOrder = [];\n var modulesRequested = {};\n var pendingRMs = [];\n var modulesWaitingForDeps = {};\n\n var apply = Function.prototype.apply;\n\n // auxiliary fns\n var isEmptyObject = function(o) {\n /*jshint unused:false */\n if (typeof o !== 'object') { return false; }\n for (var k in o) {\n if (o.hasOwnProperty(k)) {\n return false;\n }\n }\n return true;\n };\n\n /**\n * @namespace Ink_1\n */\n\n window.Ink = {\n VERSION: '3.0.5',\n _checkPendingRequireModules: function() {\n var I, F, o, dep, mod, cb, pRMs = [];\n for (I = 0, F = pendingRMs.length; I < F; ++I) {\n o = pendingRMs[I];\n\n if (!o) { continue; }\n\n for (dep in o.left) {\n if (o.left.hasOwnProperty(dep)) {\n mod = modules[dep];\n if (mod) {\n o.args[o.left[dep] ] = mod;\n delete o.left[dep];\n --o.remaining;\n }\n }\n }\n\n if (o.remaining > 0) {\n pRMs.push(o);\n }\n else {\n cb = o.cb;\n if (!cb) { continue; }\n delete o.cb; // to make sure I won't call this more than once!\n cb.apply(false, o.args);\n }\n }\n\n pendingRMs = pRMs;\n\n if (pendingRMs.length > 0) {\n setTimeout( function() { Ink._checkPendingRequireModules(); }, 0 );\n }\n },\n\n /**\n * Get the full path of a module.\n * This method looks up the paths given in setPath (and ultimately the default Ink's path).\n *\n * @method getPath\n * @param {String} key Name of the module you want to get the path\n * @param {Boolean} [noLib] Flag to skip appending 'lib.js' to the returned path.\n */\n getPath: function(key, noLib) {\n var split = key.split(/[._]/g);\n var curKey;\n var i;\n var root;\n var path;\n\n // Look for Ink.Dom.Element.1, Ink.Dom.Element, Ink.Dom, Ink in this order.\n for (i = split.length; i >= 0; i -= 1) {\n curKey = split.slice(0, i + 1).join('.'); // See comment in setPath\n if (paths[curKey]) {\n root = curKey;\n break;\n }\n }\n\n if (root in paths) {\n path = paths[root];\n } else {\n return null;\n }\n\n if (!/\\/$/.test(path)) {\n path += '/';\n }\n if (i < split.length) {\n // Add the rest of the path. For example, if we found\n // paths['Ink.Dom'] to be 'http://example.com/Ink/Dom/',\n // we now add '/Element/' to get the full path.\n path += split.slice(i + 1).join('/') + '/';\n }\n if (!noLib) {\n path += 'lib.js';\n }\n return path;\n },\n \n /**\n * Sets the URL path for a namespace.\n * Use this to customize where requireModules and createModule will load dependencies from.\n * This can be useful to set your own CDN for dynamic module loading or simply to change your module folder structure\n * \n * @method setPath\n *\n * @param {String} key Module or namespace\n * @param {String} rootURI Base URL path and schema to be appended to the module or namespace\n *\n * @example\n * Ink.setPath('Ink', 'http://my-cdn/Ink/');\n * Ink.setPath('Lol', 'http://my-cdn/Lol/');\n *\n * // Loads from http://my-cdn/Ink/Dom/Whatever/lib.js\n * Ink.requireModules(['Ink.Dom.Whatever'], function () { ... });\n * // Loads from http://my-cdn/Lol/Whatever/lib.js\n * Ink.requireModules(['Lol.Whatever'], function () { ... });\n */\n setPath: function(key, rootURI) {\n // Replacing version separator with dot because the difference\n // between a submodule and a version doesn't matter here.\n // It would also overcomplicate the implementation of getPath\n paths[key.replace(/_/, '.')] = rootURI;\n },\n\n /**\n * Loads a script URL.\n * This creates a `script` tag in the `head` of the document.\n * Reports errors by listening to 'error' and 'readystatechange' events.\n *\n * @method loadScript\n * @param {String} uri Can be an external URL or a module name\n * @param {String} [contentType]='text/javascript' The `type` attribute of the new script tag.\n */\n loadScript: function(uri, contentType) {\n /*jshint evil:true */\n\n if (uri.indexOf('/') === -1) {\n var givenUri = uri; // For the error message\n uri = this.getPath(uri);\n if (uri === null) {\n throw new Error('Could not load script \"' + givenUri + '\". ' +\n 'Path not found in the registry. Did you misspell ' +\n 'the name, or forgot to call setPath()?');\n }\n }\n\n var scriptEl = document.createElement('script');\n scriptEl.setAttribute('type', contentType || 'text/javascript');\n scriptEl.setAttribute('src', uri);\n\n scriptEl.onerror = scriptEl.onreadystatechange = function (ev) {\n ev = ev || window.event;\n if (ev.type === 'readystatechange' && scriptEl.readyState !== 'loaded') {\n // if not readyState == 'loaded' it's not an error.\n return;\n }\n Ink.error(['Failed to load script from ', uri, '.'].join(''));\n };\n // CHECK ON ALL BROWSERS\n /*if (document.readyState !== 'complete' && !document.body) {\n document.write( scriptEl.outerHTML );\n }\n else {*/\n var aHead = document.getElementsByTagName('head');\n if(aHead.length > 0) {\n aHead[0].appendChild(scriptEl);\n }\n //}\n },\n\n _loadLater: function (dep) {\n setTimeout(function () {\n if (modules[dep] || modulesRequested[dep] ||\n modulesWaitingForDeps[dep]) {\n return;\n }\n modulesRequested[dep] = true;\n Ink.loadScript(dep);\n }, 0);\n },\n\n /**\n * Defines a module namespace.\n *\n * @method namespace\n * @param {String} ns Namespace to define.\n * @param {Boolean} [returnParentAndKey] Flag to change the return value to an array containing the namespace parent and the namespace key\n * @return {Object|Array} Returns the created namespace object\n */\n namespace: function(ns, returnParentAndKey) {\n if (!ns || !ns.length) { return null; }\n\n var levels = ns.split('.');\n var nsobj = window;\n var parent;\n\n for (var i = 0, f = levels.length; i < f; ++i) {\n nsobj[ levels[i] ] = nsobj[ levels[i] ] || {};\n parent = nsobj;\n nsobj = nsobj[ levels[i] ];\n }\n\n if (returnParentAndKey) {\n return [\n parent,\n levels[i-1]\n ];\n }\n\n return nsobj;\n },\n\n /**\n * Loads a module.\n * A synchronous method to get the module from the internal registry.\n * It assumes the module is defined and loaded already!\n *\n * @method getModule\n * @param {String} mod Module name\n * @param {Number} [version] Version number of the module\n * @return {Object|Function} Module object or function, depending how the module is defined\n */\n getModule: function(mod, version) {\n var key = version ? [mod, '_', version].join('') : mod;\n return modules[key];\n },\n\n /**\n * Creates a new module. \n * Use this to wrap your code and benefit from the module loading used throughout the Ink library\n *\n * @method createModule\n * @param {String} mod Module name, separated by dots. Like Ink.Dom.Selector, Ink.UI.Modal\n * @param {Number} version Version number\n * @param {Array} deps Array of module names which are dependencies of the module being created. The order in which they are passed here will define the order they will be passed to the callback function.\n * @param {Function} modFn The callback function to be executed when all the dependencies are resolved. The dependencies are passed as arguments, in the same order they were declared. The function itself should return the module.\n * @sample Ink_1_createModule.html \n *\n */\n createModule: function(mod, ver, deps, modFn) { // define\n if (typeof mod !== 'string') {\n throw new Error('module name must be a string!');\n }\n\n // validate version correctness\n if (!(typeof ver === 'number' || (typeof ver === 'string' && ver.length > 0))) {\n throw new Error('version number missing!');\n }\n\n var modAll = [mod, '_', ver].join('');\n\n modulesWaitingForDeps[modAll] = true;\n\n var cb = function() {\n //console.log(['createModule(', mod, ', ', ver, ', [', deps.join(', '), '], ', !!modFn, ')'].join(''));\n\n // make sure module in not loaded twice\n if (modules[modAll]) {\n //console.warn(['Ink.createModule ', modAll, ': module has been defined already.'].join(''));\n return;\n }\n\n\n // delete related pending tasks\n delete modulesRequested[modAll];\n delete modulesRequested[mod];\n\n\n // run module's supplied factory\n var args = Array.prototype.slice.call(arguments);\n var moduleContent = modFn.apply(window, args);\n modulesLoadOrder.push(modAll);\n // console.log('** loaded module ' + modAll + '**');\n\n\n // set version\n if (typeof moduleContent === 'object') { // Dom.Css Dom.Event\n moduleContent._version = ver;\n }\n else if (typeof moduleContent === 'function') {\n moduleContent.prototype._version = ver; // if constructor\n moduleContent._version = ver; // if regular function\n }\n\n\n // add to global namespace...\n var isInkModule = mod.indexOf('Ink.') === 0;\n var t;\n if (isInkModule) {\n t = Ink.namespace(mod, true); // for mod 'Ink.Dom.Css', t[0] gets 'Ink.Dom' object and t[1] 'Css'\n }\n\n\n // versioned\n modules[ modAll ] = moduleContent; // in modules\n delete modulesWaitingForDeps[ modAll ];\n\n if (isInkModule) {\n t[0][ t[1] + '_' + ver ] = moduleContent; // in namespace\n }\n\n\n // unversioned\n modules[ mod ] = moduleContent; // in modules\n\n if (isInkModule) {\n if (isEmptyObject( t[0][ t[1] ] )) {\n t[0][ t[1] ] = moduleContent; // in namespace\n }\n // else {\n // console.warn(['Ink.createModule ', modAll, ': module has been defined already with a different version!'].join(''));\n // }\n }\n\n\n if (this) { // there may be pending requires expecting this module, check...\n Ink._checkPendingRequireModules();\n }\n };\n\n this.requireModules(deps, cb);\n },\n\n /**\n * Requires modules asynchronously \n * Use this to get modules, even if they're not loaded yet\n *\n * @method requireModules\n * @param {Array} deps Array of module names. The order in which they are passed here will define the order they will be passed to the callback function. \n * @param {Function} cbFn The callback function to be executed when all the dependencies are resolved. The dependencies are passed as arguments, in the same order they were declared.\n * @sample Ink_1_requireModules.html \n */\n requireModules: function(deps, cbFn) { // require\n //console.log(['requireModules([', deps.join(', '), '], ', !!cbFn, ')'].join(''));\n var i, f, o, dep, mod;\n f = deps && deps.length;\n o = {\n args: new Array(f),\n left: {},\n remaining: f,\n cb: cbFn\n };\n\n if (!(typeof deps === 'object' && deps.length !== undefined)) {\n throw new Error('Dependency list should be an array!');\n }\n if (typeof cbFn !== 'function') {\n throw new Error('Callback should be a function!');\n }\n\n for (i = 0; i < f; ++i) {\n if (Ink._moduleRenames[deps[i]]) {\n Ink.warn(deps[i] + ' was renamed to ' + Ink._moduleRenames[deps[i]]);\n dep = Ink._moduleRenames[deps[i]];\n } else {\n dep = deps[i];\n }\n\n // Because trailing commas in oldIE bring us undefined values here\n if (!dep) {\n --o.remaining;\n continue;\n }\n\n mod = modules[dep];\n if (mod) {\n o.args[i] = mod;\n --o.remaining;\n continue;\n }\n else if (!modulesRequested[dep]) {\n Ink._loadLater(dep);\n }\n o.left[dep] = i;\n }\n\n if (o.remaining > 0) {\n pendingRMs.push(o);\n }\n else {\n cbFn.apply(true, o.args);\n }\n },\n\n _moduleRenames: {\n 'Ink.UI.Aux_1': 'Ink.UI.Common_1'\n },\n\n /**\n * Lists loaded module names.\n * The list is ordered by loaded time (oldest module comes first)\n *\n * @method getModulesLoadOrder\n * @return {Array} returns the order in which modules were resolved and correctly loaded\n */\n getModulesLoadOrder: function() {\n return modulesLoadOrder.slice();\n },\n\n /**\n * Builds the markup needed to load the modules.\n * This method builds the script tags needed to load the currently used modules\n * \n * @method getModuleScripts\n * @uses getModulesLoadOrder\n * @return {String} The script markup\n */\n getModuleScripts: function() {\n var mlo = this.getModulesLoadOrder();\n mlo.unshift('Ink_1');\n mlo = mlo.map(function(m) {\n return ['<scr', 'ipt type=\"text/javascript\" src=\"', Ink.getModuleURL(m), '\"></scr', 'ipt>'].join('');\n });\n\n return mlo.join('\\n');\n },\n \n /**\n * Creates an Ink.Ext module\n *\n * Does exactly the same as createModule but creates the module in the Ink.Ext namespace\n *\n * @method createExt\n * @uses createModule\n * @param {String} moduleName Extension name\n * @param {String} version Extension version\n * @param {Array} dependencies Extension dependencies\n * @param {Function} modFn Function returning the extension\n * @sample Ink_1_createExt.html \n */\n createExt: function (moduleName, version, dependencies, modFn) {\n return Ink.createModule('Ink.Ext.' + moduleName, version, dependencies, modFn);\n },\n\n /**\n * Function.prototype.bind alternative.\n * Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.\n *\n * @method bind\n * @param {Function} fn The function \n * @param {Object} context The value to be passed as the this parameter to the target function when the bound function is called. If used as false, it preserves the original context and just binds the arguments.\n * @param {Any} [args*] Additional arguments will be sent to the original function as prefix arguments.\n * @return {Function}\n * @sample Ink_1_bind.html \n */\n bind: function(fn, context) {\n var args = Array.prototype.slice.call(arguments, 2);\n return function() {\n var innerArgs = Array.prototype.slice.call(arguments);\n var finalArgs = args.concat(innerArgs);\n return fn.apply(context === false ? this : context, finalArgs);\n };\n },\n\n /**\n * Function.prototype.bind alternative for class methods\n * Creates a new function that, when called, has this k\n * @method bindMethod\n * @uses bind\n * @param {Object} object The object that contains the method to bind\n * @param {String} methodName The name of the method that will be bound\n * @param {Any} [args*] Additional arguments will be sent to the new method as prefix arguments.\n * @return {Function}\n * @sample Ink_1_bindMethod.html \n */\n bindMethod: function (object, methodName) {\n return Ink.bind.apply(Ink,\n [object[methodName], object].concat([].slice.call(arguments, 2)));\n },\n\n /**\n * Function.prototype.bind alternative for event handlers.\n * Same as bind but keeps first argument of the call the original event.\n * Set \"context\" to `false` to preserve the original context of the function and just bind the arguments.\n *\n * @method bindEvent\n * @param {Function} fn The function \n * @param {Object} context The value to be passed as the this parameter to the target \n * @param {Any} [args*] Additional arguments will be sent to the original function as prefix arguments\n * @return {Function}\n * @sample Ink_1_bindEvent.html \n */\n bindEvent: function(fn, context) {\n var args = Array.prototype.slice.call(arguments, 2);\n return function(event) {\n var finalArgs = args.slice();\n finalArgs.unshift(event || window.event);\n return fn.apply(context === false ? this : context, finalArgs);\n };\n },\n\n /**\n * Alias to document.getElementById\n *\n * @method i\n * @param {String} id Element ID\n * @return {DOMElement}\n * @sample Ink_1_i.html \n */\n i: function(id) {\n if(!id) {\n throw new Error('Ink.i => id or element must be passed');\n }\n if(typeof(id) === 'string') {\n return document.getElementById(id);\n }\n return id;\n },\n\n /**\n * Alias for Ink.Dom.Selector\n *\n * @method ss\n * @uses Ink.Dom.Selector.select\n * @param {String} rule\n * @param {DOMElement} [from]\n * @return {Array} array of DOMElements\n * @sample Ink_1_ss.html \n */\n ss: function(rule, from)\n {\n if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') {\n throw new Error('This method requires Ink.Dom.Selector');\n }\n return Ink.Dom.Selector.select(rule, (from || document));\n },\n\n /**\n * Alias for Ink.Dom.Selector first result\n *\n * @method s\n * @uses Ink.Dom.Selector.select\n * @param {String} rule Selector string\n * @param {DOMElement} [from] Context element. If set to a DOM element, the rule will only look for descendants of this DOM Element.\n * @return {DOMElement}\n * @sample Ink_1_s.html \n */\n s: function(rule, from)\n {\n if(typeof(Ink.Dom) === 'undefined' || typeof(Ink.Dom.Selector) === 'undefined') {\n throw new Error('This method requires Ink.Dom.Selector');\n }\n return Ink.Dom.Selector.select(rule, (from || document))[0] || null;\n },\n\n /**\n * Extends an object with another\n * Copy all of the properties in one or more source objects over to the destination object, and return the destination object. It's in-order, so the last source will override properties of the same name in previous arguments.\n *\n * @method extendObj\n * @param {Object} destination The object that will receive the new/updated properties\n * @param {Object} source The object whose properties will be copied over to the destination object\n * @param {Object} [args*] Additional source objects. The last source will override properties of the same name in the previous defined sources\n * @return destination object, enriched with defaults from the sources\n * @sample Ink_1_extendObj.html \n */\n extendObj: function(destination/*, source... */) {\n var sources = [].slice.call(arguments, 1);\n\n for (var i = 0, len = sources.length; i < len; i++) {\n if (!sources[i]) { continue; }\n for (var property in sources[i]) {\n if(Object.prototype.hasOwnProperty.call(sources[i], property)) {\n destination[property] = sources[i][property];\n }\n }\n }\n\n return destination;\n },\n\n /**\n * Calls native console.log if available.\n *\n * @method log\n * @param {Any} [args*] Arguments to be evaluated\n * @sample Ink_1_log.html \n **/\n log: function () {\n // IE does not have console.log.apply in IE10 emulated mode\n var console = window.console;\n if (console && console.log) {\n apply.call(console.log, console, arguments);\n }\n },\n\n /**\n * Calls native console.warn if available.\n *\n * @method warn\n * @param {Any} [args*] Arguments to be evaluated\n * @sample Ink_1_warn.html \n **/\n warn: function () {\n // IE does not have console.log.apply in IE10 emulated mode\n var console = window.console;\n if (console && console.warn) {\n apply.call(console.warn, console, arguments);\n }\n },\n\n /**\n * Calls native console.error if available.\n *\n * @method error\n * @param {Any} [args*] Arguments to be evaluated\n * @sample Ink_1_error.html \n **/\n error: function () {\n // IE does not have console.log.apply in IE10 emulated mode\n var console = window.console;\n if (console && console.error) {\n apply.call(console.error, console, arguments);\n }\n }\n };\n\n\n // TODO for debug - to detect pending stuff\n /*\n var failCount = {}; // fail count per module name\n var maxFails = 3; // times\n var checkDelta = 0.5; //seconds\n\n var tmpTmr = setInterval(function() {\n var mk = Object.keys(modulesRequested);\n var l = mk.length;\n\n if (l > 0) {\n // console.log('** waiting for modules: ' + mk.join(', ') + ' **');\n\n for (var i = 0, f = mk.length, k, v; i < f; ++i) {\n k = mk[i];\n v = failCount[k];\n failCount[k] = (v === undefined) ? 1 : ++v;\n\n if (v >= maxFails) {\n console.error('** Loading of module ' + k + ' failed! **');\n delete modulesRequested[k];\n }\n }\n }\n else {\n // console.log('** Module loads complete. **');\n clearInterval(tmpTmr);\n }\n }, checkDelta*1000);\n */\n}(window, document));\n","/**\n * Cross Browser Ajax requests\n * @module Ink.Net.Ajax_1\n * @version 1\n */\n\nInk.createModule('Ink.Net.Ajax', '1', [], function() {\n\n 'use strict';\n\n /**\n * Creates a new XMLHttpRequest object\n *\n * @class Ink.Net.Ajax\n * @constructor\n *\n * @param {String} url Request URL\n * @param {Object} options Request options\n * @param {Boolean} [options.asynchronous]=true If false, the request synchronous.\n * @param {Boolean} [options.cors] Flag to activate CORS. Set this to true if you're doing a cross-origin request\n * @param {String} [options.method]='POST' HTTP request method. POST by default.\n * @param {Object|String} [options.parameters] Request parameters to be sent with the request\n * @param {Number} [options.timeout] Request timeout in seconds\n * @param {Number} [options.delay] Artificial delay. If the request is completed faster than this delay, wait the remaining time before executing the callbacks\n * @param {String} [options.postBody] POST request body. If not specified, it's filled with the contents from parameters\n * @param {String} [options.contentType] Content-type header to be sent. Defaults to 'application/x-www-form-urlencoded'\n * @param {Object} [options.requestHeaders] Key-value pairs for additional request headers\n * @param {Function} [options.onComplete] Callback executed after the request is completed, regardless of what happened during the request.\n * @param {Function} [options.onSuccess] Callback executed if the request is successful (requests with 2xx status codes)\n * @param {Function} [options.onFailure] Callback executed if the request fails (requests with status codes different from 2xx)\n * @param {Function} [options.onException] Callback executed if an exception occurs. Receives the exception as a parameter.\n * @param {Function} [options.onCreate] Callback executed after object initialization but before the request is made\n * @param {Function} [options.onInit] Callback executed before any initialization\n * @param {Function} [options.onTimeout] Callback executed if the request times out\n * @param {Boolean|String} [options.evalJS]=true If the request Content-type header is application/json, evaluates the response and populates responseJSON. Use 'force' if you want to force the response evaluation, no matter what Content-type it's using.\n * @param {Boolean} [options.sanitizeJSON] Flag to sanitize the content of responseText before evaluation\n * @param {String} [options.xhrProxy] URI for proxy service hosted on the same server as the web app, that can fetch documents from other domains. The service must pipe all input and output untouched (some input sanitization is allowed, like clearing cookies). e.g., requesting http://example.org/doc can become /proxy/http%3A%2F%2Fexample.org%2Fdoc The proxy service will be used for cross-domain requests, if set, else a network error is returned as exception.\n *\n * @sample Ink_Net_Ajax_1.html \n */\n var Ajax = function(url, options){\n\n // start of AjaxMock patch - uncomment to enable it\n /*var AM = SAPO.Communication.AjaxMock;\n if (AM && !options.inMock) {\n if (AM.autoRecordThisUrl && AM.autoRecordThisUrl(url)) {\n return new AM.Record(url, options);\n }\n if (AM.mockThisUrl && AM.mockThisUrl(url)) {\n return new AM.Play(url, options, true);\n }\n }*/\n // end of AjaxMock patch\n\n this.init(url, options);\n };\n\n /**\n * Options for all requests. These can then be overriden for individual ones.\n */\n Ajax.globalOptions = {\n parameters: {},\n requestHeaders: {}\n };\n\n\n // IE10 does not need XDomainRequest\n var xMLHttpRequestWithCredentials = 'XMLHttpRequest' in window && 'withCredentials' in (new XMLHttpRequest());\n\n\n\n Ajax.prototype = {\n\n init: function(url, userOptions) {\n if (!url) {\n throw new Error(\"WRONG_ARGUMENTS_ERR\");\n }\n var options = Ink.extendObj({\n asynchronous: true,\n method: 'POST',\n parameters: null,\n timeout: 0,\n delay: 0,\n postBody: '',\n contentType: 'application/x-www-form-urlencoded',\n requestHeaders: null,\n onComplete: null,\n onSuccess: null,\n onFailure: null,\n onException: null,\n onHeaders: null,\n onCreate: null,\n onInit: null,\n onTimeout: null,\n sanitizeJSON: false,\n evalJS: true,\n xhrProxy: '',\n cors: false,\n debug: false,\n useCredentials: false,\n signRequest: false\n }, Ajax.globalOptions);\n\n if (userOptions && typeof userOptions === 'object') {\n options = Ink.extendObj(options, userOptions);\n\n\n if (typeof userOptions.parameters === 'object') {\n options.parameters = Ink.extendObj(Ink.extendObj({}, Ajax.globalOptions.parameters), userOptions.parameters);\n } else if (userOptions.parameters !== null) {\n var globalParameters = this.paramsObjToStr(Ajax.globalOptions.parameters);\n if (globalParameters) {\n options.parameters = userOptions.parameters + '&' + globalParameters;\n }\n }\n\n options.requestHeaders = Ink.extendObj({}, Ajax.globalOptions.requestHeaders);\n options.requestHeaders = Ink.extendObj(options.requestHeaders, userOptions.requestHeaders);\n }\n\n this.options = options;\n\n this.safeCall('onInit');\n\n this.url = url;\n\n var urlLocation = this._locationFromURL(url);\n this.isHTTP = this._locationIsHTTP(urlLocation);\n this.isCrossDomain = this._locationIsCrossDomain(urlLocation, location);\n\n this.requestHasBody = options.method.search(/^get|head$/i) < 0;\n\n if(this.options.cors) {\n this.isCrossDomain = false;\n }\n\n this.transport = this.getTransport();\n\n this.request();\n },\n\n /**\n * Returns a location object from an URL\n *\n * @method _locationFromUrl\n * @param url\n * @private\n **/\n _locationFromURL: function (url) {\n var urlLocation = document.createElementNS ?\n document.createElementNS('http://www.w3.org/1999/xhtml', 'a') :\n document.createElement('a');\n urlLocation.href = url;\n return urlLocation;\n },\n\n /**\n * Checks whether a location is HTTP or HTTPS\n *\n * @method locationIsHttp\n * @param urlLocation\n * @private\n */\n _locationIsHTTP: function (urlLocation) {\n return urlLocation.protocol.match(/^https?:/i) ? true : false;\n },\n\n /**\n * Checks whether a location is cross-domain from another\n *\n * @method _locationIsCrossDomain\n * @param urlLocation {Location}\n * @param otherLocation {Location}\n */\n _locationIsCrossDomain: function (urlLocation, location) {\n location = location || window.location;\n if (!Ajax.prototype._locationIsHTTP(urlLocation) || location.protocol === 'widget:' || typeof window.widget === 'object') {\n return false;\n } else {\n return location.protocol !== urlLocation.protocol ||\n location.host.split(':')[0] !== urlLocation.host.split(':')[0];\n }\n },\n\n /**\n * Creates the appropriate XMLHttpRequest object\n *\n * @method getTransport\n * @return {Object} XMLHttpRequest object\n */\n getTransport: function()\n {\n /*global XDomainRequest:false, ActiveXObject:false */\n if (!xMLHttpRequestWithCredentials && this.options.cors && 'XDomainRequest' in window) {\n this.usingXDomainReq = true;\n return new XDomainRequest();\n }\n else if (typeof XMLHttpRequest !== 'undefined') {\n return new XMLHttpRequest();\n }\n else if (typeof ActiveXObject !== 'undefined') {\n try {\n return new ActiveXObject('Msxml2.XMLHTTP');\n } catch (e) {\n return new ActiveXObject('Microsoft.XMLHTTP');\n }\n } else {\n return null;\n }\n },\n\n /**\n * Set the necessary headers for an ajax request\n *\n * @method setHeaders\n * @param {String} url The url for the request\n */\n setHeaders: function()\n {\n if (this.transport) {\n try {\n var headers = {\n \"Accept\": \"text/javascript,text/xml,application/xml,application/xhtml+xml,text/html,application/json;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1\",\n \"Accept-Language\": navigator.language,\n \"X-Requested-With\": \"XMLHttpRequest\",\n \"X-Ink-Version\": \"2\"\n };\n if (this.options.cors) {\n if (!this.options.signRequest) {\n delete headers['X-Requested-With'];\n }\n delete headers['X-Ink-Version'];\n }\n\n if (this.options.requestHeaders && typeof this.options.requestHeaders === 'object') {\n for(var headerReqName in this.options.requestHeaders) {\n if (this.options.requestHeaders.hasOwnProperty(headerReqName)) {\n headers[headerReqName] = this.options.requestHeaders[headerReqName];\n }\n }\n }\n\n if (this.transport.overrideMimeType && (navigator.userAgent.match(/Gecko\\/(\\d{4})/) || [0,2005])[1] < 2005) {\n headers.Connection = 'close';\n }\n\n for (var headerName in headers) {\n if(headers.hasOwnProperty(headerName)) {\n this.transport.setRequestHeader(headerName, headers[headerName]);\n }\n }\n } catch(e) {}\n }\n },\n\n /**\n * Converts an object with parameters to a querystring\n *\n * @method paramsObjToStr\n * @param {Object|String} optParams parameters object\n * @return {String} querystring\n */\n paramsObjToStr: function(optParams) {\n var k, m, p, a, params = [];\n if (typeof optParams === 'object') {\n for (p in optParams){\n if (optParams.hasOwnProperty(p)) {\n a = optParams[p];\n if (Object.prototype.toString.call(a) === '[object Array]' && !isNaN(a.length)) {\n for (k = 0, m = a.length; k < m; k++) {\n params = params.concat([\n encodeURIComponent(p), '[]', '=',\n encodeURIComponent(a[k]), '&'\n ]);\n }\n }\n else {\n params = params.concat([\n encodeURIComponent(p), '=',\n encodeURIComponent(a), '&'\n ]);\n }\n }\n }\n if (params.length > 0) {\n params.pop();\n }\n }\n else\n {\n return optParams;\n }\n return params.join('');\n },\n\n /**\n * Set the url parameters for a GET request\n *\n * @method setParams\n */\n setParams: function()\n {\n var params = null, optParams = this.options.parameters;\n\n if(typeof optParams === \"object\"){\n params = this.paramsObjToStr(optParams);\n } else {\n params = '' + optParams;\n }\n\n if(params){\n if(this.url.indexOf('?') > -1) {\n this.url = this.url.split('#')[0] + '&' + params;\n } else {\n this.url = this.url.split('#')[0] + '?' + params;\n }\n }\n },\n\n /**\n * Gets an HTTP header from the response\n *\n * @method getHeader\n * @param {String} name Header name\n * @return {String} header Content\n */\n getHeader: function(name)\n {\n if (this.usingXDomainReq && name === 'Content-Type') {\n return this.transport.contentType;\n }\n try{\n return this.transport.getResponseHeader(name);\n } catch(e) {\n return null;\n }\n },\n\n /**\n * Gets all the HTTP headers from the response\n *\n * @method getAllHeaders\n * @return {String} The headers, each separated by a newline\n */\n getAllHeaders: function()\n {\n try {\n return this.transport.getAllResponseHeaders();\n } catch(e) {\n return null;\n }\n },\n\n /**\n * Sets the response object\n *\n * @method getResponse\n * @return {Object} the response object\n */\n getResponse: function(){\n // setup our own stuff\n var t = this.transport,\n r = {\n headerJSON: null,\n responseJSON: null,\n getHeader: this.getHeader,\n getAllHeaders: this.getAllHeaders,\n request: this,\n transport: t,\n timeTaken: new Date() - this.startTime,\n requestedUrl: this.url\n };\n\n // setup things expected from the native object\n r.readyState = t.readyState;\n try { r.responseText = t.responseText; } catch(e) {}\n try { r.responseXML = t.responseXML; } catch(e) {}\n try { r.status = t.status; } catch(e) { r.status = 0; }\n try { r.statusText = t.statusText; } catch(e) { r.statusText = ''; }\n\n return r;\n },\n\n /**\n * Aborts the request if still running. No callbacks are called\n *\n * @method abort\n */\n abort: function(){\n if (this.transport) {\n clearTimeout(this.delayTimeout);\n clearTimeout(this.stoTimeout);\n try { this.transport.abort(); } catch(ex) {}\n this.finish();\n }\n },\n\n /**\n * Executes the state changing phase of an ajax request\n *\n * @method runStateChange\n */\n runStateChange: function()\n {\n var rs = this.transport.readyState;\n if (rs === 3) {\n if (this.isHTTP) {\n this.safeCall('onHeaders');\n }\n } else if (rs === 4 || this.usingXDomainReq) {\n\n if (this.options.asynchronous && this.options.delay && (this.startTime + this.options.delay > new Date().getTime())) {\n this.delayTimeout = setTimeout(Ink.bind(this.runStateChange, this), this.options.delay + this.startTime - new Date().getTime());\n return;\n }\n\n var responseJSON,\n responseContent = this.transport.responseText,\n response = this.getResponse(),\n curStatus = this.transport.status;\n\n if (this.isHTTP && !this.options.asynchronous) {\n this.safeCall('onHeaders');\n }\n\n clearTimeout(this.stoTimeout);\n\n if (curStatus === 0) {\n // Status 0 indicates network error for http requests.\n // For http less requests, 0 is always returned.\n if (this.isHTTP) {\n this.safeCall('onException', this.makeError(18, 'NETWORK_ERR'));\n } else {\n curStatus = responseContent ? 200 : 404;\n }\n }\n else if (curStatus === 304) {\n curStatus = 200;\n }\n var isSuccess = this.usingXDomainReq || 200 <= curStatus && curStatus < 300;\n\n var headerContentType = this.getHeader('Content-Type') || '';\n if (this.options.evalJS &&\n (headerContentType.indexOf(\"application/json\") >= 0 || this.options.evalJS === 'force')){\n try {\n responseJSON = this.evalJSON(responseContent, this.sanitizeJSON);\n if(responseJSON){\n responseContent = response.responseJSON = responseJSON;\n }\n } catch(e){\n if (isSuccess) {\n // If the request failed, then this is perhaps an error page\n // so don't notify error.\n this.safeCall('onException', e);\n }\n }\n }\n\n if (this.usingXDomainReq && headerContentType.indexOf('xml') !== -1 && 'DOMParser' in window) {\n // http://msdn.microsoft.com/en-us/library/ie/ff975278(v=vs.85).aspx\n var mimeType;\n switch (headerContentType) {\n case 'application/xml':\n case 'application/xhtml+xml':\n case 'image/svg+xml':\n mimeType = headerContentType;\n break;\n default:\n mimeType = 'text/xml';\n }\n var xmlDoc = (new DOMParser()).parseFromString( this.transport.responseText, mimeType);\n this.transport.responseXML = xmlDoc;\n response.responseXML = xmlDoc;\n }\n\n if (this.transport.responseXML !== null && response.responseJSON === null && this.transport.responseXML.xml !== \"\"){\n responseContent = this.transport.responseXML;\n }\n\n if (curStatus || this.usingXDomainReq) {\n if (isSuccess) {\n this.safeCall('onSuccess', response, responseContent);\n } else {\n this.safeCall('onFailure', response, responseContent);\n }\n this.safeCall('on'+curStatus, response, responseContent);\n }\n this.finish(response, responseContent);\n }\n },\n\n /**\n * Last step after XHR is complete. Call onComplete and cleanup object\n *\n * @method finish\n * @param {Any} response\n * @param {Any} responseContent\n */\n finish: function(response, responseContent){\n if (response) {\n this.safeCall('onComplete', response, responseContent);\n }\n clearTimeout(this.stoTimeout);\n\n if (this.transport) {\n // IE6 sometimes barfs on this one\n try{ this.transport.onreadystatechange = null; } catch(e){}\n\n if (typeof this.transport.destroy === 'function') {\n // Stuff for Samsung.\n this.transport.destroy();\n }\n\n // Let XHR be collected.\n this.transport = null;\n }\n },\n\n /**\n * Safely calls a callback function.\n * Verifies that the callback is well defined and traps errors\n *\n * @method safeCall\n * @param {Function} listener\n */\n safeCall: function(listener, first/*, second*/) {\n function rethrow(exception){\n setTimeout(function() {\n // Rethrow exception so it'll land in\n // the error console, firebug, whatever.\n if (exception.message) {\n exception.message += '\\n'+(exception.stacktrace || exception.stack || '');\n }\n throw exception;\n }, 1);\n }\n if (typeof this.options[listener] === 'function') {\n //SAPO.safeCall(this, this.options[listener], first, second);\n //return object[listener].apply(object, [].slice.call(arguments, 2));\n try {\n this.options[listener].apply(this, [].slice.call(arguments, 1));\n } catch(ex) {\n rethrow(ex);\n }\n } else if (first && window.Error && (first instanceof Error)) {\n rethrow(first);\n }\n },\n\n /**\n * Sets a new request header for the next http request\n *\n * @method setRequestHeader\n * @param {String} name\n * @param {String} value\n */\n setRequestHeader: function(name, value){\n if (!this.options.requestHeaders) {\n this.options.requestHeaders = {};\n }\n this.options.requestHeaders[name] = value;\n },\n\n /**\n * Executes the request\n *\n * @method request\n */\n request: function()\n {\n if(this.transport) {\n var params = null;\n if(this.requestHasBody) {\n if(this.options.postBody !== null && this.options.postBody !== '') {\n params = this.options.postBody;\n this.setParams();\n } else if (this.options.parameters !== null && this.options.parameters !== ''){\n params = this.options.parameters;\n }\n\n if (typeof params === \"object\" && !params.nodeType) {\n params = this.paramsObjToStr(params);\n } else if (typeof params !== \"object\" && params !== null){\n params = '' + params;\n }\n\n if(this.options.contentType) {\n this.setRequestHeader('Content-Type', this.options.contentType);\n }\n } else {\n this.setParams();\n }\n\n var url = this.url;\n var method = this.options.method;\n var crossDomain = this.isCrossDomain;\n\n if (crossDomain && this.options.xhrProxy) {\n this.setRequestHeader('X-Url', url);\n url = this.options.xhrProxy + encodeURIComponent(url);\n crossDomain = false;\n }\n\n try {\n this.transport.open(method, url, this.options.asynchronous);\n } catch(e) {\n this.safeCall('onException', e);\n return this.finish(this.getResponse(), null);\n }\n\n this.setHeaders();\n\n this.safeCall('onCreate');\n\n if(this.options.timeout && !isNaN(this.options.timeout)) {\n this.stoTimeout = setTimeout(Ink.bind(function() {\n if(this.options.onTimeout) {\n this.safeCall('onTimeout');\n this.abort();\n }\n }, this), (this.options.timeout * 1000));\n }\n\n if(this.options.useCredentials && !this.usingXDomainReq) {\n this.transport.withCredentials = true;\n }\n\n if(this.options.asynchronous && !this.usingXDomainReq) {\n this.transport.onreadystatechange = Ink.bind(this.runStateChange, this);\n }\n else if (this.usingXDomainReq) {\n this.transport.onload = Ink.bind(this.runStateChange, this);\n }\n\n try {\n if (crossDomain) {\n // Need explicit handling because Mozila aborts\n // the script and Chrome fails silently.per the spec\n throw this.makeError(18, 'NETWORK_ERR');\n } else {\n this.startTime = new Date().getTime();\n this.transport.send(params);\n }\n } catch(e) {\n this.safeCall('onException', e);\n return this.finish(this.getResponse(), null);\n }\n\n if(!this.options.asynchronous) {\n this.runStateChange();\n }\n }\n },\n\n /**\n * Returns a new exception object that can be thrown\n *\n * @method makeError\n * @param code Error Code\n * @param message Message\n * @returns {Object}\n */\n makeError: function(code, message){\n if (typeof Error !== 'function') {\n return {code: code, message: message};\n }\n var e = new Error(message);\n e.code = code;\n return e;\n },\n\n /**\n * Checks if a given string is valid JSON\n *\n * @method isJSON\n * @param {String} str String to be evaluated\n * @return {Boolean} True if the string is valid JSON\n */\n isJSON: function(str)\n {\n if (typeof str !== \"string\" || !str){ return false; }\n str = str.replace(/\\\\./g, '@').replace(/\"[^\"\\\\\\n\\r]*\"/g, '');\n return (/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(str);\n },\n\n /**\n * Evaluates a given string as JSON\n *\n * @method evalJSON\n * @param {String} str String to be evaluated\n * @param {Boolean} sanitize Flag to sanitize the content\n * @return {Object} JSON content as an object\n */\n evalJSON: function(strJSON, sanitize)\n {\n if (strJSON && (!sanitize || this.isJSON(strJSON))) {\n try {\n if (typeof JSON !== \"undefined\" && typeof JSON.parse !== 'undefined'){\n return JSON.parse(strJSON);\n }\n /*jshint evil:true */\n return eval('(' + strJSON + ')');\n } catch(e) {\n throw new Error('ERROR: Bad JSON string...');\n }\n }\n return null;\n }\n };\n\n /**\n * Loads content from a given url through an XMLHttpRequest.\n *\n * Shortcut function for simple AJAX use cases. Works with JSON, XML and plain text.\n *\n * @method load\n * @param {String} url Request URL\n * @param {Function} callback Callback to be executed if the request is successful\n * @return {Object} XMLHttpRequest object\n *\n * @sample Ink_Net_Ajax_load.html \n */\n Ajax.load = function(url, callback){\n return new Ajax(url, {\n method: 'GET',\n onSuccess: function(response){\n callback(response.responseJSON || response.responseText, response);\n }\n });\n };\n\n /**\n * Loads content from a given url through an XMLHttpRequest.\n * Shortcut function for simple AJAX use cases.\n *\n * @method ping\n * @param {String} url Request url\n * @param {Function} callback Callback to be executed if the request is successful\n * @return {Object} XMLHttpRequest object\n */\n Ajax.ping = function(url, callback){\n return new Ajax(url, {\n method: 'HEAD',\n onSuccess: function(response){\n if (typeof callback === 'function'){\n callback(response);\n }\n }\n });\n };\n\n\n return Ajax;\n});\n","/**\n * Cross Browser JsonP requests\n * @module Ink.Net.JsonP_1\n * @version 1\n */\n\nInk.createModule('Ink.Net.JsonP', '1', [], function() {\n\n 'use strict';\n\n /**\n * Executes a JSONP request\n *\n * @class Ink.Net.JsonP\n * @constructor\n *\n * @param {String} uri Request URL\n * @param {Object} options Request options\n * @param {Function} options.onSuccess Success callback\n * @param {Function} [options.onFailure] Failure callback\n * @param {Object} [options.failureObj] Object to be passed as argument to failure callback\n * @param {Number} [options.timeout] Timeout for request fail, in seconds. defaults to 10\n * @param {Object} [options.params] Object with the parameters and respective values to unfold\n * @param {String} [options.callbackParam] Parameter to use as callback. defaults to 'jsoncallback'\n * @param {String} [options.internalCallback] Name of the callback function stored in the Ink.Net.JsonP object.\n * @param {String} [options.randVar] (Advanced, not recommended unless you know what you're doing) A string to append to the callback name. By default, generate a random number. Use an empty string if you already passed the correct name in the internalCallback option.\n *\n * @sample Ink_Net_JsonP_1.html \n */\n var JsonP = function(uri, options) {\n this.init(uri, options);\n };\n\n JsonP.prototype = {\n\n init: function(uri, options) {\n this.options = Ink.extendObj( {\n onSuccess: undefined,\n onFailure: undefined,\n failureObj: {},\n timeout: 10,\n params: {},\n callbackParam: 'jsoncallback',\n internalCallback: '_cb',\n randVar: false\n }, options || {});\n\n if(this.options.randVar !== false) {\n this.randVar = this.options.randVar;\n } else {\n this.randVar = parseInt(Math.random() * 100000, 10);\n }\n\n this.options.internalCallback += this.randVar;\n\n this.uri = uri;\n\n // prevent SAPO legacy onComplete - make it onSuccess\n if(typeof(this.options.onComplete) === 'function') {\n this.options.onSuccess = this.options.onComplete;\n }\n\n if (typeof this.uri !== 'string') {\n throw 'Please define an URI';\n }\n\n if (typeof this.options.onSuccess !== 'function') {\n throw 'please define a callback function on option onSuccess!';\n }\n\n Ink.Net.JsonP[this.options.internalCallback] = Ink.bind(function() {\n window.clearTimeout(this.timeout);\n delete window.Ink.Net.JsonP[this.options.internalCallback];\n this._removeScriptTag();\n this.options.onSuccess(arguments[0]);\n }, this);\n\n this._addScriptTag();\n },\n\n _addParamsToGet: function(uri, params) {\n var hasQuestionMark = uri.indexOf('?') !== -1;\n var sep, pKey, pValue, parts = [uri];\n\n for (pKey in params) {\n if (params.hasOwnProperty(pKey)) {\n if (!hasQuestionMark) { sep = '?'; hasQuestionMark = true; }\n else { sep = '&'; }\n pValue = params[pKey];\n if (typeof pValue !== 'number' && !pValue) { pValue = ''; }\n parts = parts.concat([sep, pKey, '=', encodeURIComponent(pValue)]);\n }\n }\n\n return parts.join('');\n },\n\n _getScriptContainer: function() {\n var headEls = document.getElementsByTagName('head');\n if (headEls.length === 0) {\n var scriptEls = document.getElementsByTagName('script');\n return scriptEls[0];\n }\n return headEls[0];\n },\n\n _addScriptTag: function() {\n // enrich options will callback and random seed\n this.options.params[this.options.callbackParam] = 'Ink.Net.JsonP.' + this.options.internalCallback;\n this.options.params.rnd_seed = this.randVar;\n this.uri = this._addParamsToGet(this.uri, this.options.params);\n // create script tag\n var scriptEl = document.createElement('script');\n scriptEl.type = 'text/javascript';\n scriptEl.src = this.uri;\n var scriptCtn = this._getScriptContainer();\n scriptCtn.appendChild(scriptEl);\n this.timeout = setTimeout(Ink.bind(this._requestFailed, this), (this.options.timeout * 1000));\n },\n\n _requestFailed : function () {\n delete Ink.Net.JsonP[this.options.internalCallback];\n this._removeScriptTag();\n if(typeof this.options.onFailure === 'function'){\n this.options.onFailure(this.options.failureObj);\n }\n },\n\n _removeScriptTag: function() {\n var scriptEl;\n var scriptEls = document.getElementsByTagName('script');\n var scriptUri;\n for (var i = 0, f = scriptEls.length; i < f; ++i) {\n scriptEl = scriptEls[i];\n scriptUri = scriptEl.getAttribute('src') || scriptEl.src;\n if (scriptUri !== null && scriptUri === this.uri) {\n scriptEl.parentNode.removeChild(scriptEl);\n return;\n }\n }\n }\n\n };\n\n return JsonP;\n\n});\n","/**\n * Browser Detection and User Agent sniffing\n * @module Ink.Dom.Browser_1\n * @version 1\n */\nInk.createModule('Ink.Dom.Browser', '1', [], function() {\n 'use strict'; \n\n /**\n * @namespace Ink.Dom.Browser\n * @version 1\n * @static\n * @example\n * <script>\n * Ink.requireModules(['Ink.Dom.Browser_1'],function( InkBrowser ){\n * if( InkBrowser.CHROME ){\n * console.log( 'This is a CHROME browser.' );\n * }\n * });\n * </script>\n */\n var Browser = {\n /**\n * True if the browser is Internet Explorer\n *\n * @property IE\n * @type {Boolean}\n * @public\n * @static\n */\n IE: false,\n\n /**\n * True if the browser is Gecko based\n *\n * @property GECKO\n * @type {Boolean}\n * @public\n * @static\n */\n GECKO: false,\n\n /**\n * True if the browser is Opera\n *\n * @property OPERA\n * @type {Boolean}\n * @public\n * @static\n */\n OPERA: false,\n\n /**\n * True if the browser is Safari\n *\n * @property SAFARI\n * @type {Boolean}\n * @public\n * @static\n */\n SAFARI: false,\n\n /**\n * True if the browser is Konqueror\n *\n * @property KONQUEROR\n * @type {Boolean}\n * @public\n * @static\n */\n KONQUEROR: false,\n\n /**\n * True if browser is Chrome\n *\n * @property CHROME\n * @type {Boolean}\n * @public\n * @static\n */\n CHROME: false,\n\n /**\n * The specific browser model.\n * False if it is unavailable.\n *\n * @property model\n * @type {Boolean|String}\n * @public\n * @static\n */\n model: false,\n\n /**\n * The browser version.\n * False if it is unavailable.\n *\n * @property version\n * @type {Boolean|String}\n * @public\n * @static\n */\n version: false,\n\n /**\n * The user agent string.\n * False if it is unavailable.\n *\n * @property userAgent\n * @type {Boolean|String}\n * @public\n * @static\n */\n userAgent: false,\n\n /**\n * The CSS prefix (-moz-, -webkit-, -ms-, ...)\n * False if it is unavailable \n *\n * @property cssPrefix \n * @type {Boolean|String}\n * @public \n * @static \n */\n cssPrefix: false, \n\n /**\n * The DOM prefix (Moz, Webkit, ms, ...)\n * False if it is unavailable \n * @property domPrefix \n * @type {Boolean|String}\n * @public \n * @static \n */\n domPrefix: false,\n\n /**\n * Initialization function for the Browser object.\n *\n * Is called automatically when this module is loaded, and calls setDimensions, setBrowser and setReferrer.\n *\n * @method init\n * @public\n */\n init: function() {\n this.detectBrowser();\n this.setDimensions();\n this.setReferrer();\n },\n\n /**\n * Retrieves and stores window dimensions in this object. Called automatically when this module is loaded.\n *\n * @method setDimensions\n * @public\n */\n setDimensions: function() {\n //this.windowWidth=window.innerWidth !== null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body !== null ? document.body.clientWidth : null;\n //this.windowHeight=window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;\n var myWidth = 0, myHeight = 0;\n if ( typeof window.innerWidth=== 'number' ) {\n myWidth = window.innerWidth;\n myHeight = window.innerHeight;\n } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {\n myWidth = document.documentElement.clientWidth;\n myHeight = document.documentElement.clientHeight;\n } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {\n myWidth = document.body.clientWidth;\n myHeight = document.body.clientHeight;\n }\n this.windowWidth = myWidth;\n this.windowHeight = myHeight;\n },\n\n /**\n * Stores the referrer. Called automatically when this module is loaded.\n *\n * @method setReferrer\n * @public\n */\n setReferrer: function() {\n if (document.referrer && document.referrer.length) {\n this.referrer = window.escape(document.referrer);\n } else {\n this.referrer = false;\n }\n },\n\n /**\n * Detects the browser and stores the found properties. Called automatically when this module is loaded.\n *\n * @method detectBrowser\n * @public\n */\n detectBrowser: function() {\n this._sniffUserAgent(navigator.userAgent);\n },\n\n _sniffUserAgent: function (sAgent) {\n this.userAgent = sAgent;\n\n sAgent = sAgent.toLowerCase();\n\n if (/applewebkit\\//.test(sAgent)) {\n this.cssPrefix = '-webkit-';\n this.domPrefix = 'Webkit';\n if(/(chrome|crios)\\//.test(sAgent)) {\n // Chrome\n this.CHROME = true;\n this.model = 'chrome';\n this.version = sAgent.replace(/(.*)chrome\\/([^\\s]+)(.*)/, \"$2\");\n } else {\n // Safari\n this.SAFARI = true;\n this.model = 'safari';\n var rVersion = /version\\/([^) ]+)/;\n if (rVersion.test(sAgent)) {\n this.version = sAgent.match(rVersion)[1];\n } else {\n this.version = sAgent.replace(/(.*)applewebkit\\/([^\\s]+)(.*)/, \"$2\");\n }\n }\n } else if (/opera/.test(sAgent)) {\n // Opera\n this.OPERA = true;\n this.model = 'opera';\n this.version = sAgent.replace(/(.*)opera.([^\\s$]+)(.*)/, \"$2\");\n this.cssPrefix = '-o-';\n this.domPrefix = 'O';\n } else if (/konqueror/.test(sAgent)) {\n // Konqueroh\n this.KONQUEROR = true;\n this.model = 'konqueror';\n this.version = sAgent.replace(/(.*)konqueror\\/([^;]+);(.*)/, \"$2\");\n this.cssPrefix = '-khtml-';\n this.domPrefix = 'Khtml';\n } else if (/(msie|trident)/i.test(sAgent)) {\n // MSIE\n this.IE = true;\n this.model = 'ie';\n if (/rv:((?:\\d|\\.)+)/.test(sAgent)) { // IE 11\n this.version = sAgent.match(/rv:((?:\\d|\\.)+)/)[1];\n } else {\n this.version = sAgent.replace(/(.*)\\smsie\\s([^;]+);(.*)/, \"$2\");\n }\n this.cssPrefix = '-ms-';\n this.domPrefix = 'ms';\n } else if (/gecko/.test(sAgent)) {\n // GECKO\n // Supports only:\n // Camino, Chimera, Epiphany, Minefield (firefox 3), Firefox, Firebird, Phoenix, Galeon,\n // Iceweasel, K-Meleon, SeaMonkey, Netscape, Songbird, Sylera,\n this.cssPrefix = '-moz-';\n this.domPrefix = 'Moz';\n\n this.GECKO = true;\n\n var re = /(camino|chimera|epiphany|minefield|firefox|firebird|phoenix|galeon|iceweasel|k\\-meleon|seamonkey|netscape|songbird|sylera)/;\n if(re.test(sAgent)) {\n this.model = sAgent.match(re)[1];\n this.version = sAgent.replace(new RegExp(\"(.*)\"+this.model+\"\\/([^;\\\\s$]+)(.*)\"), \"$2\");\n } else {\n // probably is mozilla\n this.model = 'mozilla';\n var reVersion = /(.*)rv:([^)]+)(.*)/;\n if(reVersion.test(sAgent)) {\n this.version = sAgent.replace(reVersion, \"$2\");\n }\n }\n }\n },\n\n /**\n * Debug function which displays browser (and Ink.Dom.Browser) information as an alert message.\n *\n * @method debug\n * @public\n * @sample Ink_Dom_Browser_1_debug.html\n */\n debug: function() {\n /*global alert:false */\n var str = \"known browsers: (ie, gecko, opera, safari, konqueror) \\n\";\n str += [this.IE, this.GECKO, this.OPERA, this.SAFARI, this.KONQUEROR] +\"\\n\";\n str += \"cssPrefix -> \"+this.cssPrefix+\"\\n\";\n str += \"domPrefix -> \"+this.domPrefix+\"\\n\";\n str += \"model -> \"+this.model+\"\\n\";\n str += \"version -> \"+this.version+\"\\n\";\n str += \"\\n\";\n str += \"original UA -> \"+this.userAgent;\n\n alert(str);\n }\n };\n\n Browser.init();\n\n return Browser;\n});\n","/**\n * CSS Utilities and toolbox\n * @module Ink.Dom.Css_1\n * @version 1\n */\n\nInk.createModule( 'Ink.Dom.Css', 1, [], function() {\n\n 'use strict';\n\n // getComputedStyle feature detection.\n var getCs = (\"defaultView\" in document) && (\"getComputedStyle\" in document.defaultView) ? document.defaultView.getComputedStyle : window.getComputedStyle;\n\n /**\n * @namespace Ink.Dom.Css\n * @static\n */\n\n var Css = {\n /**\n * Adds of removes a class.\n * Depending on addRemState, this method either adds a class if it's true or removes if if false.\n *\n * @method addRemoveClassName\n * @param {DOMElement|string} elm DOM element or element id\n * @param {string} className class name to add or remove.\n * @param {boolean} addRemState Whether to add or remove. `true` to add, `false` to remove.\n * @sample Ink_Dom_Css_addRemoveClassName.html \n */\n addRemoveClassName: function(elm, className, addRemState) {\n if (addRemState) {\n return this.addClassName(elm, className);\n }\n this.removeClassName(elm, className);\n },\n\n /**\n * Adds a class to a given element\n *\n * @method addClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String|Array} className Classes \n * @sample Ink_Dom_Css_addClassName.html\n */\n addClassName: function(elm, className) {\n elm = Ink.i(elm);\n if (!elm || !className) { return null; }\n className = ('' + className).split(/[, ]+/);\n var i = 0;\n var len = className.length;\n\n for (; i < len; i++) {\n // remove whitespace and ignore on empty string\n if (className[i].replace(/^\\s+|\\s+$/g, '')) {\n if (typeof elm.classList !== \"undefined\") {\n elm.classList.add(className[i]);\n } else if (!Css.hasClassName(elm, className[i])) {\n elm.className += (elm.className ? ' ' : '') + className[i];\n }\n }\n }\n },\n\n /**\n * Removes a class from a given element\n *\n * @method removeClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String|Array} className Class names to remove. You can either use a space separated string of classnames, comma-separated list or an array\n * @sample Ink_Dom_Css_removeClassName.html \n */\n removeClassName: function(elm, className) {\n elm = Ink.i(elm);\n if (!elm || !className) { return null; }\n \n className = ('' + className).split(/[, ]+/);\n var i = 0;\n var len = className.length;\n\n if (typeof elm.classList !== \"undefined\"){\n for (; i < len; i++) {\n elm.classList.remove(className[i]);\n }\n } else {\n var elmClassName = elm.className || '';\n var re;\n for (; i < len; i++) {\n re = new RegExp(\"(^|\\\\s+)\" + className[i] + \"(\\\\s+|$)\");\n elmClassName = elmClassName.replace(re, ' ');\n }\n elm.className = (elmClassName\n .replace(/^\\s+/, '')\n .replace(/\\s+$/, ''));\n }\n },\n\n /**\n * Alias to addRemoveClassName. \n * Utility function, saves many if/elses.\n *\n * @method setClassName\n * @uses addRemoveClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String|Array} className Class names to add\\remove. Comma separated, space separated or simply an Array\n * @param {Boolean} [add]=false Flag to switch behavior from removal to addition. true to add, false to remove\n */\n setClassName: function(elm, className, add) {\n this.addRemoveClassName(elm, className, add || false);\n },\n\n /**\n * Checks if an element has a class.\n * This method verifies if an element has ONE of a list of classes. If the last argument is flagged as true, instead checks if the element has ALL the classes\n * \n * @method hasClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String|Array} className Class names to test\n * @param {Boolean} [all]=false If flagged as true, it will check if the element contains ALL the CSS classes\n * @return {Boolean} true if a given class is applied to a given element\n * @sample Ink_Dom_Css_hasClassName.html \n */\n hasClassName: function(elm, className, all) {\n elm = Ink.i(elm);\n if (!elm || !className) { return false; }\n\n className = ('' + className).split(/[, ]+/);\n var i = 0;\n var len = className.length;\n var has;\n var re;\n\n for ( ; i < len; i++) {\n if (typeof elm.classList !== \"undefined\"){\n has = elm.classList.contains(className[i]);\n } else {\n var elmClassName = elm.className;\n if (elmClassName === className[i]) {\n has = true;\n } else {\n re = new RegExp(\"(^|\\\\s)\" + className[i] + \"(\\\\s|$)\");\n has = re.test(elmClassName);\n }\n }\n if (has && !all) { return true; } // return if looking for any class\n if (!has && all) { return false; } // return if looking for all classes\n }\n\n if (all) {\n // if we got here, all classes were found so far\n return true;\n } else {\n // if we got here with all == false, no class was found\n return false;\n }\n },\n\n /**\n * Blinks a class from an element\n * Add and removes the class from the element with a timeout, so it blinks\n *\n * @method blinkClass\n * @uses addRemoveClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String|Array} className Class name(s) to blink\n * @param {Number} timeout timeout in ms between adding and removing, default 100 ms\n * @param {Boolean} negate is true, class is removed then added\n * @sample Ink_Dom_Css_blinkClass.html \n */\n blinkClass: function(element, className, timeout, negate){\n element = Ink.i(element);\n Css.addRemoveClassName(element, className, !negate);\n setTimeout(function() {\n Css.addRemoveClassName(element, className, negate);\n }, Number(timeout) || 100);\n },\n\n /**\n * Toggles a class name from a given element\n *\n * @method toggleClassName\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String} className Class name\n * @param {Boolean} [forceAdd] Flag to force adding the the classe names if they don't exist yet.\n * @sample Ink_Dom_Css_toggleClassName.html \n */\n toggleClassName: function(elm, className, forceAdd) {\n if (elm && className){\n if (typeof elm.classList !== \"undefined\" && !/[, ]/.test(className)){\n elm = Ink.i(elm);\n if (elm !== null){\n elm.classList.toggle(className);\n }\n return true;\n }\n }\n\n if (typeof forceAdd !== 'undefined') {\n if (forceAdd === true) {\n Css.addClassName(elm, className);\n }\n else if (forceAdd === false) {\n Css.removeClassName(elm, className);\n }\n } else {\n if (Css.hasClassName(elm, className)) {\n Css.removeClassName(elm, className);\n } else {\n Css.addClassName(elm, className);\n }\n }\n },\n\n /**\n * Sets the opacity of given element \n *\n * @method setOpacity\n * @param {DOMElement|String} elm DOM element or element id\n * @param {Number} value allows 0 to 1(default mode decimal) or percentage (warning using 0 or 1 will reset to default mode)\n * @sample Ink_Dom_Css_setOpacity.html \n */\n setOpacity: function(elm, value) {\n elm = Ink.i(elm);\n if (elm !== null){\n var val = 1;\n\n if (!isNaN(Number(value))){\n if (value <= 0) { val = 0; }\n else if (value <= 1) { val = value; }\n else if (value <= 100) { val = value / 100; }\n else { val = 1; }\n }\n\n if (typeof elm.style.opacity !== 'undefined') {\n elm.style.opacity = val;\n }\n else {\n elm.style.filter = \"alpha(opacity:\"+(val*100|0)+\")\";\n }\n }\n },\n\n /**\n * Converts a css property name to a string in camelcase to be used with CSSStyleDeclaration.\n * @method _camelCase\n * @private\n * @param {String} str String to convert\n * @return {String} Converted string\n */\n _camelCase: function(str) {\n return str ? str.replace(/-(\\w)/g, function (_, $1) {\n return $1.toUpperCase();\n }) : str;\n },\n\n\n /**\n * Gets the value for an element's style attribute\n *\n * @method getStyle\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String} style Which css attribute to fetch\n * @return Style value\n * @sample Ink_Dom_Css_getStyle.html \n */\n getStyle: function(elm, style) {\n elm = Ink.i(elm);\n if (elm !== null && elm.style) {\n style = style === 'float' ? 'cssFloat': this._camelCase(style);\n\n var value = elm.style[style];\n\n if (getCs && (!value || value === 'auto')) {\n var css = getCs(elm, null);\n value = css ? css[style] : null;\n }\n else if (!value && elm.currentStyle) {\n value = elm.currentStyle[style];\n if (value === 'auto' && (style === 'width' || style === 'height')) {\n value = elm[\"offset\" + style.charAt(0).toUpperCase() + style.slice(1)] + \"px\";\n }\n }\n\n if (style === 'opacity') {\n return value ? parseFloat(value, 10) : 1.0;\n }\n else if (style === 'borderTopWidth' || style === 'borderBottomWidth' ||\n style === 'borderRightWidth' || style === 'borderLeftWidth' ) {\n if (value === 'thin') { return '1px'; }\n else if (value === 'medium') { return '3px'; }\n else if (value === 'thick') { return '5px'; }\n }\n\n return value === 'auto' ? null : value;\n }\n },\n\n\n /**\n * Adds CSS rules to an element's style attribute.\n *\n * @method setStyle\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String} style Which css attribute to set\n * @sample Ink_Dom_Css_setStyle.html \n */\n setStyle: function(elm, style) {\n elm = Ink.i(elm);\n if (elm === null) { return; }\n if (typeof style === 'string') {\n elm.style.cssText += '; '+style;\n\n if (style.indexOf('opacity') !== -1) {\n this.setOpacity(elm, style.match(/opacity:\\s*(\\d?\\.?\\d*)/)[1]);\n }\n }\n else {\n for (var prop in style) {\n if (style.hasOwnProperty(prop)){\n if (prop === 'opacity') {\n this.setOpacity(elm, style[prop]);\n }\n else if (prop === 'float' || prop === 'cssFloat') {\n if (typeof elm.style.styleFloat === 'undefined') {\n elm.style.cssFloat = style[prop];\n }\n else {\n elm.style.styleFloat = style[prop];\n }\n } else {\n elm.style[prop] = style[prop];\n }\n }\n }\n }\n },\n\n\n /**\n * Shows an element.\n * Internally it unsets the display property of an element. You can force a specific display property using forceDisplayProperty\n *\n * @method show\n * @param {DOMElement|String} elm DOM element or element id\n * @param {String} [forceDisplayProperty] Css display property to apply on show\n * @sample Ink_Dom_Css_show.html \n */\n show: function(elm, forceDisplayProperty) {\n elm = Ink.i(elm);\n if (elm !== null) {\n elm.style.display = (forceDisplayProperty) ? forceDisplayProperty : '';\n }\n },\n\n /**\n * Hides an element.\n *\n * @method hide\n * @param {DOMElement|String} elm DOM element or element id\n * @sample Ink_Dom_Css_hide.html \n */\n hide: function(elm) {\n elm = Ink.i(elm);\n if (elm !== null) {\n elm.style.display = 'none';\n }\n },\n\n /**\n * Shows or hides an element.\n * If the show parameter is true, it shows the element. Otherwise, hides it.\n *\n * @method showHide\n * @param {DOMElement|String} elm DOM element or element id\n * @param {boolean} [show]=false Whether to show or hide `elm`.\n * @sample Ink_Dom_Css_showHide.html \n */\n showHide: function(elm, show) {\n elm = Ink.i(elm);\n if (elm) {\n elm.style.display = show ? '' : 'none';\n }\n },\n\n /**\n * Toggles an element visibility.\n * \n * @method toggle\n * @param {DOMElement|String} elm DOM element or element id\n * @param {Boolean} forceShow Forces showing if element is hidden\n * @sample Ink_Dom_Css_toggle.html \n */\n toggle: function(elm, forceShow) {\n elm = Ink.i(elm);\n if (elm !== null) {\n if (typeof forceShow !== 'undefined') {\n if (forceShow === true) {\n this.show(elm);\n } else {\n this.hide(elm);\n }\n } else {\n if (this.getStyle(elm,'display').toLowerCase() === 'none') {\n this.show(elm);\n }\n else {\n this.hide(elm);\n }\n }\n }\n },\n\n _getRefTag: function(head){\n if (head.firstElementChild) {\n return head.firstElementChild;\n }\n\n for (var child = head.firstChild; child; child = child.nextSibling){\n if (child.nodeType === 1){\n return child;\n }\n }\n return null;\n },\n\n /**\n * Injects style tags with rules to the page.\n *\n * @method appendStyleTag\n * @param {String} selector The css selector for the rule\n * @param {String} style The content of the style rule\n * @param {Object} options Options for the tag\n * @param {String} [options.type]='text/css' File type\n * @param {Boolean} [options.force]=false If true, the style tag will be appended to end of head\n * \n * @sample Ink_Dom_Css_appendStyleTag.html \n */\n appendStyleTag: function(selector, style, options){\n options = Ink.extendObj({\n type: 'text/css',\n force: false\n }, options || {});\n\n var styles = document.getElementsByTagName(\"style\"),\n oldStyle = false, setStyle = true, i, l;\n\n for (i=0, l=styles.length; i<l; i++) {\n oldStyle = styles[i].innerHTML;\n if (oldStyle.indexOf(selector) >= 0) {\n setStyle = false;\n }\n }\n\n if (setStyle) {\n var defStyle = document.createElement(\"style\"),\n head = document.getElementsByTagName(\"head\")[0],\n refTag = false, styleStr = '';\n\n defStyle.type = options.type;\n\n styleStr += selector +\" {\";\n styleStr += style;\n styleStr += \"} \";\n\n if (typeof defStyle.styleSheet !== \"undefined\") {\n defStyle.styleSheet.cssText = styleStr;\n } else {\n defStyle.appendChild(document.createTextNode(styleStr));\n }\n\n if (options.force){\n head.appendChild(defStyle);\n } else {\n refTag = this._getRefTag(head);\n if (refTag){\n head.insertBefore(defStyle, refTag);\n }\n }\n }\n },\n\n /**\n * Injects an external link tag.\n * This method add a stylesheet to the head of a page\n *\n * @method appendStylesheet\n * @param {String} path File path\n * @param {Object} options Options for the tag\n * @param {String} [options.media]='screen' Media type\n * @param {String} [options.type]='text/css' File type\n * @param {Boolean} [options.force]=false If true, tag will be appended to end of head\n * @sample Ink_Dom_Css_appendStylesheet.html \n */\n appendStylesheet: function(path, options){\n options = Ink.extendObj({\n media: 'screen',\n type: 'text/css',\n force: false\n }, options || {});\n\n var refTag,\n style = document.createElement(\"link\"),\n head = document.getElementsByTagName(\"head\")[0];\n\n style.media = options.media;\n style.type = options.type;\n style.href = path;\n style.rel = \"Stylesheet\";\n\n if (options.force){\n head.appendChild(style);\n }\n else {\n refTag = this._getRefTag(head);\n if (refTag){\n head.insertBefore(style, refTag);\n }\n }\n },\n\n /**\n * Injects an external link tag.\n * Loads CSS via LINK element inclusion in HEAD (skips append if already there)\n *\n * Works similarly to appendStylesheet but:\n * supports optional callback which gets invoked once the CSS has been applied\n *\n * @method appendStylesheetCb\n * @param {String} cssURI URI of the CSS to load, if empty ignores and just calls back directly\n * @param {Function(cssURI)} [callback] optional callback which will be called once the CSS is loaded\n * @sample Ink_Dom_Css_appendStylesheetCb.html \n */\n _loadingCSSFiles: {},\n _loadedCSSFiles: {},\n appendStylesheetCb: function(url, callback) {\n if (!url) {\n return callback(url);\n }\n\n if (this._loadedCSSFiles[url]) {\n return callback(url);\n }\n\n var cbs = this._loadingCSSFiles[url];\n if (cbs) {\n return cbs.push(callback);\n }\n\n this._loadingCSSFiles[url] = [callback];\n\n var linkEl = document.createElement('link');\n linkEl.type = 'text/css';\n linkEl.rel = 'stylesheet';\n linkEl.href = url;\n\n var headEl = document.getElementsByTagName('head')[0];\n headEl.appendChild(linkEl);\n\n var imgEl = document.createElement('img');\n /*\n var _self = this;\n (function(_url) {\n imgEl.onerror = function() {\n //var url = this;\n var url = _url;\n _self._loadedCSSFiles[url] = true;\n var callbacks = _self._loadingCSSFiles[url];\n for (var i = 0, f = callbacks.length; i < f; ++i) {\n callbacks[i](url);\n }\n delete _self._loadingCSSFiles[url];\n };\n })(url);\n */\n imgEl.onerror = Ink.bindEvent(function(event, _url) {\n //var url = this;\n var url = _url;\n this._loadedCSSFiles[url] = true;\n var callbacks = this._loadingCSSFiles[url];\n for (var i = 0, f = callbacks.length; i < f; ++i) {\n callbacks[i](url);\n }\n delete this._loadingCSSFiles[url];\n }, this, url);\n imgEl.src = url;\n },\n\n /**\n * Converts decimal to hexadecimal values\n * Useful to convert colors to their hexadecimal representation.\n *\n * @method decToHex\n * @param {String} dec Either a single decimal value, an rgb(r, g, b) string or an Object with r, g and b properties\n * @return {String} Hexadecimal value\n * @sample Ink_Dom_Css_decToHex.html \n */\n decToHex: function(dec) {\n var normalizeTo2 = function(val) {\n if (val.length === 1) {\n val = '0' + val;\n }\n val = val.toUpperCase();\n return val;\n };\n\n if (typeof dec === 'object') {\n var rDec = normalizeTo2(parseInt(dec.r, 10).toString(16));\n var gDec = normalizeTo2(parseInt(dec.g, 10).toString(16));\n var bDec = normalizeTo2(parseInt(dec.b, 10).toString(16));\n return rDec+gDec+bDec;\n }\n else {\n dec += '';\n var rgb = dec.match(/\\((\\d+),\\s?(\\d+),\\s?(\\d+)\\)/);\n if (rgb !== null) {\n return normalizeTo2(parseInt(rgb[1], 10).toString(16)) +\n normalizeTo2(parseInt(rgb[2], 10).toString(16)) +\n normalizeTo2(parseInt(rgb[3], 10).toString(16));\n }\n else {\n return normalizeTo2(parseInt(dec, 10).toString(16));\n }\n }\n },\n\n /**\n * Converts hexadecimal values to decimal\n * Useful to use with CSS colors\n *\n * @method hexToDec\n * @param {String} hex hexadecimal Value with 6, 3, 2 or 1 characters\n * @return {Number} Object with properties r, g, b if length of number is >= 3 or decimal value instead.\n * @sample Ink_Dom_Css_hexToDec.html \n */\n hexToDec: function(hex){\n if (hex.indexOf('#') === 0) {\n hex = hex.substr(1);\n }\n if (hex.length === 6) { // will return object RGB\n return {\n r: parseInt(hex.substr(0,2), 16),\n g: parseInt(hex.substr(2,2), 16),\n b: parseInt(hex.substr(4,2), 16)\n };\n }\n else if (hex.length === 3) { // will return object RGB\n return {\n r: parseInt(hex.charAt(0) + hex.charAt(0), 16),\n g: parseInt(hex.charAt(1) + hex.charAt(1), 16),\n b: parseInt(hex.charAt(2) + hex.charAt(2), 16)\n };\n }\n else if (hex.length <= 2) { // will return int\n return parseInt(hex, 16);\n }\n },\n\n /**\n * Get a single property from a stylesheet.\n * Use this to obtain the value of a CSS property (searched from loaded CSS documents)\n *\n * @method getPropertyFromStylesheet\n * @param {String} selector a CSS rule. must be an exact match\n * @param {String} property a CSS property\n * @return {String} value of the found property, or null if it wasn't matched\n */\n getPropertyFromStylesheet: function(selector, property) {\n var rule = this.getRuleFromStylesheet(selector);\n if (rule) {\n return rule.style[property];\n }\n return null;\n },\n\n getPropertyFromStylesheet2: function(selector, property) {\n var rules = this.getRulesFromStylesheet(selector);\n /*\n rules.forEach(function(rule) {\n var x = rule.style[property];\n if (x !== null && x !== undefined) {\n return x;\n }\n });\n */\n var x;\n for(var i=0, t=rules.length; i < t; i++) {\n x = rules[i].style[property];\n if (x !== null && x !== undefined) {\n return x;\n }\n }\n return null;\n },\n\n getRuleFromStylesheet: function(selector) {\n var sheet, rules, ri, rf, rule;\n var s = document.styleSheets;\n if (!s) {\n return null;\n }\n\n for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) {\n sheet = document.styleSheets[si];\n rules = sheet.rules ? sheet.rules : sheet.cssRules;\n if (!rules) { return null; }\n\n for (ri = 0, rf = rules.length; ri < rf; ++ri) {\n rule = rules[ri];\n if (!rule.selectorText) { continue; }\n if (rule.selectorText === selector) {\n return rule;\n }\n }\n }\n\n return null;\n },\n\n getRulesFromStylesheet: function(selector) {\n var res = [];\n var sheet, rules, ri, rf, rule;\n var s = document.styleSheets;\n if (!s) { return res; }\n\n for (var si = 0, sf = document.styleSheets.length; si < sf; ++si) {\n sheet = document.styleSheets[si];\n rules = sheet.rules ? sheet.rules : sheet.cssRules;\n if (!rules) {\n return null;\n }\n\n for (ri = 0, rf = rules.length; ri < rf; ++ri) {\n rule = rules[ri];\n if (!rule.selectorText) { continue; }\n if (rule.selectorText === selector) {\n res.push(rule);\n }\n }\n }\n\n return res;\n },\n\n getPropertiesFromRule: function(selector) {\n var rule = this.getRuleFromStylesheet(selector);\n var props = {};\n var prop, i, f;\n\n /*if (typeof rule.style.length === 'snumber') {\n for (i = 0, f = rule.style.length; i < f; ++i) {\n prop = this._camelCase( rule.style[i] );\n props[prop] = rule.style[prop];\n }\n }\n else { // HANDLES IE 8, FIREFOX RULE JOINING... */\n rule = rule.style.cssText;\n var parts = rule.split(';');\n var steps, val, pre, pos;\n for (i = 0, f = parts.length; i < f; ++i) {\n if (parts[i].charAt(0) === ' ') {\n parts[i] = parts[i].substring(1);\n }\n steps = parts[i].split(':');\n prop = this._camelCase( steps[0].toLowerCase() );\n val = steps[1];\n if (val) {\n val = val.substring(1);\n\n if (prop === 'padding' || prop === 'margin' || prop === 'borderWidth') {\n\n if (prop === 'borderWidth') { pre = 'border'; pos = 'Width'; }\n else { pre = prop; pos = ''; }\n\n if (val.indexOf(' ') !== -1) {\n val = val.split(' ');\n props[pre + 'Top' + pos] = val[0];\n props[pre + 'Bottom'+ pos] = val[0];\n props[pre + 'Left' + pos] = val[1];\n props[pre + 'Right' + pos] = val[1];\n }\n else {\n props[pre + 'Top' + pos] = val;\n props[pre + 'Bottom'+ pos] = val;\n props[pre + 'Left' + pos] = val;\n props[pre + 'Right' + pos] = val;\n }\n }\n else if (prop === 'borderRadius') {\n if (val.indexOf(' ') !== -1) {\n val = val.split(' ');\n props.borderTopLeftRadius = val[0];\n props.borderBottomRightRadius = val[0];\n props.borderTopRightRadius = val[1];\n props.borderBottomLeftRadius = val[1];\n }\n else {\n props.borderTopLeftRadius = val;\n props.borderTopRightRadius = val;\n props.borderBottomLeftRadius = val;\n props.borderBottomRightRadius = val;\n }\n }\n else {\n props[prop] = val;\n }\n }\n }\n //}\n //console.log(props);\n\n return props;\n },\n\n /**\n * Change the font size of elements.\n * Changes the font size of the elements which match the given CSS rule\n * For this function to work, the CSS file must be in the same domain than the host page, otherwise JS can't access it.\n *\n * @method changeFontSize\n * @param {String} selector CSS selector rule\n * @param {Number} delta Number of pixels to change on font-size\n * @param {String} [op] Supported operations are '+' and '*'. defaults to '+'\n * @param {Number} [minVal] If result gets smaller than minVal, change does not occurr\n * @param {Number} [maxVal] If result gets bigger than maxVal, change does not occurr\n */\n changeFontSize: function(selector, delta, op, minVal, maxVal) {\n var that = this;\n Ink.requireModules(['Ink.Dom.Selector_1'], function(Selector) {\n var e;\n if (typeof selector !== 'string') { e = '1st argument must be a CSS selector rule.'; }\n else if (typeof delta !== 'number') { e = '2nd argument must be a number.'; }\n else if (op !== undefined && op !== '+' && op !== '*') { e = '3rd argument must be one of \"+\", \"*\".'; }\n else if (minVal !== undefined && (typeof minVal !== 'number' || minVal <= 0)) { e = '4th argument must be a positive number.'; }\n else if (maxVal !== undefined && (typeof maxVal !== 'number' || maxVal < maxVal)) { e = '5th argument must be a positive number greater than minValue.'; }\n if (e) { throw new TypeError(e); }\n\n var val, el, els = Selector.select(selector);\n if (minVal === undefined) { minVal = 1; }\n op = (op === '*') ? function(a,b){return a*b;} : function(a,b){return a+b;};\n for (var i = 0, f = els.length; i < f; ++i) {\n el = els[i];\n val = parseFloat( that.getStyle(el, 'fontSize'));\n val = op(val, delta);\n if (val < minVal) { continue; }\n if (typeof maxVal === 'number' && val > maxVal) { continue; }\n el.style.fontSize = val + 'px';\n }\n });\n }\n\n };\n\n return Css;\n\n});\n","/**\n * DOM Traversal and manipulation\n * @module Ink.Dom.Element_1\n * @version 1\n */\n\nInk.createModule('Ink.Dom.Element', 1, [], function() {\n\n 'use strict';\n\n var createContextualFragmentSupport = (\n typeof document.createRange === 'function' &&\n typeof window.Range.prototype.createContextualFragment === 'function');\n\n var deleteThisTbodyToken = 'Ink.Dom.Element tbody: ' + Math.random();\n var browserCreatesTbodies = (function () {\n var div = document.createElement('div');\n div.innerHTML = '<table>';\n return div.getElementsByTagName('tbody').length !== 0;\n }());\n\n function rect(elem){\n var dimensions = {};\n try {\n dimensions = elem.getBoundingClientRect();\n } catch(e){\n dimensions = { top: elem.offsetTop, left: elem.offsetLeft };\n }\n return dimensions;\n }\n\n /**\n * @namespace Ink.Dom.Element_1\n */\n\n var InkElement = {\n\n /**\n * Checks if something is a DOM Element.\n *\n * @method isDOMElement\n * @static\n * @param {Mixed} o The object to be checked.\n * @return {Boolean} True if it's a valid DOM Element.\n * @example\n * var el = Ink.s('#element');\n * if( InkElement.isDOMElement( el ) === true ){\n * // It is a DOM Element.\n * } else {\n * // It is NOT a DOM Element.\n * }\n */\n isDOMElement: function(o) {\n return o !== null && typeof o === 'object' && 'nodeType' in o && o.nodeType === 1;\n },\n\n /**\n * Shortcut for `document.getElementById`\n *\n * @method get\n * @param {String|DOMElement} elm Either an ID of an element, or an element.\n * @return {DOMElement|null} The DOM element with the given id or null when it was not found\n * @sample Ink_Dom_Element_1_get.html\n */\n get: function(elm) {\n if(typeof elm !== 'undefined') {\n if(typeof elm === 'string') {\n return document.getElementById(elm);\n }\n return elm;\n }\n return null;\n },\n\n /**\n * Creates a DOM element\n *\n * @method create\n * @param {String} tag tag name\n * @param {Object} properties object with properties to be set on the element. You can also call other functions in Ink.Dom.Element like this\n * @sample Ink_Dom_Element_1_create.html\n */\n create: function(tag, properties) {\n var el = document.createElement(tag);\n //Ink.extendObj(el, properties);\n for(var property in properties) {\n if(properties.hasOwnProperty(property)) {\n if (property in InkElement) {\n InkElement[property](el, properties[property]);\n } else {\n if(property === 'className' || property === 'class') {\n el.className = properties.className || properties['class'];\n } else {\n el.setAttribute(property, properties[property]);\n }\n }\n }\n }\n return el;\n },\n\n /**\n * Removes a DOM Element\n *\n * @method remove\n * @param {DOMElement} elm The element to remove\n * @sample Ink_Dom_Element_1_remove.html\n */\n remove: function(el) {\n el = Ink.i(el);\n var parEl;\n if (el && (parEl = el.parentNode)) {\n parEl.removeChild(el);\n }\n },\n\n /**\n * Scrolls the window to an element\n *\n * @method scrollTo\n * @param {DOMElement|String} elm Element where to scroll\n * @sample Ink_Dom_Element_1_scrollTo.html\n */\n scrollTo: function(elm) {\n elm = InkElement.get(elm);\n if(elm) {\n if (elm.scrollIntoView) {\n return elm.scrollIntoView();\n }\n\n var elmOffset = {},\n elmTop = 0, elmLeft = 0;\n\n do {\n elmTop += elm.offsetTop || 0;\n elmLeft += elm.offsetLeft || 0;\n\n elm = elm.offsetParent;\n } while(elm);\n\n elmOffset = {x: elmLeft, y: elmTop};\n\n window.scrollTo(elmOffset.x, elmOffset.y);\n }\n },\n\n /**\n * Gets the top offset of an element\n *\n * @method offsetTop\n * @uses Ink.Dom.Browser\n *\n * @param {DOMElement|String} elm Target element\n * @return {Number} Offset from the target element to the top of the document\n * @sample Ink_Dom_Element_1_offsetTop.html\n */\n offsetTop: function(elm) {\n return InkElement.offset(elm)[1];\n },\n\n /**\n * Gets the left offset of an element\n *\n * @method offsetLeft\n * @uses Ink.Dom.Browser\n *\n * @param {DOMElement|String} elm Target element\n * @return {Number} Offset from the target element to the left of the document\n * @sample Ink_Dom_Element_1_offsetLeft.html\n */\n offsetLeft: function(elm) {\n return InkElement.offset(elm)[0];\n },\n\n /**\n * Gets the relative offset of an element\n *\n * @method positionedOffset\n * @param {DOMElement|String} elm Target element\n * @return {Array} Array with the element offsetleft and offsettop relative to the closest positioned ancestor\n * @sample Ink_Dom_Element_1_positionedOffset.html\n */\n positionedOffset: function(element) {\n var valueTop = 0, valueLeft = 0;\n element = InkElement.get(element);\n do {\n valueTop += element.offsetTop || 0;\n valueLeft += element.offsetLeft || 0;\n element = element.offsetParent;\n if (element) {\n if (element.tagName.toLowerCase() === 'body') { break; }\n\n var value = element.style.position;\n if (!value && element.currentStyle) {\n value = element.currentStyle.position;\n }\n if ((!value || value === 'auto') && typeof getComputedStyle !== 'undefined') {\n var css = getComputedStyle(element, null);\n value = css ? css.position : null;\n }\n if (value === 'relative' || value === 'absolute') { break; }\n }\n } while (element);\n return [valueLeft, valueTop];\n },\n\n /**\n * Gets the cumulative offset for an element\n *\n * Returns the top left position of the element on the page\n *\n * @method offset\n * @uses Ink.Dom.Browser\n *\n * @method offset\n * @param {DOMElement|String} elm Target element\n * @return {[Number, Number]} Array with pixel distance from the target element to the top left corner of the document\n * @sample Ink_Dom_Element_1_offset.html\n */\n offset: function(el) {\n /*jshint boss:true */\n el = Ink.i(el);\n var res = [0, 0];\n var doc = el.ownerDocument,\n docElem = doc.documentElement,\n box = rect(el),\n body = doc.body,\n clientTop = docElem.clientTop || body.clientTop || 0,\n clientLeft = docElem.clientLeft || body.clientLeft || 0,\n scrollTop = doc.pageYOffset || docElem.scrollTop || body.scrollTop,\n scrollLeft = doc.pageXOffset || docElem.scrollLeft || body.scrollLeft,\n top = box.top + scrollTop - clientTop,\n left = box.left + scrollLeft - clientLeft;\n res = [left, top];\n return res;\n },\n\n /**\n * Gets the scroll of the element\n *\n * @method scroll\n * @param {DOMElement|String} [elm] Target element or document.body\n * @returns {Array} offset values for x and y scroll\n * @sample Ink_Dom_Element_1_scroll.html\n */\n scroll: function(elm) {\n elm = elm ? Ink.i(elm) : document.body;\n return [\n ( ( !window.pageXOffset ) ? elm.scrollLeft : window.pageXOffset ),\n ( ( !window.pageYOffset ) ? elm.scrollTop : window.pageYOffset )\n ];\n },\n\n _getPropPx: function(cs, prop) {\n var n, c;\n var val = cs.getPropertyValue ? cs.getPropertyValue(prop) : cs[prop];\n if (!val) { n = 0; }\n else {\n c = val.indexOf('px');\n if (c === -1) { n = 0; }\n else {\n n = parseFloat(val, 10);\n }\n }\n\n //console.log([prop, ' \"', val, '\" ', n].join(''));\n\n return n;\n },\n\n /**\n * Alias for offset()\n *\n * @method offset2\n * @deprecated Kept for historic reasons. Use offset() instead.\n */\n offset2: function(el) {\n return InkElement.offset(el);\n },\n\n /**\n * Checks if an element has an attribute\n *\n * @method hasAttribute\n * @param {Object} elm Target element\n * @param {String} attr Attribute name\n * @return {Boolean} Boolean based on existance of attribute\n * @sample Ink_Dom_Element_1_hasAttribute.html\n */\n hasAttribute: function(elm, attr){\n elm = Ink.i(elm);\n return elm.hasAttribute ? elm.hasAttribute(attr) : !!elm.getAttribute(attr);\n },\n /**\n * Inserts an element right after another\n *\n * @method insertAfter\n * @param {DOMElement} newElm Element to be inserted\n * @param {DOMElement|String} targetElm Key element\n * @sample Ink_Dom_Element_1_insertAfter.html\n */\n insertAfter: function(newElm, targetElm) {\n /*jshint boss:true */\n if (targetElm = InkElement.get(targetElm)) {\n if (targetElm.nextSibling !== null) {\n targetElm.parentNode.insertBefore(newElm, targetElm.nextSibling);\n } else {\n targetElm.parentNode.appendChild(newElm);\n }\n }\n },\n\n /**\n * Inserts an element before another\n *\n * @method insertBefore\n * @param {DOMElement} newElm Element to be inserted\n * @param {DOMElement|String} targetElm Key element\n * @sample Ink_Dom_Element_1_insertBefore.html\n */\n insertBefore: function (newElm, targetElm) {\n /*jshint boss:true */\n if ( (targetElm = InkElement.get(targetElm)) ) {\n targetElm.parentNode.insertBefore(newElm, targetElm);\n }\n },\n\n /**\n * Inserts an element as the first child of another\n *\n * @method insertTop\n * @param {DOMElement} newElm Element to be inserted\n * @param {DOMElement|String} targetElm Key element\n * @sample Ink_Dom_Element_1_insertTop.html\n */\n insertTop: function(newElm,targetElm) {\n /*jshint boss:true */\n if (targetElm = InkElement.get(targetElm)) {\n if (targetElm.firstChild) {\n targetElm.insertBefore(newElm, targetElm.firstChild);\n } else {\n targetElm.appendChild(newElm);\n }\n }\n },\n\n /**\n * Inserts an element as the last child of another\n *\n * @method insertBottom\n * @param {DOMElement} newElm Element to be inserted\n * @param {DOMElement|String} targetElm Key element\n * @sample Ink_Dom_Element_1_insertBottom.html\n */\n insertBottom: function(newElm, targetElm) {\n /*jshint boss:true */\n targetElm = Ink.i(targetElm);\n targetElm.appendChild(newElm);\n },\n\n /**\n * Retrieves textContent from node\n *\n * @method textContent\n * @param {DOMNode} node Where to retreive text from. Can be any node type.\n * @return {String} the text\n * @sample Ink_Dom_Element_1_textContent.html\n */\n textContent: function(node){\n node = Ink.i(node);\n var text, k, cs, m;\n\n switch(node && node.nodeType) {\n case 9: /*DOCUMENT_NODE*/\n // IE quirks mode does not have documentElement\n return InkElement.textContent(node.documentElement || node.body && node.body.parentNode || node.body);\n\n case 1: /*ELEMENT_NODE*/\n text = node.innerText;\n if (typeof text !== 'undefined') {\n return text;\n }\n /* falls through */\n case 11: /*DOCUMENT_FRAGMENT_NODE*/\n text = node.textContent;\n if (typeof text !== 'undefined') {\n return text;\n }\n\n if (node.firstChild === node.lastChild) {\n // Common case: 0 or 1 children\n return InkElement.textContent(node.firstChild);\n }\n\n text = [];\n cs = node.childNodes;\n for (k = 0, m = cs.length; k < m; ++k) {\n text.push( InkElement.textContent( cs[k] ) );\n }\n return text.join('');\n\n case 3: /*TEXT_NODE*/\n case 4: /*CDATA_SECTION_NODE*/\n return node.nodeValue;\n }\n return '';\n },\n\n /**\n * Replaces text content of a DOM Node\n * This method removes any child node previously present\n *\n * @method setTextContent\n * @param {DOMNode} node node Target node where the text will be added.\n * @param {String} text text Text to be added on the node.\n * @sample Ink_Dom_Element_1_setTextContent.html\n */\n setTextContent: function(node, text){\n node = Ink.i(node);\n switch(node && node.nodeType)\n {\n case 1: /*ELEMENT_NODE*/\n if ('innerText' in node) {\n node.innerText = text;\n break;\n }\n /* falls through */\n case 11: /*DOCUMENT_FRAGMENT_NODE*/\n if ('textContent' in node) {\n node.textContent = text;\n break;\n }\n /* falls through */\n case 9: /*DOCUMENT_NODE*/\n while(node.firstChild) {\n node.removeChild(node.firstChild);\n }\n if (text !== '') {\n var doc = node.ownerDocument || node;\n node.appendChild(doc.createTextNode(text));\n }\n break;\n\n case 3: /*TEXT_NODE*/\n case 4: /*CDATA_SECTION_NODE*/\n node.nodeValue = text;\n break;\n }\n },\n\n /**\n * Checks if an element is a link\n *\n * @method isLink\n * @param {DOMNode} node Node to check if it's link\n * @return {Boolean}\n * @sample Ink_Dom_Element_1_isLink.html\n */\n isLink: function(element){\n var b = element && element.nodeType === 1 && ((/^a|area$/i).test(element.tagName) ||\n element.hasAttributeNS && element.hasAttributeNS('http://www.w3.org/1999/xlink','href'));\n return !!b;\n },\n\n /**\n * Checks if a node is an ancestor of another\n *\n * @method isAncestorOf\n * @param {DOMNode} ancestor Ancestor node\n * @param {DOMNode} node Descendant node\n * @return {Boolean}\n * @sample Ink_Dom_Element_1_isAncestorOf.html\n */\n isAncestorOf: function(ancestor, node){\n /*jshint boss:true */\n if (!node || !ancestor) {\n return false;\n }\n if (node.compareDocumentPosition) {\n return (ancestor.compareDocumentPosition(node) & 0x10) !== 0;/*Node.DOCUMENT_POSITION_CONTAINED_BY*/\n }\n while (node = node.parentNode){\n if (node === ancestor){\n return true;\n }\n }\n return false;\n },\n\n /**\n * Checks if a node is descendant of another\n *\n * @method descendantOf\n * @param {DOMNode} node The ancestor\n * @param {DOMNode} descendant The descendant\n * @return {Boolean} true if 'descendant' is descendant of 'node'\n * @sample Ink_Dom_Element_1_descendantOf.html\n */\n descendantOf: function(node, descendant){\n return node !== descendant && InkElement.isAncestorOf(node, descendant);\n },\n\n /**\n * Get first child element of another\n * @method firstElementChild\n * @param {DOMElement} elm Parent node\n * @return {DOMElement} the Element child\n * @sample Ink_Dom_Element_1_firstElementChild.html\n */\n firstElementChild: function(elm){\n if(!elm) {\n return null;\n }\n if ('firstElementChild' in elm) {\n return elm.firstElementChild;\n }\n var child = elm.firstChild;\n while(child && child.nodeType !== 1) {\n child = child.nextSibling;\n }\n return child;\n },\n\n /**\n * Get the last child element of another\n * @method lastElementChild\n * @param {DOMElement} elm Parent node\n * @return {DOMElement} the Element child\n * @sample Ink_Dom_Element_1_lastElementChild.html\n */\n lastElementChild: function(elm){\n if(!elm) {\n return null;\n }\n if ('lastElementChild' in elm) {\n return elm.lastElementChild;\n }\n var child = elm.lastChild;\n while(child && child.nodeType !== 1) {\n child = child.previousSibling;\n }\n return child;\n },\n\n /**\n * Get the first sibling element after the node\n *\n * @method nextElementSibling\n * @param {DOMNode} node The current node\n * @return {DOMElement|Null} The first sibling element after node or null if none is found\n * @sample Ink_Dom_Element_1_nextElementSibling.html \n */\n nextElementSibling: function(node){\n var sibling = null;\n\n if(!node){ return sibling; }\n\n if(\"nextElementSibling\" in node){\n return node.nextElementSibling;\n } else {\n sibling = node.nextSibling;\n\n // 1 === Node.ELEMENT_NODE\n while(sibling && sibling.nodeType !== 1){\n sibling = sibling.nextSibling;\n }\n\n return sibling;\n }\n },\n\n /**\n * Get the first sibling element before the node\n *\n * @method previousElementSibling\n * @param {DOMNode} node The current node\n * @return {DOMElement|Null} The first element sibling before node or null if none is found\n * @sample Ink_Dom_Element_1_previousElementSibling.html \n */\n previousElementSibling: function(node){\n var sibling = null;\n\n if(!node){ return sibling; }\n\n if(\"previousElementSibling\" in node){\n return node.previousElementSibling;\n } else {\n sibling = node.previousSibling;\n\n // 1 === Node.ELEMENT_NODE\n while(sibling && sibling.nodeType !== 1){\n sibling = sibling.previousSibling;\n }\n\n return sibling;\n }\n },\n\n /**\n * Get an element's width in pixels.\n *\n * @method elementWidth\n * @param {DOMElement|String} element Target DOM element or target ID\n * @return {Number} The element's width\n * @sample Ink_Dom_Element_1_elementWidth.html \n */\n elementWidth: function(element) {\n if(typeof element === \"string\") {\n element = document.getElementById(element);\n }\n return element.offsetWidth;\n },\n\n /**\n * Get an element's height in pixels.\n *\n * @method elementHeight\n * @param {DOMElement|String} element DOM element or target ID\n * @return {Number} The element's height\n * @sample Ink_Dom_Element_1_elementHeight.html \n */\n elementHeight: function(element) {\n if(typeof element === \"string\") {\n element = document.getElementById(element);\n }\n return element.offsetHeight;\n },\n\n /**\n * Deprecated. Alias for offsetLeft()\n *\n * @method elementLeft\n * @param {DOMElement|String} element DOM element or target ID\n * @return {Number} Element's left position\n */\n elementLeft: function(element) {\n return InkElement.offsetLeft(element);\n },\n\n /**\n * Deprecated. Alias for offsetTop()\n *\n * @method elementTop\n * @param {DOMElement|string} element Target DOM element or target ID\n * @return {Number} element's top position\n */\n elementTop: function(element) {\n return InkElement.offsetTop(element);\n },\n\n /**\n * Get an element's dimensions in pixels.\n *\n * @method elementDimensions\n * @param {DOMElement|string} element DOM element or target ID\n * @return {Array} Array with element's width and height\n * @sample Ink_Dom_Element_1_elementDimensions.html \n */\n elementDimensions: function(element) {\n element = Ink.i(element);\n return [element.offsetWidth, element.offsetHeight];\n },\n\n /**\n * Get the outer dimensions of an element in pixels.\n *\n * @method outerDimensions\n * @uses Ink.Dom.Css\n *\n * @param {DOMElement} element Target element\n * @return {Array} Array with element width and height.\n * @sample Ink_Dom_Element_1_outerDimensions.html \n */\n outerDimensions: function (element) {\n var bbox = rect(element);\n\n var Css = Ink.getModule('Ink.Dom.Css_1');\n var getStyle = Ink.bindMethod(Css, 'getStyle', element);\n\n return [\n bbox.right - bbox.left + parseFloat(getStyle('marginLeft') || 0) + parseFloat(getStyle('marginRight') || 0), // w\n bbox.bottom - bbox.top + parseFloat(getStyle('marginTop') || 0) + parseFloat(getStyle('marginBottom') || 0) // h\n ];\n },\n\n /**\n * Check if an element is inside the viewport\n *\n * @method inViewport\n * @param {DOMElement} element DOM Element\n * @param {Object} [options] Options object. If you pass a Boolean value here, it is interpreted as `options.partial`\n * @param {Boolean} [options.partial]=false Return `true` even if it is only partially visible.\n * @param {Number} [options.margin]=0 Consider a margin all around the viewport with `opts.margin` width a dead zone.\n * @return {Boolean}\n * @sample Ink_Dom_Element_1_inViewport.html \n */\n inViewport: function (element, opts) {\n var dims = rect(Ink.i(element));\n if (typeof opts === 'boolean') {\n opts = {partial: opts, margin: 0};\n }\n opts = Ink.extendObj({ partial: false, margin: 0}, opts || {});\n if (opts.partial) {\n return dims.bottom + opts.margin > 0 && // from the top\n dims.left - opts.margin < InkElement.viewportWidth() && // from the right\n dims.top - opts.margin < InkElement.viewportHeight() && // from the bottom\n dims.right + opts.margin > 0; // from the left\n } else {\n return dims.top + opts.margin > 0 && // from the top\n dims.right - opts.margin < InkElement.viewportWidth() && // from the right\n dims.bottom - opts.margin < InkElement.viewportHeight() && // from the bottom\n dims.left + opts.margin > 0; // from the left\n }\n },\n\n /**\n * Check if an element is hidden.\n * Taken from Mootools Element extras ( https://gist.github.com/cheeaun/73342 )\n * Does not take into account visibility:hidden\n * @method isHidden\n * @param {DOMElement} element Element to check\n * @return {Boolean}\n * @sample Ink_Dom_Element_1_isHidden.html \n */\n\n isHidden: function (element) {\n var w = element.offsetWidth, \n h = element.offsetHeight,\n force = (element.tagName.toLowerCase() === 'tr');\n\n var Css = Ink.getModule('Ink.Dom.Css_1');\n\n return (w===0 && h===0 && !force) ? true :\n (w!==0 && h!==0 && !force) ? false :\n Css.getStyle(element, 'display').toLowerCase() === 'none';\n },\n\n /**\n * Check if an element is visible \n *\n * @method isVisible\n * @uses isHidden\n * @param {DOMElement} element Element to check\n * @return {Boolean}\n * @sample Ink_Dom_Element_1_isVisible.html \n */\n\n isVisible: function (element) {\n return !this.isHidden(element);\n },\n\n /**\n * Clones an element's position to another\n *\n * @method clonePosition\n * @param {DOMElement} cloneTo element to be position cloned\n * @param {DOMElement} cloneFrom element to get the cloned position\n * @return {DOMElement} The element with positionClone\n * @sample Ink_Dom_Element_1_clonePosition.html \n */\n clonePosition: function(cloneTo, cloneFrom){\n var pos = InkElement.offset(cloneFrom);\n cloneTo.style.left = pos[0]+'px';\n cloneTo.style.top = pos[1]+'px';\n\n return cloneTo;\n },\n\n /**\n * Text-overflow: ellipsis emulation\n * Slices off a piece of text at the end of the element and adds the ellipsis so all text fits inside.\n *\n * @method ellipsizeText\n * @param {DOMElement} element Element to modify text content\n * @param {String} [ellipsis]='\\u2026' String to append to the chopped text\n */\n ellipsizeText: function(element/*, ellipsis*/){\n if ((element = Ink.i(element))) {\n element.style.overflow = 'hidden';\n element.style.whiteSpace = 'nowrap';\n element.style.textOverflow = 'ellipsis';\n }\n },\n\n /**\n * Finds the closest ancestor element matching your test function\n * \n *\n * @method findUpwardsHaving\n * @param {DOMElement} element Element to base the search from\n * @param {Function} boolTest Testing function\n * @return {DOMElement|false} The matched element or false if did not match\n * @sample Ink_Dom_Element_1_findUpwardsHaving.html \n */\n findUpwardsHaving: function(element, boolTest) {\n while (element && element.nodeType === 1) {\n if (boolTest(element)) {\n return element;\n }\n element = element.parentNode;\n }\n return false;\n },\n\n /**\n * Finds the closest ancestor by class name\n *\n * @method findUpwardsByClass\n * @uses findUpwardsHaving\n * @param {DOMElement} element Element to base the search from\n * @param {String} className Class name to search\n * @returns {DOMElement|false} The matched element or false if did not match\n * @sample Ink_Dom_Element_1_findUpwardsByClass.html \n */\n findUpwardsByClass: function(element, className) {\n var re = new RegExp(\"(^|\\\\s)\" + className + \"(\\\\s|$)\");\n var tst = function(el) {\n var cls = el.className;\n return cls && re.test(cls);\n };\n return InkElement.findUpwardsHaving(element, tst);\n },\n\n /**\n * Finds the closest ancestor by tag name\n *\n * @method findUpwardsByTag\n * @param {DOMElement} element Element to base the search from\n * @param {String} tag Tag to search\n * @returns {DOMElement|false} the matched element or false if did not match\n * @sample Ink_Dom_Element_1_findUpwardsByTag.html \n */\n findUpwardsByTag: function(element, tag) {\n tag = tag.toUpperCase();\n var tst = function(el) {\n return el.nodeName && el.nodeName.toUpperCase() === tag;\n };\n return InkElement.findUpwardsHaving(element, tst);\n },\n\n /**\n * Finds the closest ancestor by id\n *\n * @method findUpwardsById\n * @param {HtmlElement} element Element to base the search from\n * @param {String} id ID to search\n * @returns {HtmlElement|false} The matched element or false if did not match\n * @sample Ink_Dom_Element_1_findUpwardsById.html \n */\n findUpwardsById: function(element, id) {\n var tst = function(el) {\n return el.id === id;\n };\n return InkElement.findUpwardsHaving(element, tst);\n },\n\n /**\n * Finds the closest ancestor by CSS selector\n *\n * @method findUpwardsBySelector\n * @param {HtmlElement} element Element to base the search from\n * @param {String} sel CSS selector\n * @returns {HtmlElement|false} The matched element or false if did not match\n * @sample Ink_Dom_Element_1_findUpwardsBySelector.html \n */\n findUpwardsBySelector: function(element, sel) {\n var Selector = Ink.getModule('Ink.Dom.Selector', '1');\n if (!Selector) {\n throw new Error('This method requires Ink.Dom.Selector');\n }\n var tst = function(el) {\n return Selector.matchesSelector(el, sel);\n };\n return InkElement.findUpwardsHaving(element, tst);\n },\n\n /**\n * Gets the trimmed text of an element\n *\n * @method getChildrenText\n * @param {DOMElement} el Element to base the search from\n * @param {Boolean} [removeIt] Flag to remove the text from the element\n * @return {String} Text found\n * @sample Ink_Dom_Element_1_getChildrenText.html \n */\n getChildrenText: function(el, removeIt) {\n var node,\n j,\n part,\n nodes = el.childNodes,\n jLen = nodes.length,\n text = '';\n\n if (!el) {\n return text;\n }\n\n for (j = 0; j < jLen; ++j) {\n node = nodes[j];\n if (!node) { continue; }\n if (node.nodeType === 3) { // TEXT NODE\n part = InkElement._trimString( String(node.data) );\n if (part.length > 0) {\n text += part;\n if (removeIt) { el.removeChild(node); }\n }\n else { el.removeChild(node); }\n }\n }\n\n return text;\n },\n\n /**\n * String trim implementation\n * Used by getChildrenText\n *\n * function _trimString\n * param {String} text\n * return {String} trimmed text\n */\n _trimString: function(text) {\n return (String.prototype.trim) ? text.trim() : text.replace(/^\\s*/, '').replace(/\\s*$/, '');\n },\n\n /**\n * Gets value of a select element\n *\n * @method getSelectValues\n * @param {DOMElement|String} select element\n * @return {Array} The selected values\n * @sample Ink_Dom_Element_1_getSelectValues.html \n */\n getSelectValues: function (select) {\n var selectEl = Ink.i(select);\n var values = [];\n for (var i = 0; i < selectEl.options.length; ++i) {\n values.push( selectEl.options[i].value );\n }\n return values;\n },\n\n\n /* used by fills */\n _normalizeData: function(data) {\n var d, data2 = [];\n for (var i = 0, f = data.length; i < f; ++i) {\n d = data[i];\n\n if (!(d instanceof Array)) { // if not array, wraps primitive twice: val -> [val, val]\n d = [d, d];\n }\n else if (d.length === 1) { // if 1 element array: [val] -> [val, val]\n d.push(d[0]);\n }\n data2.push(d);\n }\n return data2;\n },\n\n\n /**\n * Fills a select element with options\n *\n * @method fillSelect\n * @param {DOMElement|String} container Select element which will get filled\n * @param {Array} data Data to populate the component\n * @param {Boolean} [skipEmpty] Flag to skip empty option\n * @param {String|Number} [defaultValue] Initial selected value\n *\n * @sample Ink_Dom_Element_1_fillSelect.html \n */\n fillSelect: function(container, data, skipEmpty, defaultValue) {\n var containerEl = Ink.i(container);\n if (!containerEl) { return; }\n\n containerEl.innerHTML = '';\n var d, optionEl;\n\n if (!skipEmpty) {\n // add initial empty option\n optionEl = document.createElement('option');\n optionEl.setAttribute('value', '');\n containerEl.appendChild(optionEl);\n }\n\n data = InkElement._normalizeData(data);\n\n for (var i = 0, f = data.length; i < f; ++i) {\n d = data[i];\n\n optionEl = document.createElement('option');\n optionEl.setAttribute('value', d[0]);\n if (d.length > 2) {\n optionEl.setAttribute('extra', d[2]);\n }\n optionEl.appendChild( document.createTextNode(d[1]) );\n\n if (d[0] === defaultValue) {\n optionEl.setAttribute('selected', 'selected');\n }\n\n containerEl.appendChild(optionEl);\n }\n },\n\n\n /**\n * Creates a set of radio buttons from an array of data\n *\n * @method fillRadios\n * @param {DOMElement|String} insertAfterEl Element after which the input elements will be created\n * @param {String} name Name for the form field ([] is added if not present as a suffix)\n * @param {Array} data Data to populate the component\n * @param {Boolean} [skipEmpty] Flag to skip creation of empty options\n * @param {String|Number} [defaultValue] Initial selected value\n * @param {String} [splitEl] Name of element to add after each input element (example: 'br')\n * @return {DOMElement} Wrapper element around the radio buttons\n */\n fillRadios: function(insertAfterEl, name, data, skipEmpty, defaultValue, splitEl) {\n insertAfterEl = Ink.i(insertAfterEl);\n var containerEl = document.createElement('span');\n InkElement.insertAfter(containerEl, insertAfterEl);\n\n data = InkElement._normalizeData(data);\n\n /*\n if (name.substring(name.length - 1) !== ']') {\n name += '[]';\n }\n */\n\n var d, inputEl;\n\n if (!skipEmpty) {\n // add initial empty option\n inputEl = document.createElement('input');\n inputEl.setAttribute('type', 'radio');\n inputEl.setAttribute('name', name);\n inputEl.setAttribute('value', '');\n containerEl.appendChild(inputEl);\n if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); }\n }\n\n for (var i = 0; i < data.length; ++i) {\n d = data[i];\n\n inputEl = document.createElement('input');\n inputEl.setAttribute('type', 'radio');\n inputEl.setAttribute('name', name);\n inputEl.setAttribute('value', d[0]);\n containerEl.appendChild(inputEl);\n containerEl.appendChild( document.createTextNode(d[1]) );\n if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); }\n\n if (d[0] === defaultValue) {\n inputEl.checked = true;\n }\n }\n\n return containerEl;\n },\n\n\n /**\n * Creates set of checkbox buttons\n *\n * @method fillChecks\n * @param {DOMElement|String} insertAfterEl Element after which the input elements will be created\n * @param {String} name Name for the form field ([] is added if not present as a suffix)\n * @param {Array} data Data to populate the component\n * @param {Boolean} [skipEmpty] Flag to skip creation of empty options\n * @param {String|Number} [defaultValue] Initial selected value\n * @param {String} [splitEl] Name of element to add after each input element (example: 'br')\n * @return {DOMElement} Wrapper element around the checkboxes\n */\n fillChecks: function(insertAfterEl, name, data, defaultValue, splitEl) {\n insertAfterEl = Ink.i(insertAfterEl);\n var containerEl = document.createElement('span');\n InkElement.insertAfter(containerEl, insertAfterEl);\n\n data = InkElement._normalizeData(data);\n\n if (name.substring(name.length - 1) !== ']') {\n name += '[]';\n }\n\n var d, inputEl;\n\n for (var i = 0; i < data.length; ++i) {\n d = data[i];\n\n inputEl = document.createElement('input');\n inputEl.setAttribute('type', 'checkbox');\n inputEl.setAttribute('name', name);\n inputEl.setAttribute('value', d[0]);\n containerEl.appendChild(inputEl);\n containerEl.appendChild( document.createTextNode(d[1]) );\n if (splitEl) { containerEl.appendChild( document.createElement(splitEl) ); }\n\n if (d[0] === defaultValue) {\n inputEl.checked = true;\n }\n }\n\n return containerEl;\n },\n\n\n /**\n * Gets the index of an element relative to a parent\n *\n * @method parentIndexOf\n * @param {DOMElement} parentEl Element to parse\n * @param {DOMElement} childEl Child Element to look for\n * @return {Number} The index of the childEl inside parentEl. Returns -1 if it's not a direct child\n * @sample Ink_Dom_Element_1_parentIndexOf.html \n */\n parentIndexOf: function(parentEl, childEl) {\n var node, idx = 0;\n for (var i = 0, f = parentEl.childNodes.length; i < f; ++i) {\n node = parentEl.childNodes[i];\n if (node.nodeType === 1) { // ELEMENT\n if (node === childEl) { return idx; }\n ++idx;\n }\n }\n return -1;\n },\n\n\n /**\n * Gets the next siblings of an element\n *\n * @method nextSiblings\n * @param {String|DOMElement} elm Element\n * @return {Array} Array of next sibling elements\n * @sample Ink_Dom_Element_1_nextSiblings.html \n */\n nextSiblings: function(elm) {\n elm = Ink.i(elm);\n if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) {\n var elements = [],\n siblings = elm.parentNode.children,\n index = InkElement.parentIndexOf(elm.parentNode, elm);\n\n for(var i = ++index, len = siblings.length; i<len; i++) {\n elements.push(siblings[i]);\n }\n\n return elements;\n }\n return [];\n },\n\n\n /**\n * Gets the previous siblings of an element\n *\n * @method previousSiblings\n * @param {String|DOMElement} elm Element\n * @return {Array} Array of previous sibling elements\n * @sample Ink_Dom_Element_1_previousSiblings.html \n */\n previousSiblings: function(elm) {\n elm = Ink.i(elm);\n if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) {\n var elements = [],\n siblings = elm.parentNode.children,\n index = InkElement.parentIndexOf(elm.parentNode, elm);\n\n for(var i = 0, len = index; i<len; i++) {\n elements.push(siblings[i]);\n }\n\n return elements;\n }\n return [];\n },\n\n\n /**\n * Gets the all siblings of an element\n *\n * @method siblings\n * @param {String|DOMElement} elm Element\n * @return {Array} Array of sibling elements\n * @sample Ink_Dom_Element_1_siblings.html \n */\n siblings: function(elm) {\n elm = Ink.i(elm);\n if(typeof(elm) === 'object' && elm !== null && elm.nodeType && elm.nodeType === 1) {\n var elements = [],\n siblings = elm.parentNode.children;\n\n for(var i = 0, len = siblings.length; i<len; i++) {\n if(elm !== siblings[i]) {\n elements.push(siblings[i]);\n }\n }\n\n return elements;\n }\n return [];\n },\n\n /**\n * Counts the number of children of an element\n *\n * @method childElementCount\n * @param {String|DOMElement} elm element\n * @return {Number} number of child elements\n * @sample Ink_Dom_Element_1_childElementCount.html \n */\n childElementCount: function(elm) {\n elm = Ink.i(elm);\n if ('childElementCount' in elm) {\n return elm.childElementCount;\n }\n if (!elm) { return 0; }\n return InkElement.siblings(elm).length + 1;\n },\n\n _wrapElements: {\n TABLE: function (div, html) {\n /* If we don't create a tbody, IE7 does that for us. Adding a tbody with a random string and then filtering for that random string is the only way to avoid double insertion of tbodies. */\n if (browserCreatesTbodies) {\n div.innerHTML = \"<table>\" + html + \"<tbody><tr><td>\" + deleteThisTbodyToken + \"</tr></td></tbody></table>\";\n } else {\n div.innerHTML = \"<table>\" + html + \"</table>\";\n }\n return div.firstChild;\n },\n TBODY: function (div, html) {\n div.innerHTML = '<table><tbody>' + html + '</tbody></table>';\n return div.firstChild.getElementsByTagName('tbody')[0];\n },\n THEAD: function (div, html) {\n div.innerHTML = '<table><thead>' + html + '</thead><tbody></tbody></table>';\n return div.firstChild.getElementsByTagName('thead')[0];\n },\n TFOOT: function (div, html) {\n div.innerHTML = '<table><tfoot>' + html + '</tfoot><tbody></tbody></table>';\n return div.firstChild.getElementsByTagName('tfoot')[0];\n },\n TR: function (div, html) {\n div.innerHTML = '<table><tbody><tr>' + html + '</tr></tbody></table>';\n return div.firstChild.firstChild.firstChild;\n }\n },\n\n /**\n * Gets a wrapper DIV with a certain HTML content to be inserted inside another element.\n * This is necessary for appendHTML,prependHTML functions, because they need a container element to copy the children from.\n *\n * Works around IE table quirks\n * @method _getWrapper\n * @private\n * @param elm\n * @param html\n */\n _getWrapper: function (elm, html) {\n var nodeName = elm.nodeName && elm.nodeName.toUpperCase();\n var wrapper = document.createElement('div');\n var wrapFunc = InkElement._wrapElements[nodeName];\n\n if ( !wrapFunc ) {\n wrapper.innerHTML = html;\n return wrapper;\n }\n // special cases\n wrapper = wrapFunc(wrapper, html);\n // worst case: tbody auto-creation even when our HTML has a tbody.\n if (browserCreatesTbodies && nodeName === 'TABLE') {\n // terrible case. Deal with tbody creation too.\n var tds = wrapper.getElementsByTagName('td');\n for (var i = 0, len = tds.length; i < len; i++) {\n if (tds[i].innerHTML === deleteThisTbodyToken) {\n var tbody = tds[i].parentNode.parentNode;\n tbody.parentNode.removeChild(tbody);\n }\n }\n }\n return wrapper;\n },\n\n /**\n * Appends HTML to an element.\n * This method parses the html string and doesn't modify its contents\n *\n * @method appendHTML\n * @param {String|DOMElement} elm Element\n * @param {String} html Markup string\n * @sample Ink_Dom_Element_1_appendHTML.html \n */\n appendHTML: function(elm, html){\n elm = Ink.i(elm);\n if(elm !== null) {\n var wrapper = InkElement._getWrapper(elm, html);\n while (wrapper.firstChild) {\n elm.appendChild(wrapper.firstChild);\n }\n }\n },\n\n /**\n * Prepends HTML to an element.\n * This method parses the html string and doesn't modify its contents\n *\n * @method prependHTML\n * @param {String|DOMElement} elm Element\n * @param {String} html Markup string\n * @sample Ink_Dom_Element_1_prependHTML.html \n */\n prependHTML: function(elm, html){\n elm = Ink.i(elm);\n if(elm !== null) {\n var wrapper = InkElement._getWrapper(elm, html);\n while (wrapper.lastChild) {\n elm.insertBefore(wrapper.lastChild, elm.firstChild);\n }\n }\n },\n\n /**\n * Sets the inner HTML of an element.\n *\n * @method setHTML\n * @param {String|DOMElement} elm Element\n * @param {String} html Markup string\n * @sample Ink_Dom_Element_1_setHTML.html \n */\n setHTML: function (elm, html) {\n elm = Ink.i(elm);\n if(elm !== null) {\n try {\n elm.innerHTML = html;\n } catch (e) {\n // Tables in IE7\n while (elm.firstChild) {\n elm.removeChild(elm.firstChild);\n }\n InkElement.appendHTML(elm, html);\n }\n }\n },\n\n /**\n * Wraps an element inside a container.\n *\n * The container may or may not be in the document yet.\n *\n * @method wrap\n * @param {String|DOMElement} target Element to be wrapped\n * @param {String|DOMElement} container Element to wrap the target\n * @return Container element\n * @sample Ink_Dom_Element_1_wrap.html \n *\n * @example\n * before:\n *\n * <div id=\"target\"></div>\n *\n * call this function to wrap #target with a wrapper div.\n *\n * InkElement.wrap('target', InkElement.create('div', {id: 'container'});\n * \n * after: \n *\n * <div id=\"container\"><div id=\"target\"></div></div>\n */\n wrap: function (target, container) {\n target = Ink.i(target);\n container = Ink.i(container);\n \n var nextNode = target.nextSibling;\n var parent = target.parentNode;\n\n container.appendChild(target);\n\n if (nextNode !== null) {\n parent.insertBefore(container, nextNode);\n } else {\n parent.appendChild(container);\n }\n\n return container;\n },\n\n /**\n * Places an element outside a wrapper.\n *\n * @method unwrap\n * @param {DOMElement} elem The element you're trying to unwrap. This should be an ancestor of the wrapper.\n * @param {String} [wrapperSelector] CSS Selector for the ancestor. Use this if your wrapper is not the direct parent of elem.\n * @sample Ink_Dom_Element_1_unwrap.html \n *\n * @example\n *\n * When you have this:\n *\n * <div id=\"wrapper\">\n * <div id=\"unwrapMe\"></div>\n * </div>\n *\n * If you do this:\n *\n * InkElement.unwrap('unwrapMe');\n *\n * You get this:\n *\n * <div id=\"unwrapMe\"></div>\n * <div id=\"wrapper\"></div>\n * \n **/\n unwrap: function (elem, wrapperSelector) {\n elem = Ink.i(elem);\n var wrapper;\n if (typeof wrapperSelector === 'string') {\n wrapper = InkElement.findUpwardsBySelector(elem, wrapperSelector);\n } else if (typeof wrapperSelector === 'object' && wrapperSelector.tagName) {\n wrapper = InkElement.findUpwardsHaving(elem, function (ancestor) {\n return ancestor === wrapperSelector;\n });\n } else {\n wrapper = elem.parentNode;\n }\n if (!wrapper || !wrapper.parentNode) { return; }\n\n InkElement.insertBefore(elem, wrapper);\n },\n\n /**\n * Replaces an element with another.\n *\n * @method replace\n * @param element The element to be replaced.\n * @param replacement The new element.\n * @sample Ink_Dom_Element_1_replace.html \n *\n * @example\n * var newelement1 = InkElement.create('div');\n * // ...\n * replace(Ink.i('element1'), newelement1);\n */\n replace: function (element, replacement) {\n element = Ink.i(element);\n if(element !== null) {\n element.parentNode.replaceChild(replacement, element);\n }\n },\n\n /**\n * Removes direct text children.\n * Useful to remove nasty layout gaps generated by whitespace on the markup.\n *\n * @method removeTextNodeChildren\n * @param {DOMElement} el Element to remove text from\n * @sample Ink_Dom_Element_1_removeTextNodeChildren.html \n */\n removeTextNodeChildren: function(el) {\n el = Ink.i(el);\n if(el !== null) {\n var prevEl, toRemove, parent = el;\n el = el.firstChild;\n while (el) {\n toRemove = (el.nodeType === 3);\n prevEl = el;\n el = el.nextSibling;\n if (toRemove) {\n parent.removeChild(prevEl);\n }\n }\n }\n },\n\n /**\n * Creates a documentFragment from an HTML string.\n *\n * @method htmlToFragment\n * @param {String} html HTML string\n * @return {DocumentFragment} DocumentFragment containing all of the elements from the html string\n * @sample Ink_Dom_Element_1_htmlToFragment.html \n */\n htmlToFragment: (createContextualFragmentSupport ?\n function(html){\n var range;\n\n if(typeof html !== 'string'){ return document.createDocumentFragment(); }\n\n range = document.createRange();\n\n // set the context to document.body (firefox does this already, webkit doesn't)\n range.selectNode(document.body);\n\n return range.createContextualFragment(html);\n } : function (html) {\n var fragment = document.createDocumentFragment(),\n tempElement,\n current;\n\n if(typeof html !== 'string'){ return fragment; }\n\n tempElement = document.createElement('div');\n tempElement.innerHTML = html;\n\n // append child removes elements from the original parent\n while( (current = tempElement.firstChild) ){ // intentional assignment\n fragment.appendChild(current);\n }\n\n return fragment;\n }),\n\n _camelCase: function(str)\n {\n return str ? str.replace(/-(\\w)/g, function (_, $1){\n return $1.toUpperCase();\n }) : str;\n },\n\n /**\n * Gets data attributes from an element\n *\n * @method data\n * @param {String|DOMElement} selector Element or CSS selector\n * @return {Object} Object with the data-* properties. If no data-attributes are present, an empty object is returned.\n * @sample Ink_Dom_Element_1_data.html \n */\n data: function(selector) {\n var el;\n if (typeof selector !== 'object' && typeof selector !== 'string') {\n throw '[Ink.Dom.Element.data] :: Invalid selector defined';\n }\n\n if (typeof selector === 'object') {\n el = selector;\n }\n else {\n var InkDomSelector = Ink.getModule('Ink.Dom.Selector', 1);\n if (!InkDomSelector) {\n throw \"[Ink.Dom.Element.data] :: this method requires Ink.Dom.Selector - v1\";\n }\n el = InkDomSelector.select(selector);\n if (el.length <= 0) {\n throw \"[Ink.Dom.Element.data] :: Can't find any element with the specified selector\";\n }\n el = el[0];\n }\n\n var dataset = {};\n var attrs = el.attributes || [];\n\n var curAttr, curAttrName, curAttrValue;\n if (attrs) {\n for (var i = 0, total = attrs.length; i < total; ++i) {\n curAttr = attrs[i];\n curAttrName = curAttr.name;\n curAttrValue = curAttr.value;\n if (curAttrName && curAttrName.indexOf('data-') === 0) {\n dataset[InkElement._camelCase(curAttrName.replace('data-', ''))] = curAttrValue;\n }\n }\n }\n\n return dataset;\n },\n\n /**\n * Move the cursor on an input or textarea element.\n * @method moveCursorTo\n * @param {DOMElement} el Input or Textarea element\n * @param {Number} t Index of the character to move the cursor to\n * @sample Ink_Dom_Element_1_moveCursorTo.html \n */\n moveCursorTo: function(el, t) {\n el = Ink.i(el);\n if(el !== null) {\n if (el.setSelectionRange) {\n el.setSelectionRange(t, t);\n //el.focus();\n }\n else {\n var range = el.createTextRange();\n range.collapse(true);\n range.moveEnd( 'character', t);\n range.moveStart('character', t);\n range.select();\n }\n }\n },\n\n /**\n * Get the page's width.\n * @method pageWidth\n * @return {Number} Page width in pixels\n * @sample Ink_Dom_Element_1_pageWidth.html \n */\n pageWidth: function() {\n var xScroll;\n\n if (window.innerWidth && window.scrollMaxX) {\n xScroll = window.innerWidth + window.scrollMaxX;\n } else if (document.body.scrollWidth > document.body.offsetWidth){\n xScroll = document.body.scrollWidth;\n } else {\n xScroll = document.body.offsetWidth;\n }\n\n var windowWidth;\n\n if (window.self.innerWidth) {\n if(document.documentElement.clientWidth){\n windowWidth = document.documentElement.clientWidth;\n } else {\n windowWidth = window.self.innerWidth;\n }\n } else if (document.documentElement && document.documentElement.clientWidth) {\n windowWidth = document.documentElement.clientWidth;\n } else if (document.body) {\n windowWidth = document.body.clientWidth;\n }\n\n if(xScroll < windowWidth){\n return xScroll;\n } else {\n return windowWidth;\n }\n },\n\n /**\n * Get the page's height.\n * @method pageHeight\n * @return {Number} Page height in pixels\n * @sample Ink_Dom_Element_1_pageHeight.html \n */\n pageHeight: function() {\n var yScroll;\n\n if (window.innerHeight && window.scrollMaxY) {\n yScroll = window.innerHeight + window.scrollMaxY;\n } else if (document.body.scrollHeight > document.body.offsetHeight){\n yScroll = document.body.scrollHeight;\n } else {\n yScroll = document.body.offsetHeight;\n }\n\n var windowHeight;\n\n if (window.self.innerHeight) {\n windowHeight = window.self.innerHeight;\n } else if (document.documentElement && document.documentElement.clientHeight) {\n windowHeight = document.documentElement.clientHeight;\n } else if (document.body) {\n windowHeight = document.body.clientHeight;\n }\n\n if(yScroll < windowHeight){\n return windowHeight;\n } else {\n return yScroll;\n }\n },\n\n /**\n * Get the viewport's width.\n * @method viewportWidth\n * @return {Number} Viewport width in pixels\n * @sample Ink_Dom_Element_1_viewportWidth.html \n */\n viewportWidth: function() {\n if(typeof window.innerWidth !== \"undefined\") {\n return window.innerWidth;\n }\n if (document.documentElement && typeof document.documentElement.offsetWidth !== \"undefined\") {\n return document.documentElement.offsetWidth;\n }\n },\n\n /**\n * Get the viewport's height.\n * @method viewportHeight\n * @return {Number} Viewport height in pixels\n * @sample Ink_Dom_Element_1_viewportHeight.html \n */\n viewportHeight: function() {\n if (typeof window.innerHeight !== \"undefined\") {\n return window.innerHeight;\n }\n if (document.documentElement && typeof document.documentElement.offsetHeight !== \"undefined\") {\n return document.documentElement.offsetHeight;\n }\n },\n\n /**\n * Get the scroll's width.\n * @method scrollWidth\n * @return {Number} Scroll width\n */\n scrollWidth: function() {\n if (typeof window.self.pageXOffset !== 'undefined') {\n return window.self.pageXOffset;\n }\n if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollLeft !== 'undefined') {\n return document.documentElement.scrollLeft;\n }\n return document.body.scrollLeft;\n },\n\n /**\n * Get the scroll's height.\n * @method scrollHeight\n * @return {Number} Scroll height\n */\n scrollHeight: function() {\n if (typeof window.self.pageYOffset !== 'undefined') {\n return window.self.pageYOffset;\n }\n if (typeof document.documentElement !== 'undefined' && typeof document.documentElement.scrollTop !== 'undefined') {\n return document.documentElement.scrollTop;\n }\n return document.body.scrollTop;\n }\n };\n\n return InkElement;\n\n});\n","/**\n * Event management\n * @module Ink.Dom.Event_1\n * @version 1\n */\n\nInk.createModule('Ink.Dom.Event', 1, [], function() {\n /* jshint\n asi:true,\n strict:false,\n laxcomma:true,\n eqeqeq:false,\n laxbreak:true,\n boss:true,\n curly:false,\n expr:true\n */\n\n /**\n * @namespace Ink.Dom.Event_1\n * @static\n */\n\n /*!\n * Bean - copyright (c) Jacob Thornton 2011-2012\n * https://github.com/fat/bean\n * MIT license\n */\n var bean = (function (name, context, definition) {\n return definition()\n })('bean', this, function (name, context) {\n name = name || 'bean'\n context = context || this\n\n var win = window\n , old = context[name]\n , namespaceRegex = /[^\\.]*(?=\\..*)\\.|.*/\n , nameRegex = /\\..*/\n , addEvent = 'addEventListener'\n , removeEvent = 'removeEventListener'\n , doc = document || {}\n , root = doc.documentElement || {}\n , W3C_MODEL = root[addEvent]\n , eventSupport = W3C_MODEL ? addEvent : 'attachEvent'\n , ONE = {} // singleton for quick matching making add() do one()\n\n , slice = Array.prototype.slice\n , str2arr = function (s, d) { return s.split(d || ' ') }\n , isString = function (o) { return typeof o == 'string' }\n , isFunction = function (o) { return typeof o == 'function' }\n\n // events that we consider to be 'native', anything not in this list will\n // be treated as a custom event\n , standardNativeEvents =\n 'click dblclick mouseup mousedown contextmenu ' + // mouse buttons\n 'mousewheel mousemultiwheel DOMMouseScroll ' + // mouse wheel\n 'mouseover mouseout mousemove selectstart selectend ' + // mouse movement\n 'keydown keypress keyup ' + // keyboard\n 'orientationchange ' + // mobile\n 'focus blur change reset select submit ' + // form elements\n 'load unload beforeunload resize move DOMContentLoaded ' + // window\n 'readystatechange message ' + // window\n 'error abort scroll ' // misc\n // element.fireEvent('onXYZ'... is not forgiving if we try to fire an event\n // that doesn't actually exist, so make sure we only do these on newer browsers\n , w3cNativeEvents =\n 'show ' + // mouse buttons\n 'input invalid ' + // form elements\n 'touchstart touchmove touchend touchcancel ' + // touch\n 'gesturestart gesturechange gestureend ' + // gesture\n 'textinput' + // TextEvent\n 'readystatechange pageshow pagehide popstate ' + // window\n 'hashchange offline online ' + // window\n 'afterprint beforeprint ' + // printing\n 'dragstart dragenter dragover dragleave drag drop dragend ' + // dnd\n 'loadstart progress suspend emptied stalled loadmetadata ' + // media\n 'loadeddata canplay canplaythrough playing waiting seeking ' + // media\n 'seeked ended durationchange timeupdate play pause ratechange ' + // media\n 'volumechange cuechange ' + // media\n 'checking noupdate downloading cached updateready obsolete ' // appcache\n\n // convert to a hash for quick lookups\n , nativeEvents = (function (hash, events, i) {\n for (i = 0; i < events.length; i++) events[i] && (hash[events[i]] = 1)\n return hash\n }({}, str2arr(standardNativeEvents + (W3C_MODEL ? w3cNativeEvents : ''))))\n\n // custom events are events that we *fake*, they are not provided natively but\n // we can use native events to generate them\n , customEvents = (function () {\n var isAncestor = 'compareDocumentPosition' in root\n ? function (element, container) {\n return container.compareDocumentPosition && (container.compareDocumentPosition(element) & 16) === 16\n }\n : 'contains' in root\n ? function (element, container) {\n container = container.nodeType === 9 || container === window ? root : container\n return container !== element && container.contains(element)\n }\n : function (element, container) {\n while (element = element.parentNode) if (element === container) return 1\n return 0\n }\n , check = function (event) {\n var related = event.relatedTarget\n return !related\n ? related == null\n : (related !== this && related.prefix !== 'xul' && !/document/.test(this.toString())\n && !isAncestor(related, this))\n }\n\n return {\n mouseenter: { base: 'mouseover', condition: check }\n , mouseleave: { base: 'mouseout', condition: check }\n , mousewheel: { base: /Firefox/.test(navigator.userAgent) ? 'DOMMouseScroll' : 'mousewheel' }\n }\n }())\n\n // we provide a consistent Event object across browsers by taking the actual DOM\n // event object and generating a new one from its properties.\n , Event = (function () {\n // a whitelist of properties (for different event types) tells us what to check for and copy\n var commonProps = str2arr('altKey attrChange attrName bubbles cancelable ctrlKey currentTarget ' +\n 'detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey ' +\n 'srcElement target timeStamp type view which propertyName')\n , mouseProps = commonProps.concat(str2arr('button buttons clientX clientY dataTransfer ' +\n 'fromElement offsetX offsetY pageX pageY screenX screenY toElement'))\n , mouseWheelProps = mouseProps.concat(str2arr('wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ ' +\n 'axis')) // 'axis' is FF specific\n , keyProps = commonProps.concat(str2arr('char charCode key keyCode keyIdentifier ' +\n 'keyLocation location'))\n , textProps = commonProps.concat(str2arr('data'))\n , touchProps = commonProps.concat(str2arr('touches targetTouches changedTouches scale rotation'))\n , messageProps = commonProps.concat(str2arr('data origin source'))\n , stateProps = commonProps.concat(str2arr('state'))\n , overOutRegex = /over|out/\n // some event types need special handling and some need special properties, do that all here\n , typeFixers = [\n { // key events\n reg: /key/i\n , fix: function (event, newEvent) {\n newEvent.keyCode = event.keyCode || event.which\n return keyProps\n }\n }\n , { // mouse events\n reg: /click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i\n , fix: function (event, newEvent, type) {\n newEvent.rightClick = event.which === 3 || event.button === 2\n newEvent.pos = { x: 0, y: 0 }\n if (event.pageX || event.pageY) {\n newEvent.clientX = event.pageX\n newEvent.clientY = event.pageY\n } else if (event.clientX || event.clientY) {\n newEvent.clientX = event.clientX + doc.body.scrollLeft + root.scrollLeft\n newEvent.clientY = event.clientY + doc.body.scrollTop + root.scrollTop\n }\n if (overOutRegex.test(type)) {\n newEvent.relatedTarget = event.relatedTarget\n || event[(type == 'mouseover' ? 'from' : 'to') + 'Element']\n }\n return mouseProps\n }\n }\n , { // mouse wheel events\n reg: /mouse.*(wheel|scroll)/i\n , fix: function () { return mouseWheelProps }\n }\n , { // TextEvent\n reg: /^text/i\n , fix: function () { return textProps }\n }\n , { // touch and gesture events\n reg: /^touch|^gesture/i\n , fix: function () { return touchProps }\n }\n , { // message events\n reg: /^message$/i\n , fix: function () { return messageProps }\n }\n , { // popstate events\n reg: /^popstate$/i\n , fix: function () { return stateProps }\n }\n , { // everything else\n reg: /.*/\n , fix: function () { return commonProps }\n }\n ]\n , typeFixerMap = {} // used to map event types to fixer functions (above), a basic cache mechanism\n\n , Event = function (event, element, isNative) {\n if (!arguments.length) return\n event = event || ((element.ownerDocument || element.document || element).parentWindow || win).event\n this.originalEvent = event\n this.isNative = isNative\n this.isBean = true\n\n if (!event) return\n\n var type = event.type\n , target = event.target || event.srcElement\n , i, l, p, props, fixer\n\n this.target = target && target.nodeType === 3 ? target.parentNode : target\n\n if (isNative) { // we only need basic augmentation on custom events, the rest expensive & pointless\n fixer = typeFixerMap[type]\n if (!fixer) { // haven't encountered this event type before, map a fixer function for it\n for (i = 0, l = typeFixers.length; i < l; i++) {\n if (typeFixers[i].reg.test(type)) { // guaranteed to match at least one, last is .*\n typeFixerMap[type] = fixer = typeFixers[i].fix\n break\n }\n }\n }\n\n props = fixer(event, this, type)\n for (i = props.length; i--;) {\n if (!((p = props[i]) in this) && p in event) this[p] = event[p]\n }\n }\n }\n\n // preventDefault() and stopPropagation() are a consistent interface to those functions\n // on the DOM, stop() is an alias for both of them together\n Event.prototype.preventDefault = function () {\n if (this.originalEvent.preventDefault) this.originalEvent.preventDefault()\n else this.originalEvent.returnValue = false\n }\n Event.prototype.stopPropagation = function () {\n if (this.originalEvent.stopPropagation) this.originalEvent.stopPropagation()\n else this.originalEvent.cancelBubble = true\n }\n Event.prototype.stop = function () {\n this.preventDefault()\n this.stopPropagation()\n this.stopped = true\n }\n // stopImmediatePropagation() has to be handled internally because we manage the event list for\n // each element\n // note that originalElement may be a Bean#Event object in some situations\n Event.prototype.stopImmediatePropagation = function () {\n if (this.originalEvent.stopImmediatePropagation) this.originalEvent.stopImmediatePropagation()\n this.isImmediatePropagationStopped = function () { return true }\n }\n Event.prototype.isImmediatePropagationStopped = function () {\n return this.originalEvent.isImmediatePropagationStopped && this.originalEvent.isImmediatePropagationStopped()\n }\n Event.prototype.clone = function (currentTarget) {\n //TODO: this is ripe for optimisation, new events are *expensive*\n // improving this will speed up delegated events\n var ne = new Event(this, this.element, this.isNative)\n ne.currentTarget = currentTarget\n return ne\n }\n\n return Event\n }())\n\n // if we're in old IE we can't do onpropertychange on doc or win so we use doc.documentElement for both\n , targetElement = function (element, isNative) {\n return !W3C_MODEL && !isNative && (element === doc || element === win) ? root : element\n }\n\n /**\n * Bean maintains an internal registry for event listeners. We don't touch elements, objects\n * or functions to identify them, instead we store everything in the registry.\n * Each event listener has a RegEntry object, we have one 'registry' for the whole instance.\n */\n , RegEntry = (function () {\n // each handler is wrapped so we can handle delegation and custom events\n var wrappedHandler = function (element, fn, condition, args) {\n var call = function (event, eargs) {\n return fn.apply(element, args ? slice.call(eargs, event ? 0 : 1).concat(args) : eargs)\n }\n , findTarget = function (event, eventElement) {\n return fn.__beanDel ? fn.__beanDel.ft(event.target, element) : eventElement\n }\n , handler = condition\n ? function (event) {\n var target = findTarget(event, this) // deleated event\n if (condition.apply(target, arguments)) {\n if (event) event.currentTarget = target\n return call(event, arguments)\n }\n }\n : function (event) {\n if (fn.__beanDel) event = event.clone(findTarget(event)) // delegated event, fix the fix\n return call(event, arguments)\n }\n handler.__beanDel = fn.__beanDel\n return handler\n }\n\n , RegEntry = function (element, type, handler, original, namespaces, args, root) {\n var customType = customEvents[type]\n , isNative\n\n if (type == 'unload') {\n // self clean-up\n handler = once(removeListener, element, type, handler, original)\n }\n\n if (customType) {\n if (customType.condition) {\n handler = wrappedHandler(element, handler, customType.condition, args)\n }\n type = customType.base || type\n }\n\n this.isNative = isNative = nativeEvents[type] && !!element[eventSupport]\n this.customType = !W3C_MODEL && !isNative && type\n this.element = element\n this.type = type\n this.original = original\n this.namespaces = namespaces\n this.eventType = W3C_MODEL || isNative ? type : 'propertychange'\n this.target = targetElement(element, isNative)\n this[eventSupport] = !!this.target[eventSupport]\n this.root = root\n this.handler = wrappedHandler(element, handler, null, args)\n }\n\n // given a list of namespaces, is our entry in any of them?\n RegEntry.prototype.inNamespaces = function (checkNamespaces) {\n var i, j, c = 0\n if (!checkNamespaces) return true\n if (!this.namespaces) return false\n for (i = checkNamespaces.length; i--;) {\n for (j = this.namespaces.length; j--;) {\n if (checkNamespaces[i] == this.namespaces[j]) c++\n }\n }\n return checkNamespaces.length === c\n }\n\n // match by element, original fn (opt), handler fn (opt)\n RegEntry.prototype.matches = function (checkElement, checkOriginal, checkHandler) {\n return this.element === checkElement &&\n (!checkOriginal || this.original === checkOriginal) &&\n (!checkHandler || this.handler === checkHandler)\n }\n\n return RegEntry\n }())\n\n , registry = (function () {\n // our map stores arrays by event type, just because it's better than storing\n // everything in a single array.\n // uses '$' as a prefix for the keys for safety and 'r' as a special prefix for\n // rootListeners so we can look them up fast\n var map = {}\n\n // generic functional search of our registry for matching listeners,\n // `fn` returns false to break out of the loop\n , forAll = function (element, type, original, handler, root, fn) {\n var pfx = root ? 'r' : '$'\n if (!type || type == '*') {\n // search the whole registry\n for (var t in map) {\n if (t.charAt(0) == pfx) {\n forAll(element, t.substr(1), original, handler, root, fn)\n }\n }\n } else {\n var i = 0, l, list = map[pfx + type], all = element == '*'\n if (!list) return\n for (l = list.length; i < l; i++) {\n if ((all || list[i].matches(element, original, handler)) && !fn(list[i], list, i, type)) return\n }\n }\n }\n\n , has = function (element, type, original, root) {\n // we're not using forAll here simply because it's a bit slower and this\n // needs to be fast\n var i, list = map[(root ? 'r' : '$') + type]\n if (list) {\n for (i = list.length; i--;) {\n if (!list[i].root && list[i].matches(element, original, null)) return true\n }\n }\n return false\n }\n\n , get = function (element, type, original, root) {\n var entries = []\n forAll(element, type, original, null, root, function (entry) {\n return entries.push(entry)\n })\n return entries\n }\n\n , put = function (entry) {\n var has = !entry.root && !this.has(entry.element, entry.type, null, false)\n , key = (entry.root ? 'r' : '$') + entry.type\n ;(map[key] || (map[key] = [])).push(entry)\n return has\n }\n\n , del = function (entry) {\n forAll(entry.element, entry.type, null, entry.handler, entry.root, function (entry, list, i) {\n list.splice(i, 1)\n entry.removed = true\n if (list.length === 0) delete map[(entry.root ? 'r' : '$') + entry.type]\n return false\n })\n }\n\n // dump all entries, used for onunload\n , entries = function () {\n var t, entries = []\n for (t in map) {\n if (t.charAt(0) == '$') entries = entries.concat(map[t])\n }\n return entries\n }\n\n return { has: has, get: get, put: put, del: del, entries: entries }\n }())\n\n // we need a selector engine for delegated events, use querySelectorAll if it exists\n // but for older browsers we need Qwery, Sizzle or similar\n , selectorEngine\n , setSelectorEngine = function (e) {\n if (!arguments.length) {\n selectorEngine = doc.querySelectorAll\n ? function (s, r) {\n return r.querySelectorAll(s)\n }\n : function () {\n throw new Error('Bean: No selector engine installed') // eeek\n }\n } else {\n selectorEngine = e\n }\n }\n\n // we attach this listener to each DOM event that we need to listen to, only once\n // per event type per DOM element\n , rootListener = function (event, type) {\n if (!W3C_MODEL && type && event && event.propertyName != '_on' + type) return\n\n var listeners = registry.get(this, type || event.type, null, false)\n , l = listeners.length\n , i = 0\n\n event = new Event(event, this, true)\n if (type) event.type = type\n\n // iterate through all handlers registered for this type, calling them unless they have\n // been removed by a previous handler or stopImmediatePropagation() has been called\n for (; i < l && !event.isImmediatePropagationStopped(); i++) {\n if (!listeners[i].removed) listeners[i].handler.call(this, event)\n }\n }\n\n // add and remove listeners to DOM elements\n , listener = W3C_MODEL\n ? function (element, type, add) {\n // new browsers\n element[add ? addEvent : removeEvent](type, rootListener, false)\n }\n : function (element, type, add, custom) {\n // IE8 and below, use attachEvent/detachEvent and we have to piggy-back propertychange events\n // to simulate event bubbling etc.\n var entry\n if (add) {\n registry.put(entry = new RegEntry(\n element\n , custom || type\n , function (event) { // handler\n rootListener.call(element, event, custom)\n }\n , rootListener\n , null\n , null\n , true // is root\n ))\n if (custom && element['_on' + custom] == null) element['_on' + custom] = 0\n entry.target.attachEvent('on' + entry.eventType, entry.handler)\n } else {\n entry = registry.get(element, custom || type, rootListener, true)[0]\n if (entry) {\n entry.target.detachEvent('on' + entry.eventType, entry.handler)\n registry.del(entry)\n }\n }\n }\n\n , once = function (rm, element, type, fn, originalFn) {\n // wrap the handler in a handler that does a remove as well\n return function () {\n fn.apply(this, arguments)\n rm(element, type, originalFn)\n }\n }\n\n , removeListener = function (element, orgType, handler, namespaces) {\n var type = orgType && orgType.replace(nameRegex, '')\n , handlers = registry.get(element, type, null, false)\n , removed = {}\n , i, l\n\n for (i = 0, l = handlers.length; i < l; i++) {\n if ((!handler || handlers[i].original === handler) && handlers[i].inNamespaces(namespaces)) {\n // TODO: this is problematic, we have a registry.get() and registry.del() that\n // both do registry searches so we waste cycles doing this. Needs to be rolled into\n // a single registry.forAll(fn) that removes while finding, but the catch is that\n // we'll be splicing the arrays that we're iterating over. Needs extra tests to\n // make sure we don't screw it up. @rvagg\n registry.del(handlers[i])\n if (!removed[handlers[i].eventType] && handlers[i][eventSupport])\n removed[handlers[i].eventType] = { t: handlers[i].eventType, c: handlers[i].type }\n }\n }\n // check each type/element for removed listeners and remove the rootListener where it's no longer needed\n for (i in removed) {\n if (!registry.has(element, removed[i].t, null, false)) {\n // last listener of this type, remove the rootListener\n listener(element, removed[i].t, false, removed[i].c)\n }\n }\n }\n\n // set up a delegate helper using the given selector, wrap the handler function\n , delegate = function (selector, fn) {\n //TODO: findTarget (therefore $) is called twice, once for match and once for\n // setting e.currentTarget, fix this so it's only needed once\n var findTarget = function (target, root) {\n var i, array = isString(selector) ? selectorEngine(selector, root) : selector\n for (; target && target !== root; target = target.parentNode) {\n for (i = array.length; i--;) {\n if (array[i] === target) return target\n }\n }\n }\n , handler = function (e) {\n var match = findTarget(e.target, this)\n if (match) fn.apply(match, arguments)\n }\n\n // __beanDel isn't pleasant but it's a private function, not exposed outside of Bean\n handler.__beanDel = {\n ft : findTarget // attach it here for customEvents to use too\n , selector : selector\n }\n return handler\n }\n\n , fireListener = W3C_MODEL ? function (isNative, type, element) {\n // modern browsers, do a proper dispatchEvent()\n var evt = doc.createEvent(isNative ? 'HTMLEvents' : 'UIEvents')\n evt[isNative ? 'initEvent' : 'initUIEvent'](type, true, true, win, 1)\n element.dispatchEvent(evt)\n } : function (isNative, type, element) {\n // old browser use onpropertychange, just increment a custom property to trigger the event\n element = targetElement(element, isNative)\n isNative ? element.fireEvent('on' + type, doc.createEventObject()) : element['_on' + type]++\n }\n\n /**\n * Public API: off(), on(), add(), (remove()), one(), fire(), clone()\n */\n\n /**\n * off(element[, eventType(s)[, handler ]])\n */\n , off = function (element, typeSpec, fn) {\n var isTypeStr = isString(typeSpec)\n , k, type, namespaces, i\n\n if (isTypeStr && typeSpec.indexOf(' ') > 0) {\n // off(el, 't1 t2 t3', fn) or off(el, 't1 t2 t3')\n typeSpec = str2arr(typeSpec)\n for (i = typeSpec.length; i--;)\n off(element, typeSpec[i], fn)\n return element\n }\n\n type = isTypeStr && typeSpec.replace(nameRegex, '')\n if (type && customEvents[type]) type = customEvents[type].base\n\n if (!typeSpec || isTypeStr) {\n // off(el) or off(el, t1.ns) or off(el, .ns) or off(el, .ns1.ns2.ns3)\n if (namespaces = isTypeStr && typeSpec.replace(namespaceRegex, '')) namespaces = str2arr(namespaces, '.')\n removeListener(element, type, fn, namespaces)\n } else if (isFunction(typeSpec)) {\n // off(el, fn)\n removeListener(element, null, typeSpec)\n } else {\n // off(el, { t1: fn1, t2, fn2 })\n for (k in typeSpec) {\n if (typeSpec.hasOwnProperty(k)) off(element, k, typeSpec[k])\n }\n }\n\n return element\n }\n\n /**\n * on(element, eventType(s)[, selector], handler[, args ])\n */\n , on = function(element, events, selector, fn) {\n var originalFn, type, types, i, args, entry, first\n\n //TODO: the undefined check means you can't pass an 'args' argument, fix this perhaps?\n if (selector === undefined && typeof events == 'object') {\n //TODO: this can't handle delegated events\n for (type in events) {\n if (events.hasOwnProperty(type)) {\n on.call(this, element, type, events[type])\n }\n }\n return\n }\n\n if (!isFunction(selector)) {\n // delegated event\n originalFn = fn\n args = slice.call(arguments, 4)\n fn = delegate(selector, originalFn, selectorEngine)\n } else {\n args = slice.call(arguments, 3)\n fn = originalFn = selector\n }\n\n types = str2arr(events)\n\n // special case for one(), wrap in a self-removing handler\n if (this === ONE) {\n fn = once(off, element, events, fn, originalFn)\n }\n\n for (i = types.length; i--;) {\n // add new handler to the registry and check if it's the first for this element/type\n first = registry.put(entry = new RegEntry(\n element\n , types[i].replace(nameRegex, '') // event type\n , fn\n , originalFn\n , str2arr(types[i].replace(namespaceRegex, ''), '.') // namespaces\n , args\n , false // not root\n ))\n if (entry[eventSupport] && first) {\n // first event of this type on this element, add root listener\n listener(element, entry.eventType, true, entry.customType)\n }\n }\n\n return element\n }\n\n /**\n * add(element[, selector], eventType(s), handler[, args ])\n *\n * Deprecated: kept (for now) for backward-compatibility\n */\n , add = function (element, events, fn, delfn) {\n return on.apply(\n null\n , !isString(fn)\n ? slice.call(arguments)\n : [ element, fn, events, delfn ].concat(arguments.length > 3 ? slice.call(arguments, 5) : [])\n )\n }\n\n /**\n * one(element, eventType(s)[, selector], handler[, args ])\n */\n , one = function () {\n return on.apply(ONE, arguments)\n }\n\n /**\n * fire(element, eventType(s)[, args ])\n *\n * The optional 'args' argument must be an array, if no 'args' argument is provided\n * then we can use the browser's DOM event system, otherwise we trigger handlers manually\n */\n , fire = function (element, type, args) {\n var types = str2arr(type)\n , i, j, l, names, handlers\n\n for (i = types.length; i--;) {\n type = types[i].replace(nameRegex, '')\n if (names = types[i].replace(namespaceRegex, '')) names = str2arr(names, '.')\n if (!names && !args && element[eventSupport]) {\n fireListener(nativeEvents[type], type, element)\n } else {\n // non-native event, either because of a namespace, arguments or a non DOM element\n // iterate over all listeners and manually 'fire'\n handlers = registry.get(element, type, null, false)\n args = [false].concat(args)\n for (j = 0, l = handlers.length; j < l; j++) {\n if (handlers[j].inNamespaces(names)) {\n handlers[j].handler.apply(element, args)\n }\n }\n }\n }\n return element\n }\n\n /**\n * clone(dstElement, srcElement[, eventType ])\n *\n * TODO: perhaps for consistency we should allow the same flexibility in type specifiers?\n */\n , clone = function (element, from, type) {\n var handlers = registry.get(from, type, null, false)\n , l = handlers.length\n , i = 0\n , args, beanDel\n\n for (; i < l; i++) {\n if (handlers[i].original) {\n args = [ element, handlers[i].type ]\n if (beanDel = handlers[i].handler.__beanDel) args.push(beanDel.selector)\n args.push(handlers[i].original)\n on.apply(null, args)\n }\n }\n return element\n }\n\n , bean = {\n 'on' : on\n , 'add' : add\n , 'one' : one\n , 'off' : off\n , 'remove' : off\n , 'clone' : clone\n , 'fire' : fire\n , 'Event' : Event\n , 'setSelectorEngine' : setSelectorEngine\n , 'noConflict' : function () {\n context[name] = old\n return this\n }\n }\n\n // for IE, clean up on unload to avoid leaks\n if (win.attachEvent) {\n var cleanup = function () {\n var i, entries = registry.entries()\n for (i in entries) {\n if (entries[i].type && entries[i].type !== 'unload') off(entries[i].element, entries[i].type)\n }\n win.detachEvent('onunload', cleanup)\n win.CollectGarbage && win.CollectGarbage()\n }\n win.attachEvent('onunload', cleanup)\n }\n\n // initialize selector engine to internal default (qSA or throw Error)\n setSelectorEngine(Ink.ss)\n\n return bean\n });\n\n /**\n * Keep this declaration here and off Bean as it extends the Event\n * object and some properties are readonly in strict mode\n */\n 'use strict';\n\n var InkEvent = {\n\n KEY_BACKSPACE: 8,\n KEY_TAB: 9,\n KEY_RETURN: 13,\n KEY_ESC: 27,\n KEY_SPACE: 32,\n KEY_LEFT: 37,\n KEY_UP: 38,\n KEY_RIGHT: 39,\n KEY_DOWN: 40,\n KEY_DELETE: 46,\n KEY_HOME: 36,\n KEY_END: 35,\n KEY_PAGEUP: 33,\n KEY_PAGEDOWN: 34,\n KEY_INSERT: 45,\n \n /**\n * Creates a debounced version of a function.\n * Returns a function which calls `func`, waiting at least `wait` milliseconds between calls. This is useful for events such as `scroll` or `resize`, which can be triggered too many times per second, slowing down the browser with needless function calls.\n *\n * *note:* This does not delay the first function call to the function.\n *\n * @method throttle\n * @param {Function} func Function to call. Arguments and context are both passed.\n * @param {Number} [wait]=0 Milliseconds to wait between calls.\n * @sample Ink_Dom_Event_1_throttle.html \n **/\n throttle: function (func, wait) {\n wait = wait || 0;\n var lastCall = 0; // Warning: This breaks on Jan 1st 1970 0:00\n var timeout;\n var throttled = function () {\n var now = +new Date();\n var timeDiff = now - lastCall;\n if (timeDiff >= wait) {\n lastCall = now;\n return func.apply(this, [].slice.call(arguments));\n } else {\n var that = this;\n var args = [].slice.call(arguments);\n if (!timeout) {\n timeout = setTimeout(function () {\n timeout = null;\n return throttled.apply(that, args);\n }, wait - timeDiff);\n }\n }\n };\n return throttled;\n },\n\n /**\n * Gets the event's target element.\n *\n * @method element\n * @param {Object} ev Event object\n * @return {DOMNode} The target\n * @sample Ink_Dom_Event_1_element.html \n */\n element: function(ev) {\n var node = ev.delegationTarget ||\n ev.target ||\n // IE stuff\n (ev.type === 'mouseout' && ev.fromElement) ||\n (ev.type === 'mouseleave' && ev.fromElement) ||\n (ev.type === 'mouseover' && ev.toElement) ||\n (ev.type === 'mouseenter' && ev.toElement) ||\n ev.srcElement ||\n null;\n return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node;\n },\n\n /**\n * Gets the event's related target element.\n *\n * @method relatedTarget\n * @param {Object} ev event object\n * @return {DOMNode} The related target\n * @sample Ink_Dom_Event_1_relatedTarget.html \n */\n relatedTarget: function(ev){\n var node = ev.relatedTarget ||\n // IE stuff\n (ev.type === 'mouseout' && ev.toElement) ||\n (ev.type === 'mouseleave' && ev.toElement) ||\n (ev.type === 'mouseover' && ev.fromElement) ||\n (ev.type === 'mouseenter' && ev.fromElement) ||\n null;\n return node && (node.nodeType === 3 || node.nodeType === 4) ? node.parentNode : node;\n },\n\n /**\n * Find closest ancestor element by tag name related to the event target.\n * Navigate up the DOM tree, looking for a tag with the name `elmTagName`.\n *\n * If such tag is not found, `document` is returned.\n *\n * @method findElement\n * @param {Object} ev Event object\n * @param {String} elmTagName Tag name to find\n * @param {Boolean} [force]=false Flag to skip returning `document` and to return `false` instead.\n * @return {DOMElement} the first element which matches given tag name or the document element if the wanted tag is not found\n * @sample Ink_Dom_Event_1_findElement.html \n */\n findElement: function(ev, elmTagName, force)\n {\n var node = this.element(ev);\n while(true) {\n if(node.nodeName.toLowerCase() === elmTagName.toLowerCase()) {\n return node;\n } else {\n node = node.parentNode;\n if(!node) {\n if(force) {\n return false;\n }\n return document;\n }\n if(!node.parentNode){\n if(force){ return false; }\n return document;\n }\n }\n }\n },\n\n /**\n * Attaches an event to element\n *\n * @method observe\n * @param {DOMElement|String} element Element id or element\n * @param {String} eventName Event name\n * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event.\n * @param {Boolean} [useCapture] Flag to change event listening from bubbling to capture.\n * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later.\n * @sample Ink_Dom_Event_1_observe.html \n */\n observe: function(element, eventName, callBack, useCapture) {\n element = Ink.i(element);\n if(element) {\n if(element.addEventListener) {\n element.addEventListener(eventName, callBack, !!useCapture);\n } else {\n element.attachEvent('on' + eventName, (callBack = Ink.bind(callBack, element)));\n }\n return callBack;\n }\n },\n\n /**\n * Like observe, but listen to the event only once.\n *\n * @method observeOnce\n * @param {DOMElement|String} element Element id or element\n * @param {String} eventName Event name\n * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event.\n * @param {Boolean} [useCapture] Flag to change event listening from bubbling to capture.\n * @return {Function} The event handler used. Hang on to this if you want to `stopObserving` later.\n * @sample Ink_Dom_Event_1_observeOnce.html \n */\n observeOnce: function (element, eventName, callBack, useCapture) {\n var onceBack = function () {\n InkEvent.stopObserving(element, eventName, onceBack);\n return callBack();\n };\n return InkEvent.observe(element, eventName, onceBack, useCapture);\n },\n\n /**\n * Attaches an event to a selector or array of elements.\n *\n * @method observeMulti\n * @param {Array|String} elements \n * @param {String} eventName Event name\n * @param {Function} callBack Receives the event object as a parameter. If you're manually firing custom events, check it's eventName property to make sure you're handling the right event.\n * @param {Boolean} [useCapture] Flag change event listening from bubbling to capture.\n * @return {Function} The used callback.\n * @sample Ink_Dom_Event_1_observeMulti.html \n */\n observeMulti: function (elements, eventName, callBack, useCapture) {\n if (typeof elements === 'string') {\n elements = Ink.ss(elements);\n } else if ( /* is an element */ elements && elements.nodeType === 1) {\n elements = [elements];\n }\n if (!elements[0]) { return false; }\n\n for (var i = 0, len = elements.length; i < len; i++) {\n this.observe(elements[i], eventName, callBack, useCapture);\n }\n return callBack;\n },\n\n /**\n * Observes an event on an element and its descendants matching the selector.\n *\n * Requires Ink.Dom.Selector if you need to use a selector.\n *\n * @method observeDelegated\n * @param {DOMElement|String} element Element to observe.\n * @param {String} eventName Event name to observe.\n * @param {String} selector Child element selector. When null, finds any element.\n * @param {Function} callback Callback to be called when the event is fired\n * @return {Function} The used callback, for ceasing to listen to the event later.\n * @sample Ink_Dom_Event_1_observeDelegated.html \n **/\n observeDelegated: function (element, eventName, selector, callback) {\n return InkEvent.observe(element, eventName, function (event) {\n var fromElement = InkEvent.element(event);\n if (!fromElement || fromElement === element) { return; }\n\n var cursor = fromElement;\n\n // Go up the document tree until we hit the element itself.\n while (cursor !== element && cursor !== document && cursor) {\n if (Ink.Dom.Selector_1.matchesSelector(cursor, selector)) {\n event.delegationTarget = cursor;\n return callback(event);\n }\n cursor = cursor.parentNode;\n }\n });\n },\n\n /**\n * Removes an event attached to an element.\n *\n * @method stopObserving\n * @param {DOMElement|String} element Element id or element\n * @param {String} eventName Event name\n * @param {Function} callBack Callback function\n * @param {Boolean} [useCapture] Set to true if the event was being observed with useCapture set to true as well.\n * @sample Ink_Dom_Event_1_stopObserving.html \n */\n stopObserving: function(element, eventName, callBack, useCapture) {\n element = Ink.i(element);\n\n if(element) {\n if(element.removeEventListener) {\n element.removeEventListener(eventName, callBack, !!useCapture);\n } else {\n element.detachEvent('on' + eventName, callBack);\n }\n }\n },\n\n /**\n * Stops event propagation and bubbling.\n *\n * @method stop\n * @param {Object} event Event handle\n * @sample Ink_Dom_Event_1_stop.html \n */\n stop: function(event)\n {\n if(event.cancelBubble !== null) {\n event.cancelBubble = true;\n }\n if(event.stopPropagation) {\n event.stopPropagation();\n }\n if(event.preventDefault) {\n event.preventDefault();\n }\n if(window.attachEvent) {\n event.returnValue = false;\n }\n if(event.cancel !== null) {\n event.cancel = true;\n }\n },\n\n /**\n * Stops event propagation.\n *\n * @method stopPropagation\n * @param {Object} event Event handle\n * @sample Ink_Dom_Event_1_stopPropagation.html \n */\n stopPropagation: function(event) {\n if(event.cancelBubble !== null) {\n event.cancelBubble = true;\n }\n if(event.stopPropagation) {\n event.stopPropagation();\n }\n },\n\n /**\n * Stops event default behaviour.\n *\n * @method stopDefault\n * @param {Object} event Event handle\n * @sample Ink_Dom_Event_1_stopDefault.html \n */\n stopDefault: function(event)\n {\n if(event.preventDefault) {\n event.preventDefault();\n }\n if(window.attachEvent) {\n event.returnValue = false;\n }\n if(event.cancel !== null) {\n event.cancel = true;\n }\n },\n\n /**\n * Gets the pointer's coordinates from the event object.\n *\n * @method pointer\n * @param {Object} ev Event object\n * @return {Object} An object with the mouse X and Y position\n * @sample Ink_Dom_Event_1_pointer.html \n */\n pointer: function(ev)\n {\n return {\n x: this.pointerX(ev),\n y: this.pointerY(ev)\n };\n },\n\n /**\n * Gets the pointer's X coordinate.\n *\n * @method pointerX\n * @param {Object} ev Event object\n * @return {Number} Mouse X position\n */\n pointerX: function(ev)\n {\n return (ev.touches && ev.touches[0] && ev.touches[0].clientX) ||\n (ev.pageX) ||\n (ev.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft));\n },\n\n /**\n * Gets the pointer's Y coordinate.\n *\n * @method pointerY\n * @param {Object} ev Event object\n * @return {Number} Mouse Y position\n */\n pointerY: function(ev)\n {\n return (ev.touches && ev.touches[0] && ev.touches[0].clientY) ||\n (ev.pageY) ||\n (ev.clientY + (document.documentElement.scrollTop || document.body.scrollTop));\n },\n\n /**\n * Checks if an event is a left click.\n *\n * @method isLeftClick\n * @param {Object} ev Event object\n * @return {Boolean} True if the event is a left click\n * @sample Ink_Dom_Event_1_isLeftClick.html \n */\n isLeftClick: function(ev) {\n if (window.addEventListener) {\n if(ev.button === 0){\n return true;\n } else if(ev.type === 'touchend' && ev.button === null){\n // [todo] do the above check for pointerEvents too\n return true;\n }\n }\n else {\n if(ev.button === 1){ return true; }\n }\n return false;\n },\n\n /**\n * Checks if an event is a right click.\n *\n * @method isRightClick\n * @param {Object} ev Event object\n * @return {Boolean} True if the event is a right click\n * @sample Ink_Dom_Event_1_isRightClick.html \n */\n isRightClick: function(ev) {\n return (ev.button === 2);\n },\n\n /**\n * Checks if an event is a middle click.\n *\n * @method isMiddleClick\n * @param {Object} ev Event object\n * @return {Boolean} True if the event is a middle click\n * @sample Ink_Dom_Event_1_isMiddleClick.html \n */\n isMiddleClick: function(ev) {\n if (window.addEventListener) {\n return (ev.button === 1);\n }\n else {\n return (ev.button === 4);\n }\n return false;\n },\n\n /**\n * Gets character from an event.\n *\n * @method getCharFromKeyboardEvent\n * @param {Object} event Keyboard event\n * @param {Boolean} [changeCasing] If true uppercases, if false lowercases, otherwise keeps casing\n * @return {String} Character representation of pressed key combination\n * @sample Ink_Dom_Event_1_getCharFromKeyboardEvent.html \n */\n getCharFromKeyboardEvent: function(event, changeCasing) {\n var k = event.keyCode;\n var c = String.fromCharCode(k);\n\n var shiftOn = event.shiftKey;\n if (k >= 65 && k <= 90) { // A-Z\n if (typeof changeCasing === 'boolean') {\n shiftOn = changeCasing;\n }\n return (shiftOn) ? c : c.toLowerCase();\n }\n else if (k >= 96 && k <= 105) { // numpad digits\n return String.fromCharCode( 48 + (k-96) );\n }\n switch (k) {\n case 109: case 189: return '-';\n case 107: case 187: return '+';\n }\n return c;\n },\n\n debug: function(){}\n};\n\n/**\n * Lets you attach event listeners to both elements and objects.\n * http://github.com/fat/bean#on\n *\n * @method on\n * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object\n * @param {String} eventType An Event (or multiple events, space separated) to listen to\n * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector\n * @param {Function} [handler] The callback function\n * @param {Object} [args...] Additional arguments to pass to the callback function when triggered\n * \n * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object\n * @sample Ink_Dom_Event_1_on.html \n */\n\n/**\n * Alias for `on` but will only be executed once.\n * bean.one() is an alias for bean.on() except that the handler will only be executed once and then removed for the event type(s).\n * http://github.com/fat/bean#one\n *\n * @method one\n * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object\n * @param {String} eventType An Event (or multiple events, space separated) to listen to\n * @param {String} [selector] A CSS DOM Element selector string to bind the listener to child elements matching the selector\n * @param {Function} [handler] The callback function\n * @param [args...] Additional arguments to pass to the callback function when triggered\n * \n * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object\n * @sample Ink_Dom_Event_1_one.html \n */\n\n/**\n * Removes event handlers.\n * bean.off() is how you get rid of handlers once you no longer want them active. It's also a good idea to call off on elements before you remove them from your DOM; this gives Bean a chance to clean up some things and prevents memory leaks.\n * http://github.com/fat/bean#off\n *\n * @method off\n * @param {DOMElement|Object} element An HTML DOM element or any JavaScript Object\n * @param {String} eventType An Event (or multiple events, space separated) to remove\n * @param {Function} [handler] The specific callback function to remove\n * \n * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object\n * @sample Ink_Dom_Event_1_off.html \n */\n\n/**\n * Clones events from one object to another\n * bean.clone() is a method for cloning events from one DOM element or object to another.\n * http://github.com/fat/bean#clone\n *\n * @method clone\n * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object to copy events to\n * @param {String} srcElement An HTML DOM element or any JavaScript Object to copy events from\n * @param {String} [eventType] An Event (or multiple events, space separated) to clone\n * \n * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object\n * @sample Ink_Dom_Event_1_clone.html \n */\n\n/**\n * Triggers events.\n * http://github.com/fat/bean#fire\n *\n * @method fire\n * @param {DOMElement|Object} destElement An HTML DOM element or any JavaScript Object fire the event on\n * @param {String} eventType An Event (or multiple events, space separated) to fire\n * @param [args...] Additional arguments to pass to the callback function when triggered\n *\n * @return {DOMElement|Object} Returns the original DOM Element or Javascript Object\n * @sample Ink_Dom_Event_1_fire.html \n */\n\nreturn Ink.extendObj(InkEvent, bean);\n\n});\n","/**\n * @module Ink.Dom.FormSerialize_1\n * Two way serialization of form data and javascript objects.\n * Valid applications are ad hoc AJAX/syndicated submission of forms, restoring form values from server side state, etc.\n */\n\nInk.createModule('Ink.Dom.FormSerialize', 1, ['Ink.Util.Array_1', 'Ink.Dom.Element_1', 'Ink.Dom.Selector_1'], function (InkArray, InkElement, Selector) {\n 'use strict';\n\n // Check whether something is not a string or a DOM element, but still has length.\n function isArrayIsh(obj) {\n return obj != null &&\n (!InkElement.isDOMElement(obj)) &&\n (InkArray.isArray(obj) || (typeof obj !== 'string' && typeof obj.length === 'number'));\n }\n\n function toArray(obj) {\n if (isArrayIsh(obj)) { return obj; }\n else { return [obj]; }\n }\n\n /**\n * @namespace Ink.Dom.FormSerialize\n * @static\n **/\n var FormSerialize = {\n\n /**\n * Serializes a form element into a JS object\n * It turns field names into keys and field values into values.\n *\n * note: Multi-select and checkboxes with multiple values will result in arrays\n *\n * @method serialize\n * @param {DOMElement|String} form Form element to extract data\n * @return {Object} Map of fieldName -> String|String[]|Boolean\n * @sample Ink_Dom_FormSerialize_serialize.html \n */\n serialize: function(form) {\n var out = {};\n var emptyArrayToken = {}; // A hack so that empty select[multiple] elements appear although empty.\n\n var pairs = this.asPairs(form, { elements: true, emptyArray: emptyArrayToken });\n if (pairs == null) { return pairs; }\n InkArray.forEach(pairs, function (pair) {\n var name = pair[0].replace(/\\[\\]$/, '');\n var value = pair[1];\n var el = pair[2];\n\n if (value === emptyArrayToken) {\n out[name] = []; // It's an empty select[multiple]\n } else if (!(FormSerialize._resultsInArray(el) || /\\[\\]$/.test(pair[0]))) {\n out[name] = value;\n } else {\n out[name] = out[name] || [];\n out[name].push(value);\n }\n });\n\n return out;\n },\n\n /**\n * Like `serialize`, but returns an array of [fieldName, value] pairs.\n *\n * @method asPairs\n * @param {DOMElement|String} form Form element\n * @param {Object} [options] Options object, containing:\n * @param {Boolean} [options.elements] Instead of returning an array of [fieldName, value] pairs, return an array of [fieldName, value, fieldElement] triples.\n * @param {Boolean} [options.emptyArray] What to emit as the value of an empty select[multiple]. If you don't pass this option, nothing comes out.\n *\n * @return Array of [fieldName, value] pairs.\n **/\n asPairs: function (form, options) {\n var out = [];\n options = options || {};\n\n function emit(name, val, el) {\n if (options.elements) {\n out.push([name, val, el]);\n } else {\n out.push([name, val]);\n }\n }\n\n function serializeEl(el) {\n if (el.nodeName.toLowerCase() === 'select' && el.multiple) {\n var didEmit = false;\n InkArray.forEach(Selector.select('option:checked', el), function (thisOption) {\n emit(el.name, thisOption.value, el);\n didEmit = true;\n });\n if (!didEmit && 'emptyArray' in options) {\n emit(el.name, options.emptyArray, el);\n }\n } else {\n emit(el.name, el.value, el);\n }\n }\n\n if ((form = Ink.i(form))) {\n var inputs = InkArray.filter(form.elements, FormSerialize._isSerialized);\n for (var i = 0, len = inputs.length; i < len; i++) {\n serializeEl(inputs[i]);\n }\n return out;\n }\n\n return null;\n },\n\n /**\n * Sets form elements' values with values from an object\n *\n * Note: You can't set the values of an input with `type=\"file\"` (browser prohibits it)\n *\n * @method fillIn \n * @param {DOMElement|String} form Form element to be populated\n * @param {Object|Array} map2 mapping of fields to values contained in fields. Can be a hash (keys as names, strings or arrays for values), or an array of [name, value] pairs.\n * @sample Ink_Dom_FormSerialize_fillIn.html \n */\n fillIn: function(form, map2) {\n if (!(form = Ink.i(form))) { return null; }\n\n var pairs;\n\n if (typeof map2 === 'object' && !isArrayIsh(map2)) {\n pairs = FormSerialize._objToPairs(map2);\n } else if (isArrayIsh(map2)) {\n pairs = map2;\n } else {\n return null;\n }\n\n return FormSerialize._fillInPairs(form, pairs);\n },\n\n _objToPairs: function (obj) {\n var pairs = [];\n var val;\n for (var name in obj) if (obj.hasOwnProperty(name)) {\n val = toArray(obj[name]);\n for (var i = 0, len = val.length; i < len; i++) {\n pairs.push([name, val[i]]);\n }\n if (len === 0) {\n pairs.push([name, []]);\n }\n }\n return pairs;\n },\n\n _fillInPairs: function (form, pairs) {\n pairs = InkArray.groupBy(pairs, {\n key: function (pair) { return pair[0].replace(/\\[\\]$/, ''); }\n });\n\n // For each chunk...\n pairs = InkArray.map(pairs, function (pair) {\n // Join the items in the chunk by concatenating the values together and leaving the names alone\n var values = InkArray.reduce(pair, function (left, right) {\n return [null, left[1].concat([right[1]])];\n }, [null, []])[1];\n return [pair[0][0], values];\n });\n\n var name;\n var inputs;\n var values;\n for (var i = 0, len = pairs.length; i < len; i++) {\n name = pairs[i][0];\n\n if (name in form) {\n inputs = form[name];\n } else if ((name + '[]') in form) {\n inputs = form[name + '[]'];\n name = name + '[]';\n } else {\n continue;\n }\n\n inputs = toArray(inputs);\n values = pairs[i][1];\n\n FormSerialize._fillInOne(name, inputs, values);\n }\n },\n\n _fillInOne: function (name, inputs, values) {\n var firstOne = inputs[0];\n var firstNodeName = firstOne.nodeName.toLowerCase();\n var firstType = firstOne.getAttribute('type');\n firstType = firstType && firstType.toLowerCase();\n var isSelectMulti = firstNodeName === 'select' && InkElement.hasAttribute(firstOne, 'multiple');\n\n if (firstType === 'checkbox' || firstType === 'radio') {\n FormSerialize._fillInBoolean(inputs, values, 'checked');\n } else if (isSelectMulti) {\n FormSerialize._fillInBoolean(inputs[0].options, values, 'selected');\n } else {\n if (inputs.length !== values.length) {\n Ink.warn('Form had ' + inputs.length + ' inputs named \"' + name + '\", but received ' + values.length + ' values.');\n }\n\n for (var i = 0, len = Math.min(inputs.length, values.length); i < len; i += 1) {\n inputs[i].value = values[i];\n }\n }\n },\n\n _fillInBoolean: function (inputs, values, checkAttr /* 'selected' or 'checked' */) {\n InkArray.forEach(inputs, function (input) {\n var isChecked = InkArray.inArray(input.value, values);\n input[checkAttr] = isChecked;\n });\n },\n\n /**\n * Whether FormSerialize.serialize() should produce an array when looking at this element.\n * @method _resultsInArray\n * @private\n * @param element\n **/\n _resultsInArray: function (element) {\n var type = element.getAttribute('type');\n var nodeName = element.nodeName.toLowerCase();\n\n return type === 'checkbox' ||\n (nodeName === 'select' && InkElement.hasAttribute(element, 'multiple'));\n },\n\n _isSerialized: function (element) {\n if (!InkElement.isDOMElement(element)) { return false; }\n if (!InkElement.hasAttribute(element, 'name')) { return false; }\n\n var nodeName = element.nodeName.toLowerCase();\n\n if (!nodeName || nodeName === 'fieldset') { return false; }\n\n if (element.type === 'checkbox' || element.type === 'radio') {\n return !!element.checked;\n }\n\n return true;\n }\n };\n\n return FormSerialize;\n});\n","/**\n * Execute code only when the DOM is loaded.\n * @module Ink.Dom.Loaded_1\n * @version 1\n */\n \nInk.createModule('Ink.Dom.Loaded', 1, [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Dom.Loaded_1\n **/\n var Loaded = {\n\n /**\n * Callbacks and their contexts. Array of 2-arrays.\n *\n * []\n *\n * @attribute _contexts Array\n * @private\n * \n */\n _contexts: [], // Callbacks' queue\n\n /**\n * Specify a function to execute when the DOM is fully loaded.\n *\n * @method run\n * @param {Object} [win]=window Window object to attach/add the event\n * @param {Function} fn Callback function to be executed after the DOM is ready\n * @public\n * @sample Ink_Dom_Loaded_run.html \n */\n run: function(win, fn) {\n if (!fn) {\n fn = win;\n win = window;\n }\n\n var context;\n\n for (var i = 0, len = this._contexts.length; i < len; i++) {\n if (this._contexts[i][0] === win) {\n context = this._contexts[i][1];\n break;\n }\n }\n if (!context) {\n context = {\n cbQueue: [],\n win: win,\n doc: win.document,\n root: win.document.documentElement,\n done: false,\n top: true\n };\n context.handlers = {\n checkState: Ink.bindEvent(this._checkState, this, context),\n poll: Ink.bind(this._poll, this, context)\n };\n this._contexts.push(\n [win, context] // Javascript Objects cannot map different windows to\n // different values.\n );\n }\n\n var ael = context.doc.addEventListener;\n context.add = ael ? 'addEventListener' : 'attachEvent';\n context.rem = ael ? 'removeEventListener' : 'detachEvent';\n context.pre = ael ? '' : 'on';\n context.det = ael ? 'DOMContentLoaded' : 'onreadystatechange';\n context.wet = context.pre + 'load';\n\n var csf = context.handlers.checkState;\n var alreadyLoaded = (\n /complete|interactive|loaded/.test(context.doc.readyState) &&\n context.win.location.toString() !== 'about:blank'); // https://code.google.com/p/chromium/issues/detail?id=32357\n\n if (alreadyLoaded){\n setTimeout(Ink.bind(function () {\n fn.call(context.win, 'lazy');\n }, this), 0);\n } else {\n context.cbQueue.push(fn);\n\n context.doc[context.add]( context.det , csf );\n context.win[context.add]( context.wet , csf );\n\n var frameElement = 1;\n try{\n frameElement = context.win.frameElement;\n } catch(e) {}\n if ( !ael && context.root && context.root.doScroll ) { // IE HACK\n try {\n context.top = !frameElement;\n } catch(e) { }\n if (context.top) {\n this._poll(context);\n }\n }\n }\n },\n\n /**\n * Function that will be running the callbacks after the page is loaded\n *\n * @method _checkState\n * @param {Event} event Triggered event\n * @private\n */\n _checkState: function(event, context) {\n if ( !event || (event.type === 'readystatechange' && context.doc.readyState !== 'complete')) {\n return;\n }\n var where = (event.type === 'load') ? context.win : context.doc;\n where[context.rem](context.pre+event.type, context.handlers.checkState, false);\n this._ready(context);\n },\n\n /**\n * Polls the load progress of the page to see if it has already loaded or not\n *\n * @method _poll\n * @private\n */\n\n /**\n *\n * function _poll\n */\n _poll: function(context) {\n try {\n context.root.doScroll('left');\n } catch(e) {\n return setTimeout(context.handlers.poll, 50);\n }\n this._ready(context);\n },\n\n /**\n * Function that runs the callbacks from the queue when the document is ready.\n *\n * @method _ready\n * @private\n */\n _ready: function(context) {\n if (!context.done) {\n context.done = true;\n for (var i = 0; i < context.cbQueue.length; ++i) {\n context.cbQueue[i].call(context.win);\n }\n context.cbQueue = [];\n }\n }\n };\n\n return Loaded;\n\n});\n","/**\n * CSS selector engine\n * @module Ink.Dom.Selector_1\n * @version 1\n */\n \nInk.createModule('Ink.Dom.Selector', 1, [], function() {\n /*jshint forin:false, eqnull:true, noempty:false, expr:true, boss:true, maxdepth:false*/\n\t'use strict';\n\n/*!\n * Sizzle CSS Selector Engine\n * Copyright 2013 jQuery Foundation and other contributors\n * Released under the MIT license\n * http://sizzlejs.com/\n */\n\nvar i,\n\tcachedruns,\n\tExpr,\n\tgetText,\n\tisXML,\n\tcompile,\n\toutermostContext,\n\trecompare,\n\tsortInput,\n\n\t// Local document vars\n\tsetDocument,\n\tdocument,\n\tdocElem,\n\tdocumentIsHTML,\n\trbuggyQSA,\n\trbuggyMatches,\n\tmatches,\n\tcontains,\n\n\t// Instance-specific data\n\texpando = \"sizzle\" + -(new Date()),\n\tpreferredDoc = window.document,\n\tsupport = {},\n\tdirruns = 0,\n\tdone = 0,\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\thasDuplicate = false,\n\tsortOrder = function() { return 0; },\n\n\t// General-purpose constants\n\tstrundefined = typeof undefined,\n\tMAX_NEGATIVE = 1 << 31,\n\n\t// Array methods\n\tarr = [],\n\tpop = arr.pop,\n\tpush_native = arr.push,\n\tpush = arr.push,\n\tslice = arr.slice,\n\t// Use a stripped-down indexOf if we can't use a native one\n\tindexOf = arr.indexOf || function( elem ) {\n\t\tvar i = 0,\n\t\t\tlen = this.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( this[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\n\t// Regular expressions\n\n\t// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\t// http://www.w3.org/TR/css3-syntax/#characters\n\tcharacterEncoding = \"(?:\\\\\\\\.|[\\\\w-]|[^\\\\x00-\\\\xa0])+\",\n\n\t// Loosely modeled on CSS identifier characters\n\t// An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors\n\t// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = characterEncoding.replace( \"w\", \"w#\" ),\n\n\t// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors\n\toperators = \"([*^$|!~]?=)\",\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + characterEncoding + \")\" + whitespace +\n\t\t\"*(?:\" + operators + whitespace + \"*(?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|(\" + identifier + \")|)|)\" + whitespace + \"*\\\\]\",\n\n\t// Prefer arguments quoted,\n\t// then not containing pseudos/brackets,\n\t// then attribute selectors/non-parenthetical expressions,\n\t// then anything else\n\t// These preferences are here to reduce the number of selectors\n\t// needing tokenize in the PSEUDO preFilter\n\tpseudos = \":(\" + characterEncoding + \")(?:\\\\(((['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|((?:\\\\\\\\.|[^\\\\\\\\()[\\\\]]|\" + attributes.replace( 3, 8 ) + \")*)|.*)\\\\)|)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([\\\\x20\\\\t\\\\r\\\\n\\\\f>+~])\" + whitespace + \"*\" ),\n\trpseudo = new RegExp( pseudos ),\n\tridentifier = new RegExp( \"^\" + identifier + \"$\" ),\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + characterEncoding + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + characterEncoding + \")\" ),\n\t\t\"NAME\": new RegExp( \"^\\\\[name=['\\\"]?(\" + characterEncoding + \")['\\\"]?\\\\]\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + characterEncoding.replace( \"w\", \"w*\" ) + \")\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"CHILD\": new RegExp( \"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t// We use this for POS matching in `select`\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" +\n\t\t\twhitespace + \"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\", \"i\" )\n\t},\n\n\trsibling = /[\\x20\\t\\r\\n\\f]*[+~]/,\n\n\trnative = /^[^{]+\\{\\s*\\[native code/,\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w-]+)|(\\w+)|\\.([\\w-]+))$/,\n\n\trinputs = /^(?:input|select|textarea|button)$/i,\n\trheader = /^h\\d$/i,\n\n\trescape = /'|\\\\/g,\n\trattributeQuotes = /\\=[\\x20\\t\\r\\n\\f]*([^'\"\\]]*)[\\x20\\t\\r\\n\\f]*\\]/g,\n\n\t// CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters\n\trunescape = /\\\\([\\da-fA-F]{1,6}[\\x20\\t\\r\\n\\f]?|.)/g,\n\tfunescape = function( _, escaped ) {\n\t\tvar high = \"0x\" + escaped - 0x10000;\n\t\t// NaN means non-codepoint\n\t\treturn high !== high ?\n\t\t\tescaped :\n\t\t\t// BMP codepoint\n\t\t\thigh < 0 ?\n\t\t\t\tString.fromCharCode( high + 0x10000 ) :\n\t\t\t\t// Supplemental Plane codepoint (surrogate pair)\n\t\t\t\tString.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );\n\t};\n\n// Optimize for push.apply( _, NodeList )\ntry {\n\tpush.apply(\n\t\t(arr = slice.call( preferredDoc.childNodes )),\n\t\tpreferredDoc.childNodes\n\t);\n\t// Support: Android<4.0\n\t// Detect silently failing push.apply\n\tarr[ preferredDoc.childNodes.length ].nodeType;\n} catch ( e ) {\n\tpush = { apply: arr.length ?\n\n\t\t// Leverage slice if possible\n\t\tfunction( target, els ) {\n\t\t\tpush_native.apply( target, slice.call(els) );\n\t\t} :\n\n\t\t// Support: IE<9\n\t\t// Otherwise append directly\n\t\tfunction( target, els ) {\n\t\t\tvar j = target.length,\n\t\t\t\ti = 0;\n\t\t\t// Can't trust NodeList.length\n\t\t\twhile ( (target[j++] = els[i++]) ) {}\n\t\t\ttarget.length = j - 1;\n\t\t}\n\t};\n}\n\n/*\n * For feature detection\n * @param {Function} fn The function to test for native support\n */\nfunction isNative( fn ) {\n\treturn rnative.test( fn + \"\" );\n}\n\n/*\n * Create key-value caches of limited size\n * @returns {Function(string, Object)} Returns the Object data after storing it on itself with\n *\tproperty name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)\n *\tdeleting the oldest entry\n */\nfunction createCache() {\n\tvar cache,\n\t\tkeys = [];\n\n\treturn (cache = function( key, value ) {\n\t\t// Use (key + \" \") to avoid collision with native prototype properties (see Issue #157)\n\t\tif ( keys.push( key += \" \" ) > Expr.cacheLength ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tdelete cache[ keys.shift() ];\n\t\t}\n\t\treturn (cache[ key ] = value);\n\t});\n}\n\n/*\n * Mark a function for special use by Sizzle\n * @param {Function} fn The function to mark\n */\nfunction markFunction( fn ) {\n\tfn[ expando ] = true;\n\treturn fn;\n}\n\n/*\n * Support testing using an element\n * @param {Function} fn Passed the created div and expects a boolean result\n */\nfunction assert( fn ) {\n\tvar div = document.createElement(\"div\");\n\n\ttry {\n\t\treturn !!fn( div );\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\t// release memory in IE\n\t\tdiv = null;\n\t}\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tvar match, elem, m, nodeType,\n\t\t// QSA vars\n\t\ti, groups, old, nid, newContext, newSelector;\n\n\tif ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\n\tcontext = context || document;\n\tresults = results || [];\n\n\tif ( !selector || typeof selector !== \"string\" ) {\n\t\treturn results;\n\t}\n\n\tif ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {\n\t\treturn [];\n\t}\n\n\tif ( documentIsHTML && !seed ) {\n\n\t\t// Shortcuts\n\t\tif ( (match = rquickExpr.exec( selector )) ) {\n\t\t\t// Speed-up: Sizzle(\"#ID\")\n\t\t\tif ( (m = match[1]) ) {\n\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\telem = context.getElementById( m );\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Handle the case where IE, Opera, and Webkit return items\n\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Context is not a document\n\t\t\t\t\tif ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&\n\t\t\t\t\t\tcontains( context, elem ) && elem.id === m ) {\n\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Speed-up: Sizzle(\"TAG\")\n\t\t\t} else if ( match[2] ) {\n\t\t\t\tpush.apply( results, context.getElementsByTagName( selector ) );\n\t\t\t\treturn results;\n\n\t\t\t// Speed-up: Sizzle(\".CLASS\")\n\t\t\t} else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {\n\t\t\t\tpush.apply( results, context.getElementsByClassName( m ) );\n\t\t\t\treturn results;\n\t\t\t}\n\t\t}\n\n\t\t// QSA path\n\t\tif ( support.qsa && !rbuggyQSA.test(selector) ) {\n\t\t\told = true;\n\t\t\tnid = expando;\n\t\t\tnewContext = context;\n\t\t\tnewSelector = nodeType === 9 && selector;\n\n\t\t\t// qSA works strangely on Element-rooted queries\n\t\t\t// We can work around this by specifying an extra ID on the root\n\t\t\t// and working up from there (Thanks to Andrew Dupont for the technique)\n\t\t\t// IE 8 doesn't work on object elements\n\t\t\tif ( nodeType === 1 && context.nodeName.toLowerCase() !== \"object\" ) {\n\t\t\t\tgroups = tokenize( selector );\n\n\t\t\t\tif ( (old = context.getAttribute(\"id\")) ) {\n\t\t\t\t\tnid = old.replace( rescape, \"\\\\$&\" );\n\t\t\t\t} else {\n\t\t\t\t\tcontext.setAttribute( \"id\", nid );\n\t\t\t\t}\n\t\t\t\tnid = \"[id='\" + nid + \"'] \";\n\n\t\t\t\ti = groups.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tgroups[i] = nid + toSelector( groups[i] );\n\t\t\t\t}\n\t\t\t\tnewContext = rsibling.test( selector ) && context.parentNode || context;\n\t\t\t\tnewSelector = groups.join(\",\");\n\t\t\t}\n\n\t\t\tif ( newSelector ) {\n\t\t\t\ttry {\n\t\t\t\t\tpush.apply( results,\n\t\t\t\t\t\tnewContext.querySelectorAll( newSelector )\n\t\t\t\t\t);\n\t\t\t\t\treturn results;\n\t\t\t\t} catch(qsaError) {\n\t\t\t\t} finally {\n\t\t\t\t\tif ( !old ) {\n\t\t\t\t\t\tcontext.removeAttribute(\"id\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed );\n}\n\n/*\n * Detect xml\n * @param {Element|Object} elem An element or a document\n */\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n/*\n * Sets document-related variables once based on the current document\n * @param {Element|Object} [doc] An element or document object to use to set the document\n * @returns {Object} Returns the current document\n */\nsetDocument = Sizzle.setDocument = function( node ) {\n\tvar doc = node ? node.ownerDocument || node : preferredDoc;\n\n\t// If no document and documentElement is available, return\n\tif ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {\n\t\treturn document;\n\t}\n\n\t// Set our document\n\tdocument = doc;\n\tdocElem = doc.documentElement;\n\n\t// Support tests\n\tdocumentIsHTML = !isXML( doc );\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tsupport.getElementsByTagName = assert(function( div ) {\n\t\tdiv.appendChild( doc.createComment(\"\") );\n\t\treturn !div.getElementsByTagName(\"*\").length;\n\t});\n\n\t// Check if attributes should be retrieved by attribute nodes\n\tsupport.attributes = assert(function( div ) {\n\t\tdiv.innerHTML = \"<select></select>\";\n\t\tvar type = typeof div.lastChild.getAttribute(\"multiple\");\n\t\t// IE8 returns a string for some attributes even when not present\n\t\treturn type !== \"boolean\" && type !== \"string\";\n\t});\n\n\t// Check if getElementsByClassName can be trusted\n\tsupport.getElementsByClassName = assert(function( div ) {\n\t\t// Opera can't find a second classname (in 9.6)\n\t\tdiv.innerHTML = \"<div class='hidden e'></div><div class='hidden'></div>\";\n\t\tif ( !div.getElementsByClassName || !div.getElementsByClassName(\"e\").length ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Safari 3.2 caches class attributes and doesn't catch changes\n\t\tdiv.lastChild.className = \"e\";\n\t\treturn div.getElementsByClassName(\"e\").length === 2;\n\t});\n\n\t// Check if getElementsByName privileges form controls or returns elements by ID\n\t// If so, assume (for broader support) that getElementById returns elements by name\n\tsupport.getByName = assert(function( div ) {\n\t\t// Inject content\n\t\tdiv.id = expando + 0;\n\t\t// Support: Windows 8 Native Apps\n\t\t// Assigning innerHTML with \"name\" attributes throws uncatchable exceptions\n\t\t// http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx\n\t\tdiv.appendChild( document.createElement(\"a\") ).setAttribute( \"name\", expando );\n\t\tdiv.appendChild( document.createElement(\"i\") ).setAttribute( \"name\", expando );\n\t\tdocElem.appendChild( div );\n\n\t\t// Test\n\t\tvar pass = doc.getElementsByName &&\n\t\t\t// buggy browsers will return fewer than the correct 2\n\t\t\tdoc.getElementsByName( expando ).length === 2 +\n\t\t\t// buggy browsers will return more than the correct 0\n\t\t\tdoc.getElementsByName( expando + 0 ).length;\n\n\t\t// Cleanup\n\t\tdocElem.removeChild( div );\n\n\t\treturn pass;\n\t});\n\n\t// Support: Webkit<537.32\n\t// Detached nodes confoundingly follow *each other*\n\tsupport.sortDetached = assert(function( div1 ) {\n\t\treturn div1.compareDocumentPosition &&\n\t\t\t// Should return 1, but Webkit returns 4 (following)\n\t\t\t(div1.compareDocumentPosition( document.createElement(\"div\") ) & 1);\n\t});\n\n\t// IE6/7 return modified attributes\n\tExpr.attrHandle = assert(function( div ) {\n\t\tdiv.innerHTML = \"<a href='#'></a>\";\n\t\treturn div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&\n\t\t\tdiv.firstChild.getAttribute(\"href\") === \"#\";\n\t}) ?\n\t\t{} :\n\t\t{\n\t\t\t\"href\": function( elem ) {\n\t\t\t\treturn elem.getAttribute( \"href\", 2 );\n\t\t\t},\n\t\t\t\"type\": function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"type\");\n\t\t\t}\n\t\t};\n\n\t// ID find and filter\n\tif ( support.getByName ) {\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== strundefined && documentIsHTML ) {\n\t\t\t\tvar m = context.getElementById( id );\n\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\treturn m && m.parentNode ? [m] : [];\n\t\t\t}\n\t\t};\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"id\") === attrId;\n\t\t\t};\n\t\t};\n\t} else {\n\t\tExpr.find[\"ID\"] = function( id, context ) {\n\t\t\tif ( typeof context.getElementById !== strundefined && documentIsHTML ) {\n\t\t\t\tvar m = context.getElementById( id );\n\n\t\t\t\treturn m ?\n\t\t\t\t\tm.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode(\"id\").value === id ?\n\t\t\t\t\t\t[m] :\n\t\t\t\t\t\tundefined :\n\t\t\t\t\t[];\n\t\t\t}\n\t\t};\n\t\tExpr.filter[\"ID\"] = function( id ) {\n\t\t\tvar attrId = id.replace( runescape, funescape );\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode(\"id\");\n\t\t\t\treturn node && node.value === attrId;\n\t\t\t};\n\t\t};\n\t}\n\n\t// Tag\n\tExpr.find[\"TAG\"] = support.getElementsByTagName ?\n\t\tfunction( tag, context ) {\n\t\t\tif ( typeof context.getElementsByTagName !== strundefined ) {\n\t\t\t\treturn context.getElementsByTagName( tag );\n\t\t\t}\n\t\t} :\n\t\tfunction( tag, context ) {\n\t\t\tvar elem,\n\t\t\t\ttmp = [],\n\t\t\t\ti = 0,\n\t\t\t\tresults = context.getElementsByTagName( tag );\n\n\t\t\t// Filter out possible comments\n\t\t\tif ( tag === \"*\" ) {\n\t\t\t\twhile ( (elem = results[i++]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn tmp;\n\t\t\t}\n\t\t\treturn results;\n\t\t};\n\n\t// Name\n\tExpr.find[\"NAME\"] = support.getByName && function( tag, context ) {\n\t\tif ( typeof context.getElementsByName !== strundefined ) {\n\t\t\treturn context.getElementsByName( name );\n\t\t}\n\t};\n\n\t// Class\n\tExpr.find[\"CLASS\"] = support.getElementsByClassName && function( className, context ) {\n\t\tif ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {\n\t\t\treturn context.getElementsByClassName( className );\n\t\t}\n\t};\n\n\t// QSA and matchesSelector support\n\n\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\trbuggyMatches = [];\n\n\t// qSa(:focus) reports false when true (Chrome 21),\n\t// no need to also add to buggyMatches since matches checks buggyQSA\n\t// A support test would require too much code (would include document ready)\n\trbuggyQSA = [ \":focus\" ];\n\n\tif ( (support.qsa = isNative(doc.querySelectorAll)) ) {\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( div ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explicitly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// http://bugs.jquery.com/ticket/12359\n\t\t\tdiv.innerHTML = \"<select><option selected=''></option></select>\";\n\n\t\t\t// IE8 - Some boolean attributes are not treated correctly\n\t\t\tif ( !div.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:checked|disabled|ismap|multiple|readonly|selected|value)\" );\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( div ) {\n\n\t\t\t// Opera 10-12/IE8 - ^= $= *= and empty values\n\t\t\t// Should not select anything\n\t\t\tdiv.innerHTML = \"<input type='hidden' i=''/>\";\n\t\t\tif ( div.querySelectorAll(\"[i^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:\\\"\\\"|'')\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here and will not see later tests\n\t\t\tif ( !div.querySelectorAll(\":enabled\").length ) {\n\t\t\t\trbuggyQSA.push( \":enabled\", \":disabled\" );\n\t\t\t}\n\n\t\t\t// Opera 10-11 does not throw on post-comma invalid pseudos\n\t\t\tdiv.querySelectorAll(\"*,:x\");\n\t\t\trbuggyQSA.push(\",.*:\");\n\t\t});\n\t}\n\n\tif ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector ||\n\t\tdocElem.mozMatchesSelector ||\n\t\tdocElem.webkitMatchesSelector ||\n\t\tdocElem.oMatchesSelector ||\n\t\tdocElem.msMatchesSelector) )) ) {\n\n\t\tassert(function( div ) {\n\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t// on a disconnected node (IE 9)\n\t\t\tsupport.disconnectedMatch = matches.call( div, \"div\" );\n\n\t\t\t// This should fail with an exception\n\t\t\t// Gecko does not error, returns false instead\n\t\t\tmatches.call( div, \"[s!='']:x\" );\n\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t});\n\t}\n\n\trbuggyQSA = new RegExp( rbuggyQSA.join(\"|\") );\n\trbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join(\"|\") );\n\n\t// Element contains another\n\t// Purposefully does not implement inclusive descendent\n\t// As in, an element does not contain itself\n\tcontains = isNative(docElem.contains) || docElem.compareDocumentPosition ?\n\t\tfunction( a, b ) {\n\t\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\t\tbup = b && b.parentNode;\n\t\t\treturn a === bup || !!( bup && bup.nodeType === 1 && (\n\t\t\t\tadown.contains ?\n\t\t\t\t\tadown.contains( bup ) :\n\t\t\t\t\ta.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16\n\t\t\t));\n\t\t} :\n\t\tfunction( a, b ) {\n\t\t\tif ( b ) {\n\t\t\t\twhile ( (b = b.parentNode) ) {\n\t\t\t\t\tif ( b === a ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t};\n\n\t// Document order sorting\n\tsortOrder = docElem.compareDocumentPosition ?\n\tfunction( a, b ) {\n\n\t\t// Flag for duplicate removal\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\tvar compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b );\n\n\t\tif ( compare ) {\n\t\t\t// Disconnected nodes\n\t\t\tif ( compare & 1 ||\n\t\t\t\t(recompare && b.compareDocumentPosition( a ) === compare) ) {\n\n\t\t\t\t// Choose the first element that is related to our preferred document\n\t\t\t\tif ( a === doc || contains(preferredDoc, a) ) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tif ( b === doc || contains(preferredDoc, b) ) {\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\n\t\t\t\t// Maintain original order\n\t\t\t\treturn sortInput ?\n\t\t\t\t\t( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :\n\t\t\t\t\t0;\n\t\t\t}\n\n\t\t\treturn compare & 4 ? -1 : 1;\n\t\t}\n\n\t\t// Not directly comparable, sort on existence of method\n\t\treturn a.compareDocumentPosition ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tap = [ a ],\n\t\t\tbp = [ b ];\n\n\t\t// Exit early if the nodes are identical\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\n\t\t// Parentless nodes are either documents or disconnected\n\t\t} else if ( !aup || !bup ) {\n\t\t\treturn a === doc ? -1 :\n\t\t\t\tb === doc ? 1 :\n\t\t\t\taup ? -1 :\n\t\t\t\tbup ? 1 :\n\t\t\t\t0;\n\n\t\t// If the nodes are siblings, we can do a quick check\n\t\t} else if ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\t\t}\n\n\t\t// Otherwise we need full lists of their ancestors for comparison\n\t\tcur = a;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tap.unshift( cur );\n\t\t}\n\t\tcur = b;\n\t\twhile ( (cur = cur.parentNode) ) {\n\t\t\tbp.unshift( cur );\n\t\t}\n\n\t\t// Walk down the tree looking for a discrepancy\n\t\twhile ( ap[i] === bp[i] ) {\n\t\t\ti++;\n\t\t}\n\n\t\treturn i ?\n\t\t\t// Do a sibling check if the nodes have a common ancestor\n\t\t\tsiblingCheck( ap[i], bp[i] ) :\n\n\t\t\t// Otherwise nodes in our document sort first\n\t\t\tap[i] === preferredDoc ? -1 :\n\t\t\tbp[i] === preferredDoc ? 1 :\n\t\t\t0;\n\t};\n\n\treturn document;\n};\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\t// Make sure that attribute selectors are quoted\n\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\t// rbuggyQSA always contains :focus, so no need for an existence check\n\tif ( support.matchesSelector && documentIsHTML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) {\n\t\ttry {\n\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\tif ( ret || support.disconnectedMatch ||\n\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\t\t} catch(e) {}\n\t}\n\n\treturn Sizzle( expr, document, null, [elem] ).length > 0;\n};\n\nSizzle.contains = function( context, elem ) {\n\t// Set document vars if needed\n\tif ( ( context.ownerDocument || context ) !== document ) {\n\t\tsetDocument( context );\n\t}\n\treturn contains( context, elem );\n};\n\nSizzle.attr = function( elem, name ) {\n\tvar val;\n\n\t// Set document vars if needed\n\tif ( ( elem.ownerDocument || elem ) !== document ) {\n\t\tsetDocument( elem );\n\t}\n\n\tif ( documentIsHTML ) {\n\t\tname = name.toLowerCase();\n\t}\n\tif ( (val = Expr.attrHandle[ name ]) ) {\n\t\treturn val( elem );\n\t}\n\tif ( !documentIsHTML || support.attributes ) {\n\t\treturn elem.getAttribute( name );\n\t}\n\treturn ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ?\n\t\tname :\n\t\tval && val.specified ? val.value : null;\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\n// Document sorting and removing duplicates\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\tduplicates = [],\n\t\tj = 0,\n\t\ti = 0;\n\n\t// Unless we *know* we can detect duplicates, assume their presence\n\thasDuplicate = !support.detectDuplicates;\n\t// Compensate for sort limitations\n\trecompare = !support.sortDetached;\n\tsortInput = !support.sortStable && results.slice( 0 );\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\twhile ( (elem = results[i++]) ) {\n\t\t\tif ( elem === results[ i ] ) {\n\t\t\t\tj = duplicates.push( i );\n\t\t\t}\n\t\t}\n\t\twhile ( j-- ) {\n\t\t\tresults.splice( duplicates[ j ], 1 );\n\t\t}\n\t}\n\n\treturn results;\n};\n\n/*\n * Checks document order of two siblings\n * @param {Element} a\n * @param {Element} b\n * @returns Returns -1 if a precedes b, 1 if a follows b\n */\nfunction siblingCheck( a, b ) {\n\tvar cur = b && a,\n\t\tdiff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE );\n\n\t// Use IE sourceIndex if available on both nodes\n\tif ( diff ) {\n\t\treturn diff;\n\t}\n\n\t// Check if b follows a\n\tif ( cur ) {\n\t\twhile ( (cur = cur.nextSibling) ) {\n\t\t\tif ( cur === b ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn a ? 1 : -1;\n}\n\n// Returns a function to use in pseudos for input types\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n// Returns a function to use in pseudos for buttons\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n// Returns a function to use in pseudos for positionals\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/*\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( !nodeType ) {\n\t\t// If no nodeType, this is expected to be an array\n\t\tfor ( ; (node = elem[i]); i++ ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t} else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t// Use textContent for elements\n\t\t// innerText usage removed for consistency of new lines (see #11153)\n\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\treturn elem.textContent;\n\t\t} else {\n\t\t\t// Traverse its children\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tret += getText( elem );\n\t\t\t}\n\t\t}\n\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\treturn elem.nodeValue;\n\t}\n\t// Do not include comment or processing instruction nodes\n\n\treturn ret;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\tfind: {},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( runescape, funescape );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[4] || match[5] || \"\" ).replace( runescape, funescape );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 what (child|of-type)\n\t\t\t\t3 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t4 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t5 sign of xn-component\n\t\t\t\t6 x of xn-component\n\t\t\t\t7 sign of y-component\n\t\t\t\t8 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1].slice( 0, 3 ) === \"nth\" ) {\n\t\t\t\t// nth-* requires argument\n\t\t\t\tif ( !match[3] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === \"even\" || match[3] === \"odd\" ) );\n\t\t\t\tmatch[5] = +( ( match[7] + match[8] ) || match[3] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[3] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar excess,\n\t\t\t\tunquoted = !match[5] && match[2];\n\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\t// Accept quoted arguments as-is\n\t\t\tif ( match[4] ) {\n\t\t\t\tmatch[2] = match[4];\n\n\t\t\t// Strip excess characters from unquoted arguments\n\t\t\t} else if ( unquoted && rpseudo.test( unquoted ) &&\n\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t// excess is a negative index\n\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\tmatch[2] = unquoted.slice( 0, excess );\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\n\t\t\"TAG\": function( nodeName ) {\n\t\t\tif ( nodeName === \"*\" ) {\n\t\t\t\treturn function() { return true; };\n\t\t\t}\n\n\t\t\tnodeName = nodeName.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ className + \" \" ];\n\n\t\t\treturn pattern ||\n\t\t\t\t(pattern = new RegExp( \"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\" )) &&\n\t\t\t\tclassCache( className, function( elem ) {\n\t\t\t\t\treturn pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute(\"class\")) || \"\" );\n\t\t\t\t});\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.slice( -check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.slice( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, what, argument, first, last ) {\n\t\t\tvar simple = type.slice( 0, 3 ) !== \"nth\",\n\t\t\t\tforward = type.slice( -4 ) !== \"last\",\n\t\t\t\tofType = what === \"of-type\";\n\n\t\t\treturn first === 1 && last === 0 ?\n\n\t\t\t\t// Shortcut for :nth-*(n)\n\t\t\t\tfunction( elem ) {\n\t\t\t\t\treturn !!elem.parentNode;\n\t\t\t\t} :\n\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tvar cache, outerCache, node, diff, nodeIndex, start,\n\t\t\t\t\t\tdir = simple !== forward ? \"nextSibling\" : \"previousSibling\",\n\t\t\t\t\t\tparent = elem.parentNode,\n\t\t\t\t\t\tname = ofType && elem.nodeName.toLowerCase(),\n\t\t\t\t\t\tuseCache = !xml && !ofType;\n\n\t\t\t\t\tif ( parent ) {\n\n\t\t\t\t\t\t// :(first|last|only)-(child|of-type)\n\t\t\t\t\t\tif ( simple ) {\n\t\t\t\t\t\t\twhile ( dir ) {\n\t\t\t\t\t\t\t\tnode = elem;\n\t\t\t\t\t\t\t\twhile ( (node = node[ dir ]) ) {\n\t\t\t\t\t\t\t\t\tif ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// Reverse direction for :only-* (if we haven't yet done so)\n\t\t\t\t\t\t\t\tstart = dir = type === \"only\" && !start && \"nextSibling\";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstart = [ forward ? parent.firstChild : parent.lastChild ];\n\n\t\t\t\t\t\t// non-xml :nth-child(...) stores cache data on `parent`\n\t\t\t\t\t\tif ( forward && useCache ) {\n\t\t\t\t\t\t\t// Seek `elem` from a previously-cached index\n\t\t\t\t\t\t\touterCache = parent[ expando ] || (parent[ expando ] = {});\n\t\t\t\t\t\t\tcache = outerCache[ type ] || [];\n\t\t\t\t\t\t\tnodeIndex = cache[0] === dirruns && cache[1];\n\t\t\t\t\t\t\tdiff = cache[0] === dirruns && cache[2];\n\t\t\t\t\t\t\tnode = nodeIndex && parent.childNodes[ nodeIndex ];\n\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\n\t\t\t\t\t\t\t\t// Fallback to seeking `elem` from the start\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\t// When found, cache indexes on `parent` and break\n\t\t\t\t\t\t\t\tif ( node.nodeType === 1 && ++diff && node === elem ) {\n\t\t\t\t\t\t\t\t\touterCache[ type ] = [ dirruns, nodeIndex, diff ];\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Use previously-cached element index if available\n\t\t\t\t\t\t} else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {\n\t\t\t\t\t\t\tdiff = cache[1];\n\n\t\t\t\t\t\t// xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Use the same loop as above to seek `elem` from the start\n\t\t\t\t\t\t\twhile ( (node = ++nodeIndex && node && node[ dir ] ||\n\t\t\t\t\t\t\t\t(diff = nodeIndex = 0) || start.pop()) ) {\n\n\t\t\t\t\t\t\t\tif ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {\n\t\t\t\t\t\t\t\t\t// Cache the index of each encountered element\n\t\t\t\t\t\t\t\t\tif ( useCache ) {\n\t\t\t\t\t\t\t\t\t\t(node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif ( node === elem ) {\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\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\n\t\t\t\t\t\t// Incorporate the offset, then check against cycle size\n\t\t\t\t\t\tdiff -= last;\n\t\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf.call( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t// Potentially complex pseudos\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t// \"Whether an element is represented by a :lang() selector\n\t\t// is based solely on the element's language value\n\t\t// being equal to the identifier C,\n\t\t// or beginning with the identifier C immediately followed by \"-\".\n\t\t// The matching of C against the element's language value is performed case-insensitively.\n\t\t// The identifier C does not have to be a valid language name.\"\n\t\t// http://www.w3.org/TR/selectors/#lang-pseudo\n\t\t\"lang\": markFunction( function( lang ) {\n\t\t\t// lang value must be a valid identifier\n\t\t\tif ( !ridentifier.test(lang || \"\") ) {\n\t\t\t\tSizzle.error( \"unsupported lang: \" + lang );\n\t\t\t}\n\t\t\tlang = lang.replace( runescape, funescape ).toLowerCase();\n\t\t\treturn function( elem ) {\n\t\t\t\tvar elemLang;\n\t\t\t\tdo {\n\t\t\t\t\tif ( (elemLang = documentIsHTML ?\n\t\t\t\t\t\telem.lang :\n\t\t\t\t\t\telem.getAttribute(\"xml:lang\") || elem.getAttribute(\"lang\")) ) {\n\n\t\t\t\t\t\telemLang = elemLang.toLowerCase();\n\t\t\t\t\t\treturn elemLang === lang || elemLang.indexOf( lang + \"-\" ) === 0;\n\t\t\t\t\t}\n\t\t\t\t} while ( (elem = elem.parentNode) && elem.nodeType === 1 );\n\t\t\t\treturn false;\n\t\t\t};\n\t\t}),\n\n\t\t// Miscellaneous\n\t\t\"target\": function( elem ) {\n\t\t\tvar hash = window.location && window.location.hash;\n\t\t\treturn hash && hash.slice( 1 ) === elem.id;\n\t\t},\n\n\t\t\"root\": function( elem ) {\n\t\t\treturn elem === docElem;\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\treturn elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);\n\t\t},\n\n\t\t// Boolean properties\n\t\t\"enabled\": function( elem ) {\n\t\t\treturn elem.disabled === false;\n\t\t},\n\n\t\t\"disabled\": function( elem ) {\n\t\t\treturn elem.disabled === true;\n\t\t},\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t// Contents\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),\n\t\t\t// not comment, processing instructions, or others\n\t\t\t// Thanks to Diego Perini for the nodeName shortcut\n\t\t\t// Greater than \"@\" means alpha characters (specifically not starting with \"#\" or \"?\")\n\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\tif ( elem.nodeName > \"@\" || elem.nodeType === 3 || elem.nodeType === 4 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t// Element/input types\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar attr;\n\t\t\t// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\n\t\t\t// use getAttribute instead to test this case\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\telem.type === \"text\" &&\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === elem.type );\n\t\t},\n\n\t\t// Position-in-collection\n\t\t\"first\": createPositionalPseudo(function() {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 0;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length ) {\n\t\t\tvar i = 1;\n\t\t\tfor ( ; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tvar i = argument < 0 ? argument + length : argument;\n\t\t\tfor ( ; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\n// Add button/input type pseudos\nfor ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {\n\tExpr.pseudos[ i ] = createInputPseudo( i );\n}\nfor ( i in { submit: true, reset: true } ) {\n\tExpr.pseudos[ i ] = createButtonPseudo( i );\n}\n\nfunction tokenize( selector, parseOnly ) {\n\tvar matched, match, tokens, type,\n\t\tsoFar, groups, preFilters,\n\t\tcached = tokenCache[ selector + \" \" ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\t// Don't consume trailing commas as valid\n\t\t\t\tsoFar = soFar.slice( match[0].length ) || soFar;\n\t\t\t}\n\t\t\tgroups.push( tokens = [] );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\tmatched = match.shift();\n\t\t\ttokens.push( {\n\t\t\t\tvalue: matched,\n\t\t\t\t// Cast descendant combinators to space\n\t\t\t\ttype: match[0].replace( rtrim, \" \" )\n\t\t\t} );\n\t\t\tsoFar = soFar.slice( matched.length );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t(match = preFilters[ type ]( match ))) ) {\n\t\t\t\tmatched = match.shift();\n\t\t\t\ttokens.push( {\n\t\t\t\t\tvalue: matched,\n\t\t\t\t\ttype: type,\n\t\t\t\t\tmatches: match\n\t\t\t\t} );\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n}\n\nfunction toSelector( tokens ) {\n\tvar i = 0,\n\t\tlen = tokens.length,\n\t\tselector = \"\";\n\tfor ( ; i < len; i++ ) {\n\t\tselector += tokens[i].value;\n\t}\n\treturn selector;\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tcheckNonElements = base && dir === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar data, cache, outerCache,\n\t\t\t\tdirkey = dirruns + \" \" + doneName;\n\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching\n\t\t\tif ( xml ) {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( elem.nodeType === 1 || checkNonElements ) {\n\t\t\t\t\t\touterCache = elem[ expando ] || (elem[ expando ] = {});\n\t\t\t\t\t\tif ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) {\n\t\t\t\t\t\t\tif ( (data = cache[1]) === true || data === cachedruns ) {\n\t\t\t\t\t\t\t\treturn data === true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcache = outerCache[ dir ] = [ dirkey ];\n\t\t\t\t\t\t\tcache[1] = matcher( elem, context, xml ) || cachedruns;\n\t\t\t\t\t\t\tif ( cache[1] === true ) {\n\t\t\t\t\t\t\t\treturn true;\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\t\t\t}\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\tvar temp, i, elem,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [] ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\ttemp = condense( matcherOut, postMap );\n\t\t\tpostFilter( temp, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = temp.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = temp[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( seed ) {\n\t\t\tif ( postFinder || preFilter ) {\n\t\t\t\tif ( postFinder ) {\n\t\t\t\t\t// Get the final matcherOut by condensing this intermediate into postFinder contexts\n\t\t\t\t\ttemp = [];\n\t\t\t\t\ti = matcherOut.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\t\t\t// Restore matcherIn since elem is not yet a final match\n\t\t\t\t\t\t\ttemp.push( (matcherIn[i] = elem) );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpostFinder( null, (matcherOut = []), temp, xml );\n\t\t\t\t}\n\n\t\t\t\t// Move matched elements from seed to results to keep them synchronized\n\t\t\t\ti = matcherOut.length;\n\t\t\t\twhile ( i-- ) {\n\t\t\t\t\tif ( (elem = matcherOut[i]) &&\n\t\t\t\t\t\t(temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {\n\n\t\t\t\t\t\tseed[temp] = !(results[temp] = elem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Add elements to results, through postFinder if defined\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf.call( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\treturn ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator(elementMatcher( matchers ), matcher) ];\n\t\t} else {\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && toSelector( tokens )\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\t// A counter to specify which element is currently being matched\n\tvar matcherCachedRuns = 0,\n\t\tbySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, expandContext ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tsetMatched = [],\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\toutermost = expandContext != null,\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", expandContext && context.parentNode || context ),\n\t\t\t\t// Use integer dirruns iff this is the outermost matcher\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1);\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context !== document && context;\n\t\t\t\tcachedruns = matcherCachedRuns;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\t// Keep `i` a string if there are no elements so `matchedCount` will be \"00\" below\n\t\t\tfor ( ; (elem = elems[i]) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tj = 0;\n\t\t\t\t\twhile ( (matcher = elementMatchers[j++]) ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t\tcachedruns = ++matcherCachedRuns;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\tmatchedCount += i;\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tj = 0;\n\t\t\t\twhile ( (matcher = setMatchers[j++]) ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ selector + \" \" ];\n\n\tif ( !cached ) {\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !group ) {\n\t\t\tgroup = tokenize( selector );\n\t\t}\n\t\ti = group.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( group[i] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\t}\n\treturn cached;\n};\n\nfunction multipleContexts( selector, contexts, results ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results );\n\t}\n\treturn results;\n}\n\nfunction select( selector, context, results, seed ) {\n\tvar i, tokens, token, type, find,\n\t\tmatch = tokenize( selector );\n\n\tif ( !seed ) {\n\t\t// Try to minimize operations if there is only one group\n\t\tif ( match.length === 1 ) {\n\n\t\t\t// Take a shortcut and set the context if the root selector is an ID\n\t\t\ttokens = match[0] = match[0].slice( 0 );\n\t\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\t\tcontext.nodeType === 9 && documentIsHTML &&\n\t\t\t\t\tExpr.relative[ tokens[1].type ] ) {\n\n\t\t\t\tcontext = ( Expr.find[\"ID\"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];\n\t\t\t\tif ( !context ) {\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\n\t\t\t\tselector = selector.slice( tokens.shift().value.length );\n\t\t\t}\n\n\t\t\t// Fetch a seed set for right-to-left matching\n\t\t\ti = matchExpr[\"needsContext\"].test( selector ) ? 0 : tokens.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\ttoken = tokens[i];\n\n\t\t\t\t// Abort if we hit a combinator\n\t\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\t\tif ( (seed = find(\n\t\t\t\t\t\ttoken.matches[0].replace( runescape, funescape ),\n\t\t\t\t\t\trsibling.test( tokens[0].type ) && context.parentNode || context\n\t\t\t\t\t)) ) {\n\n\t\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\t\tselector = seed.length && toSelector( tokens );\n\t\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\t\tpush.apply( results, seed );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\tcompile( selector, match )(\n\t\tseed,\n\t\tcontext,\n\t\t!documentIsHTML,\n\t\tresults,\n\t\trsibling.test( selector )\n\t);\n\treturn results;\n}\n\n// Deprecated\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Easy API for creating new setFilters\nfunction setFilters() {}\nsetFilters.prototype = Expr.filters = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\n// Check sort stability\nsupport.sortStable = expando.split(\"\").sort( sortOrder ).join(\"\") === expando;\n\n// Initialize with the default document\nsetDocument();\n\n// Always assume the presence of duplicates if sort doesn't\n// pass them to our comparison function (as in Google Chrome).\n[0, 0].sort( sortOrder );\nsupport.detectDuplicates = hasDuplicate;\n\n// EXPOSE\n/*if ( typeof define === \"function\" && define.amd ) {\n\tdefine(function() { return Sizzle; });\n} else {\n\twindow.Sizzle = Sizzle;\n}*/\n// EXPOSE\n\n/**\n * @namespace Ink.Dom.Selector\n * @static\n */\n\n/**\n * Alias for the Sizzle selector engine\n *\n * @method select\n * @param {String} selector CSS selector to search for elements\n * @param {DOMElement} [context] By default the search is done in the document element. However, you can specify an element as search context\n * @param {Array} [results] By default this is considered an empty array. But if you want to merge it with other searches you did, pass their result array through here.\n * @return {Array} Array of resulting DOM Elements\n * @sample Ink_Dom_Selector_select.html\n */\n\n/**\n * Filters elements that match a CSS selector.\n *\n * @method matches\n * @param {String} selector CSS selector to search for elements\n * @param {Array} matches Elements to be 'matched' with\n * @return {Array} Elements that matched\n * @sample Ink_Dom_Selector_matches.html\n */\n\n/**\n * Checks if an element matches a given selector\n *\n * @method matchesSelector\n * @param {DOMElement} element Element to test\n * @param {String} selector CSS selector to test the element with\n * @return {Boolean} True if element matches the CSS selector\n * @sample Ink_Dom_Selector_matchesSelector.html \n */\n\nreturn {\n select: Sizzle,\n matches: Sizzle.matches,\n matchesSelector: Sizzle.matchesSelector\n};\n\n\n}); //( window );\n","/**\n * Array Utilities\n * @module Ink.Util.Array_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Array', '1', [], function() {\n\n 'use strict';\n\n var arrayProto = Array.prototype;\n\n /**\n * @namespace Ink.Util.Array_1\n */\n\n var InkArray = {\n\n /**\n * Checks if a value is an array\n *\n * @method isArray\n * @param testedObject {Mixed} The object we want to check\n **/\n isArray: Array.isArray || function (testedObject) {\n return {}.toString.call(testedObject) === '[object Array]';\n },\n\n /**\n * Loops through an array, grouping similar items together.\n * @method groupBy\n * @param arr {Array} The input array.\n * @param [options] {Object} options object, containing:\n * @param [options.key] {Function} A function which computes the group key by which the items are grouped.\n * @param [options.pairs] {Boolean} Set to `true` if you want to output an array of `[key, [group...]]` pairs instead of an array of groups.\n * @return {Array} An array of arrays of chunks.\n *\n * @example\n *\n * InkArray.groupBy([1, 1, 2, 2, 3, 1]) // -> [ [1, 1], [2, 2], [3], [1] ]\n * InkArray.groupBy([1.1, 1.2, 2.1], { key: Math.floor }) // -> [ [1.1, 1.2], [2.1] ]\n * InkArray.groupBy([1.1, 1.2, 2.1], { key: Math.floor, pairs: true }) // -> [ [1, [1.1, 1.2]], [2, [2.1]] ]\n *\n **/\n groupBy: function (arr, options) {\n options = options || {};\n var ret = [];\n var latestGroup;\n function eq(a, b) {\n return outKey(a) === outKey(b);\n }\n function outKey(item) {\n if (typeof options.key === 'function') {\n return options.key(item);\n } else {\n return item;\n }\n }\n\n for (var i = 0, len = arr.length; i < len; i++) {\n latestGroup = [arr[i]];\n\n // Chunkin'\n while ((i + 1 < len) && eq(arr[i], arr[i + 1])) {\n latestGroup.push(arr[i + 1]);\n i++;\n }\n\n if (options.pairs) {\n ret.push([outKey(arr[i]), latestGroup]);\n } else {\n ret.push(latestGroup);\n }\n }\n return ret;\n },\n\n /**\n * Replacement for Array.prototype.reduce.\n *\n * Produces a single result from a list of values by calling an \"aggregator\" function.\n *\n * Falls back to Array.prototype.reduce if available.\n *\n * @method reduce\n * @param array {Array} Input array to be reduced.\n * @param callback {Function} `function (previousValue, currentValue, index, all) { return {Mixed} }` to execute for each value.\n * @param initial {Mixed} Object used as the first argument to the first call of `callback`\n *\n * @example\n * var sum = InkArray.reduce([1, 2, 3], function (a, b) { return a + b; }); // -> 6\n */\n reduce: function (array, callback, initial) {\n if (arrayProto.reduce) {\n return arrayProto.reduce.apply(array, [].slice.call(arguments, 1));\n }\n\n // From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce#Polyfill\n var t = Object( array ), len = t.length >>> 0, k = 0, value;\n if ( arguments.length >= 3 ) {\n value = initial;\n } else {\n while ( k < len && !(k in t) ) k++;\n if ( k >= len )\n throw new TypeError('Reduce of empty array with no initial value');\n value = t[ k++ ];\n }\n for ( ; k < len ; k++ ) {\n if ( k in t ) {\n value = callback( value, t[k], k, t );\n }\n }\n return value;\n },\n\n /**\n * Checks if a value exists in array\n *\n * @method inArray\n * @public\n * @static\n * @param {Mixed} value Value to check\n * @param {Array} arr Array to search in\n * @return {Boolean} True if value exists in the array\n * @sample Ink_Util_Array_inArray.html\n */\n inArray: function(value, arr) {\n if (typeof arr === 'object') {\n for (var i = 0, f = arr.length; i < f; ++i) {\n if (arr[i] === value) {\n return true;\n }\n }\n }\n return false;\n },\n\n /**\n * Sorts an array of objects by an object property\n *\n * @method sortMulti\n * @param {Array} arr Array of objects to sort\n * @param {String} key Property to sort by\n * @return {Array|Boolean} False if it's not an array, returns a sorted array if it's an array.\n * @public\n * @static\n * @sample Ink_Util_Array_sortMulti.html\n */\n sortMulti: function(arr, key) {\n if (typeof arr === 'undefined' || arr.constructor !== Array) { return false; }\n if (typeof key !== 'string') { return arr.sort(); }\n if (arr.length > 0) {\n if (typeof(arr[0][key]) === 'undefined') { return false; }\n arr.sort(function(a, b){\n var x = a[key];\n var y = b[key];\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n });\n }\n return arr;\n },\n\n /**\n * Gets the indexes of a value in an array\n *\n * @method keyValue\n * @param {String} value Value to search for.\n * @param {Array} arr Array to run the search in.\n * @param {Boolean} [first] Flag to stop the search at the first match. It also returns an index number instead of an array of indexes.\n * @return {Boolean|Number|Array} False for no matches. Array of matches or first match index.\n * @public\n * @static\n * @sample Ink_Util_Array_keyValue.html\n */\n keyValue: function(value, arr, first) {\n if (typeof value !== 'undefined' && typeof arr === 'object' && this.inArray(value, arr)) {\n var aKeys = [];\n for (var i = 0, f = arr.length; i < f; ++i) {\n if (arr[i] === value) {\n if (typeof first !== 'undefined' && first === true) {\n return i;\n } else {\n aKeys.push(i);\n }\n }\n }\n return aKeys;\n }\n return false;\n },\n\n /**\n * Shuffles an array.\n *\n * @method shuffle\n * @param {Array} arr Array to shuffle\n * @return {Array|Boolean} Shuffled Array or false if not an array.\n * @public\n * @static\n * @sample Ink_Util_Array_shuffle.html\n */\n shuffle: function(arr) {\n if (typeof(arr) !== 'undefined' && arr.constructor !== Array) { return false; }\n var total = arr.length,\n tmp1 = false,\n rnd = false;\n\n while (total--) {\n rnd = Math.floor(Math.random() * (total + 1));\n tmp1 = arr[total];\n arr[total] = arr[rnd];\n arr[rnd] = tmp1;\n }\n return arr;\n },\n\n /**\n * Runs a function through each of the elements of an array\n *\n * @method forEach\n * @param {Array} arr The array to be cycled/iterated\n * @param {Function} cb The function receives as arguments the value, index and array.\n * @return {Array} Iterated array.\n * @public\n * @static\n * @sample Ink_Util_Array_forEach.html\n */\n forEach: function(array, callback, context) {\n if (arrayProto.forEach) {\n return arrayProto.forEach.call(array, callback, context);\n }\n for (var i = 0, len = array.length >>> 0; i < len; i++) {\n callback.call(context, array[i], i, array);\n }\n },\n\n /**\n * Alias for backwards compatibility. See forEach\n *\n * @method each\n */\n each: function () {\n InkArray.forEach.apply(InkArray, [].slice.call(arguments));\n },\n\n /**\n * Runs a function for each item in the array.\n * That function will receive each item as an argument and its return value will change the corresponding array item.\n * @method map\n * @param {Array} array The array to map over\n * @param {Function} map The map function. Will take `(item, index, array)` as arguments and `this` will be the `context` argument.\n * @param {Object} [context] Object to be `this` in the map function.\n *\n * @sample Ink_Util_Array_map.html\n */\n map: function (array, callback, context) {\n if (arrayProto.map) {\n return arrayProto.map.call(array, callback, context);\n }\n var mapped = new Array(len);\n for (var i = 0, len = array.length >>> 0; i < len; i++) {\n mapped[i] = callback.call(context, array[i], i, array);\n }\n return mapped;\n },\n\n /**\n * Filters an array based on a truth test.\n * This method runs a test function on all the array values and returns a new array with all the values that pass the test.\n * @method filter\n * @param {Array} array The array to filter\n * @param {Function} test A test function taking `(item, index, array)`\n * @param {Object} [context] Object to be `this` in the test function.\n * @return {Array} Returns the filtered array\n *\n * @sample Ink_Util_Array_filter.html\n */\n filter: function (array, test, context) {\n if (arrayProto.filter) {\n return arrayProto.filter.call(array, test, context);\n }\n var filtered = [],\n val = null;\n for (var i = 0, len = array.length; i < len; i++) {\n val = array[i]; // it might be mutated\n if (test.call(context, val, i, array)) {\n filtered.push(val);\n }\n }\n return filtered;\n },\n\n /**\n * Checks if some element in the array passes a truth test\n *\n * @method some\n * @param {Array} arr The array to iterate through\n * @param {Function} cb The callback to be called on the array's elements. It receives the value, the index and the array as arguments.\n * @param {Object} context Object of the callback function\n * @return {Boolean} True if the callback returns true at any point, false otherwise\n * @public\n * @static\n * @sample Ink_Util_Array_some.html\n */\n some: function(arr, cb, context){\n\n if (arr === null){\n throw new TypeError('First argument is invalid.');\n }\n\n var t = Object(arr);\n var len = t.length >>> 0;\n if (typeof cb !== \"function\"){ throw new TypeError('Second argument must be a function.'); }\n\n for (var i = 0; i < len; i++) {\n if (i in t && cb.call(context, t[i], i, t)){ return true; }\n }\n\n return false;\n },\n\n /**\n * Compares the values of two arrays and return the matches\n *\n * @method intersect\n * @param {Array} arr1 First array\n * @param {Array} arr2 Second array\n * @return {Array} Empty array if one of the arrays is false (or do not intersect) | Array with the intersected values\n * @public\n * @static\n * @sample Ink_Util_Array_intersect.html\n */\n intersect: function(arr1, arr2) {\n if (!arr1 || !arr2 || arr1 instanceof Array === false || arr2 instanceof Array === false) {\n return [];\n }\n\n var shared = [];\n for (var i = 0, I = arr1.length; i<I; ++i) {\n for (var j = 0, J = arr2.length; j < J; ++j) {\n if (arr1[i] === arr2[j]) {\n shared.push(arr1[i]);\n }\n }\n }\n\n return shared;\n },\n\n /**\n * Converts an array-like object to an array\n *\n * @method convert\n * @param {Array} arr Array to be converted\n * @return {Array} Array resulting of the conversion\n * @public\n * @static\n * @sample Ink_Util_Array_convert.html\n */\n convert: function(arr) {\n return arrayProto.slice.call(arr || [], 0);\n },\n\n /**\n * Removes duplicated values in an array.\n *\n * @method unique\n * @param {Array} arr Array to filter\n * @return {Array} Array with only unique values\n * @public\n * @static\n */\n unique: function(arr){\n if(!Array.prototype.lastIndexOf){ //IE8 slower alternative\n var newArr = [];\n\n InkArray.forEach(InkArray.convert(arr), function(i){\n if(!InkArray.inArray(i,newArr)){\n newArr.push(i);\n }\n });\n return newArr;\n }//else\n return InkArray.filter(InkArray.convert(arr), function (e, i, arr) {\n return arr.lastIndexOf(e) === i;\n });\n },\n\n /**\n * Simulates python's range(start, stop, step) function.\n *\n * Creates a list with numbers counting from start until stop, using a for loop.\n *.\n * The optional step argument defines how to step ahead. You can pass a negative number to count backwards (see the examples below).\n *\n * @method range\n * @param {Number} start The array's first element.\n * @param {Number} stop Stop counting before this number.\n * @param {Number} [step=1] Interval between numbers. You can use a negative number to count backwards.\n *\n * @sample Ink_Util_Array_1_range.html\n **/\n range: function range(a, b, step) {\n // From: https://github.com/mcandre/node-range\n if (!step) {\n step = 1;\n }\n\n var r = [];\n var x;\n\n if (step > 0) {\n for (x = a; x < b; x += step) {\n r.push(x);\n }\n } else {\n for (x = a; x > b; x += step) {\n r.push(x);\n }\n }\n\n return r;\n },\n\n /**\n * Inserts a value on a specified index\n *\n * @method insert\n * @param {Array} arr Array where the value will be inserted\n * @param {Number} idx Index of the array where the value should be inserted\n * @param {Mixed} value Value to be inserted\n * @public\n * @static\n * @sample Ink_Util_Array_insert.html\n */\n insert: function(arr, idx, value) {\n arr.splice(idx, 0, value);\n },\n\n /**\n * Removes a range of values from the array\n *\n * @method remove\n * @param {Array} arr Array where the value will be removed\n * @param {Number} from Index of the array where the removal will start removing.\n * @param {Number} rLen Number of items to be removed from the index onwards.\n * @return {Array} An array with the remaining values\n * @public\n * @static\n * @sample Ink_Util_Array_remove.html\n */\n remove: function(arr, from, rLen){\n var output = [];\n\n for(var i = 0, iLen = arr.length; i < iLen; i++){\n if(i >= from && i < from + rLen){\n continue;\n }\n\n output.push(arr[i]);\n }\n\n return output;\n }\n };\n\n return InkArray;\n\n});\n","/**\n * Binary Packing algorithm implementation\n * @module Ink.Util.BinPack_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.BinPack', '1', [], function() {\n\n 'use strict';\n\n /*jshint boss:true */\n\n // https://github.com/jakesgordon/bin-packing/\n\n /*\n Copyright (c) 2011, 2012, 2013 Jake Gordon and contributors\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n */\n\n\n\n var Packer = function(w, h) {\n this.init(w, h);\n };\n\n Packer.prototype = {\n\n init: function(w, h) {\n this.root = { x: 0, y: 0, w: w, h: h };\n },\n\n fit: function(blocks) {\n var n, node, block;\n for (n = 0; n < blocks.length; ++n) {\n block = blocks[n];\n if (node = this.findNode(this.root, block.w, block.h)) {\n block.fit = this.splitNode(node, block.w, block.h);\n }\n }\n },\n\n findNode: function(root, w, h) {\n if (root.used) {\n return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);\n }\n else if ((w <= root.w) && (h <= root.h)) {\n return root;\n }\n else {\n return null;\n }\n },\n\n splitNode: function(node, w, h) {\n node.used = true;\n node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h };\n node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h };\n return node;\n }\n\n };\n\n\n\n var GrowingPacker = function() {};\n\n GrowingPacker.prototype = {\n\n fit: function(blocks) {\n var n, node, block, len = blocks.length;\n var w = len > 0 ? blocks[0].w : 0;\n var h = len > 0 ? blocks[0].h : 0;\n this.root = { x: 0, y: 0, w: w, h: h };\n for (n = 0; n < len ; n++) {\n block = blocks[n];\n if (node = this.findNode(this.root, block.w, block.h)) {\n block.fit = this.splitNode(node, block.w, block.h);\n }\n else {\n block.fit = this.growNode(block.w, block.h);\n }\n }\n },\n\n findNode: function(root, w, h) {\n if (root.used) {\n return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);\n }\n else if ((w <= root.w) && (h <= root.h)) {\n return root;\n }\n else {\n return null;\n }\n },\n\n splitNode: function(node, w, h) {\n node.used = true;\n node.down = { x: node.x, y: node.y + h, w: node.w, h: node.h - h };\n node.right = { x: node.x + w, y: node.y, w: node.w - w, h: h };\n return node;\n },\n\n growNode: function(w, h) {\n var canGrowDown = (w <= this.root.w);\n var canGrowRight = (h <= this.root.h);\n\n var shouldGrowRight = canGrowRight && (this.root.h >= (this.root.w + w)); // attempt to keep square-ish by growing right when height is much greater than width\n var shouldGrowDown = canGrowDown && (this.root.w >= (this.root.h + h)); // attempt to keep square-ish by growing down when width is much greater than height\n\n if (shouldGrowRight) {\n return this.growRight(w, h);\n }\n else if (shouldGrowDown) {\n return this.growDown(w, h);\n }\n else if (canGrowRight) {\n return this.growRight(w, h);\n }\n else if (canGrowDown) {\n return this.growDown(w, h);\n }\n else {\n return null; // need to ensure sensible root starting size to avoid this happening\n }\n },\n\n growRight: function(w, h) {\n this.root = {\n used: true,\n x: 0,\n y: 0,\n w: this.root.w + w,\n h: this.root.h,\n down: this.root,\n right: { x: this.root.w, y: 0, w: w, h: this.root.h }\n };\n var node;\n if (node = this.findNode(this.root, w, h)) {\n return this.splitNode(node, w, h);\n }\n else {\n return null;\n }\n },\n\n growDown: function(w, h) {\n this.root = {\n used: true,\n x: 0,\n y: 0,\n w: this.root.w,\n h: this.root.h + h,\n down: { x: 0, y: this.root.h, w: this.root.w, h: h },\n right: this.root\n };\n var node;\n if (node = this.findNode(this.root, w, h)) {\n return this.splitNode(node, w, h);\n }\n else {\n return null;\n }\n }\n\n };\n\n\n\n var sorts = {\n random: function() { return Math.random() - 0.5; },\n w: function(a, b) { return b.w - a.w; },\n h: function(a, b) { return b.h - a.h; },\n a: function(a, b) { return b.area - a.area; },\n max: function(a, b) { return Math.max(b.w, b.h) - Math.max(a.w, a.h); },\n min: function(a, b) { return Math.min(b.w, b.h) - Math.min(a.w, a.h); },\n height: function(a, b) { return sorts.msort(a, b, ['h', 'w']); },\n width: function(a, b) { return sorts.msort(a, b, ['w', 'h']); },\n area: function(a, b) { return sorts.msort(a, b, ['a', 'h', 'w']); },\n maxside: function(a, b) { return sorts.msort(a, b, ['max', 'min', 'h', 'w']); },\n msort: function(a, b, criteria) { /* sort by multiple criteria */\n var diff, n;\n for (n = 0; n < criteria.length; ++n) {\n diff = sorts[ criteria[n] ](a, b);\n if (diff !== 0) {\n return diff;\n }\n }\n return 0;\n }\n };\n\n\n\n // end of Jake's code\n\n\n\n // aux, used to display blocks in unfitted property\n var toString = function() {\n return [this.w, ' x ', this.h].join('');\n };\n\n\n\n /**\n * Binary Packing algorithm implementation\n *\n * Based on the work of Jake Gordon\n *\n * see https://github.com/jakesgordon/bin-packing/\n *\n * @namespace Ink.Util.BinPack\n * @version 1\n * @static\n */\n var BinPack = {\n\n /**\n * @method binPack\n * @param {Object} o Options\n * @param {Array} o.blocks Array of items with width and height integer attributes.\n * @param {Array} [o.dimensions] Flag to fix container dimensions\n * @param {String} [o.sorter] Sorting function. One of: random, height, width, area, maxside\n * @return {Object} Returns an object containing container dimensions, filled ratio, fitted blocks, unfitted blocks and all blocks\n * @static\n */\n binPack: function(o) {\n var i, f, bl;\n\n\n\n // calculate area if not there already\n for (i = 0, f = o.blocks.length; i < f; ++i) {\n bl = o.blocks[i];\n if (! ('area' in bl) ) {\n bl.area = bl.w * bl.h;\n }\n }\n\n\n\n // apply algorithm\n var packer = o.dimensions ? new Packer(o.dimensions[0], o.dimensions[1]) : new GrowingPacker();\n\n if (!o.sorter) { o.sorter = 'maxside'; }\n\n o.blocks.sort( sorts[ o.sorter ] );\n\n packer.fit(o.blocks);\n\n var dims2 = [packer.root.w, packer.root.h];\n\n\n\n // layout is done here, generating report data...\n var fitted = [];\n var unfitted = [];\n\n for (i = 0, f = o.blocks.length; i < f; ++i) {\n bl = o.blocks[i];\n if (bl.fit) {\n fitted.push(bl);\n }\n else {\n bl.toString = toString; // TO AID SERIALIZATION\n unfitted.push(bl);\n }\n }\n\n var area = dims2[0] * dims2[1];\n var fit = 0;\n for (i = 0, f = fitted.length; i < f; ++i) {\n bl = fitted[i];\n fit += bl.area;\n }\n\n return {\n dimensions: dims2,\n filled: fit / area,\n blocks: o.blocks,\n fitted: fitted,\n unfitted: unfitted\n };\n }\n };\n\n\n\n return BinPack;\n\n});","/**\n * Cookie Utilities\n * @module Ink.Util.Cookie_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Cookie', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.Cookie_1\n */\n var Cookie = {\n\n /**\n * Gets an object with the current page cookies.\n *\n * @method get\n * @param {String} name The cookie name.\n * @return {String|Object} If the name is specified, it returns the value of that key. Otherwise it returns the full cookie object\n * @public\n * @static\n * @sample Ink_Util_Cookie_get.html\n */\n get: function(name)\n {\n var cookie = document.cookie || false;\n\n var _Cookie = {};\n if(cookie) {\n cookie = cookie.replace(new RegExp(\"; \", \"g\"), ';');\n var aCookie = cookie.split(';');\n var aItem = [];\n if(aCookie.length > 0) {\n for(var i=0; i < aCookie.length; i++) {\n aItem = aCookie[i].split('=');\n if(aItem.length === 2) {\n _Cookie[aItem[0]] = decodeURIComponent(aItem[1]);\n }\n aItem = [];\n }\n }\n }\n if(name) {\n if(typeof(_Cookie[name]) !== 'undefined') {\n return _Cookie[name];\n } else {\n return null;\n }\n }\n return _Cookie;\n },\n\n /**\n * Sets a cookie.\n *\n * @method set\n * @param {String} name Cookie name.\n * @param {String} value Cookie value.\n * @param {Number} [expires] Number of seconds the cookie will be valid for.\n * @param {String} [path] Path for the cookie. Defaults to '/'.\n * @param {String} [domain] Domain for the cookie. Defaults to current hostname.\n * @param {Boolean} [secure] Flag for secure. Default 'false'.\n * @public\n * @static\n * @sample Ink_Util_Cookie_set.html\n */\n set: function(name, value, expires, path, domain, secure)\n {\n var sName;\n if(!name || value===false || typeof(name) === 'undefined' || typeof(value) === 'undefined') {\n return false;\n } else {\n sName = name+'='+encodeURIComponent(value);\n }\n var sExpires = false;\n var sPath = false;\n var sDomain = false;\n var sSecure = false;\n\n if(expires && typeof(expires) !== 'undefined' && !isNaN(expires)) {\n var oDate = new Date();\n var sDate = (parseInt(Number(oDate.valueOf()), 10) + (Number(parseInt(expires, 10)) * 1000));\n\n var nDate = new Date(sDate);\n var expiresString = nDate.toGMTString();\n\n var re = new RegExp(\"([^\\\\s]+)(\\\\s\\\\d\\\\d)\\\\s(\\\\w\\\\w\\\\w)\\\\s(.*)\");\n expiresString = expiresString.replace(re, \"$1$2-$3-$4\");\n\n sExpires = 'expires='+expiresString;\n } else {\n if(typeof(expires) !== 'undefined' && !isNaN(expires) && Number(parseInt(expires, 10))===0) {\n sExpires = '';\n } else {\n sExpires = 'expires=Thu, 01-Jan-2037 00:00:01 GMT';\n }\n }\n\n if(path && typeof(path) !== 'undefined') {\n sPath = 'path='+path;\n } else {\n sPath = 'path=/';\n }\n\n if(domain && typeof(domain) !== 'undefined') {\n sDomain = 'domain='+domain;\n } else {\n var portClean = new RegExp(\":(.*)\");\n sDomain = 'domain='+window.location.host;\n sDomain = sDomain.replace(portClean,\"\");\n }\n\n if(secure && typeof(secure) !== 'undefined') {\n sSecure = secure;\n } else {\n sSecure = false;\n }\n\n document.cookie = sName+'; '+sExpires+'; '+sPath+'; '+sDomain+'; '+sSecure;\n },\n\n /**\n * Deletes a cookie.\n *\n * @method remove\n * @param {String} cookieName Cookie name.\n * @param {String} [path] Path of the cookie. Defaults to '/'.\n * @param {String} [domain] Domain of the cookie. Defaults to current hostname.\n * @public\n * @static\n * @sample Ink_Util_Cookie_remove.html\n */\n remove: function(cookieName, path, domain)\n {\n //var expiresDate = 'Thu, 01-Jan-1970 00:00:01 GMT';\n var sPath = false;\n var sDomain = false;\n var expiresDate = -999999999;\n\n if(path && typeof(path) !== 'undefined') {\n sPath = path;\n } else {\n sPath = '/';\n }\n\n if(domain && typeof(domain) !== 'undefined') {\n sDomain = domain;\n } else {\n sDomain = window.location.host;\n }\n\n this.set(cookieName, 'deleted', expiresDate, sPath, sDomain);\n }\n };\n\n return Cookie;\n\n});\n","/**\n * Date utility functions\n * @module Ink.Util.Date_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Date', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.Date_1 \n */\n var InkDate = {\n\n /**\n * Function that returns the string representation of the month [PT only]\n *\n * @method _months\n * @param {Number} index Month javascript (0 to 11)\n * @return {String} The month's name\n * @private\n * @static\n * @example\n * console.log( InkDate._months(0) ); // Result: Janeiro\n */\n _months: function(index){\n var _m = ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'];\n return _m[index];\n },\n\n /**\n * Function that returns the month [PT only] ( 0 to 11 )\n *\n * @method _iMonth\n * @param {String} month Month javascript (0 to 11)\n * @return {Number} The month's number\n * @private\n * @static\n * @example\n * console.log( InkDate._iMonth('maio') ); // Result: 4\n */\n _iMonth : function( month )\n {\n if ( Number( month ) ) { return +month - 1; }\n return {\n 'janeiro' : 0 ,\n 'jan' : 0 ,\n 'fevereiro' : 1 ,\n 'fev' : 1 ,\n 'março' : 2 ,\n 'mar' : 2 ,\n 'abril' : 3 ,\n 'abr' : 3 ,\n 'maio' : 4 ,\n 'mai' : 4 ,\n 'junho' : 5 ,\n 'jun' : 5 ,\n 'julho' : 6 ,\n 'jul' : 6 ,\n 'agosto' : 7 ,\n 'ago' : 7 ,\n 'setembro' : 8 ,\n 'set' : 8 ,\n 'outubro' : 9 ,\n 'out' : 9 ,\n 'novembro' : 10 ,\n 'nov' : 10 ,\n 'dezembro' : 11 ,\n 'dez' : 11\n }[ month.toLowerCase( ) ];\n } ,\n\n /**\n * Function that returns the representation the day of the week [PT Only]\n *\n * @method _wDays\n * @param {Number} index Week's day index\n * @return {String} The week's day name\n * @private\n * @static\n * @example\n * console.log( InkDate._wDays(0) ); // Result: Domingo\n */\n _wDays: function(index){\n var _d = ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado'];\n return _d[index];\n },\n\n /**\n * Function that returns day of the week in javascript 1 to 7\n *\n * @method _iWeek\n * @param {String} week Week's day name\n * @return {Number} The week's day index\n * @private\n * @static\n * @example\n * console.log( InkDate._iWeek('quarta') ); // Result: 3\n */\n _iWeek: function( week )\n {\n if ( Number( week ) ) { return +week || 7; }\n return {\n 'segunda' : 1 ,\n 'seg' : 1 ,\n 'terça' : 2 ,\n 'ter' : 2 ,\n 'quarta' : 3 ,\n 'qua' : 3 ,\n 'quinta' : 4 ,\n 'qui' : 4 ,\n 'sexta' : 5 ,\n 'sex' : 5 ,\n 'sábado' : 6 ,\n 'sáb' : 6 ,\n 'domingo' : 7 ,\n 'dom' : 7\n }[ week.toLowerCase( ) ];\n },\n\n /**\n * Function that returns the number of days of a given month (m) on a given year (y)\n *\n * @method _daysInMonth\n * @param {Number} _m Month\n * @param {Number} _y Year\n * @return {Number} Number of days of a give month on a given year\n * @private\n * @static\n * @example\n * console.log( InkDate._daysInMonth(2,2013) ); // Result: 28\n */\n _daysInMonth: function(_m,_y){\n var nDays;\n\n if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12)\n {\n nDays= 31;\n }\n else if ( _m===4 || _m===6 || _m===9 || _m===11)\n {\n nDays = 30;\n }\n else\n {\n if((_y%400===0) || (_y%4===0 && _y%100!==0))\n {\n nDays = 29;\n }\n else\n {\n nDays = 28;\n }\n }\n return nDays;\n },\n\n /**\n * Formats a date object.\n * This works exactly as php date() function. http://php.net/manual/en/function.date.php\n *\n * @method get\n * @param {String} format The format in which the date it will be formatted.\n * @param {Date} [_date] The date to format. Can receive unix timestamp or a date object. Defaults to current time.\n * @return {String} Formatted date\n * @public\n * @static\n * @sample Ink_Util_Date_get.html \n */\n get: function(format, _date){\n /*jshint maxcomplexity:65 */\n if(typeof(format) === 'undefined' || format === ''){\n format = \"Y-m-d\";\n }\n\n\n var iFormat = format.split(\"\");\n var result = new Array(iFormat.length);\n var escapeChar = \"\\\\\";\n var jsDate;\n\n if (typeof(_date) === 'undefined'){\n jsDate = new Date();\n } else if (typeof(_date)==='number'){\n jsDate = new Date(_date*1000);\n } else {\n jsDate = new Date(_date);\n }\n\n var jsFirstDay, jsThisDay, jsHour;\n /* This switch is presented in the same order as in php date function (PHP 5.2.2) */\n for (var i = 0; i < iFormat.length; i++) {\n switch(iFormat[i]) {\n case escapeChar:\n result[i] = iFormat[i+1];\n i++;\n break;\n\n\n /* DAY */\n case \"d\": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */\n var jsDay = jsDate.getDate();\n result[i] = (String(jsDay).length > 1) ? jsDay : \"0\" + jsDay;\n break;\n\n case \"D\": /* A textual representation of a day, three letters; Seg to Dom */\n result[i] = this._wDays(jsDate.getDay()).substring(0, 3);\n break;\n\n case \"j\": /* Day of the month without leading zeros; ex: 1 to 31 */\n result[i] = jsDate.getDate();\n break;\n\n case \"l\": /* A full textual representation of the day of the week; Domingo to Sabado */\n result[i] = this._wDays(jsDate.getDay());\n break;\n\n case \"N\": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */\n result[i] = jsDate.getDay() || 7;\n break;\n\n case \"S\": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */\n var temp = jsDate.getDate();\n var suffixes = [\"st\", \"nd\", \"rd\"];\n var suffix = \"\";\n\n if (temp >= 11 && temp <= 13) {\n result[i] = \"th\";\n } else {\n result[i] = (suffix = suffixes[String(temp).substr(-1) - 1]) ? (suffix) : (\"th\");\n }\n break;\n\n case \"w\": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */\n result[i] = jsDate.getDay();\n break;\n\n case \"z\": /* The day of the year (starting from 0); 0 to 365 */\n jsFirstDay = Date.UTC(jsDate.getFullYear(), 0, 0);\n jsThisDay = Date.UTC(jsDate.getFullYear(), jsDate.getMonth(), jsDate.getDate());\n result[i] = Math.floor((jsThisDay - jsFirstDay) / (1000 * 60 * 60 * 24));\n break;\n\n /* WEEK */\n case \"W\": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */\n var jsYearStart = new Date( jsDate.getFullYear( ) , 0 , 1 );\n jsFirstDay = jsYearStart.getDay() || 7;\n\n var days = Math.floor( ( jsDate - jsYearStart ) / ( 24 * 60 * 60 * 1000 ) + 1 );\n\n result[ i ] = Math.ceil( ( days - ( 8 - jsFirstDay ) ) / 7 ) + 1;\n break;\n\n\n /* MONTH */\n case \"F\": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */\n result[i] = this._months(jsDate.getMonth());\n break;\n\n case \"m\": /* Numeric representation of a month, with leading zeros; 01 to 12 */\n var jsMonth = String(jsDate.getMonth() + 1);\n result[i] = (jsMonth.length > 1) ? jsMonth : \"0\" + jsMonth;\n break;\n\n case \"M\": /* A short textual representation of a month, three letters; Jan a Dez */\n result[i] = this._months(jsDate.getMonth()).substring(0,3);\n break;\n\n case \"n\": /* Numeric representation of a month, without leading zeros; 1 a 12 */\n result[i] = jsDate.getMonth() + 1;\n break;\n\n case \"t\": /* Number of days in the given month; ex: 28 */\n result[i] = this._daysInMonth(jsDate.getMonth()+1,jsDate.getYear());\n break;\n\n /* YEAR */\n case \"L\": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */\n var jsYear = jsDate.getFullYear();\n result[i] = (jsYear % 4) ? false : ( (jsYear % 100) ? true : ( (jsYear % 400) ? false : true ) );\n break;\n\n case \"o\": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */\n throw '\"o\" not implemented!';\n\n case \"Y\": /* A full numeric representation of a year, 4 digits; 1999 */\n result[i] = jsDate.getFullYear();\n break;\n\n case \"y\": /* A two digit representation of a year; 99 */\n result[i] = String(jsDate.getFullYear()).substring(2);\n break;\n\n /* TIME */\n case \"a\": /* Lowercase Ante meridiem and Post meridiem; am or pm */\n result[i] = (jsDate.getHours() < 12) ? \"am\" : \"pm\";\n break;\n\n case \"A\": /* Uppercase Ante meridiem and Post meridiem; AM or PM */\n result[i] = (jsDate.getHours < 12) ? \"AM\" : \"PM\";\n break;\n\n case \"B\": /* Swatch Internet time; 000 through 999 */\n throw '\"B\" not implemented!';\n\n case \"g\": /* 12-hour format of an hour without leading zeros; 1 to 12 */\n jsHour = jsDate.getHours();\n result[i] = (jsHour <= 12) ? jsHour : (jsHour - 12);\n break;\n\n case \"G\": /* 24-hour format of an hour without leading zeros; 1 to 23 */\n result[i] = String(jsDate.getHours());\n break;\n\n case \"h\": /* 12-hour format of an hour with leading zeros; 01 to 12 */\n jsHour = String(jsDate.getHours());\n jsHour = (jsHour <= 12) ? jsHour : (jsHour - 12);\n result[i] = (jsHour.length > 1) ? jsHour : \"0\" + jsHour;\n break;\n\n case \"H\": /* 24-hour format of an hour with leading zeros; 01 to 24 */\n jsHour = String(jsDate.getHours());\n result[i] = (jsHour.length > 1) ? jsHour : \"0\" + jsHour;\n break;\n\n case \"i\": /* Minutes with leading zeros; 00 to 59 */\n var jsMinute = String(jsDate.getMinutes());\n result[i] = (jsMinute.length > 1) ? jsMinute : \"0\" + jsMinute;\n break;\n\n case \"s\": /* Seconds with leading zeros; 00 to 59; */\n var jsSecond = String(jsDate.getSeconds());\n result[i] = (jsSecond.length > 1) ? jsSecond : \"0\" + jsSecond;\n break;\n\n case \"u\": /* Microseconds */\n throw '\"u\" not implemented!';\n\n\n /* TIMEZONE */\n\n case \"e\": /* Timezone identifier */\n throw '\"e\" not implemented!';\n\n case \"I\": /* \"1\" if Daylight Savings Time, \"0\" otherwise. Works only on the northern hemisphere */\n jsFirstDay = new Date(jsDate.getFullYear(), 0, 1);\n result[i] = (jsDate.getTimezoneOffset() !== jsFirstDay.getTimezoneOffset()) ? (1) : (0);\n break;\n\n case \"O\": /* Difference to Greenwich time (GMT) in hours */\n var jsMinZone = jsDate.getTimezoneOffset();\n var jsMinutes = jsMinZone % 60;\n jsHour = String(((jsMinZone - jsMinutes) / 60) * -1);\n\n if (jsHour.charAt(0) !== \"-\") {\n jsHour = \"+\" + jsHour;\n }\n\n jsHour = (jsHour.length === 3) ? (jsHour) : (jsHour.replace(/([+\\-])(\\d)/, \"$1\" + 0 + \"$2\"));\n result[i] = jsHour + jsMinutes + \"0\";\n break;\n\n case \"P\": /* Difference to Greenwich time (GMT) with colon between hours and minutes */\n throw '\"P\" not implemented!';\n\n case \"T\": /* Timezone abbreviation */\n throw '\"T\" not implemented!';\n\n case \"Z\": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */\n result[i] = jsDate.getTimezoneOffset() * 60;\n break;\n\n\n /* FULL DATE/TIME */\n\n case \"c\": /* ISO 8601 date */\n throw '\"c\" not implemented!';\n\n case \"r\": /* RFC 2822 formatted date */\n var jsDayName = this._wDays(jsDate.getDay()).substr(0, 3);\n var jsMonthName = this._months(jsDate.getMonth()).substr(0, 3);\n result[i] = jsDayName + \", \" + jsDate.getDate() + \" \" + jsMonthName + this.get(\" Y H:i:s O\",jsDate);\n break;\n\n case \"U\": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */\n result[i] = Math.floor(jsDate.getTime() / 1000);\n break;\n\n default:\n result[i] = iFormat[i];\n }\n }\n\n return result.join('');\n\n },\n\n /**\n * Creates a date object based on a format string.\n * This works exactly as php date() function. http://php.net/manual/en/function.date.php\n *\n * @method set\n * @param {String} [format] The format in which the date will be formatted. Defaults to 'Y-m-d'\n * @param {String} str_date The date formatted.\n * @return {Date} Date object based on the formatted date and format\n * @public\n * @static\n * @sample Ink_Util_Date_set.html \n */\n set : function( format , str_date ) {\n if ( typeof str_date === 'undefined' ) { return ; }\n if ( typeof format === 'undefined' || format === '' ) { format = \"Y-m-d\"; }\n\n var iFormat = format.split(\"\");\n var result = new Array( iFormat.length );\n var escapeChar = \"\\\\\";\n var mList;\n\n var objIndex = {\n year : undefined ,\n month : undefined ,\n day : undefined ,\n dayY : undefined ,\n dayW : undefined ,\n week : undefined ,\n hour : undefined ,\n hourD : undefined ,\n min : undefined ,\n sec : undefined ,\n msec : undefined ,\n ampm : undefined ,\n diffM : undefined ,\n diffH : undefined ,\n date : undefined\n };\n\n var matches = 0;\n\n /* This switch is presented in the same order as in php date function (PHP 5.2.2) */\n for ( var i = 0; i < iFormat.length; i++) {\n switch( iFormat[ i ] ) {\n case escapeChar:\n result[i] = iFormat[ i + 1 ];\n i++;\n break;\n\n /* DAY */\n case \"d\": /* Day of the month, 2 digits with leading zeros; ex: 01 to 31 */\n result[ i ] = '(\\\\d{2})';\n objIndex.day = { original : i , match : matches++ };\n break;\n\n case \"j\": /* Day of the month without leading zeros; ex: 1 to 31 */\n result[ i ] = '(\\\\d{1,2})';\n objIndex.day = { original : i , match : matches++ };\n break;\n\n case \"D\": /* A textual representation of a day, three letters; Seg to Dom */\n result[ i ] = '([\\\\wá]{3})';\n objIndex.dayW = { original : i , match : matches++ };\n break;\n\n case \"l\": /* A full textual representation of the day of the week; Domingo to Sabado */\n result[i] = '([\\\\wá]{5,7})';\n objIndex.dayW = { original : i , match : matches++ };\n break;\n\n case \"N\": /* ISO-8601 numeric representation of the day of the week; 1 (Segunda) to 7 (Domingo) */\n result[ i ] = '(\\\\d)';\n objIndex.dayW = { original : i , match : matches++ };\n break;\n\n case \"w\": /* Numeric representation of the day of the week; 0 (for Sunday) through 6 (for Saturday) */\n result[ i ] = '(\\\\d)';\n objIndex.dayW = { original : i , match : matches++ };\n break;\n\n case \"S\": /* English ordinal suffix for the day of the month, 2 characters; st, nd, rd or th. Works well with j */\n result[ i ] = '\\\\w{2}';\n break;\n\n case \"z\": /* The day of the year (starting from 0); 0 to 365 */\n result[ i ] = '(\\\\d{1,3})';\n objIndex.dayY = { original : i , match : matches++ };\n break;\n\n /* WEEK */\n case \"W\": /* ISO-8601 week number of year, weeks starting on Monday; ex: 42 (the 42nd week in the year) */\n result[ i ] = '(\\\\d{1,2})';\n objIndex.week = { original : i , match : matches++ };\n break;\n\n /* MONTH */\n case \"F\": /* A full textual representation of a month, such as Janeiro or Marco; Janeiro a Dezembro */\n result[ i ] = '([\\\\wç]{4,9})';\n objIndex.month = { original : i , match : matches++ };\n break;\n\n case \"M\": /* A short textual representation of a month, three letters; Jan a Dez */\n result[ i ] = '(\\\\w{3})';\n objIndex.month = { original : i , match : matches++ };\n break;\n\n case \"m\": /* Numeric representation of a month, with leading zeros; 01 to 12 */\n result[ i ] = '(\\\\d{2})';\n objIndex.month = { original : i , match : matches++ };\n break;\n\n case \"n\": /* Numeric representation of a month, without leading zeros; 1 a 12 */\n result[ i ] = '(\\\\d{1,2})';\n objIndex.month = { original : i , match : matches++ };\n break;\n\n case \"t\": /* Number of days in the given month; ex: 28 */\n result[ i ] = '\\\\d{2}';\n break;\n\n /* YEAR */\n case \"L\": /* Whether it's a leap year; 1 if it is a leap year, 0 otherwise. */\n result[ i ] = '\\\\w{4,5}';\n break;\n\n case \"o\": /* ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. */\n throw '\"o\" not implemented!';\n\n case \"Y\": /* A full numeric representation of a year, 4 digits; 1999 */\n result[ i ] = '(\\\\d{4})';\n objIndex.year = { original : i , match : matches++ };\n break;\n\n case \"y\": /* A two digit representation of a year; 99 */\n result[ i ] = '(\\\\d{2})';\n if ( typeof objIndex.year === 'undefined' || iFormat[ objIndex.year.original ] !== 'Y' ) {\n objIndex.year = { original : i , match : matches++ };\n }\n break;\n\n /* TIME */\n case \"a\": /* Lowercase Ante meridiem and Post meridiem; am or pm */\n result[ i ] = '(am|pm)';\n objIndex.ampm = { original : i , match : matches++ };\n break;\n\n case \"A\": /* Uppercase Ante meridiem and Post meridiem; AM or PM */\n result[ i ] = '(AM|PM)';\n objIndex.ampm = { original : i , match : matches++ };\n break;\n\n case \"B\": /* Swatch Internet time; 000 through 999 */\n throw '\"B\" not implemented!';\n\n case \"g\": /* 12-hour format of an hour without leading zeros; 1 to 12 */\n result[ i ] = '(\\\\d{1,2})';\n objIndex.hourD = { original : i , match : matches++ };\n break;\n\n case \"G\": /* 24-hour format of an hour without leading zeros; 1 to 23 */\n result[ i ] = '(\\\\d{1,2})';\n objIndex.hour = { original : i , match : matches++ };\n break;\n\n case \"h\": /* 12-hour format of an hour with leading zeros; 01 to 12 */\n result[ i ] = '(\\\\d{2})';\n objIndex.hourD = { original : i , match : matches++ };\n break;\n\n case \"H\": /* 24-hour format of an hour with leading zeros; 01 to 24 */\n result[ i ] = '(\\\\d{2})';\n objIndex.hour = { original : i , match : matches++ };\n break;\n\n case \"i\": /* Minutes with leading zeros; 00 to 59 */\n result[ i ] = '(\\\\d{2})';\n objIndex.min = { original : i , match : matches++ };\n break;\n\n case \"s\": /* Seconds with leading zeros; 00 to 59; */\n result[ i ] = '(\\\\d{2})';\n objIndex.sec = { original : i , match : matches++ };\n break;\n\n case \"u\": /* Microseconds */\n throw '\"u\" not implemented!';\n\n /* TIMEZONE */\n case \"e\": /* Timezone identifier */\n throw '\"e\" not implemented!';\n\n case \"I\": /* \"1\" if Daylight Savings Time, \"0\" otherwise. Works only on the northern hemisphere */\n result[i] = '\\\\d';\n break;\n\n case \"O\": /* Difference to Greenwich time (GMT) in hours */\n result[ i ] = '([-+]\\\\d{4})';\n objIndex.diffH = { original : i , match : matches++ };\n break;\n\n case \"P\": /* Difference to Greenwich time (GMT) with colon between hours and minutes */\n throw '\"P\" not implemented!';\n\n case \"T\": /* Timezone abbreviation */\n throw '\"T\" not implemented!';\n\n case \"Z\": /* Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. */\n result[ i ] = '(\\\\-?\\\\d{1,5})';\n objIndex.diffM = { original : i , match : matches++ };\n break;\n\n /* FULL DATE/TIME */\n case \"c\": /* ISO 8601 date */\n throw '\"c\" not implemented!';\n\n case \"r\": /* RFC 2822 formatted date */\n result[ i ] = '([\\\\wá]{3}, \\\\d{1,2} \\\\w{3} \\\\d{4} \\\\d{2}:\\\\d{2}:\\\\d{2} [+\\\\-]\\\\d{4})';\n objIndex.date = { original : i , match : matches++ };\n break;\n\n case \"U\": /* Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT) */\n result[ i ] = '(\\\\d{1,13})';\n objIndex.date = { original : i , match : matches++ };\n break;\n\n default:\n result[ i ] = iFormat[ i ];\n }\n }\n\n var pattr = new RegExp( result.join('') );\n\n try {\n mList = str_date.match( pattr );\n if ( !mList ) { return; }\n }\n catch ( e ) { return ; }\n\n var _haveDatetime = typeof objIndex.date !== 'undefined';\n\n var _haveYear = typeof objIndex.year !== 'undefined';\n\n var _haveYDay = typeof objIndex.dayY !== 'undefined';\n\n var _haveDay = typeof objIndex.day !== 'undefined';\n var _haveMonth = typeof objIndex.month !== 'undefined';\n var _haveMonthDay = _haveMonth && _haveDay;\n var _haveOnlyDay = !_haveMonth && _haveDay;\n\n var _haveWDay = typeof objIndex.dayW !== 'undefined';\n var _haveWeek = typeof objIndex.week !== 'undefined';\n var _haveWeekWDay = _haveWeek && _haveWDay;\n var _haveOnlyWDay = !_haveWeek && _haveWDay;\n\n var _validDate = _haveYDay || _haveMonthDay || !_haveYear && _haveOnlyDay || _haveWeekWDay || !_haveYear && _haveOnlyWDay;\n var _noDate = !_haveYear && !_haveYDay && !_haveDay && !_haveMonth && !_haveWDay && !_haveWeek;\n\n var _haveHour12 = typeof objIndex.hourD !== 'undefined' && typeof objIndex.ampm !== 'undefined';\n var _haveHour24 = typeof objIndex.hour !== 'undefined';\n var _haveHour = _haveHour12 || _haveHour24;\n\n var _haveMin = typeof objIndex.min !== 'undefined';\n var _haveSec = typeof objIndex.sec !== 'undefined';\n var _haveMSec = typeof objIndex.msec !== 'undefined';\n\n var _haveMoreM = !_noDate || _haveHour;\n var _haveMoreS = _haveMoreM || _haveMin;\n\n var _haveDiffM = typeof objIndex.diffM !== 'undefined';\n var _haveDiffH = typeof objIndex.diffH !== 'undefined';\n //var _haveGMT = _haveDiffM || _haveDiffH;\n var hour;\n var min;\n\n if ( _haveDatetime ) {\n if ( iFormat[ objIndex.date.original ] === 'U' ) {\n return new Date( +mList[ objIndex.date.match + 1 ] * 1000 );\n }\n\n var dList = mList[ objIndex.date.match + 1 ].match( /\\w{3}, (\\d{1,2}) (\\w{3}) (\\d{4}) (\\d{2}):(\\d{2}):(\\d{2}) ([+\\-]\\d{4})/ );\n hour = +dList[ 4 ] + ( +dList[ 7 ].slice( 0 , 3 ) );\n min = +dList[ 5 ] + ( dList[ 7 ].slice( 0 , 1 ) + dList[ 7 ].slice( 3 ) ) / 100 * 60;\n\n return new Date( dList[ 3 ] , this._iMonth( dList[ 2 ] ) , dList[ 1 ] , hour , min , dList[ 6 ] );\n }\n\n var _d = new Date( );\n var year;\n var month;\n var day;\n var sec;\n var msec;\n var gmt;\n\n if ( !_validDate && !_noDate ) { return ; }\n\n if ( _validDate ) {\n if ( _haveYear ) {\n var _y = _d.getFullYear( ) - 50 + '';\n year = mList[ objIndex.year.match + 1 ];\n if ( iFormat[ objIndex.year.original ] === 'y' ) {\n year = +_y.slice( 0 , 2 ) + ( year >= ( _y ).slice( 2 ) ? 0 : 1 ) + year;\n }\n } else {\n year = _d.getFullYear();\n }\n\n if ( _haveYDay ) {\n month = 0;\n day = mList[ objIndex.dayY.match + 1 ];\n } else if ( _haveDay ) {\n if ( _haveMonth ) {\n month = this._iMonth( mList[ objIndex.month.match + 1 ] );\n } else {\n month = _d.getMonth( );\n }\n\n day = mList[ objIndex.day.match + 1 ];\n } else {\n month = 0;\n\n var week;\n if ( _haveWeek ) {\n week = mList[ objIndex.week.match + 1 ];\n } else {\n week = this.get( 'W' , _d );\n }\n\n day = ( week - 2 ) * 7 + ( 8 - ( ( new Date( year , 0 , 1 ) ).getDay( ) || 7 ) ) + this._iWeek( mList[ objIndex.week.match + 1 ] );\n }\n\n if ( month === 0 && day > 31 ) {\n var aux = new Date( year , month , day );\n month = aux.getMonth( );\n day = aux.getDate( );\n }\n }\n else {\n year = _d.getFullYear( );\n month = _d.getMonth( );\n day = _d.getDate( );\n }\n\n if ( _haveHour12 ) { hour = +mList[ objIndex.hourD.match + 1 ] + ( mList[ objIndex.ampm.match + 1 ] === 'pm' ? 12 : 0 ); }\n else if ( _haveHour24 ) { hour = mList[ objIndex.hour.match + 1 ]; }\n else if ( _noDate ) { hour = _d.getHours( ); }\n else { hour = '00'; }\n\n if ( _haveMin ) { min = mList[ objIndex.min.match + 1 ]; }\n else if ( !_haveMoreM ) { min = _d.getMinutes( ); }\n else { min = '00'; }\n\n if ( _haveSec ) { sec = mList[ objIndex.sec.match + 1 ]; }\n else if ( !_haveMoreS ) { sec = _d.getSeconds( ); }\n else { sec = '00'; }\n\n if ( _haveMSec ) { msec = mList[ objIndex.msec.match + 1 ]; }\n else { msec = '000'; }\n\n if ( _haveDiffH ) { gmt = mList[ objIndex.diffH.match + 1 ]; }\n else if ( _haveDiffM ) { gmt = String( -1 * mList[ objIndex.diffM.match + 1 ] / 60 * 100 ).replace( /^(\\d)/ , '+$1' ).replace( /(^[\\-+])(\\d{3}$)/ , '$10$2' ); }\n else { gmt = '+0000'; }\n\n return new Date( year, month, day, hour, min, sec );\n }\n };\n\n\n return InkDate;\n\n});\n","/**\n * Dump/Profiling Utilities\n * @module Ink.Util.Dumper_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Dumper', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.Dumper_1 \n */\n\n var Dumper = {\n\n /**\n * Hex code for the 'tab'\n * \n * @property _tab\n * @type {String}\n * @private\n * @readOnly\n * @static\n *\n */\n _tab: '\\xA0\\xA0\\xA0\\xA0',\n\n /**\n * Function that returns the argument passed formatted\n *\n * @method _formatParam\n * @param {Mixed} param\n * @return {String} The argument passed formatted\n * @private\n * @static\n */\n _formatParam: function(param)\n {\n var formated = '';\n\n switch(typeof(param)) {\n case 'string':\n formated = '(string) '+param;\n break;\n case 'number':\n formated = '(number) '+param;\n break;\n case 'boolean':\n formated = '(boolean) '+param;\n break;\n case 'object':\n if(param !== null) {\n if(param.constructor === Array) {\n formated = 'Array \\n{\\n' + this._outputFormat(param, 0) + '\\n}';\n } else {\n formated = 'Object \\n{\\n' + this._outputFormat(param, 0) + '\\n}';\n }\n } else {\n formated = 'null';\n }\n break;\n default:\n formated = false;\n }\n\n return formated;\n },\n\n /**\n * Function that returns the tabs concatenated\n *\n * @method _getTabs\n * @param {Number} numberOfTabs Number of Tabs\n * @return {String} Tabs concatenated\n * @private\n * @static\n */\n _getTabs: function(numberOfTabs)\n {\n var tabs = '';\n for(var _i = 0; _i < numberOfTabs; _i++) {\n tabs += this._tab;\n }\n return tabs;\n },\n\n /**\n * Function that formats the parameter to display.\n *\n * @method _outputFormat\n * @param {Any} param\n * @param {Number} dim\n * @return {String} The parameter passed formatted to displat\n * @private\n * @static\n */\n _outputFormat: function(param, dim)\n {\n var formated = '';\n //var _strVal = false;\n var _typeof = false;\n for(var key in param) {\n if(param[key] !== null) {\n if(typeof(param[key]) === 'object' && (param[key].constructor === Array || param[key].constructor === Object)) {\n if(param[key].constructor === Array) {\n _typeof = 'Array';\n } else if(param[key].constructor === Object) {\n _typeof = 'Object';\n }\n formated += this._tab + this._getTabs(dim) + '[' + key + '] => <b>'+_typeof+'</b>\\n';\n formated += this._tab + this._getTabs(dim) + '{\\n';\n formated += this._outputFormat(param[key], dim + 1) + this._tab + this._getTabs(dim) + '}\\n';\n } else if(param[key].constructor === Function) {\n continue;\n } else {\n formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => ' + param[key] + '\\n';\n }\n } else {\n formated = formated + this._tab + this._getTabs(dim) + '[' + key + '] => null \\n';\n }\n }\n return formated;\n },\n\n /**\n * Prints variable structure.\n *\n * @method printDump\n * @param {Any} param Variable to be dumped.\n * @param {DOMElement|String} [target] Element to print the dump on.\n * @public\n * @static\n * @sample Ink_Util_Dumper_printDump.html \n */\n printDump: function(param, target)\n {\n /*jshint evil:true */\n if(!target || typeof(target) === 'undefined') {\n document.write('<pre>'+this._formatParam(param)+'</pre>');\n } else {\n if(typeof(target) === 'string') {\n document.getElementById(target).innerHTML = '<pre>' + this._formatParam(param) + '</pre>';\n } else if(typeof(target) === 'object') {\n target.innerHTML = '<pre>'+this._formatParam(param)+'</pre>';\n } else {\n throw \"TARGET must be an element or an element ID\";\n }\n }\n },\n\n /**\n * Get a variable's structure.\n *\n * @method returnDump\n * @param {Any} param Variable to get the structure.\n * @return {String} The variable's structure.\n * @public\n * @static\n * @sample Ink_Util_Dumper_returnDump.html \n */\n returnDump: function(param)\n {\n return this._formatParam(param);\n },\n\n /**\n * Alert a variable's structure.\n *\n * @method alertDump\n * @param {Any} param Variable to be dumped.\n * @public\n * @static\n * @sample Ink_Util_Dumper_alertDump.html \n */\n alertDump: function(param)\n {\n window.alert(this._formatParam(param).replace(/(<b>)(Array|Object)(<\\/b>)/g, \"$2\"));\n },\n\n /**\n * Prints the variable structure to a new window.\n *\n * @method windowDump\n * @param {Any} param Variable to be dumped.\n * @public\n * @static\n * @sample Ink_Util_Dumper_windowDump.html \n */\n windowDump: function(param)\n {\n var dumperwindow = 'dumperwindow_'+(Math.random() * 10000);\n var win = window.open('',\n dumperwindow,\n 'width=400,height=300,left=50,top=50,status,menubar,scrollbars,resizable'\n );\n win.document.open();\n win.document.write('<pre>'+this._formatParam(param)+'</pre>');\n win.document.close();\n win.focus();\n }\n\n };\n\n return Dumper;\n\n});\n","/**\n * Internationalization Utilities \n * @module Ink.Util.I18n_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.I18n', '1', [], function () {\n 'use strict';\n\n var pattrText = /\\{(?:(\\{.*?})|(?:%s:)?(\\d+)|(?:%s)?|([\\w-]+))}/g;\n\n var funcOrVal = function( ret , args ) {\n if ( typeof ret === 'function' ) {\n return ret.apply(this, args);\n } else if (typeof ret !== undefined) {\n return ret;\n } else {\n return '';\n }\n };\n\n /**\n * You can use this module to internationalize your applications. It roughly emulates GNU gettext's API.\n *\n * @class Ink.Util.I18n\n * @constructor\n *\n * @param {Object} dict Object mapping language codes (in the form of `pt_PT`, `pt_BR`, `fr`, `en_US`, etc.) to their `dictionaries`\n * @param {String} [lang='pt_PT'] language code of the target language\n *\n * @sample Ink_Util_I18n_1.html\n */\n var I18n = function( dict , lang , testMode ) {\n if ( !( this instanceof I18n ) ) { return new I18n( dict , lang , testMode ); }\n\n this.reset( )\n .lang( lang )\n .testMode( testMode )\n .append( dict || { } , lang );\n };\n\n I18n.prototype = {\n reset: function( ) {\n this._dicts = [ ];\n this._dict = { };\n this._testMode = false;\n this._lang = this._gLang;\n\n return this;\n },\n /**\n * Adds translation strings for the helper to use.\n *\n * @method append\n * @param {Object} dict Object containing language objects identified by their language code\n *\n * @sample Ink_Util_I18n_1_append.html\n */\n append: function( dict ) {\n this._dicts.push( dict );\n\n this._dict = Ink.extendObj(this._dict , dict[ this._lang ] );\n\n return this;\n },\n /**\n * Gets or sets the language.\n * If there are more dictionaries available in cache, they will be loaded.\n *\n * @method lang\n * @param {String} lang Language code to set this instance to.\n */\n lang: function( lang ) {\n if ( !arguments.length ) { return this._lang; }\n\n if ( lang && this._lang !== lang ) {\n this._lang = lang;\n\n this._dict = { };\n\n for ( var i = 0, l = this._dicts.length; i < l; i++ ) {\n this._dict = Ink.extendObj( this._dict , this._dicts[ i ][ lang ] || { } );\n }\n }\n\n return this;\n },\n /**\n * Sets or unsets test mode.\n * In test mode, unknown strings are wrapped in `[ ... ]`. This is useful for debugging your application and to make sure all your translation keys are in place.\n *\n * @method testMode\n * @param {Boolean} bool Flag to set the test mode state\n */\n testMode: function( bool ) {\n if ( !arguments.length ) { return !!this._testMode; }\n\n if ( bool !== undefined ) { this._testMode = !!bool; }\n\n return this;\n },\n\n /**\n * Gest a key from the current dictionary\n *\n * @method getKey\n * @param {String} key\n * @return {Mixed} The object which happened to be in the current language dictionary on the given key.\n *\n * @sample Ink_Util_I18n_1_getKey.html\n */\n getKey: function( key ) {\n var ret;\n var gLang = this._gLang;\n var lang = this._lang;\n \n if ( key in this._dict ) {\n ret = this._dict[ key ];\n } else {\n I18n.langGlobal( lang );\n \n ret = this._gDict[ key ];\n \n I18n.langGlobal( gLang );\n }\n \n return ret;\n },\n\n /**\n * Translates a string.\n * Given a translation key, return a translated string, with replaced parameters.\n * When a translated string is not available, the original string is returned unchanged.\n *\n * @method text\n * @param {String} str Key to look for in i18n dictionary (which is returned verbatim if unknown)\n * @param {Object} [namedParms] Named replacements. Replaces {named} with values in this object.\n * @param {String} [args] Replacement #1 (replaces first {} and all {1})\n * @param {String} [arg2] Replacement #2 (replaces second {} and all {2})\n * @param {String} [argn*] Replacement #n (replaces nth {} and all {n})\n *\n * @sample Ink_Util_I18n_1_text.html\n */\n text: function( str /*, replacements...*/ ) {\n if ( typeof str !== 'string' ) { return; } // Backwards-compat\n\n var pars = Array.prototype.slice.call( arguments , 1 );\n var idx = 0;\n var isObj = typeof pars[ 0 ] === 'object';\n\n var original = this.getKey( str );\n if ( original === undefined ) { original = this._testMode ? '[' + str + ']' : str; }\n if ( typeof original === 'number' ) { original += ''; }\n\n if (typeof original === 'string') {\n original = original.replace( pattrText , function( m , $1 , $2 , $3 ) {\n var ret =\n $1 ? $1 :\n $2 ? pars[ $2 - ( isObj ? 0 : 1 ) ] :\n $3 ? pars[ 0 ][ $3 ] || '' :\n pars[ (idx++) + ( isObj ? 1 : 0 ) ];\n return funcOrVal( ret , [idx].concat(pars) );\n });\n return original;\n }\n \n return (\n typeof original === 'function' ? original.apply( this , pars ) :\n original instanceof Array ? funcOrVal( original[ pars[ 0 ] ] , pars ) :\n typeof original === 'object' ? funcOrVal( original[ pars[ 0 ] ] , pars ) :\n '');\n },\n\n /**\n * Translates and pluralizes text.\n * Given a singular string, a plural string and a number, translates either the singular or plural string.\n *\n * @method ntext\n * @return {String}\n *\n * @param {String} strSin Word to use when count is 1\n * @param {String} strPlur Word to use otherwise\n * @param {Number} count Number which defines which word to use\n * @param [args*] Extra arguments, to be passed to `text()`\n *\n * @sample Ink_Util_I18n_1_ntext.html\n */\n ntext: function( strSin , strPlur , count ) {\n var pars = Array.prototype.slice.apply( arguments );\n var original;\n\n if ( pars.length === 2 && typeof strPlur === 'number' ) {\n original = this.getKey( strSin );\n if ( !( original instanceof Array ) ) { return ''; }\n\n pars.splice( 0 , 1 );\n original = original[ strPlur === 1 ? 0 : 1 ];\n } else {\n pars.splice( 0 , 2 );\n original = count === 1 ? strSin : strPlur;\n }\n\n return this.text.apply( this , [ original ].concat( pars ) );\n },\n\n /**\n * Gets the ordinal suffix of a number.\n *\n * This works by using transforms (in the form of Objects or Functions) passed into the function or found in the special key `_ordinals` in the active language dictionary.\n *\n * @method ordinal\n *\n * @param {Number} num Input number\n * @param {Object|Function} [options]={} Dictionaries for translating. Each of these options' fallback is found in the current language's dictionary. The lookup order is the following: `exceptions`, `byLastDigit`, `default`. Each of these may be either an `Object` or a `Function`. If it's a function, it is called (with `number` and `digit` for any function except for byLastDigit, which is called with the `lastDigit` of the number in question), and if the function returns a string, that is used. If it's an object, the property is looked up using `obj[prop]`. If what is found is a string, it is used directly.\n * @param {Object|Function} [options.byLastDigit]={} If the language requires the last digit to be considered, mappings of last digits to ordinal suffixes can be created here.\n * @param {Object|Function} [options.exceptions]={} Map unique, special cases to their ordinal suffixes.\n *\n * @returns {String} Ordinal suffix for `num`.\n *\n * @sample Ink_Util_I18n_1_ordinal.html\n **/\n ordinal: function( num ) {\n if ( num === undefined ) { return ''; }\n\n var lastDig = +num.toString( ).slice( -1 );\n\n var ordDict = this.getKey( '_ordinals' );\n if ( ordDict === undefined ) { return ''; }\n\n if ( typeof ordDict === 'string' ) { return ordDict; }\n\n var ret;\n\n if ( typeof ordDict === 'function' ) {\n ret = ordDict( num , lastDig );\n\n if ( typeof ret === 'string' ) { return ret; }\n }\n\n if ( 'exceptions' in ordDict ) {\n ret = typeof ordDict.exceptions === 'function' ? ordDict.exceptions( num , lastDig ) :\n num in ordDict.exceptions ? funcOrVal( ordDict.exceptions[ num ] , [num , lastDig] ) :\n undefined;\n\n if ( typeof ret === 'string' ) { return ret; }\n }\n\n if ( 'byLastDigit' in ordDict ) {\n ret = typeof ordDict.byLastDigit === 'function' ? ordDict.byLastDigit( lastDig , num ) :\n lastDig in ordDict.byLastDigit ? funcOrVal( ordDict.byLastDigit[ lastDig ] , [lastDig , num] ) :\n undefined;\n\n if ( typeof ret === 'string' ) { return ret; }\n }\n\n if ( 'default' in ordDict ) {\n ret = funcOrVal( ordDict['default'] , [ num , lastDig ] );\n\n if ( typeof ret === 'string' ) { return ret; }\n }\n\n return '';\n },\n\n /**\n * Create an alias.\n *\n * Returns an alias to this I18n instance. It contains the I18n methods documented here, but is also a function. If you call it, it just calls `text()`. This is commonly assigned to \"_\".\n *\n * @method alias\n * @returns {Function} an alias to `text()` on this instance. You can also access the rest of the translation API through this alias.\n *\n * @sample Ink_Util_I18n_1_alias.html\n */\n alias: function( ) {\n var ret = Ink.bind( I18n.prototype.text , this );\n ret.ntext = Ink.bind( I18n.prototype.ntext , this );\n ret.append = Ink.bind( I18n.prototype.append , this );\n ret.ordinal = Ink.bind( I18n.prototype.ordinal , this );\n ret.testMode = Ink.bind( I18n.prototype.testMode , this );\n\n return ret;\n }\n };\n\n /**\n * Resets I18n global state (global dictionaries, and default language for instances)\n *\n * @method reset\n * @static\n *\n **/\n I18n.reset = function( ) {\n I18n.prototype._gDicts = [ ];\n I18n.prototype._gDict = { };\n I18n.prototype._gLang = 'pt_PT';\n };\n I18n.reset( );\n\n /**\n * Adds a dictionary to be used in all I18n instances for the corresponding language.\n *\n * @method appendGlobal\n * @static\n *\n * @param dict {Object} Dictionary to be added\n * @param lang {String} Language fo the dictionary being added\n *\n */\n I18n.appendGlobal = function( dict , lang ) {\n if ( lang ) {\n if ( !( lang in dict ) ) {\n var obj = { };\n\n obj[ lang ] = dict;\n\n dict = obj;\n }\n\n if ( lang !== I18n.prototype._gLang ) { I18n.langGlobal( lang ); }\n }\n\n I18n.prototype._gDicts.push( dict );\n\n Ink.extendObj( I18n.prototype._gDict , dict[ I18n.prototype._gLang ] );\n };\n\n I18n.append = function () {\n // [3.1.0] remove this alias\n Ink.warn('Ink.Util.I18n.append() was renamed to appendGlobal().');\n return I18n.appendGlobal.apply(I18n, [].slice.call(arguments));\n };\n\n /**\n * Gets or sets the current default language of I18n instances.\n *\n * @method langGlobal\n * @param lang the new language for all I18n instances\n *\n * @static\n *\n * @return {String} language code\n */\n I18n.langGlobal = function( lang ) {\n if ( !arguments.length ) { return I18n.prototype._gLang; }\n\n if ( lang && I18n.prototype._gLang !== lang ) {\n I18n.prototype._gLang = lang;\n\n I18n.prototype._gDict = { };\n\n for ( var i = 0, l = I18n.prototype._gDicts.length; i < l; i++ ) {\n Ink.extendObj( I18n.prototype._gDict , I18n.prototype._gDicts[ i ][ lang ] || { } );\n }\n }\n };\n\n I18n.lang = function () {\n // [3.1.0] remove this alias\n Ink.warn('Ink.Util.I18n.lang() was renamed to langGlobal().');\n return I18n.langGlobal.apply(I18n, [].slice.call(arguments));\n };\n \n return I18n;\n});","/**\n * JSON Utilities\n * @module Ink.Util.Json_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Json', '1', [], function() {\n 'use strict';\n\n var function_call = Function.prototype.call;\n var cx = /[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g;\n\n function twoDigits(n) {\n var r = '' + n;\n if (r.length === 1) {\n return '0' + r;\n } else {\n return r;\n }\n }\n\n var dateToISOString = Date.prototype.toISOString ?\n Ink.bind(function_call, Date.prototype.toISOString) :\n function(date) {\n // Adapted from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString\n return date.getUTCFullYear() +\n '-' + twoDigits( date.getUTCMonth() + 1 ) +\n '-' + twoDigits( date.getUTCDate() ) +\n 'T' + twoDigits( date.getUTCHours() ) +\n ':' + twoDigits( date.getUTCMinutes() ) +\n ':' + twoDigits( date.getUTCSeconds() ) +\n '.' + String( (date.getUTCMilliseconds()/1000).toFixed(3) ).slice( 2, 5 ) +\n 'Z';\n };\n\n /**\n * Use this class to convert JSON strings to JavaScript objects\n * `.parse()` and also to do the opposite operation `.stringify()`.\n * Internally, the standard JSON implementation is used if available\n * Otherwise, the functions mimic the standard implementation.\n *\n * Here's how to produce JSON from an existing object:\n * \n * Ink.requireModules(['Ink.Util.Json_1'], function (Json) {\n * var obj = {\n * key1: 'value1',\n * key2: 'value2',\n * keyArray: ['arrayValue1', 'arrayValue2', 'arrayValue3']\n * };\n * Json.stringify(obj); // The above object as a JSON string\n * });\n *\n * And here is how to parse JSON:\n *\n * Ink.requireModules(['Ink.Util.Json_1'], function (Json) {\n * var source = '{\"key\": \"value\", \"array\": [true, null, false]}';\n * Json.parse(source); // The above JSON string as an object\n * });\n *\n * @namespace Ink.Util.Json_1 \n * @static\n * \n */\n var InkJson = {\n _nativeJSON: window.JSON || null,\n\n _convertToUnicode: false,\n\n // Escape characters so as to embed them in JSON strings\n _escape: function (theString) {\n var _m = { '\\b': '\\\\b', '\\t': '\\\\t', '\\n': '\\\\n', '\\f': '\\\\f', '\\r': '\\\\r', '\"': '\\\\\"', '\\\\': '\\\\\\\\' };\n\n if (/[\"\\\\\\x00-\\x1f]/.test(theString)) {\n theString = theString.replace(/([\\x00-\\x1f\\\\\"])/g, function(a, b) {\n var c = _m[b];\n if (c) {\n return c;\n }\n c = b.charCodeAt();\n return '\\\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16);\n });\n }\n\n return theString;\n },\n\n // A character conversion map\n _toUnicode: function (theString)\n {\n if(!this._convertToUnicode) {\n return this._escape(theString);\n } else {\n var unicodeString = '';\n var inInt = false;\n var theUnicode = false;\n var i = 0;\n var total = theString.length;\n while(i < total) {\n inInt = theString.charCodeAt(i);\n if( (inInt >= 32 && inInt <= 126) ||\n //(inInt >= 48 && inInt <= 57) ||\n //(inInt >= 65 && inInt <= 90) ||\n //(inInt >= 97 && inInt <= 122) ||\n inInt === 8 ||\n inInt === 9 ||\n inInt === 10 ||\n inInt === 12 ||\n inInt === 13 ||\n inInt === 32 ||\n inInt === 34 ||\n inInt === 47 ||\n inInt === 58 ||\n inInt === 92) {\n\n if(inInt === 34 || inInt === 92 || inInt === 47) {\n theUnicode = '\\\\'+theString.charAt(i);\n } else if(inInt === 8) {\n theUnicode = '\\\\b';\n } else if(inInt === 9) {\n theUnicode = '\\\\t';\n } else if(inInt === 10) {\n theUnicode = '\\\\n';\n } else if(inInt === 12) {\n theUnicode = '\\\\f';\n } else if(inInt === 13) {\n theUnicode = '\\\\r';\n } else {\n theUnicode = theString.charAt(i);\n }\n } else {\n if(this._convertToUnicode) {\n theUnicode = theString.charCodeAt(i).toString(16)+''.toUpperCase();\n while (theUnicode.length < 4) {\n theUnicode = '0' + theUnicode;\n }\n theUnicode = '\\\\u' + theUnicode;\n } else {\n theUnicode = theString.charAt(i);\n }\n }\n unicodeString += theUnicode;\n\n i++;\n }\n\n return unicodeString;\n }\n\n },\n\n _stringifyValue: function(param) {\n if (typeof param === 'string') {\n return '\"' + this._toUnicode(param) + '\"';\n } else if (typeof param === 'number' && (isNaN(param) || !isFinite(param))) { // Unusable numbers go null\n return 'null';\n } else if (typeof param === 'undefined' || param === null) { // And so does undefined\n return 'null';\n } else if (typeof param.toJSON === 'function') {\n var t = param.toJSON();\n if (typeof t === 'string') {\n return '\"' + this._escape(t) + '\"';\n } else {\n return this._escape(t.toString());\n }\n } else if (typeof param === 'number' || typeof param === 'boolean') { // These ones' toString methods return valid JSON.\n return '' + param;\n } else if (typeof param === 'function') {\n return 'null'; // match JSON.stringify\n } else if (param.constructor === Date) {\n return '\"' + this._escape(dateToISOString(param)) + '\"';\n } else if (param.constructor === Array) {\n var arrayString = '';\n for (var i = 0, len = param.length; i < len; i++) {\n if (i > 0) {\n arrayString += ',';\n }\n arrayString += this._stringifyValue(param[i]);\n }\n return '[' + arrayString + ']';\n } else { // Object\n var objectString = '';\n for (var k in param) {\n if ({}.hasOwnProperty.call(param, k)) {\n if (objectString !== '') {\n objectString += ',';\n }\n objectString += '\"' + this._escape(k) + '\": ' + this._stringifyValue(param[k]);\n }\n }\n return '{' + objectString + '}';\n }\n },\n\n /**\n * Serializes a JSON object into a string.\n *\n * @method stringify\n * @param {Object} input Data to be serialized into JSON\n * @param {Boolean} convertToUnicode When `true`, converts string contents to unicode \\uXXXX\n * @return {String} Serialized string\n *\n * @sample Ink_Util_Json_stringify.html \n */\n stringify: function(input, convertToUnicode) {\n this._convertToUnicode = !!convertToUnicode;\n if(!this._convertToUnicode && this._nativeJSON) {\n return this._nativeJSON.stringify(input);\n }\n return this._stringifyValue(input); // And recurse.\n },\n \n /**\n * Parses a JSON text through a function\n * \n * @method parse\n * @param text {String} Input string\n * @param reviver {Function} Function receiving `(key, value)`, and `this`=(containing object), used to walk objects.\n * \n * @return {Object} JSON object\n *\n * @sample Ink_Util_Json_parse.html \n */\n /* From https://github.com/douglascrockford/JSON-js/blob/master/json.js */\n parse: function (text, reviver) {\n /*jshint evil:true*/\n\n// The parse method takes a text and an optional reviver function, and returns\n// a JavaScript value if the text is a valid JSON text.\n\n var j;\n\n function walk(holder, key) {\n\n// The walk method is used to recursively walk the resulting structure so\n// that modifications can be made.\n\n var k, v, value = holder[key];\n if (value && typeof value === 'object') {\n for (k in value) {\n if (Object.prototype.hasOwnProperty.call(value, k)) {\n v = walk(value, k);\n if (v !== undefined) {\n value[k] = v;\n } else {\n delete value[k];\n }\n }\n }\n }\n return reviver.call(holder, key, value);\n }\n\n\n// Parsing happens in four stages. In the first stage, we replace certain\n// Unicode characters with escape sequences. JavaScript handles many characters\n// incorrectly, either silently deleting them, or treating them as line endings.\n\n text = String(text);\n cx.lastIndex = 0;\n if (cx.test(text)) {\n text = text.replace(cx, function (a) {\n return '\\\\u' +\n ('0000' + a.charCodeAt(0).toString(16)).slice(-4);\n });\n }\n\n// In the second stage, we run the text against regular expressions that look\n// for non-JSON patterns. We are especially concerned with '()' and 'new'\n// because they can cause invocation, and '=' because it can cause mutation.\n// But just to be safe, we want to reject all unexpected forms.\n\n// We split the second stage into 4 regexp operations in order to work around\n// crippling inefficiencies in IE's and Safari's regexp engines. First we\n// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we\n// replace all simple value tokens with ']' characters. Third, we delete all\n// open brackets that follow a colon or comma or that begin the text. Finally,\n// we look to see that the remaining characters are only whitespace or ']' or\n// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.\n\n if (/^[\\],:{}\\s]*$/\n .test(text.replace(/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')\n .replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g, ']')\n .replace(/(?:^|:|,)(?:\\s*\\[)+/g, ''))) {\n\n// In the third stage we use the eval function to compile the text into a\n// JavaScript structure. The '{' operator is subject to a syntactic ambiguity\n// in JavaScript: it can begin a block or an object literal. We wrap the text\n// in parens to eliminate the ambiguity.\n\n j = eval('(' + text + ')');\n\n// In the optional fourth stage, we recursively walk the new structure, passing\n// each name/value pair to a reviver function for possible transformation.\n\n return typeof reviver === 'function' ?\n walk({'': j}, '') :\n j;\n }\n\n// If the text is not JSON parseable, then a SyntaxError is thrown.\n\n throw new SyntaxError('JSON.parse');\n }\n };\n\n return InkJson;\n});\n","/**\n * String Utilities\n * @module Ink.Util.String_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.String', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.String_1 \n */\n var InkUtilString = {\n\n /**\n * List of special chars\n * \n * @property _chars\n * @type {Array}\n * @private\n * @readOnly\n * @static\n */\n _chars: ['&','à','á','â','ã','ä','å','æ','ç','è','é',\n 'ê','ë','ì','í','î','ï','ð','ñ','ò','ó','ô',\n 'õ','ö','ø','ù','ú','û','ü','ý','þ','ÿ','À',\n 'Á','Â','Ã','Ä','Å','Æ','Ç','È','É','Ê','Ë',\n 'Ì','Í','Î','Ï','Ð','Ñ','Ò','Ó','Ô','Õ','Ö',\n 'Ø','Ù','Ú','Û','Ü','Ý','Þ','€','\\\"','ß','<',\n '>','¢','£','¤','¥','¦','§','¨','©','ª','«',\n '¬','\\xad','®','¯','°','±','²','³','´','µ','¶',\n '·','¸','¹','º','»','¼','½','¾'],\n\n /**\n * List of the special characters' html entities\n * \n * @property _entities\n * @type {Array}\n * @private\n * @readOnly\n * @static\n */\n _entities: ['amp','agrave','aacute','acirc','atilde','auml','aring',\n 'aelig','ccedil','egrave','eacute','ecirc','euml','igrave',\n 'iacute','icirc','iuml','eth','ntilde','ograve','oacute',\n 'ocirc','otilde','ouml','oslash','ugrave','uacute','ucirc',\n 'uuml','yacute','thorn','yuml','Agrave','Aacute','Acirc',\n 'Atilde','Auml','Aring','AElig','Ccedil','Egrave','Eacute',\n 'Ecirc','Euml','Igrave','Iacute','Icirc','Iuml','ETH','Ntilde',\n 'Ograve','Oacute','Ocirc','Otilde','Ouml','Oslash','Ugrave',\n 'Uacute','Ucirc','Uuml','Yacute','THORN','euro','quot','szlig',\n 'lt','gt','cent','pound','curren','yen','brvbar','sect','uml',\n 'copy','ordf','laquo','not','shy','reg','macr','deg','plusmn',\n 'sup2','sup3','acute','micro','para','middot','cedil','sup1',\n 'ordm','raquo','frac14','frac12','frac34'],\n\n /**\n * List of accented chars\n * \n * @property _accentedChars\n * @type {Array}\n * @private\n * @readOnly\n * @static\n */\n _accentedChars:['à','á','â','ã','ä','å',\n 'è','é','ê','ë',\n 'ì','í','î','ï',\n 'ò','ó','ô','õ','ö',\n 'ù','ú','û','ü',\n 'ç','ñ',\n 'À','Á','Â','Ã','Ä','Å',\n 'È','É','Ê','Ë',\n 'Ì','Í','Î','Ï',\n 'Ò','Ó','Ô','Õ','Ö',\n 'Ù','Ú','Û','Ü',\n 'Ç','Ñ'],\n\n /**\n * List of the accented chars (above), but without the accents\n * \n * @property _accentedRemovedChars\n * @type {Array}\n * @private\n * @readOnly\n * @static\n */\n _accentedRemovedChars:['a','a','a','a','a','a',\n 'e','e','e','e',\n 'i','i','i','i',\n 'o','o','o','o','o',\n 'u','u','u','u',\n 'c','n',\n 'A','A','A','A','A','A',\n 'E','E','E','E',\n 'I','I','I','I',\n 'O','O','O','O','O',\n 'U','U','U','U',\n 'C','N'],\n /**\n * Object that contains the basic HTML unsafe chars, as keys, and their HTML entities as values\n * \n * @property _htmlUnsafeChars\n * @type {Object}\n * @private\n * @readOnly\n * @static\n */\n _htmlUnsafeChars:{'<':'&lt;','>':'&gt;','&':'&amp;','\"':'&quot;',\"'\":'&apos;'},\n\n /**\n * Capitalizes a word.\n * If param as more than one word, it converts first letter of all words that have more than 2 letters\n *\n * @method ucFirst\n * @param {String} string String to capitalize.\n * @param {Boolean} [firstWordOnly]=false Flag to capitalize only the first word.\n * @return {String} Camel cased string.\n * @public\n * @static\n * @sample Ink_Util_String_ucFirst.html \n */\n ucFirst: function(string, firstWordOnly) {\n var replacer = firstWordOnly ? /(^|\\s)(\\w)(\\S{2,})/ : /(^|\\s)(\\w)(\\S{2,})/g;\n return string ? String(string).replace(replacer, function(_, $1, $2, $3){\n return $1 + $2.toUpperCase() + $3.toLowerCase();\n }) : string;\n },\n\n /**\n * Trims whitespace from strings\n *\n * @method trim\n * @param {String} string String to be trimmed\n * @return {String} Trimmed string\n * @public\n * @static\n * @sample Ink_Util_String_trim.html \n */\n trim: function(string)\n {\n if (typeof string === 'string') {\n return string.replace(/^\\s+|\\s+$|\\n+$/g, '');\n }\n return string;\n },\n\n /**\n * Strips HTML tags from strings\n *\n * @method stripTags\n * @param {String} string String to strip tags from.\n * @param {String} allowed Comma separated list of allowed tags.\n * @return {String} Stripped string\n * @public\n * @static\n * @sample Ink_Util_String_stripTags.html \n */\n stripTags: function(string, allowed)\n {\n if (allowed && typeof allowed === 'string') {\n var aAllowed = InkUtilString.trim(allowed).split(',');\n var aNewAllowed = [];\n var cleanedTag = false;\n for(var i=0; i < aAllowed.length; i++) {\n if(InkUtilString.trim(aAllowed[i]) !== '') {\n cleanedTag = InkUtilString.trim(aAllowed[i].replace(/(<|\\>)/g, '').replace(/\\s/, ''));\n aNewAllowed.push('(<'+cleanedTag+'\\\\s[^>]+>|<(\\\\s|\\\\/)?(\\\\s|\\\\/)?'+cleanedTag+'>)');\n }\n }\n var strAllowed = aNewAllowed.join('|');\n var reAllowed = new RegExp(strAllowed, \"i\");\n\n var aFoundTags = string.match(new RegExp(\"<[^>]*>\", \"g\"));\n\n for(var j=0; j < aFoundTags.length; j++) {\n if(!aFoundTags[j].match(reAllowed)) {\n string = string.replace((new RegExp(aFoundTags[j], \"gm\")), '');\n }\n }\n return string;\n } else {\n return string.replace(/<[^\\>]+\\>/g, '');\n }\n },\n\n /**\n * Encodes string into HTML entities.\n *\n * @method htmlEntitiesEncode\n * @param {String} string\n * @return {String} string encoded\n * @public\n * @static\n * @sample Ink_Util_String_htmlEntitiesEncode.html \n */\n htmlEntitiesEncode: function(string)\n {\n if (string && string.replace) {\n var re = false;\n for (var i = 0; i < InkUtilString._chars.length; i++) {\n re = new RegExp(InkUtilString._chars[i], \"gm\");\n string = string.replace(re, '&' + InkUtilString._entities[i] + ';');\n }\n }\n return string;\n },\n\n /**\n * Decodes string from HTML entities.\n *\n * @method htmlEntitiesDecode\n * @param {String} string String to be decoded\n * @return {String} Decoded string\n * @public\n * @static\n * @sample Ink_Util_String_htmlEntitiesDecode.html \n */\n htmlEntitiesDecode: function(string)\n {\n if (string && string.replace) {\n var re = false;\n for (var i = 0; i < InkUtilString._entities.length; i++) {\n re = new RegExp(\"&\"+InkUtilString._entities[i]+\";\", \"gm\");\n string = string.replace(re, InkUtilString._chars[i]);\n }\n string = string.replace(/&#[^;]+;?/g, function($0){\n if ($0.charAt(2) === 'x') {\n return String.fromCharCode(parseInt($0.substring(3), 16));\n }\n else {\n return String.fromCharCode(parseInt($0.substring(2), 10));\n }\n });\n }\n return string;\n },\n\n /**\n * Encode a string to UTF-8.\n *\n * @method utf8Encode\n * @param {String} string String to be encoded\n * @return {String} string UTF-8 encoded string\n * @public\n * @static\n */\n utf8Encode: function(string) {\n /*jshint bitwise:false*/\n string = string.replace(/\\r\\n/g,\"\\n\");\n var utfstring = \"\";\n\n for (var n = 0; n < string.length; n++) {\n\n var c = string.charCodeAt(n);\n\n if (c < 128) {\n utfstring += String.fromCharCode(c);\n }\n else if((c > 127) && (c < 2048)) {\n utfstring += String.fromCharCode((c >> 6) | 192);\n utfstring += String.fromCharCode((c & 63) | 128);\n }\n else {\n utfstring += String.fromCharCode((c >> 12) | 224);\n utfstring += String.fromCharCode(((c >> 6) & 63) | 128);\n utfstring += String.fromCharCode((c & 63) | 128);\n }\n\n }\n return utfstring;\n },\n\n /**\n * Truncates a string without breaking words.\n *\n * @method shortString\n * @param {String} str String to truncate\n * @param {Number} n Number of chars of the short string\n * @return {String} \n * @public\n * @static\n * @sample Ink_Util_String_shortString.html \n */\n shortString: function(str,n) {\n var words = str.split(' ');\n var resultstr = '';\n for(var i = 0; i < words.length; i++ ){\n if((resultstr + words[i] + ' ').length>=n){\n resultstr += '&hellip;';\n break;\n }\n resultstr += words[i] + ' ';\n }\n return resultstr;\n },\n\n /**\n * Truncates a string, breaking words and adding ... at the end.\n *\n * @method truncateString\n * @param {String} str String to truncate\n * @param {Number} length Limit for the returned string, ellipsis included.\n * @return {String} Truncated String\n * @public\n * @static\n * @sample Ink_Util_String_truncateString.html \n */\n truncateString: function(str, length) {\n if(str.length - 1 > length) {\n return str.substr(0, length - 1) + \"\\u2026\";\n } else {\n return str;\n }\n },\n\n /**\n * Decodes a string from UTF-8.\n *\n * @method utf8Decode\n * @param {String} string String to be decoded\n * @return {String} Decoded string\n * @public\n * @static\n */\n utf8Decode: function(utfstring) {\n /*jshint bitwise:false*/\n var string = \"\";\n var i = 0, c = 0, c2 = 0, c3 = 0;\n\n while ( i < utfstring.length ) {\n\n c = utfstring.charCodeAt(i);\n\n if (c < 128) {\n string += String.fromCharCode(c);\n i++;\n }\n else if((c > 191) && (c < 224)) {\n c2 = utfstring.charCodeAt(i+1);\n string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));\n i += 2;\n }\n else {\n c2 = utfstring.charCodeAt(i+1);\n c3 = utfstring.charCodeAt(i+2);\n string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));\n i += 3;\n }\n\n }\n return string;\n },\n\n /**\n * Removes all accented characters from a string.\n *\n * @method removeAccentedChars\n * @param {String} string String to remove accents from\n * @return {String} String without accented chars\n * @public\n * @static\n * @sample Ink_Util_String_removeAccentedChars.html \n */\n removeAccentedChars: function(string)\n {\n var newString = string;\n var re = false;\n for (var i = 0; i < InkUtilString._accentedChars.length; i++) {\n re = new RegExp(InkUtilString._accentedChars[i], \"gm\");\n newString = newString.replace(re, '' + InkUtilString._accentedRemovedChars[i] + '');\n }\n return newString;\n },\n\n /**\n * Count the number of occurrences of a specific needle in a haystack\n *\n * @method substrCount\n * @param {String} haystack String to search in\n * @param {String} needle String to search for\n * @return {Number} Number of occurrences\n * @public\n * @static\n * @sample Ink_Util_String_substrCount.html \n */\n substrCount: function(haystack,needle)\n {\n return haystack ? haystack.split(needle).length - 1 : 0;\n },\n\n /**\n * Eval a JSON - We recommend you Ink.Util.Json\n *\n * @method evalJSON\n * @param {String} strJSON JSON string to eval\n * @param {Boolean} sanitize Flag to sanitize input\n * @return {Object} JS Object\n * @public\n * @static\n */\n evalJSON: function(strJSON, sanitize) {\n /* jshint evil:true */\n if( (typeof sanitize === 'undefined' || sanitize === null) || InkUtilString.isJSON(strJSON)) {\n try {\n if(typeof(JSON) !== \"undefined\" && typeof(JSON.parse) !== 'undefined'){\n return JSON.parse(strJSON);\n }\n return eval('('+strJSON+')');\n } catch(e) {\n throw new Error('ERROR: Bad JSON string...');\n }\n }\n },\n\n /**\n * Checks if a string is a valid JSON object (string encoded)\n *\n * @method isJSON \n * @param {String} str String to check\n * @return {Boolean}\n * @public\n * @static\n */\n isJSON: function(str)\n {\n str = str.replace(/\\\\./g, '@').replace(/\"[^\"\\\\\\n\\r]*\"/g, '');\n return (/^[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]*$/).test(str);\n },\n\n /**\n * Escapes unsafe html chars as HTML entities\n *\n * @method htmlEscapeUnsafe\n * @param {String} str String to escape\n * @return {String} Escaped string\n * @public\n * @static\n * @sample Ink_Util_String_htmlEscapeUnsafe.html \n */\n htmlEscapeUnsafe: function(str){\n var chars = InkUtilString._htmlUnsafeChars;\n return str !== null ? String(str).replace(/[<>&'\"]/g,function(c){return chars[c];}) : str;\n },\n\n /**\n * Normalizes whitespace in string.\n * String is trimmed and sequences of whitespaces are collapsed.\n *\n * @method normalizeWhitespace\n * @param {String} str String to normalize\n * @return {String} Normalized string\n * @public\n * @static\n * @sample Ink_Util_String_normalizeWhitespace.html \n */\n normalizeWhitespace: function(str){\n return str !== null ? InkUtilString.trim(String(str).replace(/\\s+/g,' ')) : str;\n },\n\n /**\n * Converts string to unicode.\n *\n * @method toUnicode\n * @param {String} str String to convert\n * @return {String} Unicoded String\n * @public\n * @static\n * @sample Ink_Util_String_toUnicode.html \n */\n toUnicode: function(str) {\n if (typeof str === 'string') {\n var unicodeString = '';\n var inInt = false;\n var theUnicode = false;\n var total = str.length;\n var i=0;\n\n while(i < total)\n {\n inInt = str.charCodeAt(i);\n if( (inInt >= 32 && inInt <= 126) ||\n inInt === 8 ||\n inInt === 9 ||\n inInt === 10 ||\n inInt === 12 ||\n inInt === 13 ||\n inInt === 32 ||\n inInt === 34 ||\n inInt === 47 ||\n inInt === 58 ||\n inInt === 92) {\n\n /*\n if(inInt == 34 || inInt == 92 || inInt == 47) {\n theUnicode = '\\\\'+str.charAt(i);\n } else {\n }\n */\n if(inInt === 8) {\n theUnicode = '\\\\b';\n } else if(inInt === 9) {\n theUnicode = '\\\\t';\n } else if(inInt === 10) {\n theUnicode = '\\\\n';\n } else if(inInt === 12) {\n theUnicode = '\\\\f';\n } else if(inInt === 13) {\n theUnicode = '\\\\r';\n } else {\n theUnicode = str.charAt(i);\n }\n } else {\n theUnicode = str.charCodeAt(i).toString(16)+''.toUpperCase();\n while (theUnicode.length < 4) {\n theUnicode = '0' + theUnicode;\n }\n theUnicode = '\\\\u' + theUnicode;\n }\n unicodeString += theUnicode;\n\n i++;\n }\n return unicodeString;\n }\n },\n\n /**\n * Escapes a unicode character.\n *\n * @method escape\n * @param {String} c Character to escape\n * @return {String} Escaped character. Returns \\xXX if hex smaller than 0x100, otherwise \\uXXXX\n * @public\n * @static\n * @sample Ink_Util_String_escape.html \n */\n escape: function(c) {\n var hex = (c).charCodeAt(0).toString(16).split('');\n if (hex.length < 3) {\n while (hex.length < 2) { hex.unshift('0'); }\n hex.unshift('x');\n }\n else {\n while (hex.length < 4) { hex.unshift('0'); }\n hex.unshift('u');\n }\n\n hex.unshift('\\\\');\n return hex.join('');\n },\n\n /**\n * Unescapes a unicode character escape sequence\n *\n * @method unescape\n * @param {String} es Escape sequence\n * @return {String} String un-unicoded\n * @public\n * @static\n * @sample Ink_Util_String_unescape.html \n */\n unescape: function(es) {\n var idx = es.lastIndexOf('0');\n idx = idx === -1 ? 2 : Math.min(idx, 2);\n //console.log(idx);\n var hexNum = es.substring(idx);\n //console.log(hexNum);\n var num = parseInt(hexNum, 16);\n return String.fromCharCode(num);\n },\n\n /**\n * Escapes a string to unicode characters\n *\n * @method escapeText\n * @param {String} txt \n * @param {Array} [whiteList] Whitelist of characters\n * @return {String} String escaped to Unicode\n * @public\n * @static\n * @sample Ink_Util_String_escapeText.html \n */\n escapeText: function(txt, whiteList) {\n if (whiteList === undefined) {\n whiteList = ['[', ']', '\\'', ','];\n }\n var txt2 = [];\n var c, C;\n for (var i = 0, f = txt.length; i < f; ++i) {\n c = txt[i];\n C = c.charCodeAt(0);\n if (C < 32 || C > 126 && whiteList.indexOf(c) === -1) {\n c = InkUtilString.escape(c);\n }\n txt2.push(c);\n }\n return txt2.join('');\n },\n\n /**\n * Regex to check escaped strings\n *\n * @property escapedCharRegex\n * @type {Regex}\n * @public\n * @readOnly\n * @static\n */\n escapedCharRegex: /(\\\\x[0-9a-fA-F]{2})|(\\\\u[0-9a-fA-F]{4})/g,\n\n /**\n * Unescapes a string\n *\n * @method unescapeText\n * @param {String} txt\n * @return {String} Unescaped string\n * @public\n * @static\n * @sample Ink_Util_String_unescapeText.html \n */\n unescapeText: function(txt) {\n /*jshint boss:true */\n var m;\n while (m = InkUtilString.escapedCharRegex.exec(txt)) {\n m = m[0];\n txt = txt.replace(m, InkUtilString.unescape(m));\n InkUtilString.escapedCharRegex.lastIndex = 0;\n }\n return txt;\n },\n\n /**\n * Compares two strings.\n *\n * @method strcmp\n * @param {String} str1 First String\n * @param {String} str2 Second String\n * @return {Number}\n * @public\n * @static\n * @sample Ink_Util_String_strcmp.html \n */\n strcmp: function(str1, str2) {\n return ((str1 === str2) ? 0 : ((str1 > str2) ? 1 : -1));\n },\n\n /**\n * Splits a string into smaller chunks\n *\n * @method packetize\n * @param {String} str String to divide\n * @param {Number} maxLen Maximum chunk size (in characters)\n * @return {Array} Chunks of the original string\n * @public\n * @static\n * @sample Ink_Util_String_packetize.html \n */\n packetize: function(str, maxLen) {\n var len = str.length;\n var parts = new Array( Math.ceil(len / maxLen) );\n var chars = str.split('');\n var sz, i = 0;\n while (len) {\n sz = Math.min(maxLen, len);\n parts[i++] = chars.splice(0, sz).join('');\n len -= sz;\n }\n return parts;\n }\n };\n\n return InkUtilString;\n\n});\n","/**\n * URL Utilities\n * @module Ink.Util.Url_1\n * @version 1\n */\n\nInk.createModule('Ink.Util.Url', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.Url_1\n */\n var Url = {\n\n /**\n * Auxiliary string for encoding\n *\n * @property _keyStr\n * @type {String}\n * @readOnly\n * @private\n */\n _keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n\n\n /**\n * Gets URL of current page\n *\n * @method getUrl\n * @return Current URL\n * @public\n * @static\n * @sample Ink_Util_Url_getUrl.html \n */\n getUrl: function()\n {\n return window.location.href;\n },\n\n /**\n * Generates an URL string.\n *\n * @method genQueryString\n * @param {String} uri Base URL\n * @param {Object} params Object to transform to query string\n * @return {String} URI with query string set\n * @public\n * @static\n * @sample Ink_Util_Url_genQueryString.html \n */\n genQueryString: function(uri, params) {\n var hasQuestionMark = uri.indexOf('?') !== -1;\n var sep, pKey, pValue, parts = [uri];\n\n for (pKey in params) {\n if (params.hasOwnProperty(pKey)) {\n if (!hasQuestionMark) {\n sep = '?';\n hasQuestionMark = true;\n } else {\n sep = '&';\n }\n pValue = params[pKey];\n if (typeof pValue !== 'number' && !pValue) {\n pValue = '';\n }\n parts = parts.concat([sep, encodeURIComponent(pKey), '=', encodeURIComponent(pValue)]);\n }\n }\n\n return parts.join('');\n },\n\n /**\n * Gets an object from an URL encoded string.\n *\n * @method getQueryString\n * @param {String} [str] URL String. When not specified it uses the current URL.\n * @return {Object} Key-Value pair object\n * @public\n * @static\n * @sample Ink_Util_Url_getQueryString.html \n */\n getQueryString: function(str)\n {\n var url;\n if(str && typeof(str) !== 'undefined') {\n url = str;\n } else {\n url = this.getUrl();\n }\n var aParams = {};\n if(url.match(/\\?(.+)/i)) {\n var queryStr = url.replace(/^(.*)\\?([^\\#]+)(\\#(.*))?/g, \"$2\");\n if(queryStr.length > 0) {\n var aQueryStr = queryStr.split(/[;&]/);\n for(var i=0; i < aQueryStr.length; i++) {\n var pairVar = aQueryStr[i].split('=');\n aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false;\n }\n }\n }\n return aParams;\n },\n\n /**\n * Gets the URL hash value\n *\n * @method getAnchor\n * @param {String} [str] URL String. Defaults to current page URL.\n * @return {String|Boolean} Hash in the URL. If there's no hash, returns false.\n * @public\n * @static\n * @sample Ink_Util_Url_getAnchor.html \n */\n getAnchor: function(str)\n {\n var url;\n if(str && typeof(str) !== 'undefined') {\n url = str;\n } else {\n url = this.getUrl();\n }\n var anchor = false;\n if(url.match(/#(.+)/)) {\n anchor = url.replace(/([^#]+)#(.*)/, \"$2\");\n }\n return anchor;\n },\n\n /**\n * Gets the anchor string of an URL\n *\n * @method getAnchorString\n * @param {String} [string] URL to parse. Defaults to current URL.\n * @return {Object} Key-value pair object of the URL's hashtag 'variables'\n * @public\n * @static\n * @sample Ink_Util_Url_getAnchorString.html \n */\n getAnchorString: function(string)\n {\n var url;\n if(string && typeof(string) !== 'undefined') {\n url = string;\n } else {\n url = this.getUrl();\n }\n var aParams = {};\n if(url.match(/#(.+)/i)) {\n var anchorStr = url.replace(/^([^#]+)#(.*)?/g, \"$2\");\n if(anchorStr.length > 0) {\n var aAnchorStr = anchorStr.split(/[;&]/);\n for(var i=0; i < aAnchorStr.length; i++) {\n var pairVar = aAnchorStr[i].split('=');\n aParams[decodeURIComponent(pairVar[0])] = (typeof(pairVar[1]) !== 'undefined' && pairVar[1]) ? decodeURIComponent(pairVar[1]) : false;\n }\n }\n }\n return aParams;\n },\n\n\n /**\n * Parses URL string into URL parts\n *\n * @method parseUrl\n * @param {String} url URL to be parsed\n * @return {Object} Parsed URL as a key-value object.\n * @public\n * @static\n * @sample Ink_Util_Url_parseUrl.html \n */\n parseUrl: function(url) {\n var aURL = {};\n if(url && typeof url === 'string') {\n if(url.match(/^([^:]+):\\/\\//i)) {\n var re = /^([^:]+):\\/\\/([^\\/]*)\\/?([^\\?#]*)\\??([^#]*)#?(.*)/i;\n if(url.match(re)) {\n aURL.scheme = url.replace(re, \"$1\");\n aURL.host = url.replace(re, \"$2\");\n aURL.path = '/'+url.replace(re, \"$3\");\n aURL.query = url.replace(re, \"$4\") || false;\n aURL.fragment = url.replace(re, \"$5\") || false;\n }\n } else {\n var re1 = new RegExp(\"^([^\\\\?]+)\\\\?([^#]+)#(.*)\", \"i\");\n var re2 = new RegExp(\"^([^\\\\?]+)\\\\?([^#]+)#?\", \"i\");\n var re3 = new RegExp(\"^([^\\\\?]+)\\\\??\", \"i\");\n if(url.match(re1)) {\n aURL.scheme = false;\n aURL.host = false;\n aURL.path = url.replace(re1, \"$1\");\n aURL.query = url.replace(re1, \"$2\");\n aURL.fragment = url.replace(re1, \"$3\");\n } else if(url.match(re2)) {\n aURL.scheme = false;\n aURL.host = false;\n aURL.path = url.replace(re2, \"$1\");\n aURL.query = url.replace(re2, \"$2\");\n aURL.fragment = false;\n } else if(url.match(re3)) {\n aURL.scheme = false;\n aURL.host = false;\n aURL.path = url.replace(re3, \"$1\");\n aURL.query = false;\n aURL.fragment = false;\n }\n }\n if(aURL.host) {\n var regPort = /^(.*?)\\\\:(\\\\d+)$/i;\n // check for port\n if(aURL.host.match(regPort)) {\n var tmpHost1 = aURL.host;\n aURL.host = tmpHost1.replace(regPort, \"$1\");\n aURL.port = tmpHost1.replace(regPort, \"$2\");\n } else {\n aURL.port = false;\n }\n // check for user and pass\n if(aURL.host.match(/@/i)) {\n var tmpHost2 = aURL.host;\n aURL.host = tmpHost2.split('@')[1];\n var tmpUserPass = tmpHost2.split('@')[0];\n if(tmpUserPass.match(/\\:/)) {\n aURL.user = tmpUserPass.split(':')[0];\n aURL.pass = tmpUserPass.split(':')[1];\n } else {\n aURL.user = tmpUserPass;\n aURL.pass = false;\n }\n }\n }\n }\n return aURL;\n },\n\n /**\n * Formats an URL object into an URL string.\n *\n * @method format\n * @param urlObj Window.location, a.href, or parseUrl object to format\n * @return {String} Full URL.\n */\n format: function (urlObj) {\n var protocol = '';\n var host = '';\n var path = '';\n var frag = '';\n var query = '';\n\n if (typeof urlObj.protocol === 'string') {\n protocol = urlObj.protocol + '//'; // here it comes with the colon\n } else if (typeof urlObj.scheme === 'string') {\n protocol = urlObj.scheme + '://';\n }\n\n host = urlObj.host || urlObj.hostname || '';\n path = urlObj.path || '';\n\n if (typeof urlObj.query === 'string') {\n query = urlObj.query;\n } else if (typeof urlObj.search === 'string') {\n query = urlObj.search.replace(/^\\?/, '');\n }\n if (typeof urlObj.fragment === 'string') {\n frag = urlObj.fragment;\n } else if (typeof urlObj.hash === 'string') {\n frag = urlObj.hash.replace(/#$/, '');\n }\n\n return [\n protocol,\n host,\n path,\n query && '?' + query,\n frag && '#' + frag\n ].join('');\n },\n\n /**\n * Gets the last loaded script element\n *\n * @method currentScriptElement\n * @param {String} [match] String to match against the script src attribute\n * @return {DOMElement|Boolean} Returns the `script` DOM Element or false if unable to find it.\n * @public\n * @static\n * @sample Ink_Util_Url_currentScriptElement.html \n */\n currentScriptElement: function(match)\n {\n var aScripts = document.getElementsByTagName('script');\n if(typeof(match) === 'undefined') {\n if(aScripts.length > 0) {\n return aScripts[(aScripts.length - 1)];\n } else {\n return false;\n }\n } else {\n var curScript = false;\n var re = new RegExp(\"\"+match+\"\", \"i\");\n for(var i=0, total = aScripts.length; i < total; i++) {\n curScript = aScripts[i];\n if(re.test(curScript.src)) {\n return curScript;\n }\n }\n return false;\n }\n },\n\n \n /*\n base64Encode: function(string)\n {\n /**\n * --function {String} ?\n * --Convert a string to BASE 64\n * @param {String} string - string to convert\n * @return base64 encoded string\n *\n * \n if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') {\n throw \"SAPO.Utility.Url.base64Encode depends of SAPO.Utility.String, which has not been referred.\";\n }\n\n var output = \"\";\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n\n var input = SAPO.Utility.String.utf8Encode(string);\n\n while (i < input.length) {\n\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n\n enc1 = chr1 >> 2;\n enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);\n enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);\n enc4 = chr3 & 63;\n\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n\n output = output +\n this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +\n this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);\n }\n return output;\n },\n base64Decode: function(string)\n {\n * --function {String} ?\n * Decode a BASE 64 encoded string\n * --param {String} string base64 encoded string\n * --return string decoded\n if(!SAPO.Utility.String || typeof(SAPO.Utility.String) === 'undefined') {\n throw \"SAPO.Utility.Url.base64Decode depends of SAPO.Utility.String, which has not been referred.\";\n }\n\n var output = \"\";\n var chr1, chr2, chr3;\n var enc1, enc2, enc3, enc4;\n var i = 0;\n\n var input = string.replace(/[^A-Za-z0-9\\+\\/\\=]/g, \"\");\n\n while (i < input.length) {\n\n enc1 = this._keyStr.indexOf(input.charAt(i++));\n enc2 = this._keyStr.indexOf(input.charAt(i++));\n enc3 = this._keyStr.indexOf(input.charAt(i++));\n enc4 = this._keyStr.indexOf(input.charAt(i++));\n\n chr1 = (enc1 << 2) | (enc2 >> 4);\n chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);\n chr3 = ((enc3 & 3) << 6) | enc4;\n\n output = output + String.fromCharCode(chr1);\n\n if (enc3 !== 64) {\n output = output + String.fromCharCode(chr2);\n }\n if (enc4 !== 64) {\n output = output + String.fromCharCode(chr3);\n }\n }\n output = SAPO.Utility.String.utf8Decode(output);\n return output;\n },\n */\n\n\n /**\n * Debug function ?\n *\n * @method _debug\n * @private\n * @static\n */\n _debug: function() {}\n\n };\n\n return Url;\n\n});\n","/**\n * Validation Utilities\n * @module Ink.Util.Validator_1\n * @version 1\n */\n \nInk.createModule('Ink.Util.Validator', '1', [], function() {\n\n 'use strict';\n\n /**\n * @namespace Ink.Util.Validator_1 \n */\n var Validator = {\n\n /**\n * List of country codes avaible for the isPhone method\n *\n * @property _countryCodes\n * @type {Array}\n * @private\n * @static\n * @readOnly\n */\n _countryCodes : [\n 'AO',\n 'CV',\n 'MZ',\n 'PT'\n ],\n\n /**\n * International number for portugal\n *\n * @property _internacionalPT\n * @type {Number}\n * @private\n * @static\n * @readOnly\n *\n */\n _internacionalPT: 351,\n\n /**\n * List of all portuguese number prefixes\n *\n * @property _indicativosPT\n * @type {Object}\n * @private\n * @static\n * @readOnly\n *\n */\n _indicativosPT: {\n 21: 'lisboa',\n 22: 'porto',\n 231: 'mealhada',\n 232: 'viseu',\n 233: 'figueira da foz',\n 234: 'aveiro',\n 235: 'arganil',\n 236: 'pombal',\n 238: 'seia',\n 239: 'coimbra',\n 241: 'abrantes',\n 242: 'ponte de sôr',\n 243: 'santarém',\n 244: 'leiria',\n 245: 'portalegre',\n 249: 'torres novas',\n 251: 'valença',\n 252: 'vila nova de famalicão',\n 253: 'braga',\n 254: 'peso da régua',\n 255: 'penafiel',\n 256: 'são joão da madeira',\n 258: 'viana do castelo',\n 259: 'vila real',\n 261: 'torres vedras',\n 262: 'caldas da raínha',\n 263: 'vila franca de xira',\n 265: 'setúbal',\n 266: 'évora',\n 268: 'estremoz',\n 269: 'santiago do cacém',\n 271: 'guarda',\n 272: 'castelo branco',\n 273: 'bragança',\n 274: 'proença-a-nova',\n 275: 'covilhã',\n 276: 'chaves',\n 277: 'idanha-a-nova',\n 278: 'mirandela',\n 279: 'moncorvo',\n 281: 'tavira',\n 282: 'portimão',\n 283: 'odemira',\n 284: 'beja',\n 285: 'moura',\n 286: 'castro verde',\n 289: 'faro',\n 291: 'funchal, porto santo',\n 292: 'corvo, faial, flores, horta, pico',\n 295: 'angra do heroísmo, graciosa, são jorge, terceira',\n 296: 'ponta delgada, são miguel, santa maria',\n\n 91 : 'rede móvel 91 (Vodafone / Yorn)',\n 93 : 'rede móvel 93 (Optimus)',\n 96 : 'rede móvel 96 (TMN)',\n 92 : 'rede móvel 92 (TODOS)',\n //925 : 'rede móvel 925 (TMN 925)',\n //926 : 'rede móvel 926 (TMN 926)',\n //927 : 'rede móvel 927 (TMN 927)',\n //922 : 'rede móvel 922 (Phone-ix)',\n\n 707: 'número único',\n 760: 'número único',\n 800: 'número grátis',\n 808: 'chamada local',\n 30: 'voip'\n },\n /**\n * International number for Cabo Verde\n *\n * @property _internacionalCV\n * @type {Number}\n * @private\n * @static\n * @readOnly\n */\n _internacionalCV: 238,\n\n /**\n * List of all Cabo Verde number prefixes\n *\n * @property _indicativosCV\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _indicativosCV: {\n 2: 'fixo',\n 91: 'móvel 91',\n 95: 'móvel 95',\n 97: 'móvel 97',\n 98: 'móvel 98',\n 99: 'móvel 99'\n },\n /**\n * International number for Angola\n *\n * @property _internacionalAO\n * @type {Number}\n * @private\n * @static\n * @readOnly\n */\n _internacionalAO: 244,\n\n /**\n * List of all Angola number prefixes\n *\n * @property _indicativosAO\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _indicativosAO: {\n 2: 'fixo',\n 91: 'móvel 91',\n 92: 'móvel 92'\n },\n /**\n * International number for Mozambique\n *\n * @property _internacionalMZ\n * @type {Number}\n * @private\n * @static\n * @readOnly\n */\n _internacionalMZ: 258,\n\n /**\n * List of all Mozambique number prefixes\n *\n * @property _indicativosMZ\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _indicativosMZ: {\n 2: 'fixo',\n 82: 'móvel 82',\n 84: 'móvel 84'\n },\n\n /**\n * International number for Timor\n *\n * @property _internacionalTL\n * @type {Number}\n * @private\n * @static\n * @readOnly\n */\n _internacionalTL: 670,\n\n /**\n * List of all Timor number prefixes\n *\n * @property _indicativosTL\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _indicativosTL: {\n 3: 'fixo',\n 7: 'móvel 7'\n },\n\n /**\n * Regular expression groups for several groups of characters\n *\n * http://en.wikipedia.org/wiki/C0_Controls_and_Basic_Latin\n * http://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane\n * http://en.wikipedia.org/wiki/ISO_8859-1\n *\n * @property _characterGroups\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _characterGroups: {\n numbers: ['0-9'],\n asciiAlpha: ['a-zA-Z'],\n latin1Alpha: ['a-zA-Z', '\\u00C0-\\u00FF'],\n unicodeAlpha: ['a-zA-Z', '\\u00C0-\\u00FF', '\\u0100-\\u1FFF', '\\u2C00-\\uD7FF'],\n /* whitespace characters */\n space: [' '],\n dash: ['-'],\n underscore: ['_'],\n nicknamePunctuation: ['_.-'],\n\n singleLineWhitespace: ['\\t '],\n newline: ['\\n'],\n whitespace: ['\\t\\n\\u000B\\f\\r\\u00A0 '],\n\n asciiPunctuation: ['\\u0021-\\u002F', '\\u003A-\\u0040', '\\u005B-\\u0060', '\\u007B-\\u007E'],\n latin1Punctuation: ['\\u0021-\\u002F', '\\u003A-\\u0040', '\\u005B-\\u0060', '\\u007B-\\u007E', '\\u00A1-\\u00BF', '\\u00D7', '\\u00F7'],\n unicodePunctuation: ['\\u0021-\\u002F', '\\u003A-\\u0040', '\\u005B-\\u0060', '\\u007B-\\u007E', '\\u00A1-\\u00BF', '\\u00D7', '\\u00F7', '\\u2000-\\u206F', '\\u2E00-\\u2E7F', '\\u3000-\\u303F']\n },\n\n /**\n * Creates a regular expression for several character groups.\n *\n * @method createRegExp\n *\n * @param Groups* {Object}\n * Groups to build regular expressions for. Possible keys are:\n *\n * - **numbers**: 0-9\n * - **asciiAlpha**: a-z, A-Z\n * - **latin1Alpha**: asciiAlpha, plus printable characters in latin-1\n * - **unicodeAlpha**: unicode alphanumeric characters.\n * - **space**: ' ', the space character.\n * - **dash**: dash character.\n * - **underscore**: underscore character.\n * - **nicknamePunctuation**: dash, dot, underscore\n * - **singleLineWhitespace**: space and tab (whitespace which only spans one line).\n * - **newline**: newline character ('\\n')\n * - **whitespace**: whitespace characters in the ASCII character set.\n * - **asciiPunctuation**: punctuation characters in the ASCII character set.\n * - **latin1Punctuation**: punctuation characters in latin-1.\n * - **unicodePunctuation**: punctuation characters in unicode.\n *\n */\n createRegExp: function (groups) {\n var re = '^[';\n for (var key in groups) if (groups.hasOwnProperty(key)) {\n if (!(key in Validator._characterGroups)) {\n throw new Error('group ' + key + ' is not a valid character group');\n } else if (groups[key]) {\n re += Validator._characterGroups[key].join('');\n }\n }\n if (re === '^[') {\n // No changes\n return new RegExp('$^'); // match nothing\n }\n return new RegExp(re + ']*?$');\n },\n\n /**\n * Checks if a field has the required groups.\n *\n * @method checkCharacterGroups\n * @param {String} s The validation string\n * @param {Object} [groups]={} What groups are included. See createRegexp\n * @sample Ink_Util_Validator_checkCharacterGroups.html \n */\n checkCharacterGroups: function (s, groups) {\n return Validator.createRegExp(groups).test(s);\n },\n\n /**\n * Checks if a field contains unicode printable characters.\n *\n * @method unicode\n * @param {String} s The validation string\n * @param {Object} [options]={} Optional configuration object. See createRegexp\n */\n unicode: function (s, options) {\n return Validator.checkCharacterGroups(s, Ink.extendObj({\n unicodeAlpha: true}, options));\n },\n\n /**\n * Checks if a field only contains latin-1 alphanumeric characters. \n * Takes options for allowing singleline whitespace, cross-line whitespace and punctuation.\n *\n * @method latin1\n *\n * @param {String} s The validation string\n * @param {Object} [options]={} Optional configuration object. See createRegexp\n * @sample Ink_Util_Validator_latin1.html \n */\n latin1: function (s, options) {\n return Validator.checkCharacterGroups(s, Ink.extendObj({\n latin1Alpha: true}, options));\n },\n\n /**\n * Checks if a field only contains only ASCII alphanumeric characters. \n * Takes options for allowing singleline whitespace, cross-line whitespace and punctuation.\n *\n * @method ascii\n *\n * @param {String} s The validation string\n * @param {Object} [options]={} Optional configuration object. See createRegexp\n * @sample Ink_Util_Validator_ascii.html \n */\n ascii: function (s, options) {\n return Validator.checkCharacterGroups(s, Ink.extendObj({\n asciiAlpha: true}, options));\n },\n\n /**\n * Checks if a number is a valid\n *\n * @method number\n * @param {String} numb The number\n * @param {Object} [options] Further options\n * @param [options.decimalSep]='.' Allow decimal separator.\n * @param [options.thousandSep]=\",\" Strip this character from the number.\n * @param [options.negative]=false Allow negative numbers.\n * @param [options.decimalPlaces]=null Maximum number of decimal places. Use `0` for an integer number.\n * @param [options.max]=null Maximum number\n * @param [options.min]=null Minimum number\n * @param [options.returnNumber]=false When this option is true, return the number itself when the value is valid.\n * @sample Ink_Util_Validator_number.html \n */\n number: function (numb, inOptions) {\n numb = numb + '';\n var options = Ink.extendObj({\n decimalSep: '.',\n thousandSep: '',\n negative: true,\n decimalPlaces: null,\n maxDigits: null,\n max: null,\n min: null,\n returnNumber: false\n }, inOptions || {});\n // smart recursion thing sets up aliases for options.\n if (options.thousandSep) {\n numb = numb.replace(new RegExp('\\\\' + options.thousandSep, 'g'), '');\n options.thousandSep = '';\n return Validator.number(numb, options);\n }\n if (options.negative === false) {\n options.min = 0;\n options.negative = true;\n return Validator.number(numb, options);\n }\n if (options.decimalSep !== '.') {\n numb = numb.replace(new RegExp('\\\\' + options.decimalSep, 'g'), '.');\n }\n\n if (!/^(-)?(\\d+)?(\\.\\d+)?$/.test(numb) || numb === '') {\n return false; // forbidden character found\n }\n \n var split;\n if (options.decimalSep && numb.indexOf(options.decimalSep) !== -1) {\n split = numb.split(options.decimalSep);\n if (options.decimalPlaces !== null &&\n split[1].length > options.decimalPlaces) {\n return false;\n }\n } else {\n split = ['' + numb, ''];\n }\n \n if (options.maxDigits!== null) {\n if (split[0].replace(/-/g, '').length > options.maxDigits) {\n return split;\n }\n }\n \n // Now look at the actual float\n var ret = parseFloat(numb);\n \n if (options.maxExcl !== null && ret >= options.maxExcl ||\n options.minExcl !== null && ret <= options.minExcl) {\n return false;\n }\n if (options.max !== null && ret > options.max ||\n options.min !== null && ret < options.min) {\n return false;\n }\n \n if (options.returnNumber) {\n return ret;\n } else {\n return true;\n }\n },\n\n /**\n * Checks if a year is Leap \"Bissexto\"\n *\n * @method _isLeapYear\n * @param {Number} year Year to be checked\n * @return {Boolean} True if it is a leap year.\n * @private\n * @static\n * @example\n * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){\n * console.log( InkValidator._isLeapYear( 2004 ) ); // Result: true\n * console.log( InkValidator._isLeapYear( 2006 ) ); // Result: false\n * });\n */\n _isLeapYear: function(year){\n\n var yearRegExp = /^\\d{4}$/;\n\n if(yearRegExp.test(year)){\n return ((year%4) ? false: ((year%100) ? true : ((year%400)? false : true)) );\n }\n\n return false;\n },\n\n /**\n * Object with the date formats available for validation\n *\n * @property _dateParsers\n * @type {Object}\n * @private\n * @static\n * @readOnly\n */\n _dateParsers: {\n 'yyyy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\\d{4})(\\-)(\\d{1,2})(\\-)(\\d{1,2})$/},\n 'yyyy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\\d{4})(\\/)(\\d{1,2})(\\/)(\\d{1,2})$/},\n 'yy-mm-dd': {day:5, month:3, year:1, sep: '-', parser: /^(\\d{2})(\\-)(\\d{1,2})(\\-)(\\d{1,2})$/},\n 'yy/mm/dd': {day:5, month:3, year:1, sep: '/', parser: /^(\\d{2})(\\/)(\\d{1,2})(\\/)(\\d{1,2})$/},\n 'dd-mm-yyyy': {day:1, month:3, year:5, sep: '-', parser: /^(\\d{1,2})(\\-)(\\d{1,2})(\\-)(\\d{4})$/},\n 'dd/mm/yyyy': {day:1, month:3, year:5, sep: '/', parser: /^(\\d{1,2})(\\/)(\\d{1,2})(\\/)(\\d{4})$/},\n 'dd-mm-yy': {day:1, month:3, year:5, sep: '-', parser: /^(\\d{1,2})(\\-)(\\d{1,2})(\\-)(\\d{2})$/},\n 'dd/mm/yy': {day:1, month:3, year:5, sep: '/', parser: /^(\\d{1,2})(\\/)(\\d{1,2})(\\/)(\\d{2})$/}\n },\n\n /**\n * Gets the number of days in a given month of a given year\n *\n * @method _daysInMonth\n * @param {Number} _m Month (1 to 12)\n * @param {Number} _y Year\n * @return {Number} Returns the number of days in a given month of a given year\n * @private\n * @static\n * @example\n * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){\n * console.log( InkValidator._daysInMonth( 2, 2004 ) ); // Result: 29\n * console.log( InkValidator._daysInMonth( 2, 2006 ) ); // Result: 28\n * });\n */\n _daysInMonth: function(_m,_y){\n var nDays=0;\n\n _m = parseInt(_m, 10);\n _y = parseInt(_y, 10);\n\n if(_m===1 || _m===3 || _m===5 || _m===7 || _m===8 || _m===10 || _m===12) {\n nDays= 31;\n } else if ( _m===4 || _m===6 || _m===9 || _m===11) {\n nDays = 30;\n } else if (_m===2) {\n if((_y%400===0) || (_y%4===0 && _y%100!==0)) {\n nDays = 29;\n } else {\n nDays = 28;\n }\n }\n\n return nDays;\n },\n\n\n\n /**\n * Checks if a date is valid\n *\n * @method _isValidDate\n * @param {Number} year\n * @param {Number} month\n * @param {Number} day\n * @return {Boolean} True if valid\n * @private\n * @static\n * @example\n * Ink.requireModules(['Ink.Util.Validator_1'], function( InkValidator ){\n * console.log( InkValidator._isValidDate( 2004, 2, 29 ) ); // Result: true\n * console.log( InkValidator._isValidDate( 2006, 2, 29 ) ); // Result: false\n * });\n */\n _isValidDate: function(year, month, day){\n\n var yearRegExp = /^\\d{4}$/;\n var validOneOrTwo = /^\\d{1,2}$/;\n if(yearRegExp.test(year) && validOneOrTwo.test(month) && validOneOrTwo.test(day)){\n if(month>=1 && month<=12 && day>=1 && this._daysInMonth(month,year)>=day){\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Checks if an email is valid\n *\n * @method mail\n * @param {String} email\n * @return {Boolean} True if it's valid\n * @public\n * @static\n * @sample Ink_Util_Validator_mail.html \n */\n email: function(email)\n {\n var emailValido = new RegExp(\"^[_a-z0-9-]+((\\\\.|\\\\+)[_a-z0-9-]+)*@([\\\\w]*-?[\\\\w]*\\\\.)+[a-z]{2,4}$\", \"i\");\n if(!emailValido.test(email)) {\n return false;\n } else {\n return true;\n }\n },\n\n /**\n * Deprecated. Alias for email(). Use it instead.\n *\n * @method mail\n * @public\n * @static\n * @private\n */\n mail: function (mail) { return Validator.email(mail); },\n\n /**\n * Checks if an url is valid\n *\n * @method url\n * @param {String} url URL to be checked\n * @param {Boolean} [full] If true, validates a full URL (one that should start with 'http')\n * @return {Boolean} True if valid\n * @public\n * @static\n * @sample Ink_Util_Validator_url.html \n */\n url: function(url, full)\n {\n if(typeof full === \"undefined\" || full === false) {\n var reHTTP = new RegExp(\"(^(http\\\\:\\\\/\\\\/|https\\\\:\\\\/\\\\/)(.+))\", \"i\");\n if(reHTTP.test(url) === false) {\n url = 'http://'+url;\n }\n }\n\n var reUrl = new RegExp(\"^(http:\\\\/\\\\/|https:\\\\/\\\\/)([\\\\w]*(-?[\\\\w]*)*\\\\.)+[a-z]{2,4}\", \"i\");\n if(reUrl.test(url) === false) {\n return false;\n } else {\n return true;\n }\n },\n\n /**\n * Checks if a phone is valid in Portugal\n *\n * @method isPTPhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid Portuguese Phone\n * @public\n * @static\n * @sample Ink_Util_Validator_isPTPhone.html\n */\n isPTPhone: function(phone)\n {\n\n phone = phone.toString();\n var aInd = [];\n for(var i in this._indicativosPT) {\n if(typeof(this._indicativosPT[i]) === 'string') {\n aInd.push(i);\n }\n }\n var strInd = aInd.join('|');\n\n var re351 = /^(00351|\\+351)/;\n if(re351.test(phone)) {\n phone = phone.replace(re351, \"\");\n }\n\n var reSpecialChars = /(\\s|\\-|\\.)+/g;\n phone = phone.replace(reSpecialChars, '');\n //var reInt = new RegExp(\"\\\\d\", \"i\");\n var reInt = /[\\d]{9}/i;\n if(phone.length === 9 && reInt.test(phone)) {\n var reValid = new RegExp(\"^(\"+strInd+\")\");\n if(reValid.test(phone)) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Alias function for isPTPhone\n *\n * @method isPortuguesePhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid Portuguese Phone\n * @public\n * @static\n */\n isPortuguesePhone: function(phone)\n {\n return this.isPTPhone(phone);\n },\n\n /**\n * Checks if a phone is valid in Cabo Verde\n *\n * @method isCVPhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid Cape Verdean Phone\n * @public\n * @static\n * @sample Ink_Util_Validator_isCVPhone.html \n */\n isCVPhone: function(phone)\n {\n phone = phone.toString();\n var aInd = [];\n for(var i in this._indicativosCV) {\n if(typeof(this._indicativosCV[i]) === 'string') {\n aInd.push(i);\n }\n }\n var strInd = aInd.join('|');\n\n var re238 = /^(00238|\\+238)/;\n if(re238.test(phone)) {\n phone = phone.replace(re238, \"\");\n }\n\n var reSpecialChars = /(\\s|\\-|\\.)+/g;\n phone = phone.replace(reSpecialChars, '');\n //var reInt = new RegExp(\"\\\\d\", \"i\");\n var reInt = /[\\d]{7}/i;\n if(phone.length === 7 && reInt.test(phone)) {\n var reValid = new RegExp(\"^(\"+strInd+\")\");\n if(reValid.test(phone)) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Checks if a phone is valid in Angola\n *\n * @method isAOPhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid Angolan Phone\n * @public\n * @static\n * @sample Ink_Util_Validator_isAOPhone.html \n */\n isAOPhone: function(phone)\n {\n\n phone = phone.toString();\n var aInd = [];\n for(var i in this._indicativosAO) {\n if(typeof(this._indicativosAO[i]) === 'string') {\n aInd.push(i);\n }\n }\n var strInd = aInd.join('|');\n\n var re244 = /^(00244|\\+244)/;\n if(re244.test(phone)) {\n phone = phone.replace(re244, \"\");\n }\n\n var reSpecialChars = /(\\s|\\-|\\.)+/g;\n phone = phone.replace(reSpecialChars, '');\n //var reInt = new RegExp(\"\\\\d\", \"i\");\n var reInt = /[\\d]{9}/i;\n if(phone.length === 9 && reInt.test(phone)) {\n var reValid = new RegExp(\"^(\"+strInd+\")\");\n if(reValid.test(phone)) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Checks if a phone is valid in Mozambique\n *\n * @method isMZPhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid Mozambican Phone\n * @public\n * @static\n * @sample Ink_Util_Validator_isMZPhone.html \n */\n isMZPhone: function(phone)\n {\n\n phone = phone.toString();\n var aInd = [];\n for(var i in this._indicativosMZ) {\n if(typeof(this._indicativosMZ[i]) === 'string') {\n aInd.push(i);\n }\n }\n var strInd = aInd.join('|');\n var re258 = /^(00258|\\+258)/;\n if(re258.test(phone)) {\n phone = phone.replace(re258, \"\");\n }\n\n var reSpecialChars = /(\\s|\\-|\\.)+/g;\n phone = phone.replace(reSpecialChars, '');\n //var reInt = new RegExp(\"\\\\d\", \"i\");\n var reInt = /[\\d]{8,9}/i;\n if((phone.length === 9 || phone.length === 8) && reInt.test(phone)) {\n var reValid = new RegExp(\"^(\"+strInd+\")\");\n if(reValid.test(phone)) {\n if(phone.indexOf('2') === 0 && phone.length === 8) {\n return true;\n } else if(phone.indexOf('8') === 0 && phone.length === 9) {\n return true;\n }\n }\n }\n\n return false;\n },\n\n /**\n * Checks if a phone is valid in Timor\n *\n * @method isTLPhone\n * @param {Number} phone Phone number to be checked\n * @return {Boolean} True if it's a valid phone from Timor-Leste\n * @public\n * @static\n * @sample Ink_Util_Validator_isTLPhone.html \n */\n isTLPhone: function(phone)\n {\n\n phone = phone.toString();\n var aInd = [];\n for(var i in this._indicativosTL) {\n if(typeof(this._indicativosTL[i]) === 'string') {\n aInd.push(i);\n }\n }\n var strInd = aInd.join('|');\n var re670 = /^(00670|\\+670)/;\n if(re670.test(phone)) {\n phone = phone.replace(re670, \"\");\n }\n\n\n var reSpecialChars = /(\\s|\\-|\\.)+/g;\n phone = phone.replace(reSpecialChars, '');\n //var reInt = new RegExp(\"\\\\d\", \"i\");\n var reInt = /[\\d]{7}/i;\n if(phone.length === 7 && reInt.test(phone)) {\n var reValid = new RegExp(\"^(\"+strInd+\")\");\n if(reValid.test(phone)) {\n return true;\n }\n }\n\n return false;\n },\n\n /**\n * Checks if a number is a phone number.\n * This method validates the number in all country codes available the ones set in the second param\n *\n * @method isPhone\n * @param {String} phone Phone number to validate\n * @param {String|Array} [countryCode] Country code or array of countries to validate\n * @return {Boolean} True if it's a valid phone in any country available\n * @public\n * @static\n * @sample Ink_Util_Validator_isPhone.html\n */\n isPhone: function(){\n var index;\n\n if(arguments.length===0){\n return false;\n }\n\n var phone = arguments[0];\n\n if(arguments.length>1){\n if(arguments[1].constructor === Array){\n var func;\n for(index=0; index<arguments[1].length; index++ ){\n if(typeof(func=this['is' + arguments[1][index].toUpperCase() + 'Phone'])==='function'){\n if(func(phone)){\n return true;\n }\n } else {\n throw \"Invalid Country Code!\";\n }\n }\n } else if(typeof(this['is' + arguments[1].toUpperCase() + 'Phone'])==='function'){\n return this['is' + arguments[1].toUpperCase() + 'Phone'](phone);\n } else {\n throw \"Invalid Country Code!\";\n }\n } else {\n for(index=0; index<this._countryCodes.length; index++){\n if(this['is' + this._countryCodes[index] + 'Phone'](phone)){\n return true;\n }\n }\n }\n return false;\n },\n\n /**\n * Validates if a zip code is valid in Portugal\n *\n * @method codPostal\n * @param {Number|String} cp1\n * @param {optional Number|String} cp2\n * @param {optional Boolean} returnBothResults\n * @return {Boolean} True if it's a valid zip code\n * @public\n * @static\n * @sample Ink_Util_Validator_codPostal.html \n */\n codPostal: function(cp1,cp2,returnBothResults){\n\n\n var cPostalSep = /^(\\s*\\-\\s*|\\s+)$/;\n var trim = /^\\s+|\\s+$/g;\n var cPostal4 = /^[1-9]\\d{3}$/;\n var cPostal3 = /^\\d{3}$/;\n var parserCPostal = /^(.{4})(.*)(.{3})$/;\n\n\n returnBothResults = !!returnBothResults;\n\n cp1 = cp1.replace(trim,'');\n if(typeof(cp2)!=='undefined'){\n cp2 = cp2.replace(trim,'');\n if(cPostal4.test(cp1) && cPostal3.test(cp2)){\n if( returnBothResults === true ){\n return [true, true];\n } else {\n return true;\n }\n }\n } else {\n if(cPostal4.test(cp1) ){\n if( returnBothResults === true ){\n return [true,false];\n } else {\n return true;\n }\n }\n\n var cPostal = cp1.match(parserCPostal);\n\n if(cPostal!==null && cPostal4.test(cPostal[1]) && cPostalSep.test(cPostal[2]) && cPostal3.test(cPostal[3])){\n if( returnBothResults === true ){\n return [true,false];\n } else {\n return true;\n }\n }\n }\n\n if( returnBothResults === true ){\n return [false,false];\n } else {\n return false;\n }\n },\n\n /**\n * Checks if a date is valid in a given format\n *\n * @method isDate\n * @param {String} format Format defined in _dateParsers\n * @param {String} dateStr Date string\n * @return {Boolean} True if it's a valid date and in the specified format\n * @public\n * @static\n * @sample Ink_Util_Validator_isDate.html \n */\n isDate: function(format, dateStr){\n\n\n\n if(typeof(this._dateParsers[format])==='undefined'){\n return false;\n }\n var yearIndex = this._dateParsers[format].year;\n var monthIndex = this._dateParsers[format].month;\n var dayIndex = this._dateParsers[format].day;\n var dateParser = this._dateParsers[format].parser;\n var separator = this._dateParsers[format].sep;\n\n /* Trim Deactivated\n * var trim = /^\\w+|\\w+$/g;\n * dateStr = dateStr.replace(trim,\"\");\n */\n var data = dateStr.match(dateParser);\n if(data!==null){\n /* Trim Deactivated\n * for(i=1;i<=data.length;i++){\n * data[i] = data[i].replace(trim,\"\");\n *}\n */\n if(data[2]===data[4] && data[2]===separator){\n\n var _y = ((data[yearIndex].length===2) ? \"20\" + data[yearIndex].toString() : data[yearIndex] );\n\n if(this._isValidDate(_y,data[monthIndex].toString(),data[dayIndex].toString())){\n return true;\n }\n }\n }\n\n\n return false;\n },\n\n /**\n * Checks if a string is a valid color\n *\n * @method isColor\n * @param {String} str Color string to be checked\n * @return {Boolean} True if it's a valid color string\n * @public\n * @static\n * @sample Ink_Util_Validator_isColor.html \n */\n isColor: function(str){\n var match, valid = false,\n keyword = /^[a-zA-Z]+$/,\n hexa = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,\n rgb = /^rgb\\(\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*\\)$/,\n rgba = /^rgba\\(\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*(1(\\.0)?|0(\\.[0-9])?)\\s*\\)$/,\n hsl = /^hsl\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*\\)$/,\n hsla = /^hsla\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*([0-9]{1,3})(%)?\\s*,\\s*(1(\\.0)?|0(\\.[0-9])?)\\s*\\)$/;\n\n // rgb(123, 123, 132) 0 to 255\n // rgb(123%, 123%, 123%) 0 to 100\n // rgba( 4 vals) last val: 0 to 1.0\n // hsl(0 to 360, %, %)\n // hsla( ..., 0 to 1.0)\n\n if(\n keyword.test(str) ||\n hexa.test(str)\n ){\n return true;\n }\n\n var i;\n\n // rgb range check\n if((match = rgb.exec(str)) !== null || (match = rgba.exec(str)) !== null){\n i = match.length;\n\n while(i--){\n // check percentage values\n if((i===2 || i===4 || i===6) && typeof match[i] !== \"undefined\" && match[i] !== \"\"){\n if(typeof match[i-1] !== \"undefined\" && match[i-1] >= 0 && match[i-1] <= 100){\n valid = true;\n } else {\n return false;\n }\n }\n // check 0 to 255 values\n if(i===1 || i===3 || i===5 && (typeof match[i+1] === \"undefined\" || match[i+1] === \"\")){\n if(typeof match[i] !== \"undefined\" && match[i] >= 0 && match[i] <= 255){\n valid = true;\n } else {\n return false;\n }\n }\n }\n }\n\n // hsl range check\n if((match = hsl.exec(str)) !== null || (match = hsla.exec(str)) !== null){\n i = match.length;\n while(i--){\n // check percentage values\n if(i===3 || i===5){\n if(typeof match[i-1] !== \"undefined\" && typeof match[i] !== \"undefined\" && match[i] !== \"\" &&\n match[i-1] >= 0 && match[i-1] <= 100){\n valid = true;\n } else {\n return false;\n }\n }\n // check 0 to 360 value\n if(i===1){\n if(typeof match[i] !== \"undefined\" && match[i] >= 0 && match[i] <= 360){\n valid = true;\n } else {\n return false;\n }\n }\n }\n }\n\n return valid;\n },\n\n /**\n * Checks if the value is a valid IP. \n *\n * @method isIP\n * @param {String} value Value to be checked\n * @param {String} ipType Type of IP to be validated. The values are: ipv4, ipv6. By default is ipv4.\n * @return {Boolean} True if the value is a valid IP address. False if not.\n * @sample Ink_Util_Validator_isIP.html \n */\n isIP: function( value, ipType ){\n if( typeof value !== 'string' ){\n return false;\n }\n\n ipType = (ipType || 'ipv4').toLowerCase();\n\n switch( ipType ){\n case 'ipv4':\n return (/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/).test(value);\n case 'ipv6':\n return (/^\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]?\\d)){3}))|:)))(%.+)?\\s*$/).test(value);\n default:\n return false;\n }\n },\n\n /**\n * Credit Card specifications, to be used in the credit card verification.\n *\n * @property _creditCardSpecs\n * @type {Object}\n * @private\n */\n _creditCardSpecs: {\n 'default': {\n 'length': '13,14,15,16,17,18,19',\n 'prefix': /^.+/,\n 'luhn': true\n },\n\n 'american express': {\n 'length': '15',\n 'prefix': /^3[47]/,\n 'luhn' : true\n },\n\n 'diners club': {\n 'length': '14,16',\n 'prefix': /^36|55|30[0-5]/,\n 'luhn' : true\n },\n\n 'discover': {\n 'length': '16',\n 'prefix': /^6(?:5|011)/,\n 'luhn' : true\n },\n\n 'jcb': {\n 'length': '15,16',\n 'prefix': /^3|1800|2131/,\n 'luhn' : true\n },\n\n 'maestro': {\n 'length': '16,18',\n 'prefix': /^50(?:20|38)|6(?:304|759)/,\n 'luhn' : true\n },\n\n 'mastercard': {\n 'length': '16',\n 'prefix': /^5[1-5]/,\n 'luhn' : true\n },\n\n 'visa': {\n 'length': '13,16',\n 'prefix': /^4/,\n 'luhn' : true\n }\n },\n\n /**\n * Luhn function, to be used when validating credit cards\n *\n */\n _luhn: function (num){\n\n num = parseInt(num,10);\n\n if ( (typeof num !== 'number') && (num % 1 !== 0) ){\n // Luhn can only be used on nums!\n return false;\n }\n\n num = num+'';\n // Check num length\n var length = num.length;\n\n // Checksum of the card num\n var\n i, checksum = 0\n ;\n\n for (i = length - 1; i >= 0; i -= 2)\n {\n // Add up every 2nd digit, starting from the right\n checksum += parseInt(num.substr(i, 1),10);\n }\n\n for (i = length - 2; i >= 0; i -= 2)\n {\n // Add up every 2nd digit doubled, starting from the right\n var dbl = parseInt(num.substr(i, 1) * 2,10);\n\n // Subtract 9 from the dbl where value is greater than 10\n checksum += (dbl >= 10) ? (dbl - 9) : dbl;\n }\n\n // If the checksum is a multiple of 10, the number is valid\n return (checksum % 10 === 0);\n },\n\n /**\n * Checks if a number is of a specific credit card type\n * @method isCreditCard\n * @param {String} num Number to be validates\n * @param {String|Array} creditCardType Credit card type. See _creditCardSpecs for the list of supported values.\n * @return {Boolean}\n * @sample Ink_Util_Validator_isCreditCard.html \n */\n isCreditCard: function(num, creditCardType){\n\n if ( /\\d+/.test(num) === false ){\n return false;\n }\n\n if ( typeof creditCardType === 'undefined' ){\n creditCardType = 'default';\n }\n else if ( creditCardType instanceof Array ){\n var i, ccLength = creditCardType.length;\n for ( i=0; i < ccLength; i++ ){\n // Test each type for validity\n if (this.isCreditCard(num, creditCardType[i]) ){\n return true;\n }\n }\n\n return false;\n }\n\n // Check card type\n creditCardType = creditCardType.toLowerCase();\n\n if ( typeof this._creditCardSpecs[creditCardType] === 'undefined' ){\n return false;\n }\n\n // Check card number length\n var length = num.length+'';\n\n // Validate the card length by the card type\n if ( this._creditCardSpecs[creditCardType]['length'].split(\",\").indexOf(length) === -1 ){\n return false;\n }\n\n // Check card number prefix\n if ( !this._creditCardSpecs[creditCardType]['prefix'].test(num) ){\n return false;\n }\n\n // No Luhn check required\n if (this._creditCardSpecs[creditCardType]['luhn'] === false){\n return true;\n }\n\n return this._luhn(num);\n }\n };\n\n return Validator;\n\n});\n"]}