(function($){var _fichRecurso="recurso.php";$.placom=$.placom||{};$.placom.Placom={getFicheroRecurso:function(){return _fichRecurso},setFicheroRecurso:function(fichero){_fichRecurso=fichero;return this}};$.placom.Clase=function(){var hasBase=typeof(arguments[0])=="function",base=hasBase?arguments[0]:function(){},override=arguments[hasBase?1:0],statical=arguments[hasBase?2:1],result=function(){if(this.__construct){this.__construct.apply(this,arguments)}},inheritance=function(){};$.extend(result,base,statical);inheritance.prototype=base.prototype;result.prototype=new inheritance();result.prototype.constructor=result;result.prototype.__self=result;if(override){var _override=[];$.each(override,function(i){_override.push(i)});for(var i in override){if(override.hasOwnProperty(i)){_override.push(i)}}if(override.toString&&$.inArray("toString",_override)==-1){_override.push("toString")}$.each(_override,function(){if(hasBase&&typeof(base.prototype[this])=="function"&&typeof(result.prototype[this])=="function"){(function(methodName){result.prototype[methodName]=function(){var __baseSaved=this.__base;this.__base=base.prototype[methodName];var result=override[methodName].apply(this,arguments);this.__base=__baseSaved;return result}})(this)}else{result.prototype[this]=override[this]}})}return result};var _toString=Object.prototype.toString;$.extend(jQuery,{isNumber:function(object){return typeof object=="number"},isString:function(object){return _toString.call(object)=="[object String]"},isUndefined:function(object){return typeof object==="undefined"}});$.extend(Function.prototype,{unir:function(){if(arguments.length<2&&arguments[0]===undefined){return this}var __method=this,args=$.merge([],arguments),object=args.shift();return function(){return __method.apply(object,args.concat($.merge([],arguments)))}},unirConEvento:function(){var __method=this,args=$.merge([],arguments),object=args.shift();return function(event){return __method.apply(object,[event||window.event].concat(args))}}});var $break={};var metodosExtArray={__extendido:true,_each:function(iterator){for(var i=0,length=this.length;i<length;i++){iterator(this[i])}},all:function(iterator,context){iterator=iterator||function(x){return x};var result=true;this.each(function(value,index){result=result&&!!iterator.call(context,value,index);if(!result){throw $break}});return result},any:function(iterator,context){iterator=iterator||function(x){return x};var result=false;this.each(function(value,index){if(result=!!iterator.call(context,value,index)){throw $break}});return result},clear:function(){this.length=0;return this},clone:function(){return[].concat(this).extendido()},collect:function(iterator,context){iterator=iterator||function(x){return x};var results=[].extendido();this.each(function(value,index){results.push(iterator.call(context,value,index))});return results},detect:function(iterator,context){var result;this.each(function(value,index){if(iterator.call(context,value,index)){result=value;throw $break}});return result},compact:function(){return this.select(function(value){return value!==null}).extendido()},each:function(iterator,context){context=context||this;var index=0;try{this._each(function(value){iterator.call(context,value,index++)})}catch(e){if(e!=$break){throw e}}return this},eachSlice:function(number,iterator,context){var index=-number,slices=[],array=this.toArray();if(number<1){return array}while((index+=number)<array.length){slices.push(array.slice(index,index+number))}return slices.extendido().collect(iterator,context)},extended:function(){return true},findAll:function(iterator,context){var results=[].extendido();this.each(function(value,index){if(iterator.call(context,value,index)){results.push(value)}});return results},flatten:function(){return this.inject([],function(array,value){return array.concat($.isArray(value)?value.extendido().flatten():[value]).extendido()})},first:function(){return this[0]},grep:function(filter,iterator,context){iterator=iterator||function(x){return x};var results=[].extendido();if(typeof filter==="string"){filter=new RegExp(filter)}this.each(function(value,index){if(filter.test(value)){results.push(iterator.call(context,value,index))}});return results},include:function(object){if($.isFunction(this.indexOf)){if(this.indexOf(object)!=-1){return true}}var found=false;this.each(function(value){if(value==object){found=true;throw $break}});return found},indexOf:function(item,i){i||(i=0);var length=this.length;if(i<0){i=length+i}for(;i<length;i++){if(this[i]===item){return i}}return -1},inGroupsOf:function(number,fillWith){fillWith=fillWith?null:fillWith;return this.eachSlice(number,function(slice){while(slice.length<number){slice.push(fillWith)}return slice})},inject:function(memo,iterator,context){this.each(function(value,index){memo=iterator.call(context,memo,value,index)});return memo},inspect:function(){return"["+this.map($.inspect).join(", ")+"]"},intersect:function(array){array.extendido();return this.uniq().findAll(function(item){return array.detect(function(value){return item===value})})},invoke:function(method){var args=$.makeArray(arguments).slice(1);return this.map(function(value){return value[method].apply(value,args)})},last:function(){return this[this.length-1]},lastIndexOf:function(item,i){i=isNaN(i)?this.length:(i<0?this.length+i:i)+1;var n=this.slice(0,i).reverse().extendido().indexOf(item);return(n<0)?n:i-n-1},max:function(iterator,context){iterator=iterator||function(x){return x};var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value>=result){result=value}});return result},min:function(iterator,context){iterator=iterator||function(x){return x};var result;this.each(function(value,index){value=iterator.call(context,value,index);if(result==null||value<result){result=value}});return result},partition:function(iterator,context){iterator=iterator||function(x){return x};var trues=[],falses=[];this.each(function(value,index){(iterator.call(context,value,index)?trues:falses).push(value)});return[trues,falses]},pluck:function(property){var results=[].extendido();this.each(function(value){results.push(value[property])});return results},purge:function(){return[].concat(this)},reduce:function(){return this.length>1?this:this[0]},reject:function(iterator,context){var results=[].extendido();this.each(function(value,index){if(!iterator.call(context,value,index)){results.push(value)}});return results},size:function(){return this.length},sortBy:function(iterator,context){return this.map(function(value,index){return{value:value,criteria:iterator.call(context,value,index)}}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0}).pluck("value")},toArray:function(){return this.map().clone()},uniq:function(sorted){return this.inject([],function(array,value,index){array.extendido();if(0===index||(sorted?array.last()!=value:!array.include(value))){array.push(value)}return array}).extendido()},without:function(){var values=$.makeArray(arguments).extendido();return this.select(function(value){return !values.include(value)})},zip:function(){var iterator=function(x){return x},args=$.makeArray(arguments).extendido();if($.isFunction(args.last())){iterator=args.pop()}var collections=[this].concat(args).extendido().map();return this.map(function(value,index){return iterator(collections.pluck(index))})}};$.extend(metodosExtArray,{map:metodosExtArray.collect,find:metodosExtArray.detect,select:metodosExtArray.findAll,filter:metodosExtArray.findAll,member:metodosExtArray.include,entries:metodosExtArray.toArray,every:metodosExtArray.all,some:metodosExtArray.any});$.extend(Array.prototype,{extendido:function(){if(!this.__extendido){$.extend(this,metodosExtArray)}return this}});$.extend(String,{interpret:function(value){return value==null?"":String(value)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});var metodosExtString=(function(){function prepareReplacement(replacement){if($.isFunction(replacement)){return replacement}var template=new $.placom.Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if($.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=$.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=$.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!$.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new $.placom.Template(this,pattern).evaluate(object)}return{__extendido:true,gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})();$.extend(String.prototype,{extendido:function(){if(!this.__extendido){$.extend(this,metodosExtString)}return this}});$.placom.Template=$.placom.Clase({__construct:function(template,pattern){this.template=template.toString().extendido();this.pattern=pattern||this.__self.Pattern},evaluate:function(object){if(object&&$.isFunction(object.toTemplateReplacements)){object=object.toTemplateReplacements()}return this.template.gsub(this.pattern,function(match){if(object==null){return(match[1]+"")}var before=match[1]||"";if(before=="\\"){return match[2]}var ctx=object,expr=match[3];var pattern=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;match=pattern.exec(expr);if(match==null){return before}while(match!=null){var comp=match[1].extendido().startsWith("[")?match[2].replace(/\\\\]/g,"]"):match[1];ctx=ctx[comp];if(null==ctx||""==match[3]){break}expr=expr.substring("["==match[3]?match[1].length:match[0].length);match=pattern.exec(expr)}return before+String.interpret(ctx)})}},{Pattern:/(^|.|\r|\n)(#\{(.*?)\})/})})(jQuery);
