﻿/* checkbox */
(function ($) { var CB = function (e) { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); }; $.fn.checkbox = function (options) { try { document.execCommand('BackgroundImageCache', false, true); } catch (e) { } var settings = { cls: 'jquery-checkbox', empty: 'https://buyfromtaobao.com/images/spacer.gif' }; settings = $.extend(settings, options || {}); var addEvents = function (object) { var checked = object.checked; var disabled = object.disabled; var $object = $(object); if (object.stateInterval) clearInterval(object.stateInterval); object.stateInterval = setInterval(function () { if (object.disabled != disabled) $object.trigger((disabled = !!object.disabled) ? 'disable' : 'enable'); if (object.checked != checked) $object.trigger((checked = !!object.checked) ? 'check' : 'uncheck'); }, 10); return $object; }; return this.each(function () { var ch = this; var $ch = addEvents(ch); if (ch.wrapper) ch.wrapper.remove(); ch.wrapper = $('<span class="' + settings.cls + '"><span class="mark"><img src="' + settings.empty + '" /></span></span>'); ch.wrapperInner = ch.wrapper.children('span:eq(0)'); ch.wrapper.hover(function (e) { ch.wrapperInner.addClass(settings.cls + '-hover'); CB(e); }, function (e) { ch.wrapperInner.removeClass(settings.cls + '-hover'); CB(e); }); $ch.css({ position: 'absolute', zIndex: -1, visibility: 'hidden' }).after(ch.wrapper); var label = false; if ($ch.attr('id')) { label = $('label[for=' + $ch.attr('id') + ']'); if (!label.length) label = false; } if (!label) { label = $ch.closest ? $ch.closest('label') : $ch.parents('label:eq(0)'); if (!label.length) label = false; } if (label) { label.hover(function (e) { ch.wrapper.trigger('mouseover', [e]); }, function (e) { ch.wrapper.trigger('mouseout', [e]); }); label.click(function (e) { $ch.trigger('click', [e]); CB(e); return false; }); } ch.wrapper.click(function (e) { $ch.trigger('click', [e]); CB(e); return false; }); $ch.click(function (e) { CB(e); }); $ch.bind('disable', function () { ch.wrapperInner.addClass(settings.cls + '-disabled'); }).bind('enable', function () { ch.wrapperInner.removeClass(settings.cls + '-disabled'); }); $ch.bind('check', function () { ch.wrapper.addClass(settings.cls + '-checked'); }).bind('uncheck', function () { ch.wrapper.removeClass(settings.cls + '-checked'); }); $('img', ch.wrapper).bind('dragstart', function () { return false; }).bind('mousedown', function () { return false; }); if (window.getSelection) ch.wrapper.css('MozUserSelect', 'none'); if (ch.checked) ch.wrapper.addClass(settings.cls + '-checked'); if (ch.disabled) ch.wrapperInner.addClass(settings.cls + '-disabled'); }); } })(jQuery);

function setCookie(a, c) { var b = new Date; b.setTime(b.getTime() + 2592E6); document.cookie = a + "=" + escape(c) + ";expires=" + b.toGMTString() }
function getCookie(a) { a = document.cookie.match(RegExp("(^| )" + a + "=([^;]*)(;|$)")); return null != a ? unescape(a[2]) : null } 
$(document).ready(function () { $("#translateCheck").attr("checked", getCookie("c")); $("#translateCheck").checkbox() });
function ShowCurrentUser(a) { document.getElementById("iCurrentUser").innerHTML = '<a href="https://buyfromtaobao.com/members/">' + a + "</a>"; document.getElementById("iCurrentUser").style.display = "inline"; document.getElementById("iLogout").style.display = "inline" } 
function ShowLogin() { document.getElementById("iLogin").style.display = "inline" } 

/* thickbox */
var tb_pathToImage = "https://buyfromtaobao.com/images/loadingAnimation.gif"; $(document).ready(function () { tb_init("a.thickbox, area.thickbox, input.thickbox"); imgLoader = new Image; imgLoader.src = tb_pathToImage }); function tb_init(a) { $(a).click(function () { tb_show(this.title || this.name || null, this.href || this.alt, this.rel || !1); this.blur(); return !1 }) } function tb_showloader() { $("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); $("#TB_load").show() } function tb_show(a, b, i) { try { "undefined" === typeof document.body.style.maxHeight ? ($("body", "html").css({ height: "100%", width: "100%" }), $("html").css("overflow", "hidden"), null === document.getElementById("TB_HideSelect") && ($("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"), $("#TB_overlay").click(tb_remove))) : null === document.getElementById("TB_overlay") && ($("body").append("<div id='TB_overlay'></div>"), 0 == $("#TB_inj").length ? $("body").append("<div id='TB_window'></div>") : $("#TB_inj").after("<div id='TB_window'></div>"), $("#TB_overlay").click(tb_remove)); tb_detectMacXFF() ? $("#TB_overlay").addClass("TB_overlayMacFFBGHack") : $("#TB_overlay").addClass("TB_overlayBG"); null === a && (a = ""); $("body").append("<div id='TB_load'><img src='" + imgLoader.src + "' /></div>"); $("#TB_load").show(); var c = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|imageproxy\.ashx$/, d = (-1 !== b.indexOf("?") ? b.substr(0, b.indexOf("?")) : b).toLowerCase().match(c); if (".jpg" == d || ".jpeg" == d || ".png" == d || ".gif" == d || ".bmp" == d || "imageproxy.ashx" == d) { TB_imageCount = TB_NextHTML = TB_NextURL = TB_NextCaption = TB_PrevHTML = TB_PrevURL = TB_PrevCaption = ""; TB_FoundURL = !1; if (i) { TB_TempArray = $("a[@rel=" + i + "]").get(); for (TB_Counter = 0; TB_Counter < TB_TempArray.length && "" === TB_NextHTML; TB_Counter++) { TB_TempArray[TB_Counter].href.toLowerCase().match(c), TB_TempArray[TB_Counter].href != b ? TB_FoundURL ? (TB_NextCaption = TB_TempArray[TB_Counter].title, TB_NextURL = TB_TempArray[TB_Counter].href, TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>") : (TB_PrevCaption = TB_TempArray[TB_Counter].title, TB_PrevURL = TB_TempArray[TB_Counter].href, TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>") : (TB_FoundURL = !0, TB_imageCount = "Image " + (TB_Counter + 1) + " of " + TB_TempArray.length) } } imgPreloader = new Image; imgPreloader.onload = function () { imgPreloader.onload = null; var h = tb_getPageSize(), c = h[0] - 150, h = h[1] - 150, e = imgPreloader.width, f = imgPreloader.height; e > c ? (f *= c / e, e = c, f > h && (e *= h / f, f = h)) : f > h && (e *= h / f, f = h, e > c && (f *= c / e, e = c)); TB_WIDTH = e + 30; TB_HEIGHT = f + 60; $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + b + "' width='" + e + "' height='" + f + "' alt='" + a + "'/></a><div id='TB_caption'>" + a + "<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src=\"https://buyfromtaobao.com/images/close.gif\" alt=\"CLOSE\" style=\"border:0;width:15px;height:15px\" /></a></div>"); $("#TB_closeWindowButton").click(tb_remove); if ("" !== TB_PrevHTML) { var d = function () { $(document).unbind("click", d) && $(document).unbind("click", d); $("#TB_window").remove(); $("body").append("<div id='TB_window'></div>"); tb_show(TB_PrevCaption, TB_PrevURL, i); return !1 }; $("#TB_prev").click(d) } if ("" !== TB_NextHTML) { var g = function () { $("#TB_window").remove(); $("body").append("<div id='TB_window'></div>"); tb_show(TB_NextCaption, TB_NextURL, i); return !1 }; $("#TB_next").click(g) } document.onkeydown = function (a) { keycode = null == a ? event.keyCode : a.which; if (27 == keycode) { tb_remove() } else { if (190 == keycode) { if ("" != TB_NextHTML) { document.onkeydown = "", g() } } else { if (188 == keycode && "" != TB_PrevHTML) { document.onkeydown = "", d() } } } }; tb_position(); $("#TB_load").remove(); $("#TB_ImageOff").click(tb_remove); $("#TB_window").css({ display: "block" }) }; imgPreloader.src = b } else { var j = b.replace(/^[^\?]+\??/, ""), g = tb_parseQuery(j); TB_WIDTH = 1 * g.width + 30 || 850; TB_HEIGHT = 1 * g.height + 40 || 440; ajaxContentW = TB_WIDTH - 30; ajaxContentH = TB_HEIGHT - 45; -1 != b.indexOf("TB_iframe") ? (urlNoQuery = b.split("TB_"), $("#TB_iframeContent").remove(), "true" != g.modal ? $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + a + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src=\"https://buyfromtaobao.com/images/close.gif\" alt=\"CLOSE\" style=\"border:0;width:15px;height:15px\" /></a></div></div><iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(1E3 * Math.random()) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;' > </iframe>") : ($("#TB_overlay").unbind(), $("#TB_window").append("<iframe frameborder='0' hspace='0' src='" + urlNoQuery[0] + "' id='TB_iframeContent' name='TB_iframeContent" + Math.round(1E3 * Math.random()) + "' onload='tb_showIframe()' style='width:" + (ajaxContentW + 29) + "px;height:" + (ajaxContentH + 17) + "px;'> </iframe>"))) : "block" != $("#TB_window").css("display") ? "true" != g.modal ? $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>" + a + "</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'><img src=\"https://buyfromtaobao.com/images/close.gif\" alt=\"CLOSE\" style=\"border:0;width:15px;height:15px\" /></a></div></div><div id='TB_ajaxContent' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px'></div>") : ($("#TB_overlay").unbind(), $("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:" + ajaxContentW + "px;height:" + ajaxContentH + "px;'></div>")) : ($("#TB_ajaxContent")[0].style.width = ajaxContentW + "px", $("#TB_ajaxContent")[0].style.height = ajaxContentH + "px", $("#TB_ajaxContent")[0].scrollTop = 0, $("#TB_ajaxWindowTitle").html(a)); $("#TB_closeWindowButton").click(tb_remove); -1 != b.indexOf("TB_inline") ? ($("#TB_ajaxContent").append($("#" + g.inlineId).children()), $("#TB_window").unload(function () { $("#" + g.inlineId).append($("#TB_ajaxContent").children()) }), tb_position(), $("#TB_load").remove(), $("#TB_window").css({ display: "block" })) : -1 != b.indexOf("TB_iframe") ? (tb_position(), $.browser.safari && ($("#TB_load").remove(), $("#TB_window").css({ display: "block" }))) : $("#TB_ajaxContent").load(b += "&random=" + (new Date).getTime(), function () { tb_position(); $("#TB_load").remove(); tb_init("#TB_ajaxContent a.thickbox"); $("#TB_window").css({ display: "block" }) }) } if (!g.modal) { document.onkeyup = function (a) { keycode = null == a ? event.keyCode : a.which; 27 == keycode && tb_remove() } } } catch (k) { } } function tb_showIframe() { $("#TB_load").remove(); $("#TB_window").css({ display: "block" }) } function tb_remove() { $("#TB_imageOff").unbind("click"); $("#TB_closeWindowButton").unbind("click"); $("#TB_window").fadeOut("fast", function () { $("#TB_window,#TB_overlay,#TB_HideSelect").trigger("unload").unbind().remove() }); $("#TB_load").remove(); "undefined" == typeof document.body.style.maxHeight && ($("body", "html").css({ height: "auto", width: "auto" }), $("html").css("overflow", "")); document.onkeydown = ""; document.onkeyup = ""; return !1 } function tb_position() { $("#TB_window").css({ marginLeft: "-" + parseInt(TB_WIDTH / 2, 10) + "px", width: TB_WIDTH + "px" }); jQuery.browser.msie && 7 > jQuery.browser.version || $("#TB_window").css({ marginTop: "-" + parseInt(TB_HEIGHT / 2, 10) + "px" }) } function tb_parseQuery(a) { var b = {}; if (!a) { return b } for (var a = a.split(/[;&]/), i = 0; i < a.length; i++) { var c = a[i].split("="); if (c && 2 == c.length) { var d = unescape(c[0]), c = unescape(c[1]), c = c.replace(/\+/g, " "); b[d] = c } } return b } function tb_getPageSize() { var a = document.documentElement; return arrayPageSize = [window.innerWidth || self.innerWidth || a && a.clientWidth || document.body.clientWidth, window.innerHeight || self.innerHeight || a && a.clientHeight || document.body.clientHeight] } function tb_detectMacXFF() { var a = navigator.userAgent.toLowerCase(); if (-1 != a.indexOf("mac") && -1 != a.indexOf("firefox")) { return !0 } };

(function (b) { function d(b) { return "object" == typeof b ? b : { top: b, left: b} } b.fn.defaultvalue = function () { var e = arguments, c = 0; return this.each(function () { var a = b(this), k = e[c++]; a.val(k).focus(function () { a.val() == k && a.val(""); a.blur(function () { "" == a.val() && a.val(k) }) }) }) }; var i = b.scrollTo = function (e, c, a) { b(window).scrollTo(e, c, a) }; i.defaults = { axis: "y", duration: 1 }; i.window = function () { return b(window).scrollable() }; b.fn.scrollable = function () { return this.map(function () { var e = this.parentWindow || this.defaultView, e = "#document" == this.nodeName ? e.frameElement || e : this, c = e.contentDocument || (e.contentWindow || e).document, a = e.setInterval; return "IFRAME" == e.nodeName || a && b.browser.safari ? c.body : a ? c.documentElement : this }) }; b.fn.scrollTo = function (e, c, a) { "object" == typeof c && (a = c, c = 0); "function" == typeof a && (a = { onAfter: a }); a = b.extend({}, i.defaults, a); c = c || a.speed || a.duration; a.queue = a.queue && 1 < a.axis.length; a.queue && (c /= 2); a.offset = d(a.offset); a.over = d(a.over); return this.scrollable().each(function () { function k(b) { l.animate(g, c, a.easing, b && function () { b.call(this, e, a) }) } function p(a) { var a = "scroll" + a, b = j.ownerDocument; return m ? Math.max(b.documentElement[a], b.body[a]) : j[a] } var j = this, l = b(j), f = e, i, g = {}, m = l.is("html,body"); switch (typeof f) { case "number": ; case "string": if (/^([+-]=)?\d+(px)?$/.test(f)) { f = d(f); break } f = b(f, this); case "object": if (f.is || f.style) { i = (f = b(f)).offset() } } b.each(a.axis.split(""), function (b, e) { var c = "x" == e ? "Left" : "Top", d = c.toLowerCase(), h = "scroll" + c, n = j[h], o = "x" == e ? "Width" : "Height", q = o.toLowerCase(); i ? (g[h] = i[d] + (m ? 0 : n - l.offset()[d]), a.margin && (g[h] -= parseInt(f.css("margin" + c)) || 0, g[h] -= parseInt(f.css("border" + c + "Width")) || 0), g[h] += a.offset[d] || 0, a.over[d] && (g[h] += f[q]() * a.over[d])) : g[h] = f[d]; /^\d+$/.test(g[h]) && (g[h] = 0 >= g[h] ? 0 : Math.min(g[h], p(o))); !b && a.queue && (n != g[h] && k(a.onAfterFirst), delete g[h]) }); k(a.onAfter) }).end() }; b.fn.aqTip = function (e, c) { var a = b.extend({}, b.fn.aqTip.defaults, c); return this.each(function () { var c = b(this); b('<div class="aqTip"></div>').appendTo(c); var d = b(".aqTip", c); d.css({ display: "none", position: "absolute" }).css(a.css); jQuery.isFunction(e) ? e(d) : d.html(e); var j = c.position(), i = c.width() > d.width() ? c.width() : d.width(), f = j.left + a.marginX; f > document.body.clientWidth && (f = j.left - i - a.marginX); d.css({ left: f + "px", top: j.top + a.marginY + "px" }); c.hover(function () { d.show() }, function () { d.hide() }) }) }; b.fn.aqTipOne = function (d, c) { var a = b.extend({}, b.fn.aqTip.defaults, c); return this.each(function () { b("#aqTip").length || (b('<div id="aqTip"></div>').appendTo(document.body), b("#aqTip").css({ display: "none", position: "absolute" }).css(a.css)); var c = b(this); if (d) { b("#aqTip").html(d); var i = c.position(), c = c.width() > b("#aqTip").width() ? c.width() : b("#aqTip").width(); document.title = c.toString(); var j = i.left + a.marginX; j > document.body.clientWidth && (j = i.left - c - a.marginX); b("#aqTip").show().css({ left: j + "px", top: i.top + a.marginY + "px" }) } else { b("#aqTip:visible").hide() } return !1 }) }; b.fn.aqTip.defaults = { marginX: 10, marginY: 10, css: { backgroundColor: "#ffc", color: "#444", border: "1px solid #ddd", padding: "10px", cursor: "default"}} })(jQuery); function trim(b, d) { return ltrim(rtrim(b, d), d) } function ltrim(b, d) { return b.replace(RegExp("^[" + (d || "\\s") + "]+", "g"), "") } function rtrim(b, d) { return b.replace(RegExp("[" + (d || "\\s") + "]+$", "g"), "") };
