"; } jQuery_1("#industry_signup").val(selectvalue); jQuery_1("#industry_signup").prepend(str); //jQuery_1("#industry option:first").attr('selected','selected'); } }); } function industry_error_show(element_id) { var value_is; value_is = document.getElementById(element_id).value; if(value_is == 0) { value_is = ""; jQuery_1("#"+element_id).css({'border-top' : '1px solid #CE1818'}); jQuery_1("#"+element_id).css({'border-bottom' : '1px solid #CE1818'}); jQuery_1("#"+element_id).css({'border-left' : '1px solid #CE1818'}); jQuery_1("#"+element_id).css({'border-right' : '1px solid #CE1818'}); jQuery_1("#"+element_id).css({'background-color' : '#FDE8E9'}); } else { jQuery_1("#"+element_id).css({'border-top' : '1px solid #CCCCCC'}); jQuery_1("#"+element_id).css({'border-bottom' : '1px solid #CCCCCC'}); jQuery_1("#"+element_id).css({'border-left' : '1px solid #CCCCCC'}); jQuery_1("#"+element_id).css({'border-right' : '1px solid #CCCCCC'}); jQuery_1("#"+element_id).css({'background-color' : '#FFFFFF'}); } } function set_popup_cookie() { var exp=new Date();var expiry=60*60*1000; if(typeof(cookie_domain)!="undefined") set_cookie("c_popup_required",'no',expiry,"/",cookie_domain); else set_cookie("c_popup_required",'no',expiry,"/"); } jQuery_1(document).ready(function(){ jQuery_1("input[type=radio][name=is_buyer_or_seller]").bind('change',function(){ var txt =jQuery_1('input[name=is_buyer_or_seller]:checked').val(); if(txt == 1){ txt="购买产品"; jQuery_1("#cn_signupform #company").hide() } else{ txt="销售产品"; jQuery_1("#cn_signupform #company").show() } jQuery_1("#product").attr('placeholder',txt); }); jQuery_1("#cn_signupform #country").bind('change',country_chk_popup); jQuery_1('#cn_signupform #country').change(function() { jQuery_1("#city_id").remove(); jQuery_1("#state_id").remove(); country_chk_popup(); }); }); //If requesting page has inquiry sent box then adding a function to display popup box jQuery_1(document).ready(function(){ get_phone_code(223); signup(); jQuery_1(".step2").hide(); setTimeout(function() { if(mobile_chk=='true') { jQuery_1("head").append(""); var w = jQuery_1(window).width(); jQuery_1(".modal-dialog").css('width',w); jQuery_1("#signupmodal").css('right','unset'); window.scrollTo(0, 10); jQuery_1("#ajax-loader .loader").css('top','13%').css('left','13%'); } jQuery_1("#btn_cnsignup").trigger('click'); var str = "100"; // Tracking for Popup Show event if(jQuery_1("#footer_page_created").length > 0) { var str = jQuery_1("#footer_page_created").text(); } else if(jQuery_1(".smalltext").length > 0) { var str = jQuery_1(".smalltext").text(); } var regex_float = /[+-]?\d+(\.\d+)?/g; time_float = str.match(regex_float).map(function(v) { return parseFloat(v); }); tk_track_ga_event('Signup Popup Form','Show','With Country Dropdown - USA',time_float[0]); jQuery_1("#cn_signupmodel .close").click(function(){ tk_track_ga_event('Signup Popup Form','Close','With Country Dropdown - USA',time_float[0]); }); $j("#cn_signupmodel .not_now").click(function(){ tk_track_ga_event('Signup Popup Form','Close','With Country Dropdown - USA',time_float[0]); }); // jQuery_1("#signupmodal").css('right','unset'); set_popup_cookie(); if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',1); } if(jQuery_1("#header div[class='header_top']").length) { var v =jQuery_1("#header div[class='header_top']").parent().css('zIndex'); if( v>=9999) { jQuery_1("#header div[class='header_top']").parent().css('zIndex',1); } } jQuery_1('#signupmodal').on('hidden.bs.modal', function () { if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',""); } if( v>=9999) { jQuery_1("#header div[class='header_top']").parent().css('zIndex',v); } }); }, 1000); }); //If requesting page has inquiry sent box then adding a function to display popup box function display_popup(){ inquiry_popup = 1; get_phone_code(223); signup(); country_chk_popup(); jQuery_1(".step2").hide(); if(jQuery_1("#span_already").length ==0) { jQuery_1("#is_buyer_or_seller1").parent().parent().append('Already on TradeKey? Sign In'); } setTimeout(function() { if(mobile_chk=='true') { jQuery_1("head").append(""); var w = jQuery_1(window).width(); jQuery_1(".cn_signupmodel .modal").css('right','unset'); jQuery_1(".modal-dialog").css('width',w); window.scrollTo(0, 10); jQuery_1("#ajax-loader .loader").css('top','13%').css('left','13%'); } jQuery_1("#signupmodal .modal-title").text("Provide your contact details to send message"); jQuery_1("#btn_cnsignup").trigger('click'); if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',1); } jQuery_1('#signupmodal').on('hidden.bs.modal', function () { if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',""); } }); }, 1000); } function login_function() { //	jQuery_1("#signupmodal #close_btn").trigger('click'); //display_login_form(); jQuery_1("#signupmodal").removeClass("fade").modal("hide"); jQuery_1("#signupmodal").addClass("fade"); if(mobile_chk == "false") { jQuery_1("#ajax-loader .loader").css('top','35%'); } jQuery_1("#signupmodal .modal-title").text("Provide your contact details to send message"); jQuery_1("#signinmodal").modal("show").addClass("fade"); if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',1); } jQuery_1('#signinmodal').on('hidden.bs.modal', function () { if ( jQuery_1("#login_sign_in").length ) { jQuery_1("#login_sign_in").css('zIndex',""); } }); } function createCookieSidebar(name,value,days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + value + expires + "; path=/"; } function signup() { jQuery_1(document).ready(function() { jQuery_1.validator.addMethod('selectcheck', function (value) { return (value != '0' && value !=""); }, "Please Select an Industry"); jQuery_1.validator.addMethod("alphanumeric", function(value, element) { return this.optional(element) || /^[^@<>()]+$/i.test(value); }, "Please enter a valid Chat id"); jQuery_1.validator.addMethod("company_chk", function(value, element) { if(jQuery_1("#cn_signupform input[name=is_buyer_or_seller]:checked").val() == 1){ jQuery_1("#cn_signupform #company").hide(); } }, "Please enter a valid company name"); jQuery_1('#cn_signupform').validate({ rules: { country: "required", fullname: { required: true }, is_buyer_or_seller: "required", password: { required: true, minlength: 6 }, company: { required: true, }, industry:{selectcheck: true}, email: { required: true, email: true }, mobile_number :{ required: true }, product: "required", phone1: { required: true, number: true, maxlength: 3 }, im_id:{alphanumeric: true}, code:"required" }, messages: { mobile_number :{ required: "Please enter mobile number", number: "Please enter a valid mobile number" }, fullname: { required:"Please enter full name", name_chk:"Please use english words" }, country:"Please Select a Country", is_buyer_or_seller:"Please Select Either Buyer or Seller", password: { required: "Please provide a password", minlength: "Your password must be at least 5 characters long" }, company: { required:"Please provide a Company name", company_chk:"Company can not have any special character (e.g. & ; < > ' \")" }, product: "Please enter product name(s)", email: { required: "Email Address is Required", email: "Please enter a valid email address", }, phone1: { required: "Please enter your country code", number: "Please enter a valid country code" }, phone3: { required:"Please enter your phone number", number: "Please enter a valid number" }, code:"Please enter verification code" }, errorPlacement: function(error, element) { jQuery_1("#ajax-loader").hide(); element_id = jQuery_1(element).attr("id"); element.focus(function () { //jQuery_1("#preview_"+element_id).remove(); //signuptooltip(error.html(),element); }).blur(function () { //jQuery_1("#preview_"+element_id).remove(); }); }, unhighlight: function( element, error ) { element_id = jQuery_1(element).attr("id"); jQuery_1(element).removeClass("error"); jQuery_1(element).addClass("success"); jQuery_1("preview_"+element_id).remove(); if(element_id == "d_states") { jQuery_1("preview_"+element_id).remove(); } var h = jQuery_1("#signupmodal").find("div[class='col-sm-6 col-md-6 pull-left']").height(); jQuery_1("#signupmodal").find("div[class='hidden-xs col-xs-12 col-sm-6 col-md-6 right-panel-modal pull-right']").height(h); }, submitHandler: function(form) { if(jQuery_1("#legal_check_verify").val() == 1) { var verify_checkbox = document.getElementById("legal_check").checked; if (verify_checkbox == false) { alert('You must accept the terms of use.'); return false; jQuery_1("#cn_signupform #submit").attr("disabled", false); } } else { jQuery_1("#cn_signupform #submit").attr("disabled", true); } if(parseInt(jQuery_1("#joined").val()) == 1 ){ var datastring = jQuery_1("#cn_signupform").serialize(); jQuery_1.ajax({ type: "POST", url: "/index.php?action=widgets_signup_other_info", data: datastring, dataType: "json", beforeSend: function() { jQuery_1("#ajax-loader").show(); }, complete: function() { jQuery_1("#ajax-loader").hide(); }, success: function(msg) { } }); createCookie('c_popup_required', 'no' , 365); jQuery_1('#signupmodal #close_btn').click(); window.location.href = 'https://cn.tradekey.com/'+'index.html?action=memberarea_index'; return 0; } if(typeof btn === "undefined" ) { jQuery_1("#ajax-loader").hide(); return; } else if(btn == 1 ) { btn = 0; //return; } var fullname = jQuery_1("#cn_signupform #fullname").val(); var name_split = fullname.split(" "); var version = "1.0.1"; var fname = (name_split[0] != '' && name_split[0] != 'undefined') ? name_split[0] : "null"; var lname = (name_split[1] != '' && name_split[1] != 'undefined' ) ? name_split[1] : "null"; var email = jQuery_1("#cn_signupform #email").val(); var username = jQuery_1("#cn_signupform #username").val(); var password = jQuery_1("#cn_signupform #password").val(); var code = jQuery_1("#cn_signupform #popup_code").val(); var country= jQuery_1('#cn_signupform #country').val(); var mob1= jQuery_1('#cn_signupform #phone1').val(); var sid= jQuery_1('#cn_signupform #pop_sid').val(); var mob2= (jQuery_1('#cn_signupform #mobile_number').val()) ? jQuery_1('#cn_signupform #mobile_number').val(): "" ; var joined= parseInt(jQuery_1('#cn_signupform #joined').val()); if(country == 38 || country == 223 || country == 150){ var state = jQuery_1("#state_id").val(); if(jQuery_1("#city_id").length > 0){ var city = jQuery_1("#city_id").val(); } else{ var city = jQuery_1("#city_id").val(); } if(city == undefined){ var state_city = "&state="+state; } else{ var state_city = "&state="+state+"&city="+city; } } else { var state_city = ""; } var industry = (jQuery_1("#cn_signupform #industry_signup").val() != "") ? jQuery_1("#cn_signupform #industry_signup").val() : 1; //product = product.replace(/[^A-Za-z0-9,\s]/g," "); // if($("#cn_signupform input#product").length > 0) // { var product = jQuery_1("#cn_signupform input#product").val(); //} if(product.length > 0 ) { var product = jQuery_1("#cn_signupform input#product").val(); } else { var product = ''; } var phone1 = jQuery_1("#cn_signupform input#phone1").val(); var phone3 = jQuery_1("#cn_signupform input#mobile_number").val(); var company = jQuery_1("#cn_signupform input#company").val(); //var show_captcha = jQuery_1("#cn_signupform input#show_captcha").val(); var is_buyer_or_seller =jQuery_1('input[name=is_buyer_or_seller]:checked').val(); var cell_im = ""; var im_id = jQuery_1("input#im_id").val(); var im_name = jQuery_1("select#im_name").val(); if(im_name !== "") { cell_im = "&im_id="+im_id+"&im_name="+im_name; } var wechat_data =""; //var code = jQuery_1("#cn_signupform #code").val(); var socialnetwork=""; var signup_source = "newsignup_widget,cn_product_enview"; if(inquiry_popup == 1) { signup_source = signup_source + "_inquiry"; } var signup_data = "joined="+joined+"&socialnetwork="+socialnetwork+"&version="+version+"&firstname="+fname+"&lastname="+lname+"&email="+email+"&product="+product+"&password="+password+"&country="+country+state_city+"&industry="+industry+"&phone1="+phone1+"&phone3="+phone3+"&company="+company+wechat_data+"&is_buyer_or_seller="+is_buyer_or_seller+"&source="+signup_source+cell_im+"&mob1="+mob1+"&mob2="+mob2; var news_letter = 0; if(jQuery_1("#agree_newsletter").attr('checked')) { news_letter=1; } signup_data += "&agree_newsletter="+news_letter+"&code="+code+"&sid="+sid; jQuery_1("#ajax-loader").show(); tk_track_ga_event('Signup Popup Form','Submit','With Country Dropdown - USA',time_float[0]); jQuery_1.ajax({ type: "POST", url: "/index.php?action=widgets_signup_signup&return=json", data: signup_data, dataType: "json", success: function(msg) { if(parseInt(msg.error) == 0){ window.location.href = 'https://cn.tradekey.com/'+'\index.html?action=memberarea_index'; return false; } btn = 1; if(msg.error == 1) { for(i=0;i