﻿(function($) { $.fn.jCarouselLite = function(o) { o = $.extend({ btnPrev: null, btnNext: null, btnGo: null, mouseWheel: false, auto: null, speed: 200, easing: null, vertical: false, circular: false, visible: 3, start: 0, scroll: 1, beforeStart: null, afterEnd: null }, o || {}); return this.each(function() { var b = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width"; var c = $(this), ul = $("ul", c), tLi = $("li", ul), tl = tLi.size(), v = o.visible; if (o.circular) { ul.prepend(tLi.slice(tl - v - 1 + 1).clone()).append(tLi.slice(0, v).clone()); o.start += v } var f = $("li", ul), itemLength = f.size(), curr = o.start; c.css("visibility", "visible"); f.css({ overflow: "hidden", float: o.vertical ? "none" : "left" }); ul.css({ margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" }); c.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "0px" }); var g = o.vertical ? height(f) : width(f); var h = g * itemLength; var j = g * v; f.css({ width: f.width(), height: f.height() }); ul.css(sizeCss, h + "px").css(animCss, -(curr * g)); c.css(sizeCss, j + "px"); if (o.btnPrev) $(o.btnPrev).click(function() { return go(curr - o.scroll) }); if (o.btnNext) $(o.btnNext).click(function() { return go(curr + o.scroll) }); if (o.btnGo) $.each(o.btnGo, function(i, a) { $(a).click(function() { return go(o.circular ? o.visible + i : i) }) }); if (o.mouseWheel && c.mousewheel) c.mousewheel(function(e, d) { return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll) }); if (o.auto) setInterval(function() { go(curr + o.scroll) }, o.auto + o.speed); function vis() { return f.slice(curr).slice(0, v) }; function go(a) { if (!b) { if (o.beforeStart) o.beforeStart.call(this, vis()); if (o.circular) { if (a <= o.start - v - 1) { ul.css(animCss, -((itemLength - (v * 2)) * g) + "px"); curr = a == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll } else if (a >= itemLength - v + 1) { ul.css(animCss, -((v) * g) + "px"); curr = a == itemLength - v + 1 ? v + 1 : v + o.scroll } else curr = a } else { if (a < 0 || a > itemLength - v) return; else curr = a } b = true; ul.animate(animCss == "left" ? { left: -(curr * g)} : { top: -(curr * g) }, o.speed, o.easing, function() { if (o.afterEnd) o.afterEnd.call(this, vis()); b = false }); if (!o.circular) { $(o.btnPrev + "," + o.btnNext).removeClass("disabled"); $((curr - o.scroll < 0 && o.btnPrev) || (curr + o.scroll > itemLength - v && o.btnNext) || []).addClass("disabled") } } return false } }) }; function css(a, b) { return parseInt($.css(a[0], b)) || 0 }; function width(a) { return a[0].offsetWidth + css(a, 'marginLeft') + css(a, 'marginRight') }; function height(a) { return a[0].offsetHeight + css(a, 'marginTop') + css(a, 'marginBottom') } })(jQuery); $("#div_shAllTrades,#showtradediv").hover(function() { $("#div_shAllTrades").removeClass("hideAllTrades").addClass("showAllTrades"); $("#showtradediv").show(); }, function() { $("#div_shAllTrades").removeClass("showAllTrades").addClass("hideAllTrades"); $("#showtradediv").hide(); }); if ($(".moreItems .jCarouselLite li").length > 0) { $(".moreItems .jCarouselLite").jCarouselLite({ btnNext: ".next", btnPrev: ".prev", visible: 7 }); } if ($(".moreItems .jCarouselLite_page li").length > 0) { $(".moreItems .jCarouselLite_page").jCarouselLite({ btnNext: ".pagenextoff", btnPrev: ".pageprevoff", visible: 11 }); } $.fn.vcenter = function(c, b) { var a = Math.max($(this).width() / c, $(this).height() / b); $(this).width($(this).width() / a); var e = (c - $(this).width()) / 2; var d = (b - $(this).height()) / 2; $(this).css("padding", d + "px " + e + "px") }; var NewDetail = { init: function(b) { var a = $(b + ">.num  li").length; var d = 0; $(b + ">.num li").mouseover(function() { d = $(b + ">.num li").index(this); NewDetail.show(d, b) }); if ($(".slider > li").length == 1) { return } $(b).hover(function() { if (c) { clearInterval(c) } }, function() { c = setInterval(function() { NewDetail.show(d, b); d++; if (d == a) { d = 0 } }, 2000) }); var c = setInterval(function() { NewDetail.show(d, b); d++; if (d == a) { d = 0 } }, 2000) }, show: function(b, a) { $(a + ">.slider").stop(true, false).animate({ left: -218 * b }, 500); $(a + ">.num li").eq(b).addClass("on").siblings().removeClass("on") }, body: function() { $("#txtSearch").focus(function() { if ($.trim($(this).val()) == "" || $(this).val() == "   \u8bf7\u8f93\u5165\u5173\u952e\u5b57") { $(this).val("") } }); $("#txtSearch").blur(function() { if ($.trim($(this).val()) == "") { $(this).val("   \u8bf7\u8f93\u5165\u5173\u952e\u5b57") } }); $("#lipro").click(function() { $(this).removeClass("tagblue"); $(this).addClass("tagwhite"); $("#licomp").removeClass("tagwhite"); $("#licomp").addClass("tagblue"); $("#litrade").removeClass("tagwhite"); $("#litrade").addClass("tagblue"); $("#ddlType").val("pro") }); $("#licomp").click(function() { $(this).removeClass("tagblue"); $(this).addClass("tagwhite"); $("#lipro").removeClass("tagwhite"); $("#lipro").addClass("tagblue"); $("#litrade").removeClass("tagwhite"); $("#litrade").addClass("tagblue"); $("#ddlType").val("cp") }); $("#litrade").click(function() { $(this).removeClass("tagblue"); $(this).addClass("tagwhite"); $("#lipro").removeClass("tagwhite"); $("#lipro").addClass("tagblue"); $("#licomp").removeClass("tagwhite"); $("#licomp").addClass("tagblue"); $("#ddlType").val("trd") }); $("#showtradediv li").mouseover(function() { $(this).addClass("showtradediv_itembg") }); $("#showtradediv li").mouseout(function() { $(this).removeClass("showtradediv_itembg") }); $(".othernewproimgdiv").mouseover(function() { $(this).addClass("othernewproimgbd") }); $(".othernewproimgdiv").mouseout(function() { $(this).removeClass("othernewproimgbd") }); $("#pageinfo_content_left").mouseover(function() { $(this).removeClass("pageprevoff"); $(this).addClass("pageprevon") }); $("#pageinfo_content_left").mouseout(function() { $(this).removeClass("pageprevon"); $(this).addClass("pageprevoff") }); $("#pageinfo_content_right").mouseover(function() { $(this).removeClass("pagenextoff"); $(this).addClass("pagenexton") }); $("#pageinfo_content_right").mouseout(function() { $(this).removeClass("pagenexton"); $(this).addClass("pagenextoff") }); $(".pageimg").mouseover(function() { $(this).addClass("pageimg_bd") }); $(".pageimg").mouseout(function() { $(this).removeClass("pageimg_bd") }) } }; $(function() { NewDetail.body() }); var ChinaDirsDetail = { search: function(a, e) { var c = $.trim($("#" + a).val()); var b = $("#" + e); var d = b.val(); if ($.trim(d) == "" || $.trim(d) == "\u8bf7\u8f93\u5165\u5173\u952e\u5b57") { alert("\u8bf7\u8f93\u5165\u67e5\u8be2\u5173\u952e\u5b57"); b.focus(); return false } if (c == "pro") { window.location.href = "../product/search?keyword=" + encodeURIComponent(d) } else { if (c == "cp") { window.location.href = "../company/search?keyword=" + encodeURIComponent(d) } else { if (c == "trd") { window.location.href = "../trade/search?keyword=" + encodeURIComponent(d) } } } }, clear: function(d, c) { var b = new Date(); b.setTime(b.getTime() - 1); var a = c + "=a;expires=" + b.toString() + ";path=/"; document.cookie = a; $("#" + d).empty() }, head: function() { $(".btn_text").click(function() { $("#freeInfoDown").show() }); $("#freeInfo").mouseout(function() { $("#freeInfoDown").hide() }); $("#freeInfoDown").mouseover(function() { $(this).show() }); $("#productInfo").mouseover(function() { $("#productInfo").addClass("freeInfoDownBGC"); $("#tradeInfo").removeClass("freeInfoDownBGC") }); $("#tradeInfo").mouseover(function() { $("#tradeInfo").addClass("freeInfoDownBGC"); $("#productInfo").removeClass("freeInfoDownBGC") }) }, CheckLogin: function() { $.ajax({ url: "../AjaxSession.aspx?type=" + 1, cache: false, success: function(a) { if (a == "1") { } else { $("#spanGreet").html("\u60a8\u597d\uff0c" + a + "!"); $("#spanWelcome").html("").html('<a href="#" onclick="ChinaDirsDetail.CheckOut();">\u9000\u3000\u51fa</a>') } } }) }, CheckOut: function() { $.ajax({ url: "../AjaxSession.aspx?type=" + 2, cache: false, success: function(a) { if (a == "") { window.location.href = "http://www.china-dirs.com" } } }) } }; $(function() { ChinaDirsDetail.head(); ChinaDirsDetail.CheckLogin() }); (function(a) { a.fn.simpletooltip = function() { return this.each(function() { var b = a(this).attr("alt"); a(this).attr("alt", ""); if (b != undefined) { a(this).hover(function(g) { var f = g.pageX + 12; var d = g.pageY + 12; a(this).attr("alt", ""); a("body").append("<div id='simpleTooltip' style='position: absolute; z-index: 100; display: none;'>" + b + "</div>"); if (a.browser.msie) { var c = a("#simpleTooltip").outerWidth(true) } else { var c = a("#simpleTooltip").width() } a("#simpleTooltip").width(c); a("#simpleTooltip").css("left", f).css("top", d).fadeIn("medium") }, function() { a("#simpleTooltip").remove(); a(this).attr("alt", b) }); a(this).mousemove(function(h) { var f = h.pageX + 12; var d = h.pageY + 12; var c = a("#simpleTooltip").outerWidth(true); var g = a("#simpleTooltip").outerHeight(true); if (f + c > a(window).scrollLeft() + a(window).width()) { f = h.pageX - c } if (a(window).height() + a(window).scrollTop() < d + g) { d = h.pageY - g } a("#simpleTooltip").css("left", f).css("top", d).fadeIn("medium") }) } }) } })(jQuery); function ResizeImg(w, h, img) { $(img).vcenter(w, h); } $(".jCarouselLite_page .pageimg a img").lazyload({ placeholder: "../images/load2.gif", effect: "fadeIn" }); $("#pageinfo_content_right").bind("click", function() { if ($(".jCarouselLite_page .pageimg a img").length > 11) { $(window).triggerHandler("scroll"); } else { $(this).unbind("click"); } }); $("#otherproducts .othernewproimgdiv a img").lazyload({ placeholder: "../images/load4.gif", effect: "fadeIn" }); $("#otherpro_next").bind("click", function() { if ($("#otherproducts .othernewproimgdiv a img").length > 7) { $(window).triggerHandler("scroll"); } else { $(this).unbind("click"); } });
var tagCloud = document.getElementById("div_pageinfo_content"); if (tagCloud != null) { function setTagCloudStyle() { var colors = new Array("color0", "color1"); var sizes = new Array("size0", "size1", "size2"); var weights = new Array("weight0", "weight1", "weight2", "weight3", "weight4", "weight5", "weight6"); var colorsLen = colors.length; var sizesLen = sizes.length; var weightsLen = weights.length; var tagLinks = tagCloud.getElementsByTagName("a"); var tagLinksLen = tagLinks.length; for (i = 0; i < tagLinksLen; i++) { tagLinks[i].className = colors[Math.floor(colorsLen * Math.random())] + " " + sizes[Math.floor(sizesLen * Math.random())] + " " + weights[Math.floor(weightsLen * Math.random())]; } } if (document.addEventListener) { window.addEventListener('load', setTagCloudStyle, false); } else { window.attachEvent('onload', setTagCloudStyle); } };
//function setTagCloudStyle() {
//    var colors = new Array("color0", "color1");
//    var sizes = new Array("size0", "size1", "size2");
//    var weights = new Array("weight0", "weight1", "weight2", "weight3", "weight4", "weight5", "weight6");
//    var colorsLen = colors.length;
//    var sizesLen = sizes.length;
//    var weightsLen = weights.length;
//    var tagCloud = document.getElementById("div_pageinfo_content");
//    var tagLinks = tagCloud.getElementsByTagName("a");
//    var tagLinksLen = tagLinks.length;
//    for (i = 0; i < tagLinksLen; i++) {
//        tagLinks[i].className = colors[Math.floor(colorsLen * Math.random())] + " " + sizes[Math.floor(sizesLen * Math.random())] + " " + weights[Math.floor(weightsLen * Math.random())];
//    }
//}
//if (document.addEventListener) {
//    window.addEventListener('load', setTagCloudStyle, false);
//} else {
//    window.attachEvent('onload', setTagCloudStyle);
//}
