‘);$(“#fromUserEmail”).remove();}
}
});}
function showdetail(t,v) {if (v ==0) {$(t).parent().find(“li”).removeClass(“on”);$(t).addClass(“on”);$(“#productDetails”).show();$(“#companyProfile”).hide();} else {$(t).parent().find(“li”).removeClass(“on”);$(t).addClass(“on”);$(“#productDetails”).hide();$(“#companyProfile”).show();}
}
function checkEmail() {$(“#fromUserEmail”).parent().find(“.valid_message”).remove();var val =document.getElementById(“fromUserEmail”).value;if (ValidateEmail(val)) {if (val ==’sales@wuhanbearing.com’) {$(“#fromUserEmail”).parent().append(‘Sorry, you can’t message to yourself.‘);$(“#fromUserEmail”).focus();} else {validateemail(val);}
} else {$(“#fromUserEmail”).parent().append(‘Please enter a valid Business Email.‘);}
}
function validateemail(email) {var ajax =new Ajax(“XY017″,”&email=” + email);ajax.onSuccess =function () {if (ajax.state.result ==0) {showLoginDialog(email,function () {LoginUpdate();updateLoginInfo();},false,null);}
else {var url =config.WebURL + ‘join.’ + config.Suffix + ‘?surl=’ + escape(window.location.href) + “&email=” + email;var html_A =”This email address has not been registered, please register first. Register Now>>.”;jAlert(html_A);}
}
}
function checkusermessageJQuery() {if (document.getElementById(“fromUserEmail”) !=undefined &&document.getElementById(“fromUserEmail”).value ==””) {$(“#fromUserEmail”).parent().append(‘Please enter a valid Business Email.‘);$(“#fromUserEmail”).focus();return false;}
if (document.getElementById(“fromUserEmail”) !=undefined &&document.getElementById(“fromUserEmail”).value !=””) {checkEmail();return;}
if (document.getElementById(“txtContent”).value ==””) {$(“#txtContent”).parent().append(‘Please enter your message!‘);$(“#txtContent”).focus();return false;} else if (document.getElementById(“txtContent”).value.length >3000) {$(“#txtContent”).parent().append(‘Your message must be between 1-3000 characters‘);$(“#txtContent”).focus();return false;}
if (document.getElementById(“txtQuantity”).value ==””) {$(“#txtQuantity”).parent().append(‘Please enter Minimum Order Quantity!‘);$(“#txtQuantity”).focus();return false;}
if (document.getElementById(“txtCode”).value ==””) {$(“#txtCode”).parent().append(‘Please enter Verification Code!‘);$(“#txtCode”).focus();return false;}
showConfirmMessage({ConfirmText:”Submit”,msg:”If this supplier does not reply to you within 3 days, we may send your inquiry and contact information to relevant suppliers recommended by CCCME.”
,IsShowInqueryAccept:true,AcceptMsg:”I accept the above terms”,confirmCallBack:postInquryData
});}
function postInquryData() {var str_url =escape(window.location.href);var title =document.getElementById(“txtTitle”).value;var type =document.getElementById(“_param_userinfo_parent_module”).value;var ids =document.getElementById(“_param_userinfo_infoid”).value;var uids =document.getElementById(“_param_userinfo_userid”).value;var contents =document.getElementById(“txtContent”).value;var code =document.getElementById(“txtCode”).value;var quantity =document.getElementById(“txtQuantity”).value;var unit =document.getElementById(“txtUnit”).options[document.getElementById(“txtUnit”).selectedIndex].text;var othersupper =”Y”;var isopencontact =document.getElementById(“cbInqueryOpenContact”).checked ==true ?1 :0;$(“#sub”).attr(“disabled”,true).css(“background”,”rgba(0, 72, 152,0.4)”);jQuery.ajax({type:”POST”,dataType:’text’,contentType:”application/x-www-form-urlencoded; charset=utf-8″,url:”../../../Common/XYAjax.ashx?ac=xy012jquerynew&t=” + Math.round(new Date().getTime() / 1000).toString(),data:{content:encodeURIComponent(contents),title:encodeURIComponent(title),type:type,ids:ids,uids:uids,code:code,othersupper:othersupper,quantity:quantity,unit:unit,isopencontact:isopencontact
},success:function (data) {var result =data.split(‘|’);if (result[0] ==”ok”) {showMessage(“Thank you! Your message has been successfully sent to the supplier!”,function () {$(“html,body”).animate({scrollTop:0 },800);});document.getElementById(“txtContent”).value =””;document.getElementById(“txtTitle”).value =document.getElementById(“hidInfoTitle”).value;document.getElementById(“txtCode”).value =””;document.getElementById(“txtQuantity”).value =””;document.getElementById(“txtUnit”).value =”4″;document.getElementById(‘siimage’).src =’/Common/ValidateCode.ashx?=’ + Math.random();$(“#sub”).css(“background”,”#004898″);$(“#sub”).removeAttr(“disabled”);}
else if (data ==”nologin”) {showLoginDialog(“”,function () {LoginUpdate();updateLoginInfo();},false,null);}
else if (data ==”err” ||data ==”nomessage”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘Your message failed to send!’);$(“#sub”).css(“background”,”#004898″);$(“#sub”).removeAttr(“disabled”);}
else if (data ==”codeErr”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(“Type the characters you see in the picture!”);$(“#sub”).css(“background”,”#004898″);$(“#sub”).removeAttr(“disabled”);}
else if (data ==”counterr”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(“The platform is only allowed to send 50 inquiry messages per day, and you have exceeded the sending limit.”);$(“#sub”).css(“background”,”#004898″);$(“#sub”).removeAttr(“disabled”);}
}
});}
function addFavorite(linkbox) {var str_url =escape(window.location.href);var ajax =new Ajax(“xy0231″,”&Module=” + $F(“_param_userinfo_parent_module”) + “&InfoId=” + $F(“_param_userinfo_infoid”) + “&UserId=” + $F(“_param_userinfo_userid”));ajax.onSuccess =function () {if (ajax.state.result ==”1″) {if (ajax.data.content.indexOf(“ok”) >-1) {var code =ajax.data.content.split(‘|’)[1];$(linkbox).html(‘Add Favorites‘);$(linkbox).unbind(‘click’).click(function () {removeFavorite(code,linkbox);});$(“.re_ok”).hide();$(“.re_close”).hide();showMessage(‘Add Favorites Successfully !’);setTimeout(function () {$(“.requ_fu”).fadeOut().hide();},3000);}
else if (ajax.data.content ==”nologin”) {showLoginDialog(“”,function () {LoginUpdate();updateLoginInfo();},false,null);}
else if (ajax.data.content ==”err”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘Favorite Failed’);}
else if (ajax.data.content ==”exis”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘The information collection’);}
else if (ajax.data.content ==”nomessage”) {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘You Can not favorite your own information’);}
else {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘System abnormalities. Please try again later!’);}
}
}
}
function removeFavorite(id,linkbox) {var str_url =escape(window.location.href);var ajax =new Ajax(“xy0232″,”&FaCode=” + id + “&UserId=” + +$F(“_param_userinfo_userid”));ajax.onSuccess =function () {if (ajax.data.content ==”ok”) {$(linkbox).html(‘Add Favorites‘);$(linkbox).unbind(‘click’).click(function () {addFavorite(linkbox);});}
else if (ajax.data.content ==”nologin”) {linkbox.unbind(‘click’).click(function () {showLoginDialog(“”,function () {LoginUpdate();updateLoginInfo();},false,null);});}
else if (ajax.data.content ==”err”) {linkbox.unbind(‘click’).click(function () {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘Favorite Failed’);});}
else if (ajax.data.content ==”exis”) {linkbox.unbind(‘click’).click(function () {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘The information collection’);});}
else if (ajax.data.content ==”nomessage”) {linkbox.unbind(‘click’).click(function () {$(“.re_ok”).show();$(“.re_close”).show();showMessage(‘You Can not favorite your own information’);});}
}
}