
(function(){var getInnerText=function(o){var txt='';for(var i=0;i<o.childNodes.length;i++){switch(o.childNodes[i].nodeType){case 1:txt+=getInnerText(o.childNodes[i]);break;case 3:txt+=o.childNodes[i].nodeValue;break;default:break;}}
return txt;}
var getStyle=function(element,cssRule){if(document.defaultView&&document.defaultView.getComputedStyle){var rs=cssRule.replace(/[A-Z]/g,function(str){return"-"+str.toLowerCase();});var cs=document.defaultView.getComputedStyle(element,'');if(cs!=null)return cs.getPropertyValue(rs);}
else if(element.currentStyle)return element.currentStyle[cssRule];}
var replaceTags=function(){var pattern=/(^|\s)webfont(\s|$)/;var tags=(document.all)?document.all:document.getElementsByTagName('*');for(var i=0,c=tags.length;i<c;i++){var tag=tags[i];if(pattern.test(tag.className)){new WebFont(tag)}}}
var WebFont=function(tag){try{var p=new Params();p.text=getInnerText(tag);var transform=getStyle(tag,'textTransform');if(transform=='uppercase')p.text=p.text.toUpperCase();else if(transform=='lowercase')p.text=p.text.toLowerCase();var style=tag.className.split(' ');if(style.length>1){style.shift();p.style=style.join('.');}
var loader=new Image();loader.onload=function(){var img=document.createElement("IMG");img.src=loader.src;img.align="bottom";img.alt=p.text;img.longdesc=p.text;while(tag.firstChild!=null)tag.removeChild(tag.firstChild);tag.appendChild(img);loader.onload=null;p=null;tag=null;loader=null;}
loader.src="/webfonts?"+p;}catch(e){}}
var Params=function(){this.toString=function(){var ret="";for(var p in this){var val=this[p];if(val!=undefined&&typeof val!='function'){if(ret.length>0)ret+="&";ret+=p+'='+val;}}
return ret;}}
Event.addListener(window,'load',function(){replaceTags()});})();