function left_category(){
  if(typeof sortid_level_0!=='undefined'){
    $("#hot_keywords").hide();
    $("#co-branding .general_div_body span").hide();
    switch (sortid_level_0)
    {
      case 103:
          $("#menu_underwear").addClass("top_menu_on_this");
          $("#class_menu_7cv .general_title_text ").css({"background-position":"-385px -189px"});
          $("#hot_keywords_underwear").css({"display":"block"});
          $("#co-branding .general_div_body span.group_underwear").show();
          break
      case 859:
          $("#menu_bycys").addClass("top_menu_on_this");
          $("#class_menu_7cv .general_title_text ").css({"background-position":"-321px -189px"});
          $("#hot_keywords_bycys").css({"display":"block"});
          $("#co-branding .general_div_body span.group_bycys").show();
          break
      case 102:
          $("#menu_health").addClass("top_menu_on_this");
          $("#class_menu_7cv .general_title_text ").css({"background-position":"-452px -189px"});
          $("#hot_keywords_health").css({"display":"block"});
          $("#menu_health").show();
          break
      case 101:
          $("#menu_products").addClass("top_menu_on_this");
          $("#class_menu_7cv .general_title_text ").css({"background-position":"-452px -157px"});
          $("#hot_keywords_products").css({"display":"block"});
          $("#co-branding .general_div_body span.group_products").show();
          break
    }
    $("#class_menu_7cv .cate_"+sortid_level_0).addClass("cate_display");
  }else{
    $("#hot_keywords").show();
    $("#class_menu_7cv .class_first").css({'display':'block'});
    $("#class_menu_7cv .class_first .first_title").css({'color':'#FD4200','font-size':'14px'});
    $("#class_menu_7cv .cate_101").addClass("cate_display");
    $("#class_menu_7cv .cate_859").addClass("cate_display");
    $("#class_menu_7cv .cate_103").addClass("cate_display");
  }
  if(typeof sortid_level_1!=='undefined'){
    $("#class_menu_7cv .cate_"+sortid_level_1).addClass("cate_display");
  }  
}

var base='/shop';
function hiden_last_page_dialog(){
  //$("#last_page_dialog").hide();
  if (document.getElementById("last_page_dialog"))
    document.getElementById("last_page_dialog").style.display ="none";
  if (document.getElementById("div_eclipse"))
    document.getElementById("div_eclipse").style.display ="none";
  
}
function showMailNotify(productId){
  var url=base + '/stock-out-notify/'+(productId || ShopProductId)+'?'+(new Date()).getTime();
  $("#last_page_dialog").load(url);
  
  var the_height = 0;
  var the_widht =0;
  if($.browser.msie){
    the_height = document.compatMode == "CSS1Compat"? document.documentElement.clientHeight : document.body.clientHeight;
    the_widht = document.compatMode == "CSS1Compat"? document.documentElement.clientWidth : document.body.clientWidth;
  }else{
    the_height = self.innerHeight;
    the_widht = self.innerWidth;
  }
  the_height = Math.ceil(the_height/4)+document.documentElement.scrollTop;
  the_widht = Math.ceil(the_widht/4);
  $("#last_page_dialog").css({"top":+the_height+"px"});
  $("#last_page_dialog").css({"left":+the_widht+"px"});

  $("#div_eclipse").show();

  $("#last_page_dialog").show(); 
}
function mailNotify(productId){
  var email=$("#dialog_text").val();
  var emailLength=getStrLength(email);
  if(emailLength<6){
    alert("输入的邮箱格式不正确");
    return false;
  }
  if(emailLength>50){
    alert("输入的邮箱长度最大为50个字符");
    return false;
  }
  if(!/^([\w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([\w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)$/.test(email)){
    alert("输入的邮箱格式不正确");
    return false;
  }
  $.ajax({
    url : base + '/stock-out-notify',
    type : 'post',
    dataType : 'html',    
    data : 'id='+productId+'&email='+encodeURI(email),
    success : function(msg) {
      $("#last_page_dialog").html(msg);
    }
  }); 
}

function  getStrLength(str){   
    var str=String(str);
    num=str.length;
    if(num < 1){return num;}      
    var  arr=str.match(/[^\x00-\xff]/ig);
    if(arr!=null)num+=arr.length;  
    return (num);
}