/**
* dd_belatedpng: adds ie6 support: png images for css background-image and html .
* author: drew diller
* email: drew.diller@gmail.com
* url: http://www.dillerdesign.com/experiment/dd_belatedpng/
* version: 0.0.8a
* licensed under the mit license: http://dillerdesign.com/experiment/dd_belatedpng/#license
*
* example usage:
* dd_belatedpng.fix('.png_bg'); // argument is a css selector
* dd_belatedpng.fixpng( somenode ); // argument is an htmldomelement
**/
var dd_belatedpng={ns:"dd_belatedpng",imgsize:{},delay:10,nodesfixed:0,createvmlnamespace:function(){if(document.namespaces&&!document.namespaces[this.ns]){document.namespaces.add(this.ns,"urn:schemas-microsoft-com:vml")}},createvmlstylesheet:function(){var b,a;b=document.createelement("style");b.setattribute("media","screen");document.documentelement.firstchild.insertbefore(b,document.documentelement.firstchild.firstchild);if(b.stylesheet){b=b.stylesheet;b.addrule(this.ns+"\\:*","{behavior:url(#default#vml)}");b.addrule(this.ns+"\\:shape","position:absolute;");b.addrule("img."+this.ns+"_sizefinder","behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;");this.screenstylesheet=b;a=document.createelement("style");a.setattribute("media","print");document.documentelement.firstchild.insertbefore(a,document.documentelement.firstchild.firstchild);a=a.stylesheet;a.addrule(this.ns+"\\:*","{display: none !important;}");a.addrule("img."+this.ns+"_sizefinder","{display: none !important;}")}},readpropertychange:function(){var b,c,a;b=event.srcelement;if(!b.vmlinitiated){return}if(event.propertyname.search("background")!=-1||event.propertyname.search("border")!=-1){dd_belatedpng.applyvml(b)}if(event.propertyname=="style.display"){c=(b.currentstyle.display=="none")?"none":"block";for(a in b.vml){if(b.vml.hasownproperty(a)){b.vml[a].shape.style.display=c}}}if(event.propertyname.search("filter")!=-1){dd_belatedpng.vmlopacity(b)}},vmlopacity:function(b){if(b.currentstyle.filter.search("lpha")!=-1){var a=b.currentstyle.filter;a=parseint(a.substring(a.lastindexof("=")+1,a.lastindexof(")")),10)/100;b.vml.color.shape.style.filter=b.currentstyle.filter;b.vml.image.fill.opacity=a}},handlepseudohover:function(a){settimeout(function(){dd_belatedpng.applyvml(a)},1)},fix:function(a){if(this.screenstylesheet){var c,b;c=a.split(",");for(b=0;bn.h){i.b=n.h}d.vml.image.shape.style.clip="rect("+i.t+"px "+(i.r+a)+"px "+i.b+"px "+(i.l+a)+"px)"}else{d.vml.image.shape.style.clip="rect("+f.t+"px "+f.r+"px "+f.b+"px "+f.l+"px)"}},figurepercentage:function(d,c,f,a){var b,e;e=true;b=(f=="x");switch(a){case"left":case"top":d[f]=0;break;case"center":d[f]=0.5;break;case"right":case"bottom":d[f]=1;break;default:if(a.search("%")!=-1){d[f]=parseint(a,10)/100}else{e=false}}d[f]=math.ceil(e?((c[b?"w":"h"]*d[f])-(c[b?"w":"h"]*d[f])):parseint(a,10));if(d[f]%2===0){d[f]++}return d[f]},fixpng:function(c){c.style.behavior="none";var g,b,f,a,d;if(c.nodename=="body"||c.nodename=="td"||c.nodename=="tr"){return}c.isimg=false;if(c.nodename=="img"){if(c.src.tolowercase().search(/\.png$/)!=-1){c.isimg=true;c.style.visibility="hidden"}else{return}}else{if(c.currentstyle.backgroundimage.tolowercase().search(".png")==-1){return}}g=dd_belatedpng;c.vml={color:{},image:{}};b={shape:{},fill:{}};for(a in c.vml){if(c.vml.hasownproperty(a)){for(d in b){if(b.hasownproperty(d)){f=g.ns+":"+d;c.vml[a][d]=document.createelement(f)}}c.vml[a].shape.stroked=false;c.vml[a].shape.appendchild(c.vml[a].fill);c.parentnode.insertbefore(c.vml[a].shape,c)}}c.vml.image.shape.fillcolor="none";c.vml.image.fill.type="tile";c.vml.color.fill.on=false;g.attachhandlers(c);g.givelayout(c);g.givelayout(c.offsetparent);c.vmlinitiated=true;g.applyvml(c)}};try{document.execcommand("backgroundimagecache",false,true)}catch(r){}dd_belatedpng.createvmlnamespace();dd_belatedpng.createvmlstylesheet();