YUI.add("aui-base-lang",function(A,NAME){(function(){var Lang=A.Lang,aArray=A.Array,AObject=A.Object,isArray=Lang.isArray,isNumber=Lang.isNumber,isString=Lang.isString,isUndefined=Lang.isUndefined,owns=AObject.owns;A.fn=function(fn,context,args){var wrappedFn,dynamicLookup;if(!isNumber(fn)){var xargs=arguments;if(xargs.length>2)xargs=aArray(xargs,2,true);dynamicLookup=isString(fn)&&context;wrappedFn=function(){var method=!dynamicLookup?fn:context[fn];return method.apply(context||fn,xargs)}}else{var argLength= fn;fn=context;context=args;dynamicLookup=isString(fn)&&context;wrappedFn=function(){var method=!dynamicLookup?fn:context[fn],returnValue;context=context||method;if(argLength>0)returnValue=method.apply(context,aArray(arguments,0,true).slice(0,argLength));else returnValue=method.call(context);return returnValue}}return wrappedFn};A.mix(Lang,{constrain:function(num,min,max){return Math.min(Math.max(num,min),max)},emptyFn:function(){},emptyFnFalse:function(){return false},emptyFnTrue:function(){return true}, isGuid:function(id){return String(id).indexOf(A.Env._guidp)===0},isInteger:function(val){return typeof val==="number"&&isFinite(val)&&val>-9007199254740992&&val<9007199254740992&&Math.floor(val)===val},isNode:function(val){return A.instanceOf(val,A.Node)},isNodeList:function(val){return A.instanceOf(val,A.NodeList)},toFloat:function(value,defaultValue){return parseFloat(value)||defaultValue||0},toInt:function(value,radix,defaultValue){return parseInt(value,radix||10)||defaultValue||0}});A.mix(aArray, {remove:function(a,from,to){var rest=a.slice((to||from)+1||a.length);a.length=from<0?a.length+from:from;return a.push.apply(a,rest)},removeItem:function(a,item){var index=aArray.indexOf(a,item);if(index>-1)return aArray.remove(a,index);return a}});var LString=A.namespace("Lang.String"),DOC=A.config.doc,REGEX_DASH=/-([a-z])/gi,REGEX_ESCAPE_REGEX=/([.*+?^$(){}|[\]\/\\])/g,REGEX_NL2BR=/\r?\n/g,REGEX_STRIP_SCRIPTS=/(?:)((\n|\r|.)*?)(?:<\/script>)/gi,REGEX_STRIP_TAGS=/<\/?[^>]+>/gi,REGEX_UNCAMELIZE= /([a-zA-Z][a-zA-Z])([A-Z])([a-z])/g,REGEX_UNCAMELIZE_REPLACE_SEPARATOR=/([a-z])([A-Z])/g,STR_ELLIPSIS="...",htmlUnescapedValues=[],MAP_HTML_CHARS_ESCAPED={"\x26":"\x26amp;","\x3c":"\x26lt;","\x3e":"\x26gt;",'"':"\x26#034;","'":"\x26#039;","/":"\x26#047;","`":"\x26#096;"},htmlChar,MAP_HTML_CHARS_UNESCAPED={};for(htmlChar in MAP_HTML_CHARS_ESCAPED)if(MAP_HTML_CHARS_ESCAPED.hasOwnProperty(htmlChar)){var escapedValue=MAP_HTML_CHARS_ESCAPED[htmlChar];MAP_HTML_CHARS_UNESCAPED[escapedValue]=htmlChar;htmlUnescapedValues.push(htmlChar)}var REGEX_HTML_ESCAPE= new RegExp("["+htmlUnescapedValues.join("")+"]","g"),REGEX_HTML_UNESCAPE=/&([^;]+);/g;A.mix(LString,{camelize:A.cached(function(str,separator){var regex=REGEX_DASH;str=String(str);if(separator)regex=new RegExp(separator+"([a-z])","gi");return str.replace(regex,LString._camelize)}),capitalize:A.cached(function(str){if(str){str=String(str);str=str.charAt(0).toUpperCase()+str.substr(1).toLowerCase()}return str}),contains:function(str,searchString){return str.indexOf(searchString)!==-1},defaultValue:function(str, defaultValue){if(isUndefined(str)||str===""){if(isUndefined(defaultValue))defaultValue="";str=defaultValue}return str},endsWith:function(str,suffix){var length=str.length-suffix.length;return length>=0&&str.indexOf(suffix,length)===length},escapeHTML:function(str){return str.replace(REGEX_HTML_ESCAPE,LString._escapeHTML)},escapeRegEx:function(str){return str.replace(REGEX_ESCAPE_REGEX,"\\$1")},nl2br:function(str){return String(str).replace(REGEX_NL2BR,"\x3cbr /\x3e")},padNumber:function(num,length, precision){var str=precision?Number(num).toFixed(precision):String(num);var index=str.indexOf(".");if(index===-1)index=str.length;return LString.repeat("0",Math.max(0,length-index))+str},pluralize:function(count,singularVersion,pluralVersion){var suffix;if(count===1)suffix=singularVersion;else suffix=pluralVersion||singularVersion+"s";return count+" "+suffix},prefix:function(prefix,str){str=String(str);if(str.indexOf(prefix)!==0)str=prefix+str;return str},remove:function(str,substitute,all){var re= new RegExp(LString.escapeRegEx(substitute),all?"g":"");return str.replace(re,"")},removeAll:function(str,substitute){return LString.remove(str,substitute,true)},repeat:function(str,length){return(new Array(length+1)).join(str)},round:function(value,precision){value=Number(value);if(isNumber(precision)){precision=Math.pow(10,precision);value=Math.round(value*precision)/precision}return value},startsWith:function(str,prefix){return str.lastIndexOf(prefix,0)===0},stripScripts:function(str){if(str)str= String(str).replace(REGEX_STRIP_SCRIPTS,"");return str},stripTags:function(str){if(str)str=String(str).replace(REGEX_STRIP_TAGS,"");return str},substr:function(str,start,length){return String(str).substr(start,length)},uncamelize:A.cached(function(str,separator){separator=separator||" ";str=String(str);str=str.replace(REGEX_UNCAMELIZE,"$1"+separator+"$2$3");str=str.replace(REGEX_UNCAMELIZE_REPLACE_SEPARATOR,"$1"+separator+"$2");return str}),toLowerCase:function(str){return String(str).toLowerCase()}, toUpperCase:function(str){return String(str).toUpperCase()},trim:Lang.trim,truncate:function(str,length,where){str=String(str);var ellipsisLength=STR_ELLIPSIS.length,strLength=str.length;if(length>3){if(str&&strLength>length){where=where||"end";if(where==="end")str=str.substr(0,length-ellipsisLength)+STR_ELLIPSIS;else if(where==="middle"){var middlePointA=Math.floor((length-ellipsisLength)/2),middlePointB=middlePointA;if(length%2===0){middlePointA=Math.ceil((length-ellipsisLength)/2);middlePointB= Math.floor((length-ellipsisLength)/2)}str=str.substr(0,middlePointA)+STR_ELLIPSIS+str.substr(strLength-middlePointB)}else if(where==="start")str=STR_ELLIPSIS+str.substr(strLength-length+ellipsisLength)}}else str=STR_ELLIPSIS;return str},undef:function(str){if(isUndefined(str))str="";return str},unescapeEntities:function(str){if(LString.contains(str,"\x26"))if(DOC&&!LString.contains(str,"\x3c"))str=LString._unescapeEntitiesUsingDom(str);else str=LString.unescapeHTML(str);return str},unescapeHTML:function(str){return str.replace(REGEX_HTML_UNESCAPE, LString._unescapeHTML)},_camelize:function(match0,match1){return match1.toUpperCase()},_escapeHTML:function(match){return MAP_HTML_CHARS_ESCAPED[match]},_unescapeHTML:function(match,entity){var value=MAP_HTML_CHARS_UNESCAPED[match]||match;if(!value&&entity.charAt(0)==="#"){var charCode=Number("0"+value.substr(1));if(!isNaN(charCode))value=String.fromCharCode(charCode)}return value},_unescapeEntitiesUsingDom:function(str){var el=DOC.createElement("a");el.innerHTML=str;if(el.normalize)el.normalize(); str=el.firstChild.nodeValue;el.innerHTML="";return str}});AObject.map=function(obj,fn,context){var map=[],i;for(i in obj)if(owns(obj,i))map[map.length]=fn.call(context,obj[i],i,obj);return map};A.map=function(obj){var module=AObject;if(isArray(obj))module=aArray;return module.map.apply(this,arguments)}})()},"3.1.0-deprecated.77"); YUI.add("aui-classnamemanager",function(A,NAME){var ClassNameManager=A.ClassNameManager,_getClassName=ClassNameManager.getClassName;A.getClassName=A.cached(function(){var args=A.Array(arguments,0,true);args[args.length]=true;return _getClassName.apply(ClassNameManager,args)})},"3.1.0-deprecated.77",{"requires":["classnamemanager"]}); YUI.add("aui-component",function(A,NAME){var Lang=A.Lang,AArray=A.Array,concat=function(arr,arr2){return(arr||[]).concat(arr2||[])},_INSTANCES={},_CONSTRUCTOR_OBJECT=A.config.win.Object.prototype.constructor,ClassNameManager=A.ClassNameManager,_getClassName=ClassNameManager.getClassName,_getWidgetClassName=A.Widget.getClassName,getClassName=A.getClassName,CSS_HIDE=getClassName("hide");var Component=A.Base.create("component",A.Widget,[A.WidgetCssClass,A.WidgetToggle],{initializer:function(config){var instance= this;instance._originalConfig=config;instance._setRender(config);_INSTANCES[instance.get("id")]=instance},clone:function(config){var instance=this;config=config||{};config.id=config.id||A.guid();A.mix(config,instance._originalConfig);return new instance.constructor(config)},_uiSetVisible:function(value){var instance=this;var superUISetVisible=Component.superclass._uiSetVisible;if(superUISetVisible)superUISetVisible.apply(instance,arguments);var hideClass=instance.get("hideClass");if(hideClass!==false){var boundingBox= instance.get("boundingBox");boundingBox.toggleClass(hideClass||CSS_HIDE,!value)}},_renderBoxClassNames:function(){var instance=this;var boundingBoxNode=instance.get("boundingBox")._node;var contentBoxNode=instance.get("contentBox")._node;var boundingBoxNodeClassName=boundingBoxNode.className;var contentBoxNodeClassName=contentBoxNode.className;var boundingBoxBuffer=boundingBoxNodeClassName?boundingBoxNodeClassName.split(" "):[];var contentBoxBuffer=contentBoxNodeClassName?contentBoxNodeClassName.split(" "): [];var classes=instance._getClasses();var classLength=classes.length;var auiClassesLength=classLength-4;var classItem;var classItemName;boundingBoxBuffer.push(_getWidgetClassName());for(var i=classLength-3;i>=0;i--){classItem=classes[i];classItemName=String(classItem.NAME).toLowerCase();boundingBoxBuffer.push(classItem.CSS_PREFIX||_getClassName(classItemName));if(i<=auiClassesLength){classItemName=classItemName;contentBoxBuffer.push(getClassName(classItemName,"content"))}}contentBoxBuffer.push(instance.getClassName("content")); if(boundingBoxNode===contentBoxNode)contentBoxNodeClassName=AArray.dedupe(contentBoxBuffer.concat(boundingBoxBuffer)).join(" ");else{boundingBoxNode.className=AArray.dedupe(boundingBoxBuffer).join(" ");contentBoxNodeClassName=AArray.dedupe(contentBoxBuffer).join(" ")}contentBoxNode.className=contentBoxNodeClassName},_renderInteraction:function(event,parentNode){var instance=this;instance.render(parentNode);var renderHandles=instance._renderHandles;for(var i=renderHandles.length-1;i>=0;i--){var handle= renderHandles.pop();handle.detach()}},_setRender:function(config){var instance=this;var render=config&&config.render;if(render&&render.constructor===_CONSTRUCTOR_OBJECT){var eventType=render.eventType||"mousemove";var parentNode=render.parentNode;var selector=render.selector||parentNode;if(selector){instance._renderHandles=[];var renderHandles=instance._renderHandles;if(!Lang.isArray(eventType))eventType=[eventType];var renderInteraction=A.rbind(instance._renderInteraction,instance,parentNode);var interactionNode= A.one(selector);for(var i=eventType.length-1;i>=0;i--)renderHandles[i]=interactionNode.once(eventType[i],renderInteraction);delete config.render}}}},{ATTRS:{useARIA:{writeOnce:true,value:false,validator:Lang.isBoolean},hideClass:{value:CSS_HIDE},render:{value:false,writeOnce:true}}});Component._INSTANCES=_INSTANCES;Component.getById=function(id){return _INSTANCES[id]};var DEFAULT_UI_ATTRS=A.Widget.prototype._UI_ATTRS;Component._applyCssPrefix=function(component){if(component&&component.NAME&&!("CSS_PREFIX"in component))component.CSS_PREFIX=A.getClassName(String(component.NAME).toLowerCase());return component};Component.create=function(config){config=config||{};var extendsClass=config.EXTENDS||A.Component;var component=config.constructor;if(!A.Object.owns(config,"constructor"))component=function(){component.superclass.constructor.apply(this,arguments)};var configProto=config.prototype;if(configProto)if(config.UI_ATTRS||config.BIND_UI_ATTRS||config.SYNC_UI_ATTRS){var BIND_UI_ATTRS=concat(config.BIND_UI_ATTRS, config.UI_ATTRS);var SYNC_UI_ATTRS=concat(config.SYNC_UI_ATTRS,config.UI_ATTRS);var extendsProto=extendsClass.prototype;var extendsUIAttrs=extendsProto&&extendsProto._UI_ATTRS||DEFAULT_UI_ATTRS;BIND_UI_ATTRS=concat(extendsUIAttrs.BIND,BIND_UI_ATTRS);SYNC_UI_ATTRS=concat(extendsUIAttrs.SYNC,SYNC_UI_ATTRS);var configProtoUIAttrs=configProto._UI_ATTRS;if(!configProtoUIAttrs)configProtoUIAttrs=configProto._UI_ATTRS={};if(BIND_UI_ATTRS.length)configProtoUIAttrs.BIND=BIND_UI_ATTRS;if(SYNC_UI_ATTRS.length)configProtoUIAttrs.SYNC= SYNC_UI_ATTRS}var augmentsClasses=config.AUGMENTS;if(augmentsClasses&&!Lang.isArray(augmentsClasses))augmentsClasses=[augmentsClasses];A.mix(component,config);delete component.prototype;A.extend(component,extendsClass,configProto);if(augmentsClasses)component=A.Base.build(config.NAME,component,augmentsClasses,{dynamic:false});Component._applyCssPrefix(component);return component};Component.CSS_PREFIX=getClassName("component");var Base=A.Base;Component.build=function(){var component=Base.build.apply(Base, arguments);Component._applyCssPrefix(component);return component};A.Component=Component},"3.1.0-deprecated.77",{"requires":["aui-classnamemanager","aui-widget-cssclass","aui-widget-toggle","base-build","widget-base"]}); YUI.add("aui-debounce",function(A,NAME){var Lang=A.Lang,aArray=A.Array,isString=Lang.isString,isUndefined=Lang.isUndefined,DEFAULT_ARGS=[];var toArray=function(arr,fallback,index,arrayLike){return!isUndefined(arr)?aArray(arr,index||0,arrayLike!==false):fallback};A.debounce=function(fn,delay,context,args){var id;var tempArgs;var wrapped;if(isString(fn)&&context)fn=A.bind(fn,context);delay=delay||0;args=toArray(arguments,DEFAULT_ARGS,3);var clearFn=function(){clearInterval(id);id=null};var base=function(){clearFn(); var result=fn.apply(context,tempArgs||args||DEFAULT_ARGS);tempArgs=null;return result};var delayFn=function(delayTime,newArgs,newContext,newFn){wrapped.cancel();delayTime=!isUndefined(delayTime)?delayTime:delay;fn=newFn||fn;context=newContext||context;if(newArgs!==args)tempArgs=toArray(newArgs,DEFAULT_ARGS,0,false).concat(args);if(delayTime>0)id=setInterval(base,delayTime);else return base()};var cancelFn=function(){if(id)clearFn()};var setDelay=function(delay){cancelFn();delay=delay||0};wrapped= function(){var currentArgs=arguments.length?arguments:args;return wrapped.delay(delay,currentArgs,context||this)};wrapped.cancel=cancelFn;wrapped.delay=delayFn;wrapped.setDelay=setDelay;return wrapped}},"3.1.0-deprecated.77"); YUI.add("aui-delayed-task-deprecated",function(A,NAME){var DelayedTask=function(fn,scope,args){var instance=this;instance._args=args;instance._delay=0;instance._fn=fn;instance._id=null;instance._scope=scope||instance;instance._time=0;instance._base=function(){var now=instance._getTime();if(now-instance._time>=instance._delay){clearInterval(instance._id);instance._id=null;instance._fn.apply(instance._scope,instance._args||[])}}};DelayedTask.prototype={delay:function(delay,newFn,newScope,newArgs){var instance= this;if(instance._id&&instance._delay!=delay)instance.cancel();instance._delay=delay||instance._delay;instance._time=instance._getTime();instance._fn=newFn||instance._fn;instance._scope=newScope||instance._scope;instance._args=newArgs||instance._args;if(!A.Lang.isArray(instance._args))instance._args=[instance._args];if(!instance._id)if(instance._delay>0)instance._id=setInterval(instance._base,instance._delay);else instance._base()},cancel:function(){var instance=this;if(instance._id){clearInterval(instance._id); instance._id=null}},_getTime:function(){var instance=this;return+new Date}};A.DelayedTask=DelayedTask},"3.1.0-deprecated.77",{"requires":["yui-base"]}); YUI.add("aui-event-base",function(A,NAME){var aArray=A.Array,DOMEventFacade=A.DOMEventFacade,DOMEventFacadeProto=DOMEventFacade.prototype;var KeyMap={BACKSPACE:8,TAB:9,NUM_CENTER:12,ENTER:13,RETURN:13,SHIFT:16,CTRL:17,ALT:18,PAUSE:19,CAPS_LOCK:20,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,PRINT_SCREEN:44,INSERT:45,DELETE:46,ZERO:48,ONE:49,TWO:50,THREE:51,FOUR:52,FIVE:53,SIX:54,SEVEN:55,EIGHT:56,NINE:57,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75, L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,CONTEXT_MENU:93,NUM_ZERO:96,NUM_ONE:97,NUM_TWO:98,NUM_THREE:99,NUM_FOUR:100,NUM_FIVE:101,NUM_SIX:102,NUM_SEVEN:103,NUM_EIGHT:104,NUM_NINE:105,NUM_MULTIPLY:106,NUM_PLUS:107,NUM_MINUS:109,NUM_PERIOD:110,NUM_DIVISION:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NUM_LOCK:144,WIN_KEY:224,WIN_IME:229,NON_MODIFYING_KEYS:["ALT","CAPS_LOCK","CTRL","DOWN","END","ESC","F1","F10","F11","F12", "F2","F3","F4","F5","F6","F7","F8","F9","HOME","LEFT","NUM_LOCK","PAGE_DOWN","PAGE_UP","PAUSE","PRINT_SCREEN","RIGHT","SHIFT","SPACE","UP","WIN_KEY"],hasModifier:function(event){return event&&(event.ctrlKey||event.altKey||event.shiftKey||event.metaKey)},isKey:function(keyCode,name){var instance=this;return name&&(instance[name]||instance[name.toUpperCase()])===keyCode},isKeyInRange:function(keyCode,start,end){var instance=this;var result=false;if(start&&end){var startKey=instance[start]||instance[start.toUpperCase()]; var endKey=instance[end]||instance[end.toUpperCase()];result=startKey&&endKey&&(keyCode>=startKey&&keyCode<=endKey)}return result},isKeyInSet:function(keyCode){var instance=this;var args=aArray(arguments,1,true);return instance._isKeyInSet(keyCode,args)},isNavKey:function(keyCode){var instance=this;return instance.isKeyInRange(keyCode,"PAGE_UP","DOWN")||instance.isKeyInSet(keyCode,"ENTER","TAB","ESC")},isSpecialKey:function(keyCode,eventType){var instance=this;var isCtrlPress=eventType==="keypress"&& instance.ctrlKey;return isCtrlPress||instance.isNavKey(keyCode)||instance.isKeyInRange(keyCode,"SHIFT","CAPS_LOCK")||instance.isKeyInSet(keyCode,"BACKSPACE","PRINT_SCREEN","INSERT","WIN_IME")},isModifyingKey:function(keyCode){var instance=this;return!instance._isKeyInSet(keyCode,instance.NON_MODIFYING_KEYS)},_isKeyInSet:function(keyCode,arr){var instance=this;var i=arr.length;var result=false;var keyName;var key;while(i--){keyName=arr[i];key=keyName&&(instance[keyName]||instance[String(keyName).toUpperCase()]); if(keyCode===key){result=true;break}}return result}};A.mix(DOMEventFacadeProto,{hasModifier:function(){var instance=this;return KeyMap.hasModifier(instance)},isKey:function(name){var instance=this;return KeyMap.isKey(instance.keyCode,name)},isKeyInRange:function(start,end){var instance=this;return KeyMap.isKeyInRange(instance.keyCode,start,end)},isKeyInSet:function(){var instance=this;var args=aArray(arguments,0,true);return KeyMap._isKeyInSet(instance.keyCode,args)},isModifyingKey:function(){var instance= this;return KeyMap.isModifyingKey(instance.keyCode)},isNavKey:function(){var instance=this;return KeyMap.isNavKey(instance.keyCode)},isSpecialKey:function(){var instance=this;return KeyMap.isSpecialKey(instance.keyCode,instance.type)}});A.Event.KeyMap=KeyMap;A.Event.supportsDOMEvent=A.supportsDOMEvent},"3.1.0-deprecated.77",{"requires":["event-base"]}); YUI.add("aui-event-input",function(A,NAME){var DOM_EVENTS=A.Node.DOM_EVENTS;if(A.Features.test("event","input")){DOM_EVENTS.input=1;return}DOM_EVENTS.cut=1;DOM_EVENTS.dragend=1;DOM_EVENTS.paste=1;var KeyMap=A.Event.KeyMap,_HANDLER_DATA_KEY="~~aui|input|event~~",_INPUT_EVENT_TYPE=["keydown","paste","drop","cut"],_SKIP_FOCUS_CHECK_MAP={cut:1,drop:1,paste:1};A.Event.define("input",{on:function(node,subscription,notifier){var instance=this;subscription._handler=node.on(_INPUT_EVENT_TYPE,A.bind(instance._dispatchEvent, instance,subscription,notifier))},delegate:function(node,subscription,notifier,filter){var instance=this;subscription._handles=[];subscription._handler=node.delegate("focus",function(event){var element=event.target,handler=element.getData(_HANDLER_DATA_KEY);if(!handler){handler=element.on(_INPUT_EVENT_TYPE,A.bind(instance._dispatchEvent,instance,subscription,notifier));subscription._handles.push(handler);element.setData(_HANDLER_DATA_KEY,handler)}},filter)},detach:function(node,subscription){subscription._handler.detach()}, detachDelegate:function(node,subscription){A.Array.each(subscription._handles,function(handle){var element=A.one(handle.evt.el);if(element)element.setData(_HANDLER_DATA_KEY,null);handle.detach()});subscription._handler.detach()},_dispatchEvent:function(subscription,notifier,event){var instance=this,input,valueBeforeKey;input=event.target;if(_SKIP_FOCUS_CHECK_MAP[event.type]||input.get("ownerDocument").get("activeElement")===input)if(KeyMap.isModifyingKey(event.keyCode)){if(subscription._timer){subscription._timer.cancel(); subscription._timer=null}valueBeforeKey=KeyMap.isKey(event.keyCode,"WIN_IME")?null:input.get("value");subscription._timer=A.soon(A.bind("_fireEvent",instance,subscription,notifier,event,valueBeforeKey))}},_fireEvent:function(subscription,notifier,event,valueBeforeKey){var input=event.target;subscription._timer=null;if(input.get("value")!==valueBeforeKey)notifier.fire(event)}})},"3.1.0-deprecated.77",{"requires":["aui-event-base","event-delegate","event-synthetic","timers"]}); YUI.add("aui-form-validator",function(A,NAME){var Lang=A.Lang,AObject=A.Object,isBoolean=Lang.isBoolean,isDate=Lang.isDate,isEmpty=AObject.isEmpty,isFunction=Lang.isFunction,isNode=Lang.isNode,isObject=Lang.isObject,isString=Lang.isString,trim=Lang.trim,defaults=A.namespace("config.FormValidator"),getRegExp=A.DOM._getRegExp,getCN=A.getClassName,CSS_FORM_GROUP=getCN("form","group"),CSS_HAS_ERROR=getCN("has","error"),CSS_ERROR_FIELD=getCN("error","field"),CSS_HAS_SUCCESS=getCN("has","success"),CSS_SUCCESS_FIELD= getCN("success","field"),CSS_HELP_BLOCK=getCN("help","block"),CSS_STACK=getCN("form-validator","stack"),TPL_MESSAGE='\x3cdiv role\x3d"alert"\x3e\x3c/div\x3e',TPL_STACK_ERROR='\x3cdiv class\x3d"'+[CSS_STACK,CSS_HELP_BLOCK].join(" ")+'"\x3e\x3c/div\x3e';if(!Element.prototype.matches)Element.prototype.matches=Element.prototype.msMatchesSelector;A.mix(defaults,{STRINGS:{DEFAULT:"Please fix {field}.",acceptFiles:"Please enter a value with a valid extension ({0}) in {field}.",alpha:"Please enter only alpha characters in {field}.", alphanum:"Please enter only alphanumeric characters in {field}.",date:"Please enter a valid date in {field}.",digits:"Please enter only digits in {field}.",email:"Please enter a valid email address in {field}.",equalTo:"Please enter the same value again in {field}.",iri:"Please enter a valid IRI in {field}.",max:"Please enter a value less than or equal to {0} in {field}.",maxLength:"Please enter no more than {0} characters in {field}.",min:"Please enter a value greater than or equal to {0} in {field}.", minLength:"Please enter at least {0} characters in {field}.",number:"Please enter a valid number in {field}.",range:"Please enter a value between {0} and {1} in {field}.",rangeLength:"Please enter a value between {0} and {1} characters long in {field}.",required:"{field} is required.",url:"Please enter a valid URL in {field}."},REGEX:{alpha:/^[a-z_]+$/i,alphanum:/^\w+$/,digits:/^\d+$/,email:new RegExp("^((([a-z]|\\d|[!#\\$%\x26'\\*\\+\\-\\/\x3d\\?\\^_`{\\|}~]|"+"[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF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0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\"+".)*(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|"+"(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]"+"|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])"+"*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)"+"(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\"+ "uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$\x26'\\(\\)\\*\\+,;\x3d]"+"|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF"+"\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$\x26'\\(\\)\\*\\+,;\x3d]|:|@)*)"+"*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\"+"uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$\x26'\\(\\)\\*\\+,;\x3d]|"+":|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|"+"[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})"+"|[!\\$\x26'\\(\\)\\*\\+,;\x3d]|:|@)|\\/|\\?)*)?$", "i")},RULES:{acceptFiles:function(val,node,ruleValue){var regex=null;if(isString(ruleValue)){var extensions=ruleValue.replace(/\./g,"").split(/,\s*|\b\s*/);extensions=A.Array.map(extensions,A.Escape.regex);regex=getRegExp("[.]("+extensions.join("|")+")$","i")}return regex&®ex.test(val)},date:function(val){var date=new Date(val);return isDate(date)&&date!=="Invalid Date"&&!isNaN(date)},equalTo:function(val,node,ruleValue){var comparator=A.one(ruleValue);return comparator&&trim(comparator.val())=== val},hasValue:function(val,node){var instance=this;if(A.FormValidator.isCheckable(node)){var name=node.get("name"),elements=A.all(instance.getFieldsByName(name));return elements.filter(":checked").size()>0}else return!!val},max:function(val,node,ruleValue){return Lang.toFloat(val)<=ruleValue},maxLength:function(val,node,ruleValue){return val.length<=ruleValue},min:function(val,node,ruleValue){return Lang.toFloat(val)>=ruleValue},minLength:function(val,node,ruleValue){return val.length>=ruleValue}, range:function(val,node,ruleValue){var num=Lang.toFloat(val);return num>=ruleValue[0]&&num<=ruleValue[1]},rangeLength:function(val,node,ruleValue){var length=val.length;return length>=ruleValue[0]&&length<=ruleValue[1]},required:function(val,node,ruleValue){var instance=this;if(ruleValue===true)return defaults.RULES.hasValue.apply(instance,[val,node]);else return true}}});var FormValidator=A.Component.create({NAME:"form-validator",ATTRS:{boundingBox:{setter:A.one},containerErrorClass:{value:CSS_HAS_ERROR, validator:isString},containerValidClass:{value:CSS_HAS_SUCCESS,validator:isString},errorClass:{value:CSS_ERROR_FIELD,validator:isString},extractRules:{value:true,validator:isBoolean},fieldContainer:{value:"."+CSS_FORM_GROUP},fieldStrings:{value:{},validator:isObject},labelCssClass:{validator:isString,value:"control-label"},messageContainer:{getter:function(val){return A.Node.create(val).clone()},value:TPL_MESSAGE},rules:{getter:function(val){var instance=this;if(!instance._rulesAlreadyExtracted)instance._extractRulesFromMarkup(val); return val},validator:isObject,value:{}},selectText:{value:true,validator:isBoolean},showMessages:{value:true,validator:isBoolean},showAllMessages:{value:false,validator:isBoolean},skipValidationTargetSelector:{value:"a[class~\x3dbtn-cancel]"},stackErrorContainer:{getter:function(val){return A.Node.create(val).clone()},value:TPL_STACK_ERROR},strings:{valueFn:function(){return defaults.STRINGS}},validateOnBlur:{value:true,validator:isBoolean},validateOnInput:{value:false,validator:isBoolean},validClass:{value:CSS_SUCCESS_FIELD, validator:isString}},_setCustomRules:function(object){A.each(object,function(rule,fieldName){A.config.FormValidator.RULES[fieldName]=rule.condition;A.config.FormValidator.STRINGS[fieldName]=rule.errorMessage})},addCustomRules:function(object){var instance=this;if(isObject(object))instance._setCustomRules(object)},isCheckable:function(node){var nodeType=node.get("type").toLowerCase();return nodeType==="checkbox"||nodeType==="radio"},EXTENDS:A.Base,prototype:{initializer:function(){var instance=this; instance.errors={};instance._blurHandlers=null;instance._fileBlurHandlers=null;instance._fileInputHandlers=null;instance._inputHandlers=null;instance._rulesAlreadyExtracted=false;instance._stackErrorContainers={};instance.bindUI();instance._uiSetValidateOnBlur(instance.get("validateOnBlur"));instance._uiSetValidateOnInput(instance.get("validateOnInput"))},bindUI:function(){var instance=this,boundingBox=instance.get("boundingBox");var onceFocusHandler=boundingBox.delegate("focus",function(){instance._setARIARoles(); onceFocusHandler.detach()},"input,select,textarea,button");instance.publish({errorField:{defaultFn:instance._defErrorFieldFn},validField:{defaultFn:instance._defValidFieldFn},validateField:{defaultFn:instance._defValidateFieldFn}});boundingBox.on({reset:A.bind(instance._onFormReset,instance),submit:A.bind(instance._onFormSubmit,instance)});instance.after({extractRulesChange:instance._afterExtractRulesChange,validateOnBlurChange:instance._afterValidateOnBlurChange,validateOnInputChange:instance._afterValidateOnInputChange})}, addFieldError:function(field,ruleName){var instance=this,errors=instance.errors,name=field.get("name");if(!errors[name])errors[name]=[];errors[name].push(ruleName)},clearFieldError:function(field){var fieldName=isNode(field)?field.get("name"):field;if(isString(fieldName))delete this.errors[fieldName]},eachRule:function(fn){var instance=this;A.each(instance.get("rules"),function(rule,fieldName){if(isFunction(fn))fn.apply(instance,[rule,fieldName])})},findFieldContainer:function(field){var instance= this,fieldContainer=instance.get("fieldContainer");if(fieldContainer)return field.ancestor(fieldContainer)},focusInvalidField:function(){var instance=this,boundingBox=instance.get("boundingBox"),field=boundingBox.one("."+CSS_ERROR_FIELD);if(field){field=instance.findFieldContainer(field);if(instance.get("selectText"))field.selectText();field.focus();field.scrollIntoView(false);window.scrollBy(0,field.getDOM().scrollHeight)}},getField:function(field){var instance=this;if(isString(field)){field=instance.getFieldsByName(field); if(field&&field.length&&!field.name)field=field[0]}return A.one(field)},getFieldsByName:function(fieldName){var instance=this,domBoundingBox=instance.get("boundingBox").getDOM();return domBoundingBox.elements[fieldName]},getFieldError:function(field){var instance=this;return instance.errors[field.get("name")]},getFieldStackErrorContainer:function(field){var instance=this,name=isNode(field)?field.get("name"):field,stackContainers=instance._stackErrorContainers;if(!stackContainers[name])stackContainers[name]= instance.get("stackErrorContainer");return stackContainers[name]},getFieldErrorMessage:function(field,rule){var instance=this,fieldName=field.get("name"),fieldStrings=instance.get("fieldStrings")[fieldName]||{},fieldRules=instance.get("rules")[fieldName],fieldLabel=instance._findFieldLabel(field),strings=instance.get("strings"),substituteRulesMap={};if(fieldLabel)substituteRulesMap.field=fieldLabel;if(rule in fieldRules){var ruleValue=A.Array(fieldRules[rule]);A.each(ruleValue,function(value,index){substituteRulesMap[index]= [value].join("")})}var message=fieldStrings[rule]||strings[rule]||strings.DEFAULT;return Lang.sub(message,substituteRulesMap)},hasErrors:function(){var instance=this;return!isEmpty(instance.errors)},highlight:function(field,valid){var instance=this,fieldContainer,fieldName,namedFieldNodes;if(field){fieldContainer=instance.findFieldContainer(field);fieldName=field.get("name");if(this.validatable(field)){namedFieldNodes=A.all(instance.getFieldsByName(fieldName));namedFieldNodes.each(function(node){instance._highlightHelper(node, instance.get("errorClass"),instance.get("validClass"),valid)});if(fieldContainer)instance._highlightHelper(fieldContainer,instance.get("containerErrorClass"),instance.get("containerValidClass"),valid)}else if(!field.val())instance.resetField(fieldName)}},normalizeRuleValue:function(ruleValue,field){var instance=this;return isFunction(ruleValue)?ruleValue.apply(instance,[field]):ruleValue},unhighlight:function(field){var instance=this;instance.highlight(field,true)},printStackError:function(field, container,errors){var instance=this;if(!instance.get("showAllMessages"))if(A.Array.indexOf(errors,"required")!==-1)errors=["required"];else errors=errors.slice(0,1);container.empty();A.Array.each(errors,function(error){var message=instance.getFieldErrorMessage(field,error),messageEl=instance.get("messageContainer").addClass(error);container.append(messageEl.html(message))})},resetAllFields:function(){var instance=this;instance.eachRule(function(rule,fieldName){instance.resetField(fieldName)})},resetField:function(field){var instance= this,fieldName,fieldRules,namedFieldNodes,stackContainer;fieldName=isNode(field)?field.get("name"):field;if(fieldName){fieldRules=instance.get("rules")[fieldName];if(fieldRules){instance.clearFieldError(fieldName);stackContainer=instance.getFieldStackErrorContainer(fieldName);stackContainer.remove();namedFieldNodes=A.all(instance.getFieldsByName(fieldName));namedFieldNodes.each(function(node){instance.resetFieldCss(node);node.removeAttribute("aria-errormessage");node.removeAttribute("aria-invalid")})}}}, resetFieldCss:function(field){var instance=this,fieldContainer=instance.findFieldContainer(field);var removeClasses=function(elem,classAttrs){if(elem)A.each(classAttrs,function(attrName){elem.removeClass(instance.get(attrName))})};removeClasses(field,["validClass","errorClass"]);removeClasses(fieldContainer,["containerValidClass","containerErrorClass"])},validatable:function(field){var instance=this,validatable=false,fieldRules=instance.get("rules")[field.get("name")];if(fieldRules)validatable=instance.normalizeRuleValue(fieldRules.required, field)||defaults.RULES.hasValue.apply(instance,[field.val(),field]);return!!validatable},validate:function(){var instance=this;instance.eachRule(function(rule,fieldName){instance.validateField(fieldName)});instance.focusInvalidField()},validateField:function(field){var fieldNode,validatable;this.resetField(field);fieldNode=isString(field)?this.getField(field):field;if(isNode(fieldNode)){validatable=this.validatable(fieldNode);if(validatable)this.fire("validateField",{validator:{field:fieldNode}})}}, _afterExtractRulesChange:function(event){var instance=this;instance._uiSetExtractRules(event.newVal)},_afterValidateOnBlurChange:function(event){var instance=this;instance._uiSetValidateOnBlur(event.newVal)},_afterValidateOnInputChange:function(event){var instance=this;instance._uiSetValidateOnInput(event.newVal)},_defErrorFieldFn:function(event){var instance=this,field,label,stackContainer,target,validator;label=instance.get("labelCssClass");validator=event.validator;field=validator.field;instance.highlight(field); if(instance.get("showMessages")){target=field;stackContainer=instance.getFieldStackErrorContainer(field);if(A.FormValidator.isCheckable(target))target=field.ancestor("."+CSS_HAS_ERROR).get("lastChild");var id=field.get("id")+"Helper";stackContainer.set("id",id);target.placeAfter(stackContainer);instance.printStackError(field,stackContainer,validator.errors)}},_defValidFieldFn:function(event){var instance=this;var field=event.validator.field;instance.unhighlight(field)},_defValidateFieldFn:function(event){var instance= this;var field=event.validator.field;var fieldRules=instance.get("rules")[field.get("name")];A.each(fieldRules,function(ruleValue,ruleName){var rule=defaults.RULES[ruleName];var fieldValue=trim(field.val());ruleValue=instance.normalizeRuleValue(ruleValue,field);if(isFunction(rule)&&!rule.apply(instance,[fieldValue,field,ruleValue]))instance.addFieldError(field,ruleName)});var fieldErrors=instance.getFieldError(field);if(fieldErrors)instance.fire("errorField",{validator:{field:field,errors:fieldErrors}}); else instance.fire("validField",{validator:{field:field}})},_findFieldLabel:function(field){var labelCssClass="."+this.get("labelCssClass"),label=A.one("label[for\x3d"+field.get("id")+"]")||field.ancestor().previous(labelCssClass);if(!label){label=field.ancestor("."+CSS_HAS_ERROR);if(label)label=label.one(labelCssClass)}if(label)return label.get("text")},_highlightHelper:function(field,errorClass,validClass,valid){var instance=this;if(valid){field.removeClass(errorClass).addClass(validClass);if(validClass=== CSS_SUCCESS_FIELD){field.removeAttribute("aria-errormessage");field.removeAttribute("aria-invalid")}}else{field.removeClass(validClass).addClass(errorClass);if(errorClass===CSS_ERROR_FIELD){field.set("aria-errormessage",field.get("id")+"Helper");field.set("aria-invalid",true)}}},_extractRulesFromMarkup:function(rules){var instance=this,domBoundingBox=instance.get("boundingBox").getDOM(),elements=domBoundingBox.elements,defaultRulesKeys=AObject.keys(defaults.RULES),defaultRulesJoin=defaultRulesKeys.join("|"), regex=getRegExp("field-("+defaultRulesJoin+")","g"),i,length,ruleNameMatch=[],ruleMatcher=function(m1,m2){ruleNameMatch.push(m2)};for(i=0,length=elements.length;i\s]+\/)>/g,REGEX_TAGNAME=/<([\w:]+)/;div=null;var _setUnselectable=function(element,unselectable,noRecurse){var descendants,value=unselectable?"on":"",i,descendant;element.setAttribute("unselectable", value);if(!noRecurse){descendants=element.getElementsByTagName("*");for(i=0;descendant=descendants[i];i++)descendant.setAttribute("unselectable",value)}};A.mix(NODE_PROTO,{ancestorsByClassName:function(className,testSelf){var instance=this;var ancestors=[];var cssRE=new RegExp("\\b"+className+"\\b");var currentEl=instance.getDOM();if(!testSelf)currentEl=currentEl.parentNode;while(currentEl&¤tEl.nodeType!==9){if(currentEl.nodeType===1&&cssRE.test(currentEl.className))ancestors.push(currentEl); currentEl=currentEl.parentNode}return A.all(ancestors)},attr:function(name,value){var instance=this,i;if(!isUndefined(value)){var el=instance.getDOM();if(name in el)instance.set(name,value);else instance.setAttribute(name,value);return instance}else{if(isObject(name)){for(i in name)if(name.hasOwnProperty(i))instance.attr(i,name[i]);return instance}var currentValue=instance.get(name);if(!Lang.isValue(currentValue))currentValue=instance.getAttribute(name);return currentValue}},clone:function(){var clone; if(SUPPORT_CLONED_EVENTS)clone=function(){var el=this.getDOM();var clone;if(el.nodeType!==3){var outerHTML=this.outerHTML();outerHTML=outerHTML.replace(REGEX_IE8_ACTION,'\x3d"$1"\x3e').replace(REGEX_LEADING_WHITE_SPACE,"");clone=ANode.create(outerHTML)}else clone=A.one(el.cloneNode());return clone};else clone=function(){return this.cloneNode(true)};return clone}(),center:function(val){var instance=this,nodeRegion=instance.get("region"),x,y;if(isArray(val)){x=val[0];y=val[1]}else{var region;if(isObject(val)&& !A.instanceOf(val,ANode))region=val;else region=(A.one(val)||A.getBody()).get("region");x=region.left+region.width/2;y=region.top+region.height/2}instance.setXY([x-nodeRegion.width/2,y-nodeRegion.height/2])},empty:function(){var instance=this;instance.all("\x3e*").remove().purge();var el=ANode.getDOMNode(instance);while(el.firstChild)el.removeChild(el.firstChild);return instance},getDOM:function(){var instance=this;return ANode.getDOMNode(instance)},getBorderWidth:function(sides){var instance=this; return instance._getBoxStyleAsNumber(sides,MAP_BORDER)},getCenterXY:function(){var instance=this;var region=instance.get("region");return[region.left+region.width/2,region.top+region.height/2]},getMargin:function(sides){var instance=this;return instance._getBoxStyleAsNumber(sides,MAP_MARGIN)},getPadding:function(sides){var instance=this;return instance._getBoxStyleAsNumber(sides,MAP_PADDING)},guid:function(){var instance=this;var currentId=instance.get("id");if(!currentId){currentId=A.stamp(instance); instance.set("id",currentId)}return currentId},hover:function(overFn,outFn){var instance=this;var hoverOptions;var defaultHoverOptions=instance._defaultHoverOptions;if(isObject(overFn,true)){hoverOptions=overFn;hoverOptions=A.mix(hoverOptions,defaultHoverOptions);overFn=hoverOptions.over;outFn=hoverOptions.out}else hoverOptions=A.mix({over:overFn,out:outFn},defaultHoverOptions);instance._hoverOptions=hoverOptions;hoverOptions.overTask=A.debounce(instance._hoverOverTaskFn,null,instance);hoverOptions.outTask= A.debounce(instance._hoverOutTaskFn,null,instance);return new A.EventHandle([instance.on(hoverOptions.overEventType,instance._hoverOverHandler,instance),instance.on(hoverOptions.outEventType,instance._hoverOutHandler,instance)])},html:function(){var args=arguments,length=args.length;if(length)this.set("innerHTML",args[0]);else return this.get("innerHTML");return this},outerHTML:function(){var instance=this;var domEl=instance.getDOM();if("outerHTML"in domEl)return domEl.outerHTML;var temp=ANode.create("\x3cdiv\x3e\x3c/div\x3e").append(this.clone()); try{return temp.html()}catch(e){}finally{temp=null}},placeAfter:function(newNode){var instance=this;return instance._place(newNode,instance.get("nextSibling"))},placeBefore:function(newNode){var instance=this;return instance._place(newNode,instance)},prependTo:function(selector){var instance=this;A.one(selector).prepend(instance);return instance},radioClass:function(cssClass){var instance=this;var siblings=instance.siblings();if(isString(cssClass)){siblings.removeClass(cssClass);instance.addClass(cssClass)}else if(isArray(cssClass)){var siblingNodes= siblings.getDOM();var regex=getRegExp("(?:^|\\s+)(?:"+cssClass.join("|")+")(?\x3d\\s+|$)","g"),node,i;for(i=siblingNodes.length-1;i>=0;i--){node=siblingNodes[i];node.className=node.className.replace(regex,"")}instance.addClass(cssClass.join(" "))}return instance},resetId:function(prefix){var instance=this;instance.attr("id",A.guid(prefix));return instance},selectText:function(start,end){var instance=this;var textField=instance.getDOM();var length=instance.val().length;end=isValue(end)?end:length; start=isValue(start)?start:0;try{if(textField.setSelectionRange)textField.setSelectionRange(start,end);else if(textField.createTextRange){var range=textField.createTextRange();range.moveStart("character",start);range.moveEnd("character",end-length);range.select()}else textField.select();if(textField!==DOC.activeElement)textField.focus()}catch(e){}return instance},selectable:function(noRecurse){var instance=this;instance.setStyles({"-webkit-user-select":CSS_SELECTABLE_VALUE,"-khtml-user-select":CSS_SELECTABLE_VALUE, "-moz-user-select":CSS_SELECTABLE_VALUE,"-ms-user-select":CSS_SELECTABLE_VALUE,"-o-user-select":CSS_SELECTABLE_VALUE,"user-select":CSS_SELECTABLE_VALUE});if(A.UA.ie||A.UA.opera)_setUnselectable(instance._node,false,noRecurse);return instance},swallowEvent:function(eventName,preventDefault){var instance=this;var fn=function(event){event.stopPropagation();if(preventDefault){event.preventDefault();event.halt()}return false};if(isArray(eventName)){AArray.each(eventName,function(name){instance.on(name, fn)});return this}else instance.on(eventName,fn);return instance},text:function(text){var instance=this;var el=instance.getDOM();if(!isUndefined(text)){text=A.DOM._getDoc(el).createTextNode(text);return instance.empty().append(text)}return instance._getText(el.childNodes)},toggle:function(){var instance=this;instance._toggleView.apply(instance,arguments);return instance},unselectable:function(noRecurse){var instance=this;instance.setStyles({"-webkit-user-select":CSS_UNSELECTABLE_VALUE,"-khtml-user-select":CSS_UNSELECTABLE_VALUE, "-moz-user-select":CSS_UNSELECTABLE_VALUE,"-ms-user-select":CSS_UNSELECTABLE_VALUE,"-o-user-select":CSS_UNSELECTABLE_VALUE,"user-select":CSS_UNSELECTABLE_VALUE});if(A.UA.ie||A.UA.opera)_setUnselectable(instance._node,true,noRecurse);return instance},val:function(value){var instance=this;if(isUndefined(value))return instance.get("value");else return instance.set("value",value)},_getBoxStyleAsNumber:function(sides,map){var instance=this;var sidesArray=sides.match(/\w/g),value=0,side,sideKey,i;for(i= sidesArray.length-1;i>=0;i--){sideKey=sidesArray[i];side=0;if(sideKey){side=parseFloat(instance.getComputedStyle(map[sideKey]));side=Math.abs(side);value+=side||0}}return value},_getText:function(childNodes){var instance=this;var length=childNodes.length,childNode,str=[],i;for(i=0;i0)where=where.firstChild}return A.DOM._ADD_HTML(node, content,where)}}ANodeList.importMethod(NODE_PROTO,["after","appendTo","attr","before","empty","getX","getXY","getY","hover","html","innerHeight","innerWidth","outerHeight","outerHTML","outerWidth","prepend","prependTo","purge","selectText","selectable","setX","setXY","setY","text","toggle","unselectable","val"]);A.mix(NODELIST_PROTO,{all:function(selector){var instance=this,newNodeList=[],nodes=instance._nodes,length=nodes.length,subList,i;for(i=0;i=9||isShivDisabled())return;var BUFFER_CSS_TEXT=[],LOCATION=WIN.location,DOMAIN=LOCATION.protocol+"//"+LOCATION.host,HTML=DOC.documentElement,HTML5_ELEMENTS=A.HTML5_ELEMENTS,HTML5_ELEMENTS_LENGTH=HTML5_ELEMENTS.length,HTML5_ELEMENTS_LIST=HTML5_ELEMENTS.join("|"), REGEX_CLONE_NODE_CLEANUP=new RegExp("\x3c(/?):("+HTML5_ELEMENTS_LIST+")","gi"),REGEX_ELEMENTS=new RegExp("("+HTML5_ELEMENTS_LIST+")","gi"),REGEX_ELEMENTS_FAST=new RegExp("\\b("+HTML5_ELEMENTS_LIST+")\\b","i"),REGEX_PRINT_MEDIA=/print|all/,REGEX_RULE=new RegExp("(^|[^\\n{}]*?\\s)("+HTML5_ELEMENTS_LIST+").*?{([^}]*)}","gim"),REGEX_TAG=new RegExp("\x3c(/*)("+HTML5_ELEMENTS_LIST+")","gi"),SELECTOR_REPLACE_RULE="."+"printfix-"+"$1",STR_EMPTY="",STR_URL_DOMAIN="url("+DOMAIN,TAG_REPLACE_ORIGINAL="\x3c$1$2", TAG_REPLACE_FONT="\x3c$1font";var html5shiv=A.html5shiv,isStylesheetDefined=function(obj){return obj&&obj+STR_EMPTY!==undefined},toggleNode=function(node,origNode,prop){var state=origNode[prop];if(state)node.setAttribute(prop,state);else node.removeAttribute(prop)};html5shiv(DOC);var printFix=function(){var destroy;var afterPrint=function(){if(isShivDisabled())destroy();else printFix.onAfterPrint()};var beforePrint=function(){if(isShivDisabled())destroy();else printFix.onBeforePrint()};destroy=function(){WIN.detachEvent("onafterprint", afterPrint);WIN.detachEvent("onbeforeprint",beforePrint)};var init=function(){WIN.attachEvent("onafterprint",afterPrint);WIN.attachEvent("onbeforeprint",beforePrint)};init();printFix.destroy=destroy;printFix.init=init};A.mix(printFix,{onAfterPrint:function(){var instance=this;instance.restoreHTML();var styleSheet=instance._getStyleSheet();styleSheet.styleSheet.cssText=""},onBeforePrint:function(){var instance=this;var styleSheet=instance._getStyleSheet();var cssRules=instance._getAllCSSText();styleSheet.styleSheet.cssText= instance.parseCSS(cssRules);instance.writeHTML()},parseCSS:function(cssText){var css="";var rules=cssText.match(REGEX_RULE);if(rules)css=rules.join("\n").replace(REGEX_ELEMENTS,SELECTOR_REPLACE_RULE);return css},restoreHTML:function(){var instance=this;var bodyClone=instance._getBodyClone();var bodyEl=instance._getBodyEl();var newNodes=bodyClone.getElementsByTagName("IFRAME");var originalNodes=bodyEl.getElementsByTagName("IFRAME");var length=originalNodes.length;if(length===newNodes.length)while(length--){var newNode= newNodes[length];var originalNode=originalNodes[length];originalNode.swapNode(newNode)}bodyClone.innerHTML="";HTML.removeChild(bodyClone);HTML.appendChild(bodyEl)},writeHTML:function(){var instance=this;var i=-1;var j;var bodyEl=instance._getBodyEl();var html5Element;var cssClass;var nodeList;var nodeListLength;var node;var buffer=[];while(++i-1&&backgroundImage.indexOf("https")===-1)elStyle.backgroundImage=backgroundImage.replace("url(",STR_URL_DOMAIN)}bodyElStyle.display=""}var bodyElClone=bodyEl.cloneNode(true);var newNodes=bodyElClone.getElementsByTagName("*");if(length===newNodes.length)while(length--){var newNode=newNodes[length];var newNodeName=newNode.nodeName; if(newNodeName==="INPUT"||newNodeName==="OPTION"||newNodeName==="IFRAME"){var originalNode=originalNodes[length];var originalNodeName=originalNode.nodeName;if(originalNodeName===newNodeName){var prop=null;if(newNodeName==="OPTION")prop="selected";else if(newNodeName==="INPUT"&&(newNode.type==="checkbox"||newNode.type==="radio"))prop="checked";else if(newNodeName==="IFRAME")newNode.src="";if(prop!==null)toggleNode(newNode,originalNode,prop)}}}var bodyHTML=bodyElClone.innerHTML;bodyHTML=bodyHTML.replace(REGEX_CLONE_NODE_CLEANUP, TAG_REPLACE_ORIGINAL).replace(REGEX_TAG,TAG_REPLACE_FONT);bodyClone.innerHTML=bodyHTML;newNodes=bodyClone.getElementsByTagName("IFRAME");originalNodes=bodyEl.getElementsByTagName("IFRAME");length=originalNodes.length;if(length===newNodes.length)while(length--){var newNodeIframe=newNodes[length];var originalNodeIframe=originalNodes[length];originalNodeIframe.swapNode(newNodeIframe)}},_getAllCSSText:function(){var instance=this;var buffer=[];var styleSheets=instance._getAllStyleSheets(DOC.styleSheets, "all");var rule;var cssText;var styleSheet;for(var i=0;styleSheet=styleSheets[i];i++){var rules=styleSheet.rules;if(rules&&rules.length)for(var j=0,ruleLength=rules.length;j