var location_url=document.location.href; var city_name='\u4e0a\u6d77'; var skip_set_city=0; var suffix=''; var host_url=''; var site_domain=''; host_url=window.location.host; host_url=host_url.toLowerCase(); site_domain=host_url; function getLoginUser(user){ if(user==''){ ini_top_nav_html(''); }else{ ini_top_nav_html(user.name); } try{ user_page_ini(user); }catch(e){} } function URLEncode (clearString) { var output = ''; var x = 0; clearString = clearString.toString(); var regex = /(^[a-zA-Z0-9-_.]*)/; while (x < clearString.length) { var match = regex.exec(clearString.substr(x)); if (match != null && match.length > 1 && match[1] != '') { output += match[1]; x += match[1].length; } else { if (clearString.substr(x, 1) == ' ') { clearString[x] == ' ' output += '+'; } else { var charCode = clearString.charCodeAt(x); var hexVal = charCode.toString(16); output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase(); } x++; } } return output; } function ini_top_nav_html(login_user){ var city_id=''; city_id=jia_header_get_cookie('jia_city_id'); if(city_id=='shanghai' || city_id=='other'){ var fenzhan=''; }else{ var fenzhan=city_id+'/'; } var tel='400-660-7700'; var div_city_id=city_id; /* var div_city_id=jQuery('#region-wrap').attr('city_id'); if(!div_city_id){ div_city_id=jQuery('#region_wrap').attr('city_id'); }*/ if(city_id){ if(city_id!='shanghai'){ tel='400-880-2600'; } } var app_id='201'; if(site_domain=='zhuangxiu.jia.com'){ app_id='200'; } var returl=URLEncode(location_url); var top_nav_html='

'; if(!login_user){ top_nav_html+='登录'; top_nav_html+=' 注册'; }else{ top_nav_html+=' 欢迎您, '+login_user+' '; top_nav_html+=' 退出 '; top_nav_html+=''; } top_nav_html+='

'; top_nav_html+=''; jQuery("#top-nav").html(top_nav_html); if(window.location.host!='tgmall.jia.com'){ jQuery(".myorder,.mini_cart").hover(function () { jQuery(this).find(".menu_bd").removeClass("hide").addClass("show"); load_cart_data(); }, function () { jQuery(this).find(".menu_hd").removeClass("hover"); jQuery(this).find(".menu_bd").removeClass("show").addClass("hide"); }); jQuery(".mini_cart .cart_bd li").hover(function () { jQuery(this).toggleClass("item-highlight"); }); load_cart_data(); } } function del_cart_item(item_id,obj){ var $this=jQuery(obj); jQuery.ajax({ url: 'http://mall.jia.com/order/cart/top_nav_delete_cart?item_id='+item_id+'&callback=?', type: 'GET', async: false, dataType: 'jsonp', jsonp: 'callback', success: function(data) { jQuery(".menu_hd .red").text("("+data['count']+")"); var parentNode = $this.parent().parent().parent(); parentNode.remove(); jQuery(".show_cart_msg").html(""); jQuery(".cart_bd li").eq(4).show(); var count = (data['count']-5>0)?(data['count']-5):0; jQuery(".cart_info em").text(count); load_cart_data(); } }); } function ini_cart_data(da){ var data = da.list ; var item_count = da.item_count ; if(item_count.shop_msg == 0) { jQuery(".menu_hd .red").text(""); jQuery(".show_cart_msg").html("  您的购物车暂时为空,请赶快购物吧!"); jQuery(".menu_bd ul").html(""); jQuery(".cart_info em").text('0'); jQuery(".mini_cart s").removeClass('has'); jQuery(".menu_hd .red").text("(0)"); }else{ var str = ''; var p_show=0; for(var i =0;i4){ str +='style="display: none;"';} str += '>
'; str += '
'; str += '
'+data[i].name+' *'+data[i].product_count+'
'; str += '

'; if(data[i].comments || data[i].comments=='undefined') { str +=' 颜色:'+data[i].comments +''; } str +=''+(data[i].price*data[i].product_count).toFixed(2)+'

删除

'; if(i<5){ p_show = parseInt(p_show)+parseInt(data[i].product_count); } } if(!item_count['product_show_count'] || item_count['product_show_count']=='undefined'){ item_count['product_show_count']='0'; } jQuery(".show_cart_msg").html(""); jQuery(".menu_bd ul").html(""); jQuery(".menu_hd .red").text("("+item_count['product_show_count']+')') ; jQuery(".cart_bd ").append(str); jQuery(".mini_cart s").addClass('has'); if(parseFloat(da['item_count']['product_show_key'])<5) { jQuery(".cart_info em").text(0); jQuery(".cart_info").hide(); }else{ jQuery(".cart_info em").text((parseInt(item_count['product_show_count'])-p_show)); } } } function load_cart_data(){ jQuery.ajax({ type: "get", url: "http://mall.jia.com/order/cart/top_nav_js?json=true&callback=?", dataType: "jsonp", jsonp: 'callback', cache: false, timeout : 10000, error: function(error){}, success: function(da) { jQuery(".cart_bd ").html(""); ini_cart_data(da); } }); } jQuery("head").append(""); var huizhou_url='http://mall.jia.com'; var huzhou_url='http://mall.jia.com'; if(host_url=='mall.jia.com' || host_url=='tgmall.jia.com' ){ city_name='上海'; skip_set_city=1; host_url='http://tgmall.jia.com/'; }else if(host_url=='jiaju.jia.com' || host_url=='tgjiaju.jia.com'){ host_url='http://tgjiaju.jia.com/'; }else if(host_url=='zhuangxiu.jia.com'){ host_url='http://zhuangxiu.jia.com/'; }else if(host_url=='pinpai.jia.com'){ host_url='http://pinpai.jia.com/'; }else if(host_url=='bbs.jia.com'){ host_url='http://bbs.jia.com/'; }else if(host_url=='tg.jia.com'){ host_url='http://tg.jia.com/'; }else{ if(host_url=='www.jia.com' || host_url=='shanghai.jia.com' || host_url=='zixun.jia.com' || host_url=='tuku.jia.com'){ city_name='上海'; skip_set_city=1; } host_url='http://'; suffix='.jia.com' } var jiaheaderjson = {"region_content":"\n\t\n\t"+city_name+"<\/em> <\/i>\n\t<\/span>\n<\/span>\n
\n\t
\n\t\t
[A-C]<\/dt>\n\t\t
\u5317\u4eac<\/a>\n\t\t\u957f\u6c99<\/a>\n\t\t\u6210\u90fd<\/a>\n\t\t\u91cd\u5e86<\/a>\n\t\t\u5e38\u5dde<\/a><\/dd>\n\t<\/dl>\n\t
\n\t\t
[D-H]<\/dt>\n\t\t
\n\t\t\u676d\u5dde<\/a>\n\t\t\u5927\u8fde<\/a>\n\t\t\u5e7f\u5dde<\/a>\n\t\t\u54c8\u5c14\u6ee8<\/a>\n\t\t\u60e0\u5dde<\/a>\n\t\t\u6e56\u5dde<\/a>\n\t\t\u5408\u80a5<\/a>\n\t\t\u798f\u5dde<\/a>\n\t\t<\/dd>\n\t\t<\/dl>\n\t
\n\t\t
[J-Q]<\/dt>\n\t\t
\u5357\u4eac<\/a>\n\t\t\u6d4e\u5357<\/a>\n\t\t\u9752\u5c9b<\/a>\n\t\t\u6606\u660e<\/a>\n\t\t\u5b81\u6ce2<\/a>\n\t\t\u6606\u5c71<\/a>\n\t\t\u5357\u901a<\/a>\n\t\t\u5357\u5b81<\/a>\n\t\t\u91d1\u534e<\/a>\n\t\t\u5357\u660c<\/a><\/dd>\n\t\t<\/dl>\n\t
\n\t\t
[S-Z]<\/dt>\n\t\t
\u4e0a\u6d77<\/a>\n\t\t\u82cf\u5dde<\/a>\n\t\t\u65e0\u9521<\/a>\n\t\t\u6b66\u6c49<\/a>\n\t\t\u5929\u6d25<\/a>\n\t\t\u6c88\u9633<\/a>\n\t\t\u6df1\u5733<\/a>\n\t\t\u897f\u5b89<\/a>\n\t\t\u626c\u5dde<\/a>\n\t\t\u77f3\u5bb6\u5e84<\/a><\/dd>\n\t<\/dl>\n<\/div>"}; function jia_header_change_city(cname,ccityname){ if(cname=='huizhou' || cname=='huzhou'){ cname='shanghai'; ccityname='上海'; } var expCook = new Date("December 31,2020"); document.cookie = ("city_id="+cname+";path=/; domain=.jia.com;expires="+expCook.toGMTString()); document.cookie = ("city_name="+encodeURI(ccityname)+";path=/; domain=.jia.com;expires="+expCook.toGMTString()); if(location_url.indexOf('bbs.jia.com')>0){ window.location.href="http://mall.jia.com/bbs.php"; }else{ if(cname=='shanghai'){ window.location.href="http://mall.jia.com/" }else{ window.location.href="http://tgmall.jia.com/"+cname } //location.reload(); } } function jia_header_get_cookie(c_name){ if (document.cookie.length>0){ c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1){ c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return ""; } function set_current_city(){ var div_city_name=jQuery('#region-wrap').attr('city_name'); if(div_city_name){ jQuery('#J_region').html(div_city_name); return; } var c_name='city_name'; var city='';     if (document.cookie.length>0){        c_start=document.cookie.indexOf(c_name + "=");  if (c_start!=-1){          c_start=c_start + c_name.length+1;   c_end=document.cookie.indexOf(";",c_start);   if (c_end==-1) c_end=document.cookie.length;           city=decodeURIComponent(document.cookie.substring(c_start,c_end));   } } if(city!=''){ jQuery('#J_region').html(city); }   }   /* jQuery(document).ready(function(){ var $region_wrap = jQuery('#region-wrap'); if($region_wrap){ $region_wrap.html(jiaheaderjson.region_content); if(skip_set_city==0){ set_current_city(); } try{ mall_Cate(); }catch(e){} } }); */ (function ($, plugin) { var data = {}, id = 1, etid = plugin + 'ETID'; $.fn[plugin] = function (speed, group) { id ++; group = group || this.data(etid) || id; speed = speed || 150; if (group === id) this.data(etid, group); this._hover = this.hover; this.hover = function (over, out) { over = over || $.noop; out = out || $.noop; this._hover(function (event) { var elem = this; clearTimeout(data[group]); data[group] = setTimeout(function () { over.call(elem, event); }, speed); }, function (event) { var elem = this; clearTimeout(data[group]); data[group] = setTimeout(function () { out.call(elem, event); }, speed); }); return this; }; return this; }; $.fn[plugin + 'Pause'] = function () { clearTimeout(this.data(etid)); return this; }; $[plugin] = { get: function () { return id ++; }, pause: function (group) { clearTimeout(data[group]); } }; })(jQuery, 'mouseDelay'); $(function(){ $('body').append(''); var $indexHover = $('.Sweeps-code-index'); var $indexMenu = $('.Sweeps-code-index-mian'); var group = 'menu_1'; $indexHover.mouseDelay(false, group).hover(function () { var $this = $(this); var l = $this.offset().left; var t = $this.offset().top; var w = $indexMenu.outerWidth(); var tw = $this.outerWidth(); $indexMenu.css({ left : l-w/2+tw/2, top : t+20 }).show(); }, function () { $indexMenu.hide(); }); $indexMenu.mouseDelay(false, group).hover(null, function () { $indexMenu.hide(); }); })