_UD_='undefined';var FLIR={version:'2.0Liteb1',options:{path:'',defaultStyle:null,onreplacing:null,onreplaced:null},dpi:96,init:function(options){this.options.defaultStyle=new FLIRStyle();if(typeof options!=_UD_)
for(var i in options)
this.options[i]=options[i];this.dpi();},replace:function(o,F){if(!o||o.flirReplaced)return;if(!F||!F.cssMap)
F=this.options.defaultStyle;if(typeof o=='string')return;if(typeof o.length!=_UD_){if(o.length==0)return;for(var i=0;i<o.length;i++)
this.replace(o[i],F);return;}
o.flirStyle=F;if(typeof FLIR.options.onreplacing=='function')o=FLIR.options.onreplacing(o,F);o.innerHTML=o.innerHTML.replace(/^\s+|\s+$/g,'').replace(/<\s*(\w|\/)[^>]+>/g,'');var op=F.options.output;if((typeof document.body.style.maxHeight==_UD_)&&(o.fPNG6=(op=='png'||(op=='auto'&&FLIR.style(o,'background-color')=='transparent'))))
FLIR._Rimg(o,F,true);else
FLIR._Rimg(o,F);if(typeof FLIR.options.onreplaced=='function')FLIR.options.onreplaced(o,F);},_Rimg:function(o,F,png6){var img=document.createElement('IMG');var url=F.URL(o);img.alt=o.innerHTML;img.onerror=function(){o.innerHTML=img.alt;};img.className='flir-image';img.style.border='none';if(png6){img.src=this.options.path+'spacer.png';if(o.offsetWidth){img.style.width=o.offsetWidth+'px';img.style.height=o.offsetHeight+'px';}
img.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+url+'", sizingMethod="image")';}else{img.src=url;}
o.innerHTML='';o.appendChild(img);},style:function(el,prop){if(el.currentStyle){if(prop.indexOf('-')>-1)
prop=prop.split('-')[0]+prop.split('-')[1].substr(0,1).toUpperCase()+prop.split('-')[1].substr(1);var y=el.currentStyle[prop];}else if(window.getComputedStyle){var y=document.defaultView.getComputedStyle(el,'').getPropertyValue(prop);}
return y;},dpi:function(){if(screen.logicalXDPI){var dpi=parseInt(screen.logicalXDPI);}else{var dpicook=document.cookie.match(/<dpi>(\d+)<\/dpi>/);if(dpicook){this.dpi=dpicook[1];return;}
var test=document.createElement('DIV');test.style.position='absolute';test.style.visibility='hidden';test.style.border=test.style.padding=test.style.margin='0';test.style.height=test.style.width='1in';document.body.appendChild(test);var dpi=parseInt(test.offsetHeight);document.body.removeChild(test);var future=new Date();future.setDate(new Date().getDate()+365);document.cookie='dpi=<dpi>'+this.dpi+'</dpi>;expires='+future.toGMTString()+';path=/';}
if(dpi>0)
this.dpi=dpi;}};function FLIRStyle(options){this.options={};this.defaults={mode:'static',output:'auto',fixBaseline:false,hq:false,css:{}};this.cssMap={'background-color':'Background','color':'Color','font-family':'Font','font-size':'FontSize','line-height':'LineHeight','text-align':'Default'};for(var i in this.defaults)
this.options[i]=this.defaults[i];if(options&&typeof options.css=='string')
options.css=this.pcs(options.css);if(typeof this.loadopts==_UD_)console.log(this);this.loadopts(options);}
FLIRStyle.prototype.loadopts=function(options){for(var i in this.cssMap){i=i.replace(/[A-Z]/g,function(w){return'-'+w.toLowerCase();});this.options['css'][i]=options&&options.css&&typeof options.css[i]!=_UD_?options.css[i]:null;}
if(typeof options!=_UD_){for(var i in options){if(options[i]==null)continue;if(typeof this[i]!=_UD_){this[i]=options[i];}else{if(i=='css')
for(var csi in options[i])
this.options[i][csi]=options[i][csi];else
this.options[i]=options[i];}}}};FLIRStyle.prototype.pcs=function(css){var p=css.split(';');var c={};var v;for(var i=0;i<p.length;i++){if(p[i].indexOf(':')<0)continue;v=p[i].split(':');c[v[0].replace(/^\s+|\s+$/,'')]=v[1].replace(/^\s+|\s+$/,'');}
return cssobj;};FLIRStyle.prototype.URL=function(o,ot){var tx=ot?ot:o.innerHTML;var t=this.options.css['text-transform'];if(t==null)
t=FLIR.style(o,'text-transform');switch(t){case'capitalize':tx=tx.replace(/\w+/g,function(w){return w.charAt(0).toUpperCase()+w.substr(1).toLowerCase();});break;case'lowercase':tx=tx.toLowerCase();break;case'uppercase':tx=tx.toUpperCase().replace(/&[a-z0-9]+;/gi,function(m){return m.toLowerCase();});break;}
return FLIR.options.path+'generate.php?t='+this.enc(tx,o.fPNG6)+'&h='+o.offsetHeight+'&w='+o.offsetWidth+'&c='+this.fC(o)+'&d='+FLIR.dpi+'&f='+this.ser();};FLIRStyle.prototype.enc=function(str,bIE6Png){str=encodeURIComponent(str.replace(/&/g,'{*A}').replace(/\+/g,'{*P}').replace(/\(/g,'{*LP}').replace(/\)/g,'{*RP}'));if(bIE6Png)
str=escape(str);return str;};FLIRStyle.prototype.ser=function(){var s='';for(var i in this.options){if(i=='css'||this.options[i]==this.defaults[i])continue;s+=',"'+i+'":"'+this.options[i].toString().replace(/"/g,"'")+'"';}
return encodeURIComponent('{'+s.substr(1)+'}');};FLIRStyle.prototype.fC=function(o){var opt={};for(var i in this.options.css)
opt[i]=this.options.css[i];for(var i in this.cssMap)
this.options.css[i]=this.get(o,i,this.cssMap[i]);var s='';for(var i in this.options.css){if(this.options.css[i]==null||typeof this.options.css[i]==_UD_)
this.options.css[i]='';s+='|'+encodeURIComponent(this.options.css[i].toString().replace(/|/g,''));}
s=s.substr(1);this.options.css=opt;return s;};FLIRStyle.prototype.get=function(o,css_property,flirstyle_name){var func='get'+flirstyle_name;var optprop=this.options.css[css_property];var val=!optprop||optprop==null?FLIR.style(o,css_property):this.options.css[css_property];var ret=typeof this[func]=='function'?this[func](o,val):val;return ret=='normal'||ret=='none'||ret=='start'?'':ret;};FLIRStyle.prototype.getBackground=function(o,val){return this.getColor(o,val);};FLIRStyle.prototype.getFont=function(o,val){if(val.indexOf(','))
val=val.split(',')[0];return val.replace(/['"]/g,'').toLowerCase();};FLIRStyle.prototype.getColor=function(o,val){switch(val){case'transparent':case'none':return'';default:if(val.substr(0,1)=='#')
val=val.substr(1);return val.replace(/['"\(\) ]|rgba?/g,'').toLowerCase();}};FLIRStyle.prototype.getFontSize=function(o,val){var px=this.getMeasurement(o,val,true);var prepx=px;if('*/+-'.indexOf(val[0])>-1){try{px=Math.round((parseFloat(eval(px.toString().concat(val))))*10000)/10000;}catch(err){px=16;}}
o.flirFontSize=px;return px;};FLIRStyle.prototype.getMeasurement=function(o,val,bFontSize){var px,em,prcnt;if(val=='normal'||val=='none')return'';if(val.indexOf('px')>-1){px=Math.round(parseFloat(val));}else if(val.indexOf('pt')>-1){var pts=parseFloat(val);px=pts/(72/FLIR.dpi);}else if((em=(val.indexOf('em')>-1))||(prcnt=(val.indexOf('%')>-1))){if(!o.flirFontSize){var test=document.createElement('DIV');test.style.padding=test.style.border='0';test.style.position='absolute';test.style.visibility='hidden';if(bFontSize)
test.style.lineHeight='100%';test.innerHTML='FlirTest';o.appendChild(test);px=test.offsetHeight;o.removeChild(test);}else{px=o.flirFontSize;}}
return px;};
