function detectIE6()
{
	var browser = navigator.appName;

	if (browser == "Microsoft Internet Explorer")
	{
		var b_version = navigator.appVersion;
		var re = /\MSIE\s+(\d\.\d\b)/;
		var res = b_version.match(re);

		if (res[1] <= 6)
			return true;
	}

	return false;
}

function pngFix()
{
	if (detectIE6())
	{
		var png = /\.png/i;

		$(".png").each(function() {
			var src = $(this).css("background-image");

			if (png.test(src))
			{
				this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+src.substring(4,src.length-1)+",sizingMethod='crop')";
				this.style.backgroundImage = "none";
			}
		});

		$(".spng").each(function() {
			if (png.test(this.src))
			{
				this.style.width = this.offsetWidth + "px";
				this.style.height = this.offsetHeight + "px";
				this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.src+",sizingMethod='crop')";
				this.src = "/bitrix/templates/traffic/images/blank.gif";
			}
		});
	}
}

function trim(s)
{
	s = s.replace( /^\s+/g, "");
	return s.replace( /\s+$/g, "");
}

function log(el)
{
	if (typeof console == "object")
		console.log(el);
}
