// JavaScript Document
(function($) {
    $.fn.ulmenu = function() {
        return this.each(function() {
            $(this).hover(
                function() {
                }, function() {
                    $(this).find("ul ul").hide();
                }
            );

            var _li = $(this).find("ul > li");
            _li.hover(
				function() {
				    $(this).parent().find("ul").hide();
				    $(this).children("ul").css("left", $(this).position().left + "px").show();
				}, function() {
				    $(this).find("ul ul").hide();
				}
			);

            var _ulli = $(this).find("ul ul li");
            _ulli.hover(
				function() {
				    $(this).parent().find("ul").hide();
				    var _ul = $(this).children("ul");
				    if (_ul) {
				        var _p = $(this).position();
				        _ul.css({ left: $(this).width() + "px", top: _p.top + "px" }).show();
				    }
				}, function() {
				}
			);
        });
    }
})(jQuery);

function googleTranslateElementInit() {
    new google.translate.TranslateElement({
        pageLanguage: 'zh-CN'
    }, 'google_translate_element');
}

$(function() {
    var url = location.href;
    $("#addFavorite").click(function() {
        window.external.AddFavorite(url, document.title);
        return false;
    });
    $("#setDefault").click(function() {
        this.style.behavior = "url(#default#homepage)";
        this.setHomePage(url);
        return false;
    });

    $(".mmenu > ul > li > a").each(function(i) {
        $(this).css("background-position", -($(this).width() * i + 57) + "px");
    });
    $(".mmenu").ulmenu();

    $(".lightbox").lightBox();
});

