var IEPNGFix=window.IEPNGFix||{};IEPNGFix.tileBG=function(a,b,c){var d=this.data[a.uniqueID],e=Math.max(a.clientWidth,a.scrollWidth),f=Math.max(a.clientHeight,a.scrollHeight),g=a.currentStyle.backgroundPositionX,h=a.currentStyle.backgroundPositionY,i=a.currentStyle.backgroundRepeat;if(!d.tiles)d.tiles={elm:a,src:"",cache:[],img:new Image,old:{}};var j=d.tiles,k=j.img.width,l=j.img.height;if(b){if(!c&&b!=j.src){j.img.onload=function(){this.onload=null;IEPNGFix.tileBG(a,b,1)};return j.img.src=b}}else{if(j.src)c=1;k=l=0}j.src=b;if(!c&&e==j.old.w&&f==j.old.h&&g==j.old.x&&h==j.old.y&&i==j.old.r)return;var m={top:"0%",left:"0%",center:"50%",bottom:"100%",right:"100%"},n,o,p;n=m[g]||g;o=m[h]||h;if(p=n.match(/(\d+)%/))n=Math.round((e-k)*(parseInt(p[1])/100));if(p=o.match(/(\d+)%/))o=Math.round((f-l)*(parseInt(p[1])/100));n=parseInt(n);o=parseInt(o);var q={repeat:1,"repeat-x":1}[i],r={repeat:1,"repeat-y":1}[i];if(q){n%=k;if(n>0)n-=k}if(r){o%=l;if(o>0)o-=l}this.hook.enabled=0;if(!{relative:1,absolute:1}[a.currentStyle.position])a.style.position="relative";var s=0,t,u=q?e:n+0.1,v,w=r?f:o+0.1,x,y,z;if(k&&l)for(t=n;t<u;t+=k)for(v=o;v<w;v+=l){z=0;if(!j.cache[s]){j.cache[s]=document.createElement("div");z=1}var A=Math.max(0,t+k>e?e-t:k),B=Math.max(0,v+l>f?f-v:l);x=j.cache[s];y=x.style;y.behavior="none";y.left=t-parseInt(a.currentStyle.paddingLeft)+"px";y.top=v+"px";y.width=A+"px";y.height=B+"px";y.clip="rect("+(v<0?0-v:0)+"px,"+A+"px,"+B+"px,"+(t<0?0-t:0)+"px)";y.display="block";if(z){y.position="absolute";y.zIndex=-999;if(a.firstChild)a.insertBefore(x,a.firstChild);else a.appendChild(x)}this.fix(x,b,0);s++}while(s<j.cache.length){this.fix(j.cache[s],"",0);j.cache[s++].style.display="none"}this.hook.enabled=1;j.old={w:e,h:f,x:g,y:h,r:i}};IEPNGFix.update=function(){for(var a in IEPNGFix.data){var b=IEPNGFix.data[a].tiles;if(b&&b.elm&&b.src)IEPNGFix.tileBG(b.elm,b.src)}};IEPNGFix.update.timer=0;if(window.attachEvent&&!window.opera)window.attachEvent("onresize",function(){clearTimeout(IEPNGFix.update.timer);IEPNGFix.update.timer=setTimeout(IEPNGFix.update,100)})
