$(function(){
	$('a[rel=compare]').click(function() {
		$('#compared_goods').load($(this).attr('href'));
		$('#compare_block').show('slow');
		JSFX_FloatTopRight();
		return false;
	});
	$('#compared_goods').load('/actions.php?action=compare_show');
	$('#compare_clear').click(function() {
		$('#compare_block').hide('slow');
		$('#compared_goods').load('/actions.php?action=compare_clear');
		return false;
	});
	if (compare){
		$('#compare_block').show('slow');
		JSFX_FloatTopRight();
	}
});
function JSFX_FloatTopRight() {
        var startX = 5, startY = 120;
        var ns = (navigator.appName.indexOf("Netscape") != -1);
        var d = document;
        var px = document.layers ? "" : "px";
        function ml(id)
        {
                var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
                if(d.layers)el.style=el;
                el.sP=function(x,y){this.style.right=x+px;this.style.top=y+px;};
                el.x = startX; el.y = startY;
                return el;
        }
        window.stayTopRight=function()
        {
                var pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
                var dY = (pY > startY) ? pY : startY;
                ftlObj.y += (dY - ftlObj.y)/8;
                ftlObj.sP(ftlObj.x, ftlObj.y);
                setTimeout("stayTopRight()", 40);
        }
        ftlObj = ml("compare_block");
        stayTopRight();
}
