
function balonme()
{
	$('span.baloonme').hover(function(){

        $(this).find("em").animate({opacity: "show", top: "-75"}, "slow");
		var imagepath = $(this).find("em").attr("title");
		var ourimage = new Image();
		ourimage.src=imagepath;
		if (ourimage.height == 0 || ourimage.width == 0)
		{
			var div_marginleft = 100 - $(this).width()/2;
			var div_margintop = 100 - $(this).height()/2;
		}
		else
		{
			var hc = ourimage.height/300;
			var wc = ourimage.width/300;
			if (hc > 1 || wc > 1)
			{
				if (hc >= wc)
				{
					ourimage.width = 300/ourimage.height * ourimage.width;
					ourimage.height = 300;
				}
				if (hc < wc)
				{
					ourimage.height = 300/ourimage.width * ourimage.height;
					ourimage.width = 300;
				}
			}
			var div_marginleft = ourimage.width/2 - $(this).width()/2;
			var div_margintop = ourimage.height/2 - $(this).height()/2;
		}

		$(this).find("em").show("slow");
		$(this).find("em").addClass("baloonclass");
		$(this).find("em").css("margin-left","-"+div_marginleft+"px");
		$(this).find("em").css("margin-top","-"+div_margintop+"px");
		var hoverText = $(this).attr("title");
		$(this).find("em").append("<img src=\""+imagepath+"\" alt=\""+hoverText+"\" />");
		if (ourimage.height == 0 || ourimage.width == 0)
		{
			$(this).find("em").find("img").css("width","300");
			$(this).find("em").find("img").css("height","300");
		}
		else
		{
			$(this).find("em").find("img").css("width",ourimage.width);
			$(this).find("em").find("img").css("height",ourimage.height);
		}
		}, function() {
			$(this).find("em").hide("fast");
			$(this).find("em").empty();
            }
	);
}

function filtermenu2 (){
	$('#shopfilter').hover(function() {
		$(this).children("ul").slideDown("slow");
		$("#shopfilter ul li:has(ul)").hover(function()
		{
			$(this).children("ul").css("display", "none");
			$(this).children("ul").slideDown("slow");
		},
		function()
		{
			$(this).children("ul").slideUp("fast");
		});
	},
		function() {
			$(this).children("ul").slideUp("fast");
		}
	);
}
function filtermenu (){

	$('#shopfilter').click(function() {
		$(this).attr("name", "clickon");
		$(this).children("ul").css("left", "-180");
		$(this).children("ul").slideDown("slow");
		$("#shopfilter ul li:has(ul)").click(function()
		{
			$(this).parent().find("ul").css("display", "none");
			$(this).children("ul").css("left", "-170");
			$(this).children("ul").slideDown("slow");

			$(this).children("ul li a").click(function(){
				$('#shopfilter').find("ul").hide();
			});
		});
	}
	);
}

function bottom2brouserBottom ()
{
	var toHeight = $().height();
	toHeight -= 241 + 18; //247
	if ($.browser.msie)
	{
		toHeight -= 6;
	}
	if ($.browser.opera)
	{
		toHeight += 40;
	}
	if ($("#leftmenu").height() < toHeight)
	{
		$("#leftmenu").height(toHeight);
	}
}

function input_blur_focus_text(id)
{
    var text = $(id).parent().prev().text();
    $(id).attr('value',text);
    $(id).blur(function(){
        if ($(this).attr('value') == '')
        {
            $(this).attr('value',text);
        }
    });
    $(id).focus(function(){
        if ($(this).attr('value') == text)
        {
            $(this).attr('value','');
        }
    });
}

function lvivart_vendor_desc()
{
    var h1 = $('#vendoritem h1');
    var hi_title = h1.html();
    
    h1.prepend('<span id="vdesc"></span>');
    //alert($('#vdesc').);
    $('h1').click(function(){
        h1.append('<div id="eelbox"></div>');
        //alert($('#eelbox').height());
        $('#eelbox').html('<div id="eelboxb"></div>');
        //h1.css('position', 'relative');
        var eel_left = $('#eelbox').width() /2 - 210;
        //var eel_top = $('#eelbox').height() /2 - 160;
        var eel_top = 200;
        $('#eelboxb').each (function(){
            $(this).html(hi_title+$('#eevendordescription').html());
            $(this).animate({"left": eel_left, "top": eel_top, "width": 400, "height": 300}, "slow");
        });
        $('#eelbox').click(function(){
            //$('#eelboxb').animate({"left": $('#eelbox').width(), "top": $('#eelbox').height(), "width": 0, "height": 0}, "slow");
            h1.empty().html(hi_title).prepend('<span id="vdesc"></span>');
            return false;
        });

    });
}

$(document).ready(function(){
	filtermenu();
	bottom2brouserBottom ();
//    input_blur_focus_text('#fe_userlogin');
//    input_blur_focus_text('#fe_userpass');
    if($('#eevendordescription').length)
    {
        lvivart_vendor_desc();
    }
//    alert(screen.availHeight);
});