$(function(){ //Make external links open in a new window. $('a').filter(function() { return this.hostname && this.hostname !== location.hostname; }).attr('target', '_blank'); }); $(window).load(function () { //dynamic svg images function dynImagesWork (x) { for ( i = 0 ; i < x.length ; i++ ) { if (x[i].className.match('dyn_gradient')) { if(x[i].currentStyle) { var topColor = x[i].currentStyle['backgroundColor'].substr(1); var bottomColor = x[i].currentStyle['borderBottomColor'].substr(1); } else { if (window.getComputedStyle) { var topColor = window.getComputedStyle(x[i], null).getPropertyValue('background-color').substr(4).replace(" ","").replace(" ","").replace(")","").split(","); var bottomColor = window.getComputedStyle(x[i], null).getPropertyValue('border-bottom-color').substr(4).replace(" ","").replace(" ","").replace(")","").split(","); for ( cc = 0 ; cc < 3 ; cc++ ) { topColor[cc] = parseInt(topColor[cc]).toString(16); if (topColor[cc].length == "1") { topColor[cc] = "0" + topColor[cc]; } bottomColor[cc] = parseInt(bottomColor[cc]).toString(16); if (bottomColor[cc].length == "1") { bottomColor[cc] = "0" + bottomColor[cc]; } } topColor = topColor.join(""); bottomColor = bottomColor.join(""); } } x[i].style.backgroundImage = 'url(/style/images/gradients/' + x[i].offsetHeight + '-' + topColor + '-' + bottomColor + '.png)'; } else { if (x[i].className.match('dyn_image')) { if (x[i].currentStyle) { bgImage = x[i].currentStyle['backgroundImage']; } else { if (window.getComputedStyle) { bgImage = window.getComputedStyle(x[i], null).getPropertyValue('background-image'); } } dimensions = x[i].offsetWidth + 'x' + x[i].offsetHeight; x[i].style.backgroundImage = bgImage.replace('1x1',dimensions); x[i].style.backgroundColor = 'transparent'; } } } } dynImagesWork(document.getElementsByTagName('div')); });