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('
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); } } };