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