if("undefined"==typeof console){var _noOp=function(){};window.console={info:_noOp,error:_noOp,warn:_noOp,clear:_noOp,debug:_noOp,assert:_noOp,log:_noOp}}var Widgets={version:"1.01",debug:!1,debugOptions:{globalEvents:!0,instanceCreation:!0,render:!1,observe:!0,widgetLoaded:!1,checkJsDoc:!1},widgets:{},cssWidgets:[],globalFailure:!1,urlRoutes:{routes:[]},session:{},asyncJsonErrorHandler:function(e,t,n){$W.alert("Error on ajax call to: "+this.url+"\n\n"+n,this.getWidgetName()),console.info(this)},stackTrace:{cur:0,data:[],add:function(e){this.data[this.cur]?this.data[this.cur]=e:this.data.push(e),this.cur++},remove:function(){this.cur--},getData:function(){return this.data.slice(0,this.cur)}},pageReady:function(){var e=[],t=null,n=null,r=null;if($("HEAD>META").each(function(){var i=$(this),a=i.attr("name");if(a)if("widgets"===a){if(!i.attr("content"))return void $W.alert("<META> TAG 'widgets' has no content.");e.push(i.attr("content"))}else if("widgets:callback"===a)t=i.attr("content");else if("widgets:url:prefix"===a)n=i.attr("content");else if("widgets:progress:callback"===a)r=i.attr("content");else if("url-match"===a){var o=i.attr("url");if(!o)return void $W.alert("<META> TAG 'url-match' has no 'url' attribute.");if(!i.attr("handler"))return void $W.alert("<META> TAG 'url-match' has no 'handler' attribute.");o=$.trim(o),"function"==typeof window[i.attr("handler")]?"/"==o?$W.urlRoutes.home=i.attr("handler"):$W.urlRoutes.routes.push({handler:i.attr("handler"),url:o}):$W.alert("<META> TAG 'url-match'\n\nHandler does NOT exist: "+i.attr("handler"))}else if("url-match:otherwise"===a){if(!i.attr("handler"))return void $W.alert("<META> TAG 'url-match' has no 'handler' attribute.");"function"==typeof window[i.attr("handler")]?$W.urlRoutes["default"]=i.attr("handler"):$W.alert("<META> TAG 'url-match'\n\nHandler does NOT exist: "+i.attr("handler"))}}),0!=e.length){for(var i in $W.urlRoutes.routes){var a=$W.urlRoutes.routes[i].url.replace(/\{\w+\}/g,"(\\w+)");$W.urlRoutes.routes[i].regExp=new RegExp(a)}$W.loading={widgetUrls:[],callback:t,level:0,loaded:0,total:0,totalLoaded:0,prefix:n},r&&($W.loading.progress=window[r]);for(var o=0;o<e.length;o++)$W.loading.widgetUrls[o]=e[o].split(","),$W.loading.total+=$W.loading.widgetUrls[o].length;"undefined"==typeof window.loadWidgetsUsingTag?$W.loadLevelWidgets():$W.loadWidgetsUsingTag()}},define:function(e){var t=window;if(e.indexOf(".")>-1)for(var n=e.split("."),r=0;r<n.length;r++)console.info(r+":  "+n[r]),"undefined"==typeof t[n[r]]&&(t[n[r]]={}),t=t[n[r]];else"undefined"==typeof t[e]&&(t[e]={})},routeUrl:function(){var e=location.hash;if(e){if(e=$.trim(e),"#"===e.substring(0,1)&&(e=e.substring(1)),"/"!=e){var t=!1;for(var n in $W.urlRoutes.routes){var r=$W.urlRoutes.routes[n];if(r.regExp.test(e)){t=!0;var i=r.regExp.exec(e).splice(1);try{window[r.handler].apply(window,i)}catch(a){$W.alert("[URL-Match Function]: "+r.handler+"\n\n"+a.message)}break}}return!t&&$W.urlRoutes["default"]?void window[$W.urlRoutes["default"]].call(window):void 0}if($W.urlRoutes["/"])return void window[$W.urlRoutes["/"]].call(window)}else{if($W.urlRoutes.home)return void window[$W.urlRoutes.home].call(window);if($W.urlRoutes["default"])return void window[$W.urlRoutes["default"]].call(window)}},appendCssLinks:function(){var e,t,n=$("HEAD").first();for(var r in $W.cssWidgets)t=$W.cssWidgets[r].substring(0,$W.cssWidgets[r].lastIndexOf(".")),e=$W.core.replacer("%1%2.css",$W.loading.prefix,t),$$("link").attr({rel:"stylesheet",href:e,type:"text/css",media:"screen"}).appendTo(n)},addWidgetLevel:function(e){$W.loading.widgetUrls.push(e.split(","))},internal_widgetProcessed:function(e){if($W.loading.loaded++,$W.loading.totalLoaded++,$W.loading.loaded===$W.loading.widgetUrls[$W.loading.level].length)if($W.loading.progress&&$W.loading.progress(Math.floor(100*$W.loading.totalLoaded/$W.loading.total)),$W.loading.loaded=0,$W.loading.level++,$W.loading.level<$W.loading.widgetUrls.length)$W.loadLevelWidgets();else{if($W.shadow("--< All Widgets loaded >--"),null!=$W.loading.callback){$W.appendCssLinks();var t=window[$W.loading.callback];if(!t||"function"!=typeof t)return void $W.alert("Callback is NOT a Function!");try{window[$W.loading.callback].call(window)}catch(n){return void $W.alert("[Callback Function]: "+n.message)}}$W.routeUrl()}},internal_processHtml:function(isolated,filePrefix,jsRaw){try{eval(jsRaw)}catch(exc){return void $W.alert(filePrefix+".js : Syntax JS Exception: "+exc.message)}var widgetName=$W.lastWName;return isolated?($W.shadow("[ASYNC LOAD]"+widgetName+" succesfully loaded."),void $W.loading.callback()):void $W.internal_widgetProcessed(widgetName)},loadLevelWidgets:function(){for(var e=$W.loading.widgetUrls[$W.loading.level],t=0;t<e.length;t++)$W.asyncLoadWidget(e[t])},loadWidgetsUsingTag:function(){for(var e,t,n,r;$W.loading.level<$W.loading.widgetUrls.length;){e=$W.loading.widgetUrls[$W.loading.level];for(var i=0;i<e.length;i++)t=$.trim(e[i]),n=$W.core.getFile(t),r=$W.core.replacer("%1%2/%3.js",$W.loading.prefix,t,n),$("HEAD").append($$("script").attr({type:"text/javascript",src:r}));$W.loading.level++}$("HEAD").append($$("script").attr({type:"text/javascript"}).text("window."+$W.loading.callback+"(); $W.appendCssLinks();"))},asyncLoadWidget:function(e,t){t&&($W.loading.callback=t);var n=t?!0:!1,r=$.trim(e),i=$W.core.getFile(r),a=$W.core.replacer("%1%2/%3.js",$W.loading.prefix,r,i);$.ajax({url:a,cache:!1,type:"GET",dataType:"html",success:$W.internal_processHtml.curry(n,r),error:function(e,t,n){$W.alert(r+".js - "+e.status+" : "+n+"\n\n[Url Real] "+this.url,"Widget-Loader")}})},show:function(e){alert(e)},shadow:function(e){console&&console.info(e)},alert:function(e,t){var n="[Widgets "+$W.version+"] \n\n"+e+" ";t&&(n+="\n\nWidget:   "+t+" "),$W.show(n)},core:{replacer:function(e){for(var t=arguments.length-1,n=1;t>=n;n++)e=e.replace(new RegExp("%"+n,"g"),arguments[n]);return e},replaceRegex:/id=\"([\w-_#]+)\"/gi,cssVarRegex:/\${class}/gi,isDouble:function(e){return/^[\-+]{0,1}[0-9]*[.]{0,1}[0-9]*$/.test(e)},isEmail:function(e){return/^(([0-9a-zA-Z]+[\-._+&])*[0-9a-zA-Z]+@([\-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}){0,1}$/.test(e)},isUrl:function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},isNumber:function(e){return/^[\-]{0,1}[0-9]+$/.test(e)},isRequired:function(e){return e.trim().length>0},maxLength:function(e,t){return t.trim().length<=e},minLength:function(e,t){return t.trim().length>=e},min:function(e,t){return t>=e},max:function(e,t){return e>=t},between:function(e,t,n){return t>=n&&n>=e},matchRegex:function(e,t){return e.test(t)},validationMessage:{Url:"Must be an url.",RegEx:"Must match a regular expression.",Between:"Must be between these numbers: ",Min:"The minimum value is: ",Max:"The maximum value is: ",MinLength:"The minimum length is: ",MaxLength:"The maximum length is: ",Email:"Must be an email.",Number:"Must be a number.",Required:"Can't be empty",Double:"Must be a number"},getFile:function(e){var t=e.lastIndexOf("/");return-1==t&&(t=e.lastIndexOf("\\")),-1==t?e:e.substring(t+1)}},eventsMapping:{allHandlers:[]},_observeEvent:function(e,t){$W.eventsMapping[t]?-1==$.inArray(e,$W.eventsMapping[t])&&$W.eventsMapping[t].push(e):$W.eventsMapping[t]=[e]},_removeObserver:function(e,t){$W.eventsMapping[t]&&($W.eventsMapping[t]=$.grep($W.eventsMapping[t],function(t){return e.getWidgetName()!=t.getWidgetName()}))},_fireEvent:function(e,t,n){var r="string"==typeof n?n:n.getWidgetName(),i=$W.core.replacer,a=$W.eventsMapping[e];if(a){$W.stackTrace.add(i("--> EVENT fired: '%1' by: %2",e,r)),$W.debug&&$W.debugOptions.globalEvents&&$W.shadow(i("<-> Evento global: '%1' (%2). Observers: %3",e,r,a.length+$W.eventsMapping.allHandlers.length));for(var o,s=0;s<a.length;s++){o=a[s];var l="onEvent"+e.capitalize();$.isFunction(o[l])?($W.debug&&$W.debugOptions.globalEvents&&$W.shadow(i("'%1' <-> (%2)",e,o.getWidgetName())),o[l](t)):$.isFunction(o.eventsMapping)&&($W.debug&&$W.debugOptions.globalEvents&&$W.shadow(i("'%1' <-> (%2)",e,o.getWidgetName())),o.eventsMapping(e,t))}for(var d=$W.eventsMapping.allHandlers,s=0;s<d.length;s++)o=d[s],$.isFunction(o.allEventsHandler)&&($W.debug&&$W.debugOptions.globalEvents&&$W.shadow(i("'%1' <-> (%2)",e,o.getWidgetName())),o.allEventsHandler(e,t));$W.stackTrace.remove()}else $W.debug&&$W.debugOptions.globalEvents&&$W.shadow(i('<-> Evento global -sin observers-: "%1" (por %2)',e,r))},printStackTrace:function(e,t,n){n||(n=$W.stackTrace.getData());var r=$W.core.replacer,i="";e&&(e=e.message,i+=t?r("%1\non widget: %2 \n\n",e,t):r("%1\n\n",e));for(var a=n.length-1;a>=0;a--)-1==n[a].indexOf("fireEvent (")&&(i+=n[a]+"\n");$W.alert(i)},stackTraceHelper:function(e,t,n,r,i,a){return n&&n.method===e&&n.widget===t?(i.push(n.widgetHierarchy?r("at %1 (%2)\n",e,$W.widgets[n.widgetHierarchy].parent):r("at %1 (%2)\n",e,$W.widgets[t].parent)),n.widgetHierarchy=$W.widgets[t].parent,n):(i.push(r("at %1 (%2)\n",e,t)),a)}};window.$W=Widgets,String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")}),String.prototype.capitalize||(String.prototype.capitalize=function(){return this.replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()})}),String.prototype.uncapitalize||(String.prototype.uncapitalize=function(){return this.substring(0,1).toLowerCase()+this.substring(1)}),Function.prototype.bind||(Function.prototype.bind=function(e){var t=[].slice,n=t.call(arguments,1),r=this,i=function(){},a=function(){return r.apply(this instanceof i?this:e||{},n.concat(t.call(arguments)))};return i.prototype=r.prototype,a.prototype=new i,a}),Function.prototype.curry=function(){var e=this,t=Array.prototype.slice.call(arguments);return function(){return e.apply(this,t.concat(Array.prototype.slice.call(arguments)))}},function(){var e=!1,t=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){},Class.extend=function(n){function r(){!e&&this.initialize&&this.initialize.apply(this,arguments)}var i=this.prototype;e=!0;var a=new this;e=!1;var o=[];if(i.getWidgetName&&(a.getSuperClass=function(){return i.getWidgetName()}),!n.id)throw $W.globalFailure=!0,new Error("No ID property found.");if($W.widgets[n.id])throw new Error("\n\nYa existe un widget con id: '"+n.id+"'\n\nPosible copy paste de widgets?");$W.widgets[n.id]={parent:"[root]",instanceCount:0},i.getWidgetName&&($W.widgets[n.id].parent=i.getWidgetName()),a.widgetDefinition=$W.widgets[n.id],a.getWidgetName=function(){return"undefined"==typeof this._instanceId?n.id+"-?":n.id+"-"+this._instanceId},$W.lastWName=n.id,$W.hasCss=n.includeCss,a.jsdoc={};for(var s in n)"getWidgetName"!=s&&("function"==typeof n[s]&&"function"==typeof i[s]&&t.test(n[s])?(a[s]=function(e,t){return function(){if(!$W.globalFailure){if("undefined"==typeof this.getWidgetName)return void alert("[Widgets "+$W.version+"] \n\nPosible metodo sin 'handler'. Informacion:\n\nTag: "+this.nodeName+"\nId: "+$(this).attr("id"));$W.stackTrace.add($W.core.replacer("at %1 (%2)",e,this.getWidgetName()));var n=this._super;this._super=i[e];try{var r=t.apply(this,arguments)}catch(a){$W.printStackTrace(a),$W.globalFailure=!0}return $W.stackTrace.remove(),this._super=n,r}}}(s,n[s]),a[s].n=s):"function"==typeof n[s]&&"_"!==s.substring(0,1)&&"local"!==s.substring(0,5)?(o.push(s),a[s]=function(e,t){return function(){if(!$W.globalFailure){if("undefined"==typeof this.getWidgetName)return void alert("[Widgets "+$W.version+"] \n\nPosible metodo(leaf) sin 'handler'. Informacion:\n\nTag: "+this.nodeName+"\nId: "+$(this).attr("id"));$W.stackTrace.add($W.core.replacer("at %1 (%2)",e,this.getWidgetName())),("initialize"===e||"render"===e)&&"function"==typeof i[e]&&i[e].apply(this,arguments);try{3==arguments.length&&arguments[2]&&arguments[2].readyState&&arguments[2].responseText&&(this.ajaxing=!1);var n=t.apply(this,arguments)}catch(r){$W.printStackTrace(r,this.getWidgetName()),$W.globalFailure=!0}return $W.stackTrace.remove(),n}}}(s,n[s]),a[s].n=s):s.toLowerCase().indexOf("jsdoc")===s.length-5&&"string"==typeof n[s]&&n[s].length>5?a.jsdoc[s.substring(0,s.length-5)]=n[s]:a[s]=n[s]);if($W.debugOptions.checkJsDoc)for(var l=0;l<o.length;l++){var d=o[l];"render"!==d&&"initialize"!==d&&!a.jsdoc[d]&&window.console&&window.console.warn&&console.warn("No hay jsDoc para '"+d+"' ("+n.id+")")}if(n.staticFunctionsOrder)for(var l=0;l<n.staticFunctionsOrder.length;l++){var c=n.staticFunctionsOrder[l];n[c]()}else for(var l=0;l<o.length;l++)"static"==o[l].toLowerCase().substring(0,6)&&n[o[l]]();return a._classFunctions=function(){return o},r.prototype=a,r.constructor=r,r.extend=arguments.callee,r}}(),Widgets.AbstractWidget=Class.extend({id:"AbstractWidget",_rendered:0,initialize:function(){this._instanceId=this.widgetDefinition.instanceCount++,this.initBindings(),this.observers=[],this._callbackLog={},$W.debug&&$W.debugOptions.instanceCreation&&$W.shadow($W.core.replacer("Instancia creada: %1",this.getWidgetName()))},lightMergeJsDoc:"Permite mergear dos objetos, agregando el segundo al primero. Si hay 2 propiedades iguales, no la pisa.",lightMerge:function(e,t){if(null==e||null==t){var n="Source is null";throw null!=e&&null==t&&(n="Target is null"),new Error("Merge: Null not allowed! "+n)}for(var r in t)("undefined"==typeof e[r]||null===e[r])&&(e[r]=t[r])},initBindingsJsDoc:"Inicializa el binding para funciones de handler",initBindings:function(){for(var e=0;e<this._classFunctions().length;e++){var t=this._classFunctions()[e];"allEventsHandler"==t&&this.observeEvent("allHandlers"),"onEvent"===t.substring(0,7)&&this.observeEvent(t.substring(7).uncapitalize()),t.toLowerCase().indexOf("handler")>-1&&(this[t]=this[t].bind(this))}},getElementByIdJsDoc:"Obtiene un elemento [nativo HTML] mediante un ID del template",getElementById:function(e){var t=this.getElementId(e);return document.getElementById(t)||null},$getJsDoc:"Obtiene un elemento [jQuery] a partir de un ID del template",$get:function(e){if(0==this._rendered)throw new Error("$get(): Widget it's NOT rendered!");return $(this.getElementById(e))},cloneJsDoc:"clona un objeto",clone:function(e){var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},$spanJsDoc:"Helper que crea un objeto jQuery <SPAN>",$span:function(){return $(document.createElement("SPAN")).append(arguments[0])},$newJsDoc:"Permite crear un elemento dinamicamente",$new:function(e){return $(document.createElement(e))},$divJsDoc:"Helper que crea un objeto jQuery <DIV>",$div:function(){return $(document.createElement("DIV"))},$buttonJsDoc:"Helper que crea un objeto jQuery <INPUT> de tipo BUTTON",$button:function(e){return this.$new("input").attr("type","button").val(e)},$textInputJsDoc:"Helper que crea un objeto jQuery <INPUT> de tipo TEXT",$textInput:function(e){return this.$new("input").attr("type","text").val(e)},$checkJsDoc:"Helper que crea un CHECKBOX, opcionalmente marcado",$check:function(e){return this.$new("input").attr("type","checkbox").attr("checked",e)},$radioJsDoc:"Helper que crea un RADIOBUTTON, opcionalmente marcado",$radio:function(e){return this.$new("input").attr("type","radio").attr("checked",e)},$tableJsDoc:"Helper que crea un objeto TABLE",$table:function(){return this.$new("table")},$tdJsDoc:"Helper que crea un <TD> opcionalmente con contenido",$td:function(){return $(document.createElement("TD")).append(arguments.length>1?Array.prototype.slice.call(arguments):arguments[0])},$trJsDoc:"Helper que crea un <TR>",$tr:function(){return $(document.createElement("TR"))},getElementIdJsDoc:"Metodo interno que resuelve un ID de template, en ID real",getElementId:function(e){var t="W:"+this.id+":"+e+":"+this._instanceId;return t},generateIdJsDoc:"Genera un id en el contexto de la instancia",generateId:function(e){return"W:"+this.id+":"+e+":"+this._instanceId},getHtmlTemplateJsDoc:"Metodo interno, obtiene el template del widget",getHtmlTemplate:function(){var e=this.widgetDefinition.htmlTemplate,t=$W.core.replacer('id="W:%1:$1:%2"',this.id,this._instanceId);return e=e.replace($W.core.replaceRegex,t)},render:function(e,t){if("disable-render"!==e){e?"string"==typeof e?this._container=$(e):this._container=e:this._container=$(document.body),this._container.attr("widget:rendered",this.getWidgetName());var n=this.getHtmlTemplate();return $W.debug&&$W.debugOptions.render&&$W.shadow($W.core.replacer("Widget %1 renderizado",this.getWidgetName())),t?(this._container.append(n),this._rendered++,this):(this._container.empty(),this._container.html(n),this._rendered++,this)}},getContainerJsDoc:"Retorna el contenedor donde fue renderizado el widget",getContainer:function(){return this._container},observeJsDoc:"Permite observar la instancia de otro widget, reaccionando en un metodo especifico",observe:function(e,t){$W.debug&&$W.debugOptions.observe&&$W.shadow($W.core.replacer("%1 observa a: %2 [%3]",this.getWidgetName(),e.getWidgetName(),t)),e.observers.push([this,t])},updateObserversJsDoc:"Dispara que todos los widgets que lo observaban (observe) reaccionen",updateObservers:function(e){$W.debug&&$W.debugOptions.observe&&$W.shadow($W.core.replacer("[] Actualizando observers por: %1. Observadores: %2",this.getWidgetName(),this.observers.length));for(var t=0;t<this.observers.length;t++){var n=this.observers[t][0];$W.debug&&$W.debugOptions.observe&&$W.shadow($W.core.replacer("(-) Widget %1 reacciona ejecutando '%2'",n.getWidgetName(),this.observers[t][1])),n[this.observers[t][1]].call(n,e)}},observeEventJsDoc:"Permite observar un evento global",observeEvent:function(e){$W._observeEvent(this,e)},stopObservingJsDoc:"Deja de observar un evento global",stopObserving:function(e){$W._removeObserver(this,e)},fireEventJsDoc:"Dispara un evento global, con posibles datos asociados",fireEvent:function(e,t){$W._fireEvent(e,t,this)},_validations:{},asyncJsonJsDoc:"Ejecuta una peticion AJAX, asumiendo que la respuesta del servidor es en lenguaje JSON",asyncJson:function(e,t,n,r,i){if(!t)throw new Error("Ajax: Undefined URL!");i||(i={}),this.url=t;var a={url:t,context:this,data:n,headers:{"Widget-Origin":this.getWidgetName()},type:i.method?i.method:"POST",processData:void 0!=typeof i.processData?i.processData:!0,success:r?[e,function(){this._callbackLog[e.n]=!0,this.postCallback()}]:e,dataType:i.dataType?i.dataType:"json",error:$W.asyncJsonErrorHandler};i.contentType&&(a.contentType=i.contentType),this.ajaxing=!0,$.ajax(a)},asyncFormDataJsDoc:"Ejecuta una peticion AJAX enviando un FormData (multipart)",asyncFormData:function(e,t,n,r){r||(r={});var i={url:t,context:this,data:n,type:"POST",processData:!1,success:e,contentType:!1,dataType:r.dataType?r.dataType:"json",error:$W.asyncJsonErrorHandler};$.ajax(i)},postCallbackJsDoc:"Metodo que debe redefinir cada widget, en caso de usar el metodo",postCallback:function(){throw new Error("Redefinir metodo")},asyncTextJsDoc:"Ejecuta una peticion AJAX, asumiendo una respuesta del server de texto",asyncText:function(e,t,n,r){if(r||(r={}),!t)throw new Error("Ajax: Undefined URL!");$.ajax({url:t,context:this,data:n,headers:r.headers,type:"POST",success:e,dataType:"text",error:function(e,n,r){$W.alert("Error on ajax call to: "+t+"\n\n"+r,this.getWidgetName())}})},toString:function(){return"Widget: "+this.getWidgetName()},printStackTraceJsDoc:"Muestra un stacktrace al usuario",printStackTrace:function(e){$W.printStackTrace(e)},getSession:function(){return $W.session},getWidgetName:function(){return"AbstractWidget"}}),$($W.pageReady),window.$$=function(e){return $(document.createElement(e))};