var isAgencyType = false; var mcePromo = 0; var cartPage = 0; var mask_cart = 0; var prepareProducts = []; var webType = 'cn'; var country_Image = "United States,Canada,United Kingdom,Australia,China,Germany,France,Japan,Korea South,Switzerland,"; country_Image += "Algeria,Argentina,Austria,Belgium,Brazil,Chile,Croatia,Czech Republic,Denmark,Finland,"; country_Image += "Hong Kong,Hungary,India,Iraq,Ireland,Israel,Italy,Lebanon,Luxembourg,Malaysia,"; country_Image += "Mexico,Morocco,Netherlands,New Zealand,Norway,Pakistan,Peru,Philippines,Poland,Portugal,"; country_Image += "Qatar,Russia,Saudi Arabia,Serbia,Singapore,Slovakia,Slovenia,South Africa,Spain,Sweden,"; country_Image += "Taiwan,Thailand,Tunisia,Turkey,Ukraine"; var country_Type = "United Kingdom,Germany,France,Switzerland,Albania,Armenia,Austria,Azerbaijan"; country_Type += ",Belarus,Belgium,Bosnia Herzegovina,Bulgaria,Croatia,Cyprus,Czech Republic,Denmark"; country_Type += ",Estonia,Finland,France,Georgia,Germany,Gibraltar,Greece,Hungary"; country_Type += ",Iceland,Ireland,Italy,Latvia,Lithuania,Luxembourg"; country_Type += ",Macedonia,Malta,Moldova,Monaco,Montenegro,Netherlands,Norway"; country_Type += ",Poland,Portugal,Romania,Russia,Serbia,Slovakia,Slovenia,Spain,Sweden"; country_Type += ",Switzerland,Turkey,Ukraine"; var us_states = "Alabama,Alaska,Arizona,Arkansas,California,Colorado,Connecticut,Delaware,District of Columbia,Florida,Georgia"; us_states += ",Hawaii,Idaho,Illinois,Indiana,Iowa,Kansas,Kentucky,Louisiana"; us_states += ",Maine,Maryland,Massachusetts,Michigan,Minnesota,Mississippi,Missouri,Montana"; us_states += ",Nebraska,Nevada,New Hampshire,New Jersey,New Mexico,New York,North Carolina,North Dakota"; us_states += ",Ohio,Oklahoma,Oregon,Pennsylvania,Rhode Island,South Carolina,South Dakota"; us_states += ",Tennessee,Texas,Utah,Vermont,Virginia,Washington,Washington D.C.,West Virginia"; us_states += ",Wisconsin,Wyoming"; var mask_cart = 0; $(document).ready(function(){ //page top select country //$("#search_txt").val("eg. Name, CAS, Target"); //page top select country $("#pgt_select_country").click(function(){ $("#mask_top_country").show(); $(".page_top_country").show(); }); $(document).click(function(){ $("#mask_top_country").hide(); $(".page_top_country").hide(); }); $("#pgt_country_list,#pgt_select_country").click(function(event){ event.stopPropagation(); }); $("#a_pgt_cart").mouseover(function(){ if(typeof($.cookie("mce_cart_cn"))!="undefined" || $.trim($.cookie("mce_cart_cn"))!=""){ $(".page_top_cart").show(); mask_cart = 0 } }); $(".page_top_cart").mouseover(function(){ if(typeof($.cookie("mce_cart_cn"))!="undefined" || $.trim($.cookie("mce_cart_cn"))!=""){ if(mask_cart == 0){ // if($(".page_top_country").is(':hidden')){ // $("#mask_top_country").show(); // } $(".page_top_cart").show(); } else if(mask_cart == 1) { $(".page_top_cart").show(); } } }); $("#a_pgt_cart, .page_top_cart").mouseout(function(){ if($(".page_top_country").is(':visible')) $("#mask_top_country").show(); $(".page_top_cart").hide(); $("#mask_top_country").hide(); }); $("#a_pgt_cart, .page_top_cart").mouseout(function(){ if(!$(".page_top_country").is(':hidden')) $("#mask_top_country").show(); $(".page_top_cart").hide(); $("#mask_top_cart").hide(); }); //20160406 main_nav nav_pathway_target_list $(".nav_mask").height($(document.body).height()); //nav pathway img var height = $('#nav_target_list').outerHeight(); $('.target_hide').css('height', height); $('.blank').css('height', height); $('#nav_pathway').mouseover(function(){ showPathway(); }); $('#nav_pathway').mouseout(function(){ hidePathway(); $("#nav_target_list").hide(); $('#nav_pathway_list ul li').removeClass('actived'); }); $('#nav_pathway_target_list').mouseover(function(){ showPathway(); }); $('#nav_pathway_target_list').mouseout(function(){ hidePathway() }); var navTargetList = $('#nav_target_list'); var navPathwayListOffsetBaseline = $('#nav_pathway_list ul').parent().parent().parent(); $('#nav_pathway_list ul').menuAim({ outerSize: { width: 278, height: 504 }, offset: function() { var baselineOffset = navPathwayListOffsetBaseline.offset(); return { top: baselineOffset.top + 48, left: baselineOffset.left } }, activate: function(row) { $(row).addClass('actived').siblings().removeClass(); navTargetList.children().hide().eq($('#nav_pathway_list ul li').index(row)).show(); }, enter: function() { navTargetList.show(); } }); //main_nav products $('#nav_pro,#nav_pro_list').mouseover(function () { hideNavlib(); $("#nav_pro_list").show(); $("#nav_products_mask").show(); }); var tir=0; $('#nav_pro, #nav_pro_list').mouseout(function() { clearTimeout(tir); tir = setTimeout(function() { hideNavPro(); }, 100); }).mouseover(function() { clearTimeout(tir); }); //main_nav lib $('#nav_lib,#nav_lib_list').mouseover(function () { hidePathway(); hideNavPro(); hideNavService(); hideNavKit(); hideNavNews(); hideNavProtein(); hideNavActive(); $("#nav_lib_list").show(); $("#nav_lib_mask").show(); }); var tir=0; $('#nav_lib, #nav_lib_list').mouseout(function() { clearTimeout(tir); tir = setTimeout(function() { hideNavlib(); }, 100); }).mouseover(function() { clearTimeout(tir); }); //重组蛋白 $('#nav_protein,#nav_protein_category_list').mouseover(function () { hidePathway(); hideNavPro(); hideNavService(); hideNavKit(); hideNavNews(); hideNavlib(); hideNavActive(); $("#nav_protein_category_list").show(); $("#nav_protein_mask").show(); }); var tir1=0; $('#nav_protein, #nav_protein_category_list').mouseout(function() { clearTimeout(tir1); tir1 = setTimeout(function() { hideNavProtein(); }, 100); }).mouseover(function() { clearTimeout(tir1); }); var navProteinChildList = $('#nav_protein_child_list'); var navProteinListOffsetBaseline = $('#nav_protein_first_list ul').parent().parent().parent(); $('#nav_protein_first_list ul').menuAim({ outerSize: { width: 878, height: 810 }, offset: function() { var baselineOffset = navProteinListOffsetBaseline.offset(); return { top: baselineOffset.top + 48, left: baselineOffset.left } }, activate: function(row) { if ($(row).find('a').next().length > 0) { $(row).addClass('actived').siblings().removeClass(); navProteinChildList.children().hide().eq($('#nav_protein_first_list ul li').index(row)).show(); var proteinHeight = $('#nav_protein_first_list').outerHeight(); $('#nav_protein_child_list').css('height', proteinHeight); $('#nav_protein_child_list .target_hide').css('height', proteinHeight); $('#nav_protein_child_list .blank').css('height', proteinHeight); var $indexUL = navProteinChildList.children().eq($('#nav_protein_first_list ul li').index(row)).find('ul'); var liHeight = 0; var showNum = 0; var hideNum = 0 $indexUL.find('li').each(function(index, dom) { liHeight += $(dom).outerHeight(); if (liHeight + 64 >= proteinHeight) { hideNum += 1; } else { showNum += 1; } }); if (hideNum > 0) { $indexUL.find('li').each(function(index, dom) { if (index >= showNum - 1) { $(dom).hide(); } }); $indexUL.append('
  • More...
  • '); } } else { $(row).addClass('actived').siblings().removeClass(); navProteinChildList.children().hide().eq($('#nav_protein_first_list ul li').index(row)).hide(); } }, enter: function() { navProteinChildList.show(); } }); //kit $('#nav_kit, #nav_kit_category_list').mouseover(function () { hidePathway(); hideNavPro(); hideNavService(); hideNavProtein(); hideNavNews(); hideNavlib(); hideNavActive(); $("#nav_kit_category_list").show(); $("#nav_kit_mask").show(); }); var kitTir=0; $('#nav_kit, #nav_kit_category_list').mouseout(function() { clearTimeout(kitTir); kitTir = setTimeout(function() { hideNavKit(); }, 100); }).mouseover(function() { clearTimeout(kitTir); }); var navKitChildList = $('#nav_kit_child_list'); var navKitListOffsetBaseline = $('#nav_kit_first_list ul').parent().parent().parent(); $('#nav_kit_first_list ul').menuAim({ outerSize: { width: 764, height: 700 }, offset: function() { var baselineOffset = navKitListOffsetBaseline.offset(); return { top: baselineOffset.top + 48, left: baselineOffset.left } }, activate: function(row) { if ($(row).find('a').next().length > 0) { $(row).addClass('actived').siblings().removeClass(); navKitChildList.children().hide().eq($('#nav_kit_first_list ul li').index(row)).show(); var proteinHeight = $('#nav_kit_first_list').outerHeight(); $('#nav_kit_child_list').css('height', proteinHeight); $('#nav_kit_child_list .target_hide').css('height', proteinHeight); $('#nav_kit_child_list .blank').css('height', proteinHeight); var $indexUL = navKitChildList.children().eq($('#nav_kit_first_list ul li').index(row)).find('ul'); var liHeight = 0; var showNum = 0; var hideNum = 0 $indexUL.find('li').each(function(index, dom) { liHeight += $(dom).outerHeight(); if (liHeight + 64 >= proteinHeight) { hideNum += 1; } else { showNum += 1; } }); if (hideNum > 0) { $indexUL.find('li').each(function(index, dom) { if (index >= showNum - 1) { $(dom).hide(); } }); $indexUL.append('
  • More...
  • '); } } else { $(row).addClass('actived').siblings().removeClass(); navKitChildList.children().hide().eq($('#nav_kit_first_list ul li').index(row)).hide(); } }, enter: function() { navKitChildList.show(); } }); //main_nav news $('#nav_news,#nav_news_list').mouseover(function () { hideNavProtein(); hideNavKit(); hideNavService(); hideNavlib(); hideNavActive(); $("#nav_news_list").show(); $("#nav_news_mask").show(); }); //main_nav service $('#nav_service,#nav_service_list').mouseover(function () { hideNavProtein(); hideNavKit(); hideNavNews(); hideNavlib(); hideNavActive(); $("#nav_service_list").show(); $("#nav_service_mask").show(); }); var tirNews=0; $('#nav_news, #nav_news_list').mouseout(function() { clearTimeout(tirNews); tirNews = setTimeout(function() { hideNavNews(); }, 100); }).mouseover(function() { clearTimeout(tirNews); }); var tir1=0; $('#nav_service, #nav_service_list').mouseout(function() { clearTimeout(tir1); tir1 = setTimeout(function() { hideNavService(); }, 100); }).mouseover(function() { clearTimeout(tir1); }); //main_nav contact $('#nav_contact,#nav_contact_list').mouseover(function(){ //$("#nav_contact_list").show(); //$("#nav_contact_mask").show(); }); var tir2=0; $('#nav_contact,#nav_contact_list').mouseout(function(){ clearTimeout(tir2); tir2=setTimeout(function(){ hideNavContact(); },100) }).mouseover(function(){ clearTimeout(tir2); }) //main_nav active $('#nav_active,#nav_active_list').mouseover(function () { hideNavProtein(); hideNavKit(); hideNavService(); hideNavlib(); hideNavNews(); hideNavPro(); $("#nav_active_list").show(); $("#nav_active_mask").show(); }); var tir=0; $('#nav_active,#nav_active_list').mouseout(function() { clearTimeout(tir); tir = setTimeout(function() { hideNavActive(); }, 100); }).mouseover(function() { clearTimeout(tir); }); //hd_email_icon $('#hd_email_icon').click(function() { $(".hd_country_cart").hide(); $(".hd_email").show(); var hdEmailML = parseInt($(".hd_rgt").outerWidth())-parseInt($(".hd_tel").outerWidth())-parseInt($(".hd_historical").outerWidth())-21; $(".hd_email").css("padding-left",hdEmailML+"px"); }); var time1=0; $('#hd_email_icon, .hd_email').mouseout(function() { clearTimeout(time1); time1 = setTimeout(function() { $(".hd_country_cart").show(); $(".hd_email").hide(); }, 500); }).mouseover(function() { clearTimeout(time1); }); }) function hideNavPro(){ $("#nav_pro_list").hide(); $("#nav_products_mask").hide(); } function showPathway() { $("#nav_pathway_target_list").show(); $("#nav_pathway_mask").show(); } function hidePathway() { $("#nav_pathway_target_list").hide(); $("#nav_pathway_mask").hide(); } function hideNavProtein() { $("#nav_protein_mask").hide(); $("#nav_protein_category_list").hide(); $("#nav_protein_mask").hide(); $('#nav_protein_category_list ul li').removeClass('actived'); $("#nav_protein_child_list").hide(); } function hideNavKit() { $("#nav_kit_mask").hide(); $("#nav_kit_category_list").hide(); $("#nav_kit_mask").hide(); $('#nav_kit_category_list ul li').removeClass('actived'); $("#nav_kit_child_list").hide(); } function hideNavNews(){ $("#nav_news_list").hide(); $("#nav_news_mask").hide(); } function hideNavService(){ $("#nav_service_list").hide(); $("#nav_service_mask").hide(); } function hideNavContact(){ $("#nav_contact_list").hide(); $("#nav_contact_mask").hide(); } function hideNavlib(){ $("#nav_lib_list").hide(); $("#nav_lib_mask").hide(); } function hideNavActive() { $("#nav_active_list").hide(); $("#nav_active_mask").hide(); } // function showNavlib() { // $("#nav_lib_list").show(); // $("#nav_lib_mask").show(); // } $("#inquiry_btn").click(function(){ validateSubmit(); }); // $('#nav_protein').mouseover(function(){ // showProtein(); // }); // $('#nav_protein').mouseout(function(){ // hideProtein(); // $("#nav_protein_child_list").hide(); // $('#nav_protein_first_list ul li').removeClass('actived'); // }); // // $('#nav_protein_category_list').mouseover(function(){ // showProtein(); // }); // $('#nav_protein_category_list').mouseout(function(){ // hideProtein() // }); // function showProtein() { // $("#nav_protein_category_list").show(); // $("#nav_protein_mask").show(); // } // function hideProtein() { // $("#nav_protein_category_list").hide(); // $("#nav_protein_mask").hide(); // } window.onscroll = function () { var pageTopH = $(".page_top").outerHeight(); var hdNavMT = $("#hd_nav").offset().top + $(document).scrollTop(); if (hdNavMT == pageTopH) { $(".page_top").addClass("page_top_bb").removeClass("page_top_bs"); } else { $(".page_top").addClass("page_top_bs").removeClass("page_top_bb"); } } function getProjectUrl(){ var curWwwPath=window.document.location.href; var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); var localhostPath=curWwwPath.substring(0,pos); var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); return localhostPath; // return localhostPath+projectName; // return "http://171.16.0.250:8080"; } function selCou(couName) { // if (couName == 'China') { var couImgName = couName.replace(' ', '_'); var couImgCss = couName; $.cookie("mce_country_name", couName, {expires: 7, path: "/"}); $.cookie("mce_country_tel", $("#pgt_country_tel").text(), {expires: 7, path: "/"}); var couImgUrl = "http://file.medchemexpress.com/new/images/country/" + couImgName.replace(',_China', '').replace(', China', '') + ".png"; if (country_Image.indexOf(couName) < 0) { couImgCss = 'Other Countries'; couImgUrl = getProjectUrl() + "/new/images/country/Other_Countries.png"; } $("#span_country_icon").text(couImgCss); $("#pgt_select_country img").attr("src", couImgUrl); $(".page_top_country").hide(); if (typeof($.cookie("mce_cart_cn")) != "undefined" && $.cookie("mce_cart_cn") != "") { var mce_cart_cn_str = $.cookie("mce_cart_cn"); var reg = new RegExp("免费样品","g") mce_cart_cn_str = mce_cart_cn_str.replace(reg,"Free Sample").replace('Free Sample (0.1 - 0.5 mg)', 'Free Sample (0.1 - 0.2 mg)'); $.cookie("mce_cart_cn",mce_cart_cn_str, {expires: 7, path: "/"}); } /*if (typeof($.cookie("mce_cart_cn")) != "undefined" && $.cookie("mce_cart_cn") != "") { changeCartPrice(); if (cartPage == 1) { product_cart_list_update(); if ($.trim($("#customerFedEx_1").val()).length > 1) { var customerFedEx = $.trim($("#customerFedEx_1").val().replace(/-/g, "").replace(/[ ]/g, "")); if (isNaN(customerFedEx) == false && customerFedEx.length == 9) { proFreight = 0; } else { proFreight = 35; } } else { proFreight = 35; } //alert("proFreight----"+proFreight); document.getElementById('select_Freight').value = proFreight; var viewType = '¥'; $('#td_Freight').html('¥' + proFreight); cartProListPriceSum = getCartPrice_FreightSum(getCartPriceSum(), proFreight); $('#cartProListPriceSum').html(cartProListPriceSum); cartProListPriceSumLast = cartProListPriceSum.replace("¥", ""); if (parseInt(cartProListPriceSumLast) == 0) { $("#cus_info_pay").hide(); $("#cus_info_pay_dt").hide(); $("#cus_info_bill").hide(); $("#cus_info_bill_dt").hide(); } else { $("#cus_info_pay").show(); $("#cus_info_pay_dt").show(); $("#cus_info_bill").show(); $("#cus_info_bill_dt").show(); } if (getCartPriceSum().replace("¥", "") == '0') { $("#mce_promocode_tr").hide(); } else { $("#mce_promocode_tr").show(); } // getFreight_2(); // checkPromoCode(); } } if (cartPage == 2) { chooseOrderCountry_2(); getQuotationBySession(); } if (cartPage == 3) { chooseOrderCountry_3(); } if (cartPage == 4) { chooseOrderCountry_4(); } if (cartPage == 5) { if ($.trim($("#customerFedEx_1").val()).length > 1) { var customerFedEx = $.trim($("#customerFedEx_1").val().replace(/-/g, "").replace(/[ ]/g, "")); if (isNaN(customerFedEx) == false && customerFedEx.length == 9) { proFreight = 0; } else { proFreight = 35; } } else { proFreight = 35; } //alert(proFreight+"-----proFreight"); $("#select_Freight").val(proFreight); var proPriceSum = $("#mceCustomOrderSum").val(); //alert(proPriceSum); var obj_price = parseInt(proPriceSum.replace("¥", "")); getFreight_2(); cartPage = 5; }*/ } /* * Math.ceil() 向上取整 * Math.floor() 向下取整 * Math.round() 四舍五入 * */ function changeCartPrice() { var mce_cart_cn_str = $.cookie("mce_cart_cn"); var mce_cart_cn_proList_1 = $.cookie("mce_cart_cn").split("|"); var mce_cart_cn_proList_num = mce_cart_cn_proList_1.length; var changPriceType = "¥"; var changPriceType_c = "¥"; for (var i = 0; i < mce_cart_cn_proList_num; i++) { var cart_pro_list = mce_cart_cn_proList_1[i].split(";"); if (cart_pro_list[3].indexOf(changPriceType) < 0) { var c_price = parseInt(cart_pro_list[3].replace(changPriceType_c, "")); cart_pro_list[3] = cart_pro_list[5]; mce_cart_cn_proList_1[i] = cart_pro_list.join(";"); //alert(cart_pro_list[3]); //alert(mce_cart_cn_proList_1[i]); } } mce_cart_cn_str = mce_cart_cn_proList_1.join("|"); $.cookie('mce_cart_cn', mce_cart_cn_str, {expires: 7, path: "/"}); mce_cart_cn_update(); } function McebCountryInitialize(){ selCou("China"); } //=====================================// // Bread // //=====================================// $(document).ready(function(){ var breadDropdown = $(".bread_dropdown"); for(var i=0;i"+historyProductArr[1]+""; var history_url = historyProductArr[0].replace("/InhibitorKit/","/inhibitor-kit/"); viewedProLi=viewedProLi+"
  • "+historyProductArr[1]+"
  • "; } } historyProductsArr2[i] = historyProductsArr[i]; } } //mce.com $("#viewedPro").html("

    Your Recently Viewed Products:

    " +"
    "); // mce.cn $("#viewed_list").html(""); $.cookie('mce_historyProducts',historyProductsArr2.join("|"), {expires: 7, path: "/"}); } }) //cpd details - price button $(document).ready(function(){ //price_info table style -20160308 for(var i =0; i<$(".price_info table").length; i++){ $(".price_info table").eq(i).find("tr:odd").find("td").css("background-color","#fff"); $(".price_info table").eq(i).find("tr:even").find("td").css("background-color","#fbfbfb"); $(".price_info table").eq(i).find("tr").find("th").css("background-color","none"); } $(".a_get_quote").click(function(){ $(window).scrollTop(400); $(".bluk_inquiry").show(); }); $('.price_info table td select').change(function(){ var cpdNum = $(".price_info table td select option:selected").text(); if(cpdNum!=0){ $(".price_info table td select").css("border-color","#DDD"); $(".price_tbl_notice").css({'visibility':'hidden'}); } }); //btn_bulk_inquiry $(".btn_bulk_inquiry").click(function(){ $(window).scrollTop(400); $(".bluk_inquiry").show(); }); // $("#inquiry_btn").click(function(){ validateSubmit(); }); if($("#btn_inquiry_submit").length > 0) { $("#btn_inquiry_submit").click(function(){ validateSubmit(); }); } $(".bluk_notice_tit span").click(function(){ $(".mask").hide(); $(".bluk_notice").hide(); $(".form_btn_submit_send").addClass("form_btn_submit") .removeClass("form_btn_submit_send"); }); $(document).click(function(){ $(".bluk_notice").hide(); $(".mask").hide(); }); $(".bluk_notice,#inquiry_btn").click(function(event){ event.stopPropagation(); }); }) function clearTxtSearch(txtId){ var search_value = document.getElementById(txtId).value; if(search_value=="eg. Name, CAS, Target"){ document.getElementById(txtId).value = ""; $("#search_txt").css("color","#331515"); } search_value = null; } function checkAddress(emailAddress){ if(emailAddress!=""&&emailAddress!=null&&emailAddress!="undefined"){ emailAddress=emailAddress.toLowerCase(); if(emailAddress.indexOf("@hotmail.")!=-1||emailAddress.indexOf("@yahoo.")!=-1||emailAddress.indexOf("@gmail.")!=-1|| emailAddress.indexOf("@sina.")!=-1||emailAddress.indexOf("@qq.")!=-1||emailAddress.indexOf("@sohu.")!=-1 ||emailAddress.indexOf("@aol.")!=-1||emailAddress.indexOf("@outlook.")!=-1||emailAddress.indexOf("comcast.net")!=-1 ||emailAddress.indexOf("@163.")!=-1 ||emailAddress.indexOf("@live.")!=-1 ){ return false; }else{ return true; } }else{ //pass return true; } } function resetCart(){ $.cookie('mce_cart_cn','', {expires: 7, path: "/"}); mce_cart_cn_update(); $('#form_notice').html("

    Cookies have been reset! You may now add your items to your cart again. Continue Shopping!

    "); } function patch(re,s){ var len = 0; if(s!=null && s!=""){ re=eval("/"+re+"/ig"); if(s.match(re)!=null){ len = s.match(re).length; } } return len; } function checkAgent(){ var agentName; var agentTel; var agentEmail; var countryType; $.ajax({ url: "mce_contactUs!checkAgent.shtml?mcenow="+new Date().getTime(), data:"countryName="+$.trim($.cookie("mce_country_name")), cache:false, dataType:'json', success:function(data){ var meaasge = ""; $.each(data, function(i, item) { if(i.trim()=="checkMessage"){ meaasge = item; } }); if(meaasge=="success"){ $.each(data, function(i, item) { if(i.trim()=="countryType"){ countryType = item; } if(i.trim()=="agentName"){ agentName = item; } if(i.trim()=="agentTel"){ agentTel = item; } if(i.trim()=="agentEmail"){ agentEmail = item; } }); if(parseInt(countryType)==1){ $("#your_dis").show(); $("#find_your_dis").hide(); $("#your_dis").html("Your local distributor: " + agentName); $("#pgt_country_tel").html(agentTel); $("#agentEmail").html(agentEmail); }else { $("#your_dis").hide(); $("#your_dis").html(""); $("#find_your_dis").show(); $("#pgt_country_tel").html(agentTel); $("#agentEmail").html(agentEmail) } }else{ alert("查询失败!"); } } }); } function checkEmailFormat(emailAddress) { // if (emailAddress.indexOf("@") == 0) { // return false; // } // if (emailAddress!="") { // emailAddress = emailAddress.substring(emailAddress.indexOf("@"), emailAddress.length); // } // var reg = /@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; // var reg = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; var reg = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; if(!reg.test(emailAddress)) { return false; } return true; } function toMCECom(enCountryName) { enCountryName = enCountryName.indexOf(',') > 0 ? enCountryName.substr(0, enCountryName.indexOf(',')) : enCountryName; if (window.location.search != '') { //window.location.href = "http://www.medchemexpress.com" + window.location.pathname + window.location.search + "&enCountryName=" + enCountryName; var search_str_1 = window.location.search; var sub_index = search_str_1.indexOf('&enCountryName') > 0 ? search_str_1.indexOf('&enCountryName') : search_str_1.indexOf('?enCountryName'); var search_str = sub_index>=0? search_str_1.substr(0, sub_index) : search_str_1; if (sub_index>0) { window.location.href = "http://www.medchemexpress.com" + window.location.pathname + search_str + "&enCountryName=" + enCountryName; } else { window.location.href = "http://www.medchemexpress.com" + window.location.pathname + search_str + "?enCountryName=" + enCountryName; } } else { window.location.href = "http://www.medchemexpress.com" + window.location.pathname + "?enCountryName=" + enCountryName; } } if (typeof String.prototype.endsWith != 'function') { String.prototype.endsWith = function(suffix) { return this.indexOf(suffix, this.length - suffix.length) !== -1; }; } function goCoordinate(infoName){ var sTop = $("#"+infoName).offset().top - 86; $("body,html").animate({scrollTop: sTop+"px"}, 1000); if ($(".more-details").hasClass("icon-plus")){ $(".list-references li").find("p").css("display","block"); $(".more-details").addClass("icon-minus").removeClass("icon-plus"); } } function checkSearchParam() { if ($("#search_txt").val().trim() != '' && $("#search_txt").val().trim() != 'eg. Name, CAS, Target') { $("#search_txt").val($("#search_txt").val().trim().replace("eg. Name, CAS, Target", '')) return true; } else { return false; } } // text 非空验证 var textisEmpty = { yes: function(id){ if($(id).val().trim() == ""){ $(id).addClass('nonempty_submit').removeClass('nonempty'); }else { $(id).addClass('nonempty').removeClass('nonempty_submit'); } }, not: function (id) { $(id).addClass('nonempty').removeClass('nonempty_submit'); } }; var dateFormat =/^(\d{4})-(\d{2})-(\d{2})$/; var textisDate = { yes: function (id) { if ($(id).val().trim() == "") { $(id).addClass('nonempty').removeClass('nonempty_submit'); } else { if (dateFormat.test($(id).val().trim())) { $(id).addClass('nonempty').removeClass('nonempty_submit'); } else { $(id).addClass('nonempty_submit').removeClass('nonempty'); } } }, not : function (id) { $(id).addClass('nonempty').removeClass('nonempty_submit'); } }; function checkGermany() {} function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var r = window.location.search.substr(1).match(reg); var context = ""; if (r != null) context = r[2]; reg = null; r = null; return context == null || context == "" || context == "undefined" ? "" : context; } function replaceParamVal(name, value) { var oUrl = this.location.href.toString(); var nUrl = ''; if (getQueryString(name) != '') { const re = new RegExp(name + '=[^&]*', 'gi') nUrl = oUrl.replace(re, name + '=' + value) } else { nUrl += oUrl + (oUrl.indexOf('?') != -1 ? '&' : '?') + name + '=' + value; } history.replaceState({}, "", nUrl); } function clearLftCtus() { let lftCtusH = ($(window).height() - $("#lft_ctus").outerHeight())/2; $("#lft_ctus").stop(true).css("top",lftCtusH); } window.clearLftCtus=clearLftCtus; const csrfToken = $('meta[name="_csrf"]').attr('content'); $(function(){ let mobile = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i) if(mobile) { // let currentUrl = $(location).prop('href'); $(".btn-popup,.btn-chat-frame").on("touchstart", function(){ // let province = $("#provinceSelect").val(); let province = localStorage.getItem('mce.coustomer-provice.district'); if (province === null || province === '') { window.location.href = "/online-customer-service.html"; } else { window.location.href = "/online-dialog-box.html"; } }) }else { $(".region-item").on("click", function() { // $(".region-item").removeClass("active") // $(this).addClass("active"); if($(".card-body").scrollTop() !== 0){ localStorage.setItem("offsetTop", $(".card-body").scrollTop()); } }) $(".btn-popup,.btn-chat-frame").on("click", function(){ let province = localStorage.getItem('mce.coustomer-provice.district'); $(".dialog-box").addClass("show"); $(".card-body,.card-bottom").show(); if (province === null || province === '') { $(".modal-backdrop").addClass("ph"); $(".dialog-card-body").html(''); } else { window.contactService(); } if($(".dialog-box").hasClass("show")) { let regionItem = $(".region-item"); $.each($(regionItem), function() { let itemWidth = $(this).width(); let contentWidth = $(this).find("a").width(); if(contentWidth >= itemWidth) { $(this).css({"font-size": "1em"}) } }) let offset = localStorage.getItem("offsetTop"); // console.log(offset) $(".card-body").animate({ scrollTop: offset },0) } }); $(".btn-close-prompt").on("click", function() { $(".tips-box").hide(); }) } $(".region-navigation .choose-item").on("click", function() { let currentId = $(".all-region").find(".region-sort-container").eq($(this).index() - 1).children(".region-title").attr("id"); let scrollHeight = $(".card-body").scrollTop(); $(this).addClass("active").siblings().removeClass("active"); $(".card-body").animate({ scrollTop: scrollHeight + $("#" + currentId).position().top },0) }) $(".choose-hot-region").on('click', function() { let hotRegionTop = $(".hot-region").position().top; let scrollHeight =$(".card-body").scrollTop(); $(".card-body").animate({ scrollTop: scrollHeight + hotRegionTop },0) }) // let boxOffsetTop = $('#Footer').offset().top; // let boxHeight = $('#Footer').outerHeight(); // // $(window).scroll(function() { // let scrollTop = $(this).scrollTop(); // // if(scrollTop + boxHeight >= boxOffsetTop - 340) { // $(".dialog-wrapper").css({"position": "sticky"}); // }else { // $(".dialog-wrapper").css({"position": "fixed"}); // } // }); // $(".region-item").on("click", function() { // $(".region-item").removeClass("active") // $(this).addClass("active"); // }) $(".region-navigation span").on("click", function() { $(this).addClass("active").siblings().removeClass("active"); }) $('.btn-close').on("click", function (){ $(".dialog-box").removeClass("show"); $(".modal-backdrop").removeClass("ph"); }) }); function mceMessageWin(province) { var parm = encodeURIComponent(JSON.stringify({ "province":province } ) ); (function(win, doc, src, opt) { win[opt] = win[opt] || function () { win[opt].options = arguments[0]}; var script = doc.createElement("script"); script.async = 1; script.src = src; doc.body.appendChild(script); }) (window, document, "http://webchat-bj.clink.cn/webchat.js?v="+Date.now(), "clinkWebchatOptions"); clinkWebchatOptions({ accessId: 'b520e312-cbc3-4c3a-adbf-83c053e00875', visitorExtraInfo: encodeURIComponent(JSON.stringify({ "province":province } ) ) }); } // 定义格式化封装函数 function formaData(timer) { const year = timer.getFullYear() const month = timer.getMonth() + 1 // 由于月份从0开始,因此需加1 const day = timer.getDate() const hour = timer.getHours() const minute = timer.getMinutes() const second = timer.getSeconds() return `${pad(year, 4)}-${pad(month)}-${pad(day)} ${pad(hour)}:${pad(minute)}:${pad(second)}` } // 定义具体处理标准 // timeEl 传递过来具体的数值:年月日时分秒 // total 字符串总长度 默认值为2 // str 补充元素 默认值为"0" function pad(timeEl, total = 2, str = '0') { return timeEl.toString().padStart(total, str) } function getLocalTimeStr() { let now = new Date(); return formaData(now); } function iframeMce(province) { var parm = { "province":province}; var url = "http://webchat-bj.clink.cn/chat.html?accessId=b520e312-cbc3-4c3a-adbf-83c053e00875&headerDisplay=0&language=&tinetWebChatType=tinetFrame&autoConnectWs=1&isJsEmbed=1&preview=pc&visitorExtraInfo=" + encodeURIComponent(JSON.stringify(parm)); if ($('#isProDetail').length > 0 || $('#isKitDetail').length > 0) { var title = ''; if ($('#isProDetail').length > 0) { title = $('#head_pro_name').html() + ' ' + $('#head_pro_synonyms_name').html(); } else if ($('#isKitDetail').length > 0) { title = $('#head_pro_name').html(); if ($('#head_pro_name_cn').length > 0) { title += ' ' + $('#head_pro_name_cn').html() } } var linkCard = { title: title, subTitle: title, description: $('meta[property="og:description"]').attr('content'), price: "", priceStyle: {'font-size': '14px', 'color': '#4385ff'}, img: $('#pro_structure_img').attr('src'), url: $('meta[property="og:url"]').attr('content'), time: getLocalTimeStr(), tabMenuName: "自定义菜单", buttonText: "咨询该产品", appid: "", pagepath: "", extraInfo: [ { name: "目录号", value: $('#statisticalProCatNo').val() } ] }; url = url + "&linkCard=" + encodeURIComponent(JSON.stringify(linkCard)); } // 创建iframe元素 var iframe = document.createElement("iframe"); iframe.name = "myIframe"; iframe.src = url; iframe.width = 400; iframe.height = 519; iframe.style.borderStyle = "none" iframe.headerDisplay $(".dialog-card-body").append(iframe); $(".card-body,.card-bottom").hide(); //document.body.appendChild(iframe); } function isCnActive24Time() { //EU Taiwan ADCs var temp_cn = new Date(); var startTime = new Date("2024/06/01,00:00:00"); var endTime = new Date("2024/08/15,23:59:59"); return temp_cn.getTime() > startTime.getTime() && temp_cn.getTime() < endTime.getTime(); } function isActivityCode() { if ($('#activityCode').length > 0) { $('.activityCode').show(); } } window.onload = function(){ if ($(".detail_rgt").length > 0 && $('.detail_lft').length > 0) { var detail_rgt_height = Math.floor($(".detail_rgt").outerHeight()); var detail_lft_height = Math.floor($(".detail_lft").outerHeight()); //console.log("r: "+detail_rgt_height , "l: "+detail_lft_height) if(detail_rgt_height + 116 < detail_lft_height) { $(".pro_related_lib,.pro_related_kit,.protein_img,#recombinant-proteins-link").fadeIn(0); } } };