<component lightWeight="true">
<attach event="onpropertychange" onevent="handlePropertychange()" />
<attach event="ondetach" onevent="restore()" />
<attach event="onresize" for="window" onevent="handleResize()" />
<script type="text/javascript">function init(){var c,d,a=doc.createElement("div"),b=doc.createElement("img");a.style.position="absolute",a.style.zIndex=-1,a.style.top=0,a.style.right=0,a.style.left=0,a.style.bottom=0,a.style.overflow="hidden",b.alt="",b.style.position="absolute",b.style.width=b.style.width="auto",a.appendChild(b),element.insertBefore(a,element.firstChild),d=[element.currentStyle.backgroundPositionX,element.currentStyle.backgroundPositionY],element.bgsExpando=c={wrapper:a,img:b,backgroundSize:element.currentStyle["background-size"],backgroundPositionX:positions[d[0]]||parseFloat(d[0])/100,backgroundPositionY:positions[d[1]]||parseFloat(d[1])/100},"auto"==element.currentStyle.zIndex&&(element.style.zIndex=0),"static"==element.currentStyle.position&&(element.style.position="relative"),refreshDisplay(element,c)&&(refreshDimensions(element,c),refreshBackgroundImage(element,c,function(){updateBackground(element,c)}))}function refreshDisplay(a,b){var c=a.currentStyle.display;return c!=b.display&&(b.display=c,b.somethingChanged=!0),"none"!=c}function refreshDimensions(a,b){var c=a.offsetWidth-(parseFloat(a.currentStyle.borderLeftWidth)||0)-(parseFloat(a.currentStyle.borderRightWidth)||0),d=a.offsetHeight-(parseFloat(a.currentStyle.borderTopWidth)||0)-(parseFloat(a.currentStyle.borderBottomWidth)||0);(c!=b.innerWidth||d!=b.innerHeight)&&(b.innerWidth=c,b.innerHeight=d,b.somethingChanged=!0)}function refreshBackgroundImage(a,b,c){var d=b.img,e=(rsrc.exec(a.currentStyle.backgroundImage)||[])[1];e&&e!=b.backgroundSrc?(b.backgroundSrc=e,b.somethingChanged=!0,d.onload=function(){var a=d.width,e=d.height;(1!=a||1!=e)&&(b.imgWidth=a,b.imgHeight=e,b.constrain=!1,c(),d.style.visibility="visible",d.onload=null)},d.style.visibility="hidden",d.src=b.backgroundSrc,(d.readyState||d.complete)&&(d.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",d.src=b.backgroundSrc),b.ignoreNextPropertyChange=!0,a.style.backgroundImage="none"):c()}function updateBackground(a,b){if(b.somethingChanged){var g,h,c=b.img,d=b.innerWidth/b.innerHeight,e=b.imgWidth/b.imgHeight,f=b.constrain;"contain"==b.backgroundSize?e>d?(b.constrain=g="width",h=Math.floor((b.innerHeight-b.innerWidth/e)*b.backgroundPositionY),c.style.top=h+"px",g!=f&&(c.style.width="100%",c.style.height="auto",c.style.left=0)):(b.constrain=g="height",h=Math.floor((b.innerWidth-b.innerHeight*e)*b.backgroundPositionX),c.style.left=h+"px",g!=f&&(c.style.width="auto",c.style.height="100%",c.style.top=0)):"cover"==b.backgroundSize&&(e>d?(b.constrain=g="height",h=Math.floor((b.innerHeight*e-b.innerWidth)*b.backgroundPositionX),c.style.left=-h+"px",g!=f&&(c.style.width="auto",c.style.height="100%",c.style.top=0)):(b.constrain=g="width",h=Math.floor((b.innerWidth/e-b.innerHeight)*b.backgroundPositionY),c.style.top=-h+"px",g!=f&&(c.style.width="100%",c.style.height="auto",c.style.left=0))),b.somethingChanged=!1}}function handlePropertychange(){var a=element.bgsExpando;return a.ignoreNextPropertyChange?(a.ignoreNextPropertyChange=!1,void 0):(refreshDisplay(element,a)&&(refreshDimensions(element,a),refreshBackgroundImage(element,a,function(){updateBackground(element,a)})),void 0)}function handleResize(){var a=element.bgsExpando;"none"!=a.display&&(refreshDimensions(element,a),updateBackground(element,a))}function restore(){var a=element.bgsExpando;try{element.style.backgroundImage="url('"+a.backgroundSrc+"')",element.removeChild(a.wrapper),element.bgsExpando=null}catch(b){}}var rsrc=/url\(["']?(.*?)["']?\)/,positions={top:0,left:0,bottom:1,right:1,center:.5},doc=element.document;init();</script>
