var userId = null; var username = null; var basepath = "http://www.lianlianny.com/agricprod/"; var loginWebUrl = "http://passport.www.lianlianny.com/agricprod"; var hnuserid = null; $(document).ready(function () { $('.lists .list').hover(function () { $(this).find('.list-pre').hide(); $(this).find('.list-next').show(); }, function () { $(this).find('.list-pre').show(); $(this).find('.list-next').hide(); }); var returnUrl = window.location.href; var loginUrl = loginWebUrl + "/myinfo/goLogin?returnUrl=" + returnUrl; $(".tp-log a").attr("href", loginUrl); $("#topmenu1 li").hover(function () { $(this).addClass("hover").find("div.tp-cont").show(); }, function () { $(this).removeClass("hover").find("div.tp-cont").hide(); }); function clearText(field) { if (field.defaultValue == field.value) field.value = ''; else if (field.value == '') field.value = field.defaultValue; } $("#topmenu li, #topmenu_wel li").hover(function () { $(this).addClass("hover").find("div.tp-cont").show(); }, function () { $(this).removeClass("hover").find("div.tp-cont").hide(); }); $(".select").each(function () { var s = $(this); var z = parseInt(s.css("z-index")); var dt = $(this).children("dt"); var dd = $(this).children("dd"); var _show = function () { dd.slideDown(200); dt.addClass("cur"); s.css("z-index", z + 1); }; var _hide = function () { dd.slideUp(200); dt.removeClass("cur"); s.css("z-index", z); }; dt.click(function () { dd.is(":hidden") ? _show() : _hide(); }); dd.find("a").click(function () { dt.html($(this).html()); _hide(); dt.attr("search-key", $(this).attr("data-type")); }); $("body").click(function (i) { !$(i.target).parents(".select").first().is(s) ? _hide() : ""; }); }) $curtainopen = false; $(".rope").click(function () { $(this).blur(); if ($curtainopen == false) { $(this).stop().animate({ top: '0px' }, { queue: false, duration: 350, easing: 'easeOutBounce' }); $(".leftcurtain").stop().animate({ width: '60px' }, 2000); $(".rightcurtain").stop().animate({ width: '60px' }, 2000, function () { $(".leftcurtain").fadeOut(1000); $(".rightcurtain").fadeOut(1000); }); $("#mask").fadeOut(2500); $("body").css("overflow", "auto"); $(".rope").fadeOut(300); $curtainopen = true; } else { $(this).stop().animate({ top: '-40px' }, { queue: false, duration: 350, easing: 'easeOutBounce' }); $(".leftcurtain").stop().animate({ width: '50%' }, 2000); $(".rightcurtain").stop().animate({ width: '51%' }, 2000); $curtainopen = false; } return false; }); //视频遮罩 $(".video_img_1").mouseover(function () { $(this).siblings(".play").fadeIn(); }); $(".play").mouseout(function () { $(".play").fadeOut(); }); //请求用户信息 $.ajax({ url: basepath + "getUserLoginInfo", // 跨域URL type: 'POST', dataType: 'jsonp', jsonp: "callback", jsonpCallback: "userLoginState", success: function (data) { if (data) { userId = data.userId; username = data.userName; if (userId != null && userId != "") { $(".topbar-name").show(); $(".userName").html(username); $(".topbar-login").hide(); //系统未读消息 $.getJSON(basepath + "common/getusermsg?userid='" + userId + "'&callback=?", function (data) { if (data.success) { $(".msgnum").html(data.msgcount); } else { $(".msgnum").html(0); } }); $("#releaseLogin").show(); $("#releaseNoLogin").hide(); hnuserid = userId; } else { $(".topbar-name").hide(); $(".topbar-login").show(); $("#releaseLogin").hide(); $("#releaseNoLogin").show(); } } else { $(".topbar-name").hide(); } } }); }); function initsubscription() { $("#select_market").empty(); $.ajax({ url: "/tools/submit_ajax.ashx?action=view_market_product", type: 'get', dataType: 'json', cache: true, async: true, success: function (result) { if (!result.IsError) { $(result.Data).each(function (i, item) { $("").appendTo("#select_market"); }); } } }); }