// PNG fixer
// ---------

$(window).load(function()
{
    if ($.browser.msie)// && parseInt($.browser.version.substr(0, 1)) < 7)
    {
        $("img.png").each(function(){
            $(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + $(this).attr('src') + "', sizingMethod='scale')").attr("src", "{global_theme_path}/images/clear.gif");
        });
        $("div.png").each(function(){
            var bg = $(this).css("backgroundImage");
            bg.match(/^url[("']+(.*\.png)[)"']+$/i);
            bg = RegExp.$1;
            $(this).css("filter", "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + bg + "', sizingMethod='crop')").css("backgroundImage", "none");
        });
    }
});

// Sticky Footer
// -------------

$(window).load(function()
{
	positionFooter();
	$(window).scroll(positionFooter).resize(positionFooter);
	
	function positionFooter()
	{
		var docHeight = $(document.body).height() - $("#sticky-footer-push").height();
		if(docHeight < $(window).height())
		{
			var diff = $(window).height() - docHeight;
			if(!$("#sticky-footer-push").length > 0)
			{
				$("#sticky_footer").before('<div id="sticky-footer-push"></div>');
			}
			$("#sticky-footer-push").height(diff);
		}	
	}
});

