var subMenuVisible = false;
$(document).ready(function() {
    $('INPUT.auto-hint').each(function(i, el) {
        if ($(this).val() == '') {
            $(this).val($(this).attr('title'));
        }
        $(el).focus(function() {
            if ($(this).val() == $(this).attr('title')) {
                $(this).val('');
            }
        });
        $(el).blur(function() {
            if ($(this).val() == '') {
                $(this).val($(this).attr('title'));
            }
        });
    });


    $('ul.tabs a').click(function() {
        var currTab = $(this).attr('href');
        if ($(currTab).length > 0) {
            $('ul.tabs li').removeClass('current');
            $(this).parent().addClass('current');
            $('.tabs-block .tab-cont').hide();
            $(currTab).show();
        }
        return false;
    });

    //	$('.products-list .product-link').hover(function(){
    //		var bigImgLink = $(this).attr('rel');
    //		var botText = $(this).find('span.name').html();
    //		$('#product-preview').find('img').attr('src', bigImgLink);
    //		$('#product-preview').find('span.title').html(botText);
    //	});

    $('.zoom .mini a').click(function() {
        var mainImage = $(this).attr('rel');
        setTimeout(function() {
            $('.main-image-region #big-image').attr('src', mainImage);
        }, 100);
    });

    if ($.browser.msie && $.browser.version == 6) {
        $('.navigation ul li.top').mouseover(function() {
            $(this).find('.sub-menu').show();
            if ($(this).find('.sub-menu').length > 0) {
                subMenuVisible = true;
                $('.products-filter select').hide();
            }

        });

        $('.navigation ul li.top').mouseout(function() {
            subMenuVisible = false;
            setTimeout('moutMenu();', 0);
            $('.sub-menu').hide()
        });
    }
    if ($.browser.msie && $.browser.version == 6) {
        $('.navigation ul li.top').mouseover(function() {
            $(this).find('.sub-menu-1col').show();
            if ($(this).find('.sub-menu-1col').length > 0) {
                subMenuVisible = true;
                $('.products-filter select').hide();
            }

        });

        $('.navigation ul li.top').mouseout(function() {
            subMenuVisible = false;
            //setTimeout('moutMenu();', 0);
            $('.sub-menu-1col').hide()
        });
    }
})

function moutMenu() {
    if (!subMenuVisible) {
        $('.sub-menu').hide();
        $('.products-filter select').show();
    }
    if (!subMenuVisible) {
        $('.sub-menu-1col').hide();
        $('.products-filter select').show();
    }
};