var _translation={};
var _constant={};
function _translate(_1,_2){
if(_translation[_1]!=undefined){
if(typeof (_translation[_1])=="string"){
return _translation[_1];
}else{
return _translation[_1].process(_2);
}
}else{
return "@"+_1+"@";
}
}
translateModifier=function(_3){
data={};
for(var i=1;i<arguments.length;i+=2){
var _5=arguments[i];
var _6=arguments[i+1];
data[_5]=_6;
}
return _translate(_3,data);
};
var fancyLayoutCache=new Object();
fancyLayout=function(s,_8){
var _9=false;
var _a="";
for(var i=0;i<arguments.length;i++){
if(arguments[i]){
_a+=arguments[i].toString();
}
}
if(startsWith(s,"[gadget]")){
_9=true;
}
if(_9||!fancyLayoutCache[_a]){
if(_8){
_8=_8.replace("!","|");
}
fancyLayoutCache[_a]=fancy_layout(s,_8);
}
return fancyLayoutCache[_a];
};
function _Template(_c,_d){
this.name=_c;
this.code=_d;
this.template=null;
}
_Template.prototype.process=function(_e){
if(this.template==null){
try{
this.template=TrimPath.parseTemplate(this.code);
}
catch(e){
logging.error("error while parsing template:"+this.name+": "+e,e);
return "";
}
}
if(_e==undefined){
_e={};
}
_e._MODIFIERS={quoteElement:quoteElement,quoteAttr:quoteAttr,fancyLayout:fancyLayout,fancy_layout:fancyLayout,translate:translateModifier};
_e.throwExceptions=true;
try{
return this.template.process(_e,_e);
}
catch(e){
logging.error("error while processing template:"+this.name+": "+e,e);
return "";
}
};
var templateCache=new Object();
function _getTemplate(id){
if(!templateCache[id]){
templateCache[id]=new _Template(id,id);
}
return templateCache[id];
}
function _delay(_10,_11,_12){
if(_10){
setTimeout(function(){
if($(_11)){
_12();
}else{
setTimeout(function(){
if($(_11)){
_12();
}
},200);
}
},10);
}else{
_12();
}
}
templates={get:function(id){
return _getTemplate(id);
},addFromString:function(id,_15){
templateCache[id]=new _Template(id,_15);
},addTranslation:function(key,_17){
_translation[key]=new _Template(key,_17);
},addConstant:function(key,_19){
_constant[key]=_19;
},updateElement:function(_1a,_1b,_1c,_1d,_1e){
_delay(_1d,_1a,function(){
try{
$(_1a).innerHTML=templates.get(_1b).process(_1c);
if(_1e){
_1e();
}
}
catch(e){
logging.error("error processing template: "+e,e);
}
});
},insertBottom:function(_1f,_20,_21){
new Insertion.Bottom(_1f,templates.get(_20).process(_21));
},insertTop:function(_22,_23,_24){
new Insertion.Top(_22,templates.get(_23).process(_24));
},insertBefore:function(_25,_26,_27){
new Insertion.Before(_25,templates.get(_26).process(_27));
},process:function(_28,_29){
return templates.get(_28).process(_29);
},translate:function(key,_2b){
return _translate(key,_2b);
},exists:function(key){
if(templateCache[key]){
return true;
}else{
return false;
}
},constant:function(key){
if(_constant[key]!=undefined){
return _constant[key];
}else{
return "#"+key+"#";
}
},reload:function(id){
var url="/";
var _30="module=Utility&action=compileTemplate&id="+id;
var _31=new Ajax.Request(url,{asynchronous:false,method:"get",parameters:_30,onSuccess:function(_32){
eval(_32.responseText);
}});
}};


