﻿if (!document.myGetElementsByClassName) { document.myGetElementsByClassName = function(D) { var C = document.getElementsByTagName("*") || document.all; var E = new Array(); for (var B = 0; B < C.length; B++) { var G = C[B]; var F = G.className.split(" "); for (var A = 0; A < F.length; A++) { if (F[A] == D) { E.push(G); break } } } return E } } var Reflection = { defaultHeight: 0.5, defaultOpacity: 0.5, add: function(D, O) { Reflection.remove(D); doptions = { height: Reflection.defaultHeight, opacity: Reflection.defaultOpacity }; if (O) { for (var I in doptions) { if (!O[I]) { O[I] = doptions[I] } } } else { O = doptions } try { var L = document.createElement("div"); var B = D; var E = B.className.split(" "); var H = ""; for (j = 0; j < E.length; j++) { if (E[j] != "reflect") { if (H) { H += " " } H += E[j] } } var J = Math.floor(B.height * O.height); var G = Math.floor(B.height * (1 + O.height)); var N = B.width; if (document.all && !window.opera) { if (B.parentElement.tagName == "A") { var L = document.createElement("a"); L.href = B.parentElement.href } L.className = H; B.className = "reflected"; L.style.cssText = B.style.cssText; B.style.cssText = "vertical-align: bottom"; var F = document.createElement("img"); F.src = B.src; F.style.width = N + "px"; F.style.display = "block"; F.style.height = B.height + "px"; F.style.marginBottom = "-" + (B.height - J) + "px"; F.style.filter = "flipv progid:DXImageTransform.Microsoft.Alpha(opacity=" + (O.opacity * 100) + ", style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy=" + (O.height * 100) + ")"; L.style.width = N + "px"; L.style.height = G + "px"; B.parentNode.replaceChild(L, B); L.appendChild(B); L.appendChild(F) } else { var C = document.createElement("canvas"); if (C.getContext) { L.className = H; B.className = "reflected"; L.style.cssText = B.style.cssText; B.style.cssText = "vertical-align: bottom"; var A = C.getContext("2d"); C.style.height = J + "px"; C.style.width = N + "px"; C.height = J; C.width = N; L.style.width = N + "px"; L.style.height = G + "px"; B.parentNode.replaceChild(L, B); L.appendChild(B); L.appendChild(C); A.save(); A.translate(0, D.height - 1); A.scale(1, -1); A.drawImage(D, 0, 0, N, D.height); A.restore(); A.globalCompositeOperation = "destination-out"; var M = A.createLinearGradient(0, 0, 0, J); M.addColorStop(1, "rgba(255, 255, 255, 1.0)"); M.addColorStop(0, "rgba(255, 255, 255, " + (1 - O.opacity) + ")"); A.fillStyle = M; A.rect(0, 0, N, J * 2); A.fill() } } } catch (K) { } }, remove: function(A) { if (A.className == "reflected") { A.className = A.parentNode.className; A.parentNode.parentNode.replaceChild(A, A.parentNode) } } }; function addReflections() { var C = document.myGetElementsByClassName("reflect"); for (i = 0; i < C.length; i++) { var B = null; var A = null; var D = C[i].className.split(" "); for (j = 0; j < D.length; j++) { if (D[j].indexOf("rheight") == 0) { var B = D[j].substring(7) / 100 } else { if (D[j].indexOf("ropacity") == 0) { var A = D[j].substring(8) / 100 } } } Reflection.add(C[i], { height: B, opacity: A }) } } var previousOnload = window.onload; window.onload = function() { if (previousOnload) { previousOnload() } addReflections() };
