function replaceElem(selector, bgUrl, sw)
{
	$(selector).each(
		function(elem, index) {
			var txt = $(this).text();
			if (!txt) return false;
			txt = escape(txt.toLowerCase());
			txt = encode64(unescape(txt));
			$(this).css('background', 'url("' + bgUrl + '?text=' + txt + '&text2=' + txt + '&format=png&base64=true") no-repeat');
			$(this).css('text-indent', '-9999px');
			$(this).css('display','block');
			if (sw)
			{
				var t = $(this);
				var i = new Image();
				i.src = bgUrl + "?text=" + txt + "&text2=" + txt + "&format=png&base64=true";
				i.onload = function() {
					t[0].style.width = this.width + "px";
				}
			}
		}
	);
}


$(function() {
		replaceElem('.left-col-elem h3', '/svg/menu.svg');
		replaceElem('.left-col-elem li a.link span', '/svg/menu.svg', true);
		replaceElem('#services li', '/svg/list.svg');
		replaceElem('#contact-short a', '/svg/link-small.svg');
		replaceElem('#contact-short span', '/svg/list.svg');
		replaceElem('ul.news li.graphics span.title', '/svg/sections/news-graphics.svg');
		replaceElem('ul.news li.design span.title', '/svg/sections/news-design.svg');
		replaceElem('ul.news li.photo span.title', '/svg/sections/news-photo.svg');
		replaceElem('#copyright span', '/svg/list.svg');
});
