锘縱ar count = 3;
var isclick = false;
var currentmenuName = "Properties";
$(function () {
$('.opentitle').find('h2').click(function () {
if ($(this).parent().parent().attr('class') == 'openbox') {
$(this).parent().parent().attr('class', 'openbox-o');
}
else {
$(this).parent().parent().attr('class', 'openbox');
}
});
$('.opentitle').find('h2').next('span').click(function () {
if ($(this).parent().parent().attr('class') == 'openbox') {
$(this).parent().parent().attr('class', 'openbox-o');
}
else {
$(this).parent().parent().attr('class', 'openbox');
}
});
//var isSafe = $("#isSafe").val();
//if (isSafe == '1') {
// var lab1=$("#s_label1");
// if (lab1!=undefined) {
// $("#s_label1").attr('class', 's_hovertab');
// $("#s_label_c1").attr('class', 'Label_show');
// }
// var lab1 = $("#s_label2");
// if (lab1 != undefined) {
// $("#s_label2").attr('class', 's_normaltab');
// $("#s_label_c2").attr('class', 'hide');
// }
//}
$("#btnSearch").click(function () {
location.href = "/ProductList_en.aspx?kwd=" + $("#keyWord").val();
});
$("#btnSearchFloat").click(function () {
location.href = "/ProductList_en.aspx?kwd=" + $("#keyWordFloat").val();
});
var anchor = $("a[data-field='anchor']");
var coordinate = $("div[data-field='coordinate']");
//var shtml = "
";
//$("#menufloat").html(shtml);
//$("#menufloat2").html(shtml);
$("#menufloat a").click(function () {
$(document).scrollTop($("#" + $(this).attr("data-upper")).offset().top - 80);
isclick = true;
currentmenuName = $(this).attr("data-upper");
})
$("#menufloat2 a").click(function () {
$(document).scrollTop($("#" + $(this).attr("data-upper")).offset().top - 80);
isclick = true;
currentmenuName = $(this).attr("data-upper");
})
$("#holder a").click(function () {
var offsetTop = $("a[name='" + $(this).attr("data-holder") + "']").offset().top - 50
$(document).scrollTop(offsetTop);
})
$("#keyWord").keydown(function (event) {
if (event.keyCode == 13) {
location.href = "/ProductList_en.aspx?kwd=" + $(this).val();
}
});
$("#keyWordFloat").keydown(function (event) {
if (event.keyCode == 13) {
location.href = "/ProductList_en.aspx?kwd=" + $(this).val();
}
});
$("#Structure").click(function () {
location.href = "/StructuredSearch_EN.htm";
})
$(window).scroll(function () {
if (isclick) {
$("#menufloat2 a").removeClass("current");
$("#menufloat2 a[data-upper='" + currentmenuName + "']").addClass("current");
$("#menufloat a").removeClass("current");
$("#menufloat a[data-upper='" + currentmenuName + "']").addClass("current");
}
else {
for (var i = 0; i < coordinate.length; i++) {
if ($(coordinate[i]).offset().top - $(this).scrollTop() > 0 && ($(coordinate[i]).offset().top - $(this).scrollTop() < 500) && ($(coordinate[i]).offset().top - $(this).scrollTop() > -100)) {
$("#menufloat2 a").removeClass("current");
$("#menufloat2 a[data-upper='" + $(coordinate[i]).attr("data-upper") + "']").addClass("current");
$("#menufloat a").removeClass("current");
$("#menufloat a[data-upper='" + $(coordinate[i]).attr("data-upper") + "']").addClass("current");
}
}
var scrollTop = $(this).scrollTop();
if (scrollTop > $("#menufloat").offset().top) {
$("#menufloat2").show();
$("#menufloat").css("visibility", "hidden");
}
else if (scrollTop <= $("#menufloat").offset().top) {
$("#menufloat2").hide();
$("#menufloat").css("visibility", "");
}
}
if (isclick && currentmenuName != 'Properties') {
var scrollTop = $(this).scrollTop();
if (scrollTop > $("#menufloat").offset().top) {
$("#menufloat2").show();
$("#menufloat").css("visibility", "hidden");
}
else if (scrollTop <= $("#menufloat").offset().top) {
$("#menufloat2").hide();
$("#menufloat").css("visibility", "");
}
}
isclick = false;
});
$("#menufloat a").click(function () {
isclick = true;
currentmenuName = $(this).attr("data-upper");
$("#menufloat a").removeClass("current");
$(this).addClass("current");
$("#menufloat2 a").removeClass("current");
$("#menufloat2 a[data-upper='" + $(this).text() + "']").addClass("current");
});
$("#menufloat2 a").click(function () {
isclick = true;
currentmenuName = $(this).attr("data-upper");
$("#menufloat2 a").removeClass("current");
$(this).addClass("current");
$("#menufloat a").removeClass("current");
$("#menufloat a[data-upper='" + $(this).text() + "']").addClass("current");
});
$("div[data-field='goldpro']").click(function () {
location.href = "/ProductAdvertising.aspx";
});
$("#SupplierCountDetail").change(function () {
$.get("/Handler/GetSupplieListByNationality.ashx", { cbn: $("#cbnumber").val(), country: $("#SupplierCountDetail").val() }, function (result) {
var type = result.Type;
var suppliers = result.Suppliers;
if (suppliers != null) {
var shtml = "Supplier | Tel | Fax | Email | Country | ProdList | Advantage |
";
var shtml02 = "Supplier | Advantage |
";
for (var i = 0; i < suppliers.length > 0; i++) {
shtml += "";
shtml02 += "
";
var IsVip = false;
if (suppliers[i].HWOrderValue >= 206) {
IsVip = true;
}
if (type = "A") {
if (IsVip) {
if (suppliers[i].HWOrderValue >= 280 && suppliers[i].HWOrderValue <= 300) {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
else if (suppliers[i].HWOrderValue >= 310) {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
else {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
}
else {
if (suppliers[i].HWOrderValue >= 280 && suppliers[i].HWOrderValue <= 300) {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
else if (suppliers[i].HWOrderValue >= 310) {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
else {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
}
}
else {
shtml += "" + suppliers[i].SupplierEName + "";
shtml02 += " | " + suppliers[i].SupplierEName + "";
if (suppliers[i].PhysicalId > 0 && suppliers[i].AuthenticatingId > 0) {
shtml += "";
shtml02 += "";
}
shtml += " | ";
shtml02 += "";
}
shtml += " " + suppliers[i].Tel + "
| ";
shtml += "" + suppliers[i].Fax + " | ";
shtml += "" + suppliers[i].Email + " | ";
shtml += " " + suppliers[i].SNationality + " | ";
shtml += "" + suppliers[i].ProdCount + " | ";
shtml += " " + suppliers[i].ECEI + " |
";
shtml02 += " " + suppliers[i].ECEI + " | ";
}
$("#GridView2").empty();
$("#GridView2").html(shtml);
$("#GridView2_02").empty();
$("#GridView2_02").html(shtml02);
$("div[data-field='goldpro']").unbind("click");
$("div[data-field='goldpro']").click(function () {
location.href = "/ProductAdvertising.aspx";
});
}
}, "json");
});
$("#prev_main").click(function () {
if (count <= 3) {
return;
}
$("li[data-id='" + count + "']").hide();
$("li[data-id='" + (count - 3) + "']").show();
count--;
})
$("#next_main").click(function () {
if (count >= $("#imagetext_productcount").val()) {
return;
}
count++;
$("li[data-id='" + count + "']").show();
$("li[data-id='" + (count - 3) + "']").hide();
})
$("#bt_delegate_list").click(function () {
var cas = $(this).attr("data-cas");
var productname = $(this).attr("data-productname");
var cbnumber = $(this).attr("data-cbnumber");
source = "ChemicalProductProperty_EN_new.aspx";
location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source;
});
$("#bt_delegate_list_float").click(function () {
var cas = $(this).attr("data-cas");
var productname = $(this).attr("data-productname");
var cbnumber = $(this).attr("data-cbnumber");
source = "ChemicalProductProperty_EN_new.aspx";
location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source;
});
$("input[data-field='inquiry']").click(function () {
delCookie("merge");
setCookie("merge", $(this).attr("data-cbsid"), "d1");
var cas = $("#bt_delegate_list").attr("data-cas");
var productname = $("#bt_delegate_list").attr("data-productname");
var cbnumber = $("#bt_delegate_list").attr("data-cbnumber");
source = "ChemicalProductProperty_EN_new.aspx";
location.href = "InquiryToSupplier.aspx?cas=" + cas + "&n=" + productname + "&cbnumber=" + cbnumber + "&source=" + source;
});
$("#spectrumdiv a").attr('target', '_blank');
})
function delCookie(name) {
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval = getCookie(name);
if (cval != null)
document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
}
function setCookie(name, value, time) {
var strsec = getsec(time);
var exp = new Date();
exp.setTime(exp.getTime() + strsec * 1);
document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
function getCookie(name) {
var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
if (arr = document.cookie.match(reg))
return unescape(arr[2]);
else
return null;
}
function getsec(str) {
var str1 = str.substring(1, str.length) * 1;
var str2 = str.substring(0, 1);
if (str2 == "s") {
return str1 * 1000;
}
else if (str2 == "h") {
return str1 * 60 * 60 * 1000;
}
else if (str2 == "d") {
return str1 * 24 * 60 * 60 * 1000;
}
}