(function ($) { $.fn.jqzoom = function (options) { var settings = { zoomType: "standard", zoomWidth: 200, zoomHeight: 200, xOffset: 10, yOffset: 0, position: "right", lens: true, lensReset: false, imageOpacity: 0.2, title: true, alwaysOn: false, showEffect: "show", hideEffect: "hide", fadeinSpeed: "fast", fadeoutSpeed: "slow", preloadImages: true, showPreload: true, preloadText: "Loading zoom", preloadPosition: "center" }; options = options || {}; $.extend(settings, options); return this.each(function () { var a = $(this); var aTitle = a.attr("title"); $(a).removeAttr("title"); $(a).css("outline-style", "none"); var img = $("img", this); var imageTitle = img.attr("title"); img.removeAttr("title"); var smallimage = new Smallimage(img); var smallimagedata = {}; var btop = 0; var bleft = 0; var loader = null; loader = new Loader(); var ZoomTitle = (trim(aTitle).length > 0) ? aTitle : (trim(imageTitle).length > 0) ? imageTitle : null; var ZoomTitleObj = new zoomTitle(); var largeimage = new Largeimage(a[0].href); var lens = new Lens(); var lensdata = {}; var largeimageloaded = false; var scale = {}; var stage = null; var running = false; var mousepos = {}; var firstime = 0; var preloadshow = false; var isMouseDown = false; var dragstatus = false; smallimage.loadimage(); $(this).click(function () { return false }); $(this).hover(function (e) { mousepos.x = e.pageX; mousepos.y = e.pageY; activate() }, function () { deactivate() }); if (settings.alwaysOn) { setTimeout(function () { activate() }, 150) } function activate() { if (!running) { smallimage.findborder(); running = true; imageTitle = img.attr("title"); img.removeAttr("title"); aTitle = a.attr("title"); $(a).removeAttr("title"); largeimage = new Largeimage(a[0].href); largeimage.loadimage(); a[0].blur(); return false } } function deactivate() { if (settings.zoomType == "reverse" && !settings.alwaysOn) { img.css({ opacity: 1 }) } if (!settings.alwaysOn) { running = false; largeimageloaded = false; $(lens.node).unbind("mousemove"); lens.remove(); if ($("div.jqZoomWindow").length > 0) { stage.remove() } if ($("div.jqZoomTitle").length > 0) { ZoomTitleObj.remove() } img.attr("title", imageTitle); a.attr("title", aTitle); $().unbind(); a.unbind("mousemove"); firstime = 0; if (jQuery(".zoom_ieframe").length > 0) { jQuery(".zoom_ieframe").remove() } } else { if (settings.lensReset) { switch (settings.zoomType) { case "innerzoom": largeimage.setcenter(); break; default: lens.center(); break } } } if (settings.alwaysOn) { activate() } } function Smallimage(image) { this.node = image[0]; this.loadimage = function () { this.node.src = image[0].src }; this.findborder = function () { var bordertop = ""; bordertop = $(img).css("border-top-width"); btop = ""; var borderleft = ""; borderleft = $(img).css("border-left-width"); bleft = ""; if (bordertop) { for (i = 0; i < 3; i++) { var x = []; x = bordertop.substr(i, 1); if (isNaN(x) == false) { btop = btop + "" + bordertop.substr(i, 1) } else { break } } } if (borderleft) { for (i = 0; i < 3; i++) { if (!isNaN(borderleft.substr(i, 1))) { bleft = bleft + borderleft.substr(i, 1) } else { break } } } btop = (btop.length > 0) ? eval(btop) : 0; bleft = (bleft.length > 0) ? eval(bleft) : 0 }; this.node.onload = function () { a.css({ cursor: "crosshair" }); if (a.css("position") != "absolute" && a.parent().css("position")) { a.css({ cursor: "crosshair", position: "relative" }) } if (a.parent().css("position") != "absolute") { a.parent().css("position", "relative") } else {} if ($.browser.safari || $.browser.opera) { $(img).css({ position: "absolute", top: "0px", left: "0px" }) } smallimagedata.w = $(this).width(); smallimagedata.h = $(this).height(); smallimagedata.h = $(this).height(); smallimagedata.pos = $(this).offset(); smallimagedata.pos.l = $(this).offset().left; smallimagedata.pos.t = $(this).offset().top; smallimagedata.pos.r = smallimagedata.w + smallimagedata.pos.l; smallimagedata.pos.b = smallimagedata.h + smallimagedata.pos.t; a.height(smallimagedata.h); a.width(smallimagedata.w); if (settings.preloadImages) { largeimage.loadimage() } }; return this } function Lens() { this.node = document.createElement("div"); $(this.node).addClass("jqZoomPup"); this.node.onerror = function () { $(lens.node).remove(); lens = new Lens(); lens.activate() }; this.loadlens = function () { switch (settings.zoomType) { case "reverse": this.image = new Image(); this.image.src = smallimage.node.src; this.node.appendChild(this.image); $(this.node).css({ opacity: 1 }); break; case "innerzoom": this.image = new Image(); this.image.src = largeimage.node.src; this.node.appendChild(this.image); $(this.node).css({ opacity: 1 }); break; default: break } switch (settings.zoomType) { case "innerzoom": lensdata.w = smallimagedata.w; lensdata.h = smallimagedata.h; break; default: lensdata.w = (settings.zoomWidth) / scale.x; lensdata.h = (settings.zoomHeight) / scale.y; break } $(this.node).css({ width: lensdata.w + "px", height: lensdata.h + "px", position: "absolute", display: "none", borderWidth: 1 + "px" }); a.append(this.node) }; return this } Lens.prototype.activate = function () { this.loadlens(); switch (settings.zoomType) { case "reverse": img.css({ opacity: settings.imageOpacity }); (settings.alwaysOn) ? lens.center() : lens.setposition(null); a.bind("mousemove", function (e) { mousepos.x = e.pageX; mousepos.y = e.pageY; lens.setposition(e) }); break; case "innerzoom": $(this.node).css({ top: 0, left: 0 }); if (settings.title) { ZoomTitleObj.loadtitle() } largeimage.setcenter(); a.bind("mousemove", function (e) { mousepos.x = e.pageX; mousepos.y = e.pageY; largeimage.setinner(e) }); break; default: (settings.alwaysOn) ? lens.center() : lens.setposition(null); $(a).bind("mousemove", function (e) { mousepos.x = e.pageX; mousepos.y = e.pageY; lens.setposition(e) }); break } return this }; Lens.prototype.setposition = function (e) { if (e) { mousepos.x = e.pageX; mousepos.y = e.pageY } if (firstime == 0) { var lensleft = (smallimagedata.w) / 2 - (lensdata.w) / 2; var lenstop = (smallimagedata.h) / 2 - (lensdata.h) / 2; $("div.jqZoomPup").show(); if (settings.lens) { this.node.style.visibility = "visible" } else { this.node.style.visibility = "hidden"; $("div.jqZoomPup").hide() } firstime = 1 } else { var lensleft = mousepos.x - smallimagedata.pos.l - (lensdata.w) / 2; var lenstop = mousepos.y - smallimagedata.pos.t - (lensdata.h) / 2 } if (overleft()) { lensleft = 0 + bleft } else { if (overright()) { if ($.browser.msie) { lensleft = smallimagedata.w - lensdata.w + bleft + 1 } else { lensleft = smallimagedata.w - lensdata.w + bleft - 1 } } } if (overtop()) { lenstop = 0 + btop } else { if (overbottom()) { if ($.browser.msie) { lenstop = smallimagedata.h - lensdata.h + btop + 1 } else { lenstop = smallimagedata.h - lensdata.h - 1 + btop } } } lensleft = parseInt(lensleft); lenstop = parseInt(lenstop); $("div.jqZoomPup", a).css({ top: lenstop, left: lensleft }); if (settings.zoomType == "reverse") { $("div.jqZoomPup img", a).css({ position: "absolute", top: -(lenstop - btop + 1), left: -(lensleft - bleft + 1) }) } this.node.style.left = lensleft + "px"; this.node.style.top = lenstop + "px"; largeimage.setposition(); function overleft() { return mousepos.x - (lensdata.w + 2 * 1) / 2 - bleft < smallimagedata.pos.l } function overright() { return mousepos.x + (lensdata.w + 2 * 1) / 2 > smallimagedata.pos.r + bleft } function overtop() { return mousepos.y - (lensdata.h + 2 * 1) / 2 - btop < smallimagedata.pos.t } function overbottom() { return mousepos.y + (lensdata.h + 2 * 1) / 2 > smallimagedata.pos.b + btop } return this }; Lens.prototype.center = function () { $("div.jqZoomPup", a).css("display", "none"); var lensleft = (smallimagedata.w) / 2 - (lensdata.w) / 2; var lenstop = (smallimagedata.h) / 2 - (lensdata.h) / 2; this.node.style.left = lensleft + "px"; this.node.style.top = lenstop + "px"; $("div.jqZoomPup", a).css({ top: lenstop, left: lensleft }); if (settings.zoomType == "reverse") { $("div.jqZoomPup img", a).css({ position: "absolute", top: -(lenstop - btop + 1), left: -(lensleft - bleft + 1) }) } largeimage.setposition(); if ($.browser.msie) { $("div.jqZoomPup", a).show() } else { setTimeout(function () { $("div.jqZoomPup").fadeIn("fast") }, 10) } }; Lens.prototype.getoffset = function () { var o = {}; o.left = parseInt(this.node.style.left); o.top = parseInt(this.node.style.top); return o }; Lens.prototype.remove = function () { if (settings.zoomType == "innerzoom") { $("div.jqZoomPup", a).fadeOut("fast", function () { $(this).remove() }) } else { $("div.jqZoomPup", a).remove() } }; Lens.prototype.findborder = function () { var bordertop = ""; bordertop = $("div.jqZoomPup").css("borderTop"); lensbtop = ""; var borderleft = ""; borderleft = $("div.jqZoomPup").css("borderLeft"); lensbleft = ""; if ($.browser.msie) { var temp = bordertop.split(" "); bordertop = temp[1]; var temp = borderleft.split(" "); borderleft = temp[1] } if (bordertop) { for (i = 0; i < 3; i++) { var x = []; x = bordertop.substr(i, 1); if (isNaN(x) == false) { lensbtop = lensbtop + "" + bordertop.substr(i, 1) } else { break } } } if (borderleft) { for (i = 0; i < 3; i++) { if (!isNaN(borderleft.substr(i, 1))) { lensbleft = lensbleft + borderleft.substr(i, 1) } else { break } } } lensbtop = (lensbtop.length > 0) ? eval(lensbtop) : 0; lensbleft = (lensbleft.length > 0) ? eval(lensbleft) : 0 }; function Largeimage(url) { this.url = url; this.node = new Image(); this.loadimage = function () { if (!this.node) { this.node = new Image() } this.node.style.position = "absolute"; this.node.style.display = "none"; this.node.style.left = "-5000px"; this.node.style.top = "10px"; loader = new Loader(); if (settings.showPreload && !preloadshow) { loader.show(); preloadshow = true } document.body.appendChild(this.node); this.node.src = this.url }; this.node.onload = function () { this.style.display = "block"; var w = Math.round($(this).width()); var h = Math.round($(this).height()); this.style.display = "none"; scale.x = (w / smallimagedata.w); scale.y = (h / smallimagedata.h); if ($("div.preload").length > 0) { $("div.preload").remove() } largeimageloaded = true; if (settings.zoomType != "innerzoom" && running) { stage = new Stage(); stage.activate() } if (running) { lens = new Lens(); lens.activate() } if ($("div.preload").length > 0) { $("div.preload").remove() } }; return this } Largeimage.prototype.setposition = function () { this.node.style.left = Math.ceil(-scale.x * parseInt(lens.getoffset().left) + bleft) + "px"; this.node.style.top = Math.ceil(-scale.y * parseInt(lens.getoffset().top) + btop) + "px" }; Largeimage.prototype.setinner = function (e) { this.node.style.left = Math.ceil(-scale.x * Math.abs(e.pageX - smallimagedata.pos.l)) + "px"; this.node.style.top = Math.ceil(-scale.y * Math.abs(e.pageY - smallimagedata.pos.t)) + "px"; $("div.jqZoomPup img", a).css({ position: "absolute", top: this.node.style.top, left: this.node.style.left }) }; Largeimage.prototype.setcenter = function () { this.node.style.left = Math.ceil(-scale.x * Math.abs((smallimagedata.w) / 2)) + "px"; this.node.style.top = Math.ceil(-scale.y * Math.abs((smallimagedata.h) / 2)) + "px"; $("div.jqZoomPup img", a).css({ position: "absolute", top: this.node.style.top, left: this.node.style.left }) }; function Stage() { var leftpos = smallimagedata.pos.l; var toppos = smallimagedata.pos.t; this.node = document.createElement("div"); $(this.node).addClass("jqZoomWindow"); $(this.node).css({ position: "absolute", width: Math.round(settings.zoomWidth) + "px", height: Math.round(settings.zoomHeight) + "px", display: "none", zIndex: 10000, overflow: "hidden" }); switch (settings.position) { case "right": leftpos = (smallimagedata.pos.r + Math.abs(settings.xOffset) + settings.zoomWidth < screen.width) ? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset)) : (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset)); topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight; toppos = (topwindow < screen.height && topwindow > 0) ? smallimagedata.pos.t + settings.yOffset : smallimagedata.pos.t; break; case "left": leftpos = (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth > 0) ? (smallimagedata.pos.l - Math.abs(settings.xOffset) - settings.zoomWidth) : (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset)); topwindow = smallimagedata.pos.t + settings.yOffset + settings.zoomHeight; toppos = (topwindow < screen.height && topwindow > 0) ? smallimagedata.pos.t + settings.yOffset : smallimagedata.pos.t; break; case "top": toppos = (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight > 0) ? (smallimagedata.pos.t - Math.abs(settings.yOffset) - settings.zoomHeight) : (smallimagedata.pos.t + smallimagedata.h + Math.abs(settings.yOffset)); leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth; leftpos = (leftwindow < screen.width && leftwindow > 0) ? smallimagedata.pos.l + settings.xOffset : smallimagedata.pos.l; break; case "bottom": toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < $("body").height()) ? (smallimagedata.pos.b + Math.abs(settings.yOffset)) : (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset)); leftwindow = smallimagedata.pos.l + settings.xOffset + settings.zoomWidth; leftpos = (leftwindow < screen.width && leftwindow > 0) ? smallimagedata.pos.l + settings.xOffset : smallimagedata.pos.l; break; default: leftpos = (smallimagedata.pos.l + smallimagedata.w + settings.xOffset + settings.zoomWidth < screen.width) ? (smallimagedata.pos.l + smallimagedata.w + Math.abs(settings.xOffset)) : (smallimagedata.pos.l - settings.zoomWidth - Math.abs(settings.xOffset)); toppos = (smallimagedata.pos.b + Math.abs(settings.yOffset) + settings.zoomHeight < screen.height) ? (smallimagedata.pos.b + Math.abs(settings.yOffset)) : (smallimagedata.pos.t - settings.zoomHeight - Math.abs(settings.yOffset)); break } this.node.style.left = leftpos + "px"; this.node.style.top = toppos + "px"; return this } Stage.prototype.activate = function () { if (!this.node.firstChild) { this.node.appendChild(largeimage.node) } if (settings.title) { ZoomTitleObj.loadtitle() } document.body.appendChild(this.node); switch (settings.showEffect) { case "show": $(this.node).show(); break; case "fadein": $(this.node).fadeIn(settings.fadeinSpeed); break; default: $(this.node).show(); break } $(this.node).show(); if ($.browser.msie && $.browser.version < 7) { this.ieframe = $('').css({ position: "absolute", left: this.node.style.left, top: this.node.style.top, zIndex: 99, width: settings.zoomWidth, height: settings.zoomHeight }).insertBefore(this.node) } largeimage.node.style.display = "block" }; Stage.prototype.remove = function () { switch (settings.hideEffect) { case "hide": $(".jqZoomWindow").remove(); break; case "fadeout": $(".jqZoomWindow").fadeOut(settings.fadeoutSpeed); break; default: $(".jqZoomWindow").remove(); break } }; function zoomTitle() { this.node = jQuery("
").addClass("jqZoomTitle").html("" + ZoomTitle + ""); this.loadtitle = function () { if (settings.zoomType == "innerzoom") { $(this.node).css({ position: "absolute", top: smallimagedata.pos.b + 3, left: (smallimagedata.pos.l + 1), width: smallimagedata.w }).appendTo("body") } else { $(this.node).appendTo(stage.node) } } } zoomTitle.prototype.remove = function () { $(".jqZoomTitle").remove() }; function Loader() { this.node = document.createElement("div"); $(this.node).addClass("preload"); $(this.node).html(settings.preloadText); $(this.node).appendTo("body").css("visibility", "hidden"); this.show = function () { switch (settings.preloadPosition) { case "center": loadertop = smallimagedata.pos.t + (smallimagedata.h - $(this.node).height()) / 2; loaderleft = smallimagedata.pos.l + (smallimagedata.w - $(this.node).width()) / 2; break; default: var loaderoffset = this.getoffset(); loadertop = !isNaN(loaderoffset.top) ? smallimagedata.pos.t + loaderoffset.top : smallimagedata.pos.t + 0; loaderleft = !isNaN(loaderoffset.left) ? smallimagedata.pos.l + loaderoffset.left : smallimagedata.pos.l + 0; break } $(this.node).css({ top: loadertop, left: loaderleft, position: "absolute", visibility: "visible" }) }; return this } Loader.prototype.getoffset = function () { var o = null; o = $("div.preload").offset(); return o } }) } })(jQuery); function trim(a) { while (a.substring(0, 1) == " ") { a = a.substring(1, a.length) } while (a.substring(a.length - 1, a.length) == " ") { a = a.substring(0, a.length - 1) } return a }; (function (c) { function i() { this.regional = []; this.regional[""] = { labels: ["Years", "Months", "Weeks", "Days", "Hours", "Minutes", "Seconds"], labels1: ["Year", "Month", "Week", "Day", "Hour", "Minute", "Second"], compactLabels: ["y", "m", "w", "d"], whichLabels: null, timeSeparator: ":", isRTL: false }; this._defaults = { until: null, since: null, timezone: null, serverSync: null, format: "dHMS", layout: "", compact: false, significant: 0, description: "", expiryUrl: "", expiryText: "", alwaysExpire: false, onExpiry: null, onTick: null, tickInterval: 1 }; c.extend(this._defaults, this.regional[""]); this._serverSyncs = [] } var f = "countdown"; var j = 0; var d = 1; var k = 2; var h = 3; var g = 4; var e = 5; var b = 6; c.extend(i.prototype, { markerClassName: "hasCountdown", _timer: setInterval(function () { c.countdown._updateTargets() }, 980), _timerTargets: [], setDefaults: function (l) { this._resetExtraLabels(this._defaults, l); a(this._defaults, l || {}) }, UTCDate: function (p, t, r, l, m, o, q, n) { if (typeof t == "object" && t.constructor == Date) { n = t.getMilliseconds(); q = t.getSeconds(); o = t.getMinutes(); m = t.getHours(); l = t.getDate(); r = t.getMonth(); t = t.getFullYear() } var s = new Date(); s.setUTCFullYear(t); s.setUTCDate(1); s.setUTCMonth(r || 0); s.setUTCDate(l || 1); s.setUTCHours(m || 0); s.setUTCMinutes((o || 0) - (Math.abs(p) < 30 ? p * 60 : p)); s.setUTCSeconds(q || 0); s.setUTCMilliseconds(n || 0); return s }, periodsToSeconds: function (l) { return l[0] * 31557600 + l[1] * 2629800 + l[2] * 604800 + l[3] * 86400 + l[4] * 3600 + l[5] * 60 + l[6] }, _settingsCountdown: function (n, l) { if (!l) { return c.countdown._defaults } var m = c.data(n, f); return (l == "all" ? m.options : m.options[l]) }, _attachCountdown: function (o, m) { var l = c(o); if (l.hasClass(this.markerClassName)) { return } l.addClass(this.markerClassName); var n = { options: c.extend({}, m), _periods: [0, 0, 0, 0, 0, 0, 0] }; c.data(o, f, n); this._changeCountdown(o) }, _addTarget: function (l) { if (!this._hasTarget(l)) { this._timerTargets.push(l) } }, _hasTarget: function (l) { return (c.inArray(l, this._timerTargets) > -1) }, _removeTarget: function (l) { this._timerTargets = c.map(this._timerTargets, function (m) { return (m == l ? null : m) }) }, _updateTargets: function () { for (var l = this._timerTargets.length - 1; l >= 0; l--) { this._updateCountdown(this._timerTargets[l]) } }, _updateCountdown: function (v, t) { var r = c(v); t = t || c.data(v, f); if (!t) { return } r.html(this._generateHTML(t)); r[(this._get(t, "isRTL") ? "add" : "remove") + "Class"]("countdown_rtl"); var s = this._get(t, "onTick"); if (s) { var l = t._hold != "lap" ? t._periods : this._calculatePeriods(t, t._show, this._get(t, "significant"), new Date()); var p = this._get(t, "tickInterval"); if (p == 1 || this.periodsToSeconds(l) % p == 0) { s.apply(v, [l]) } } var m = t._hold != "pause" && (t._since ? t._now.getTime() < t._since.getTime() : t._now.getTime() >= t._until.getTime()); if (m && !t._expiring) { t._expiring = true; if (this._hasTarget(v) || this._get(t, "alwaysExpire")) { this._removeTarget(v); var q = this._get(t, "onExpiry"); if (q) { q.apply(v, []) } var o = this._get(t, "expiryText"); if (o) { var u = this._get(t, "layout"); t.options.layout = o; this._updateCountdown(v, t); t.options.layout = u } var n = this._get(t, "expiryUrl"); if (n) { window.location = n } } t._expiring = false } else { if (t._hold == "pause") { this._removeTarget(v) } } c.data(v, f, t) }, _changeCountdown: function (q, n, p) { n = n || {}; if (typeof n == "string") { var m = n; n = {}; n[m] = p } var o = c.data(q, f); if (o) { this._resetExtraLabels(o.options, n); a(o.options, n); this._adjustSettings(q, o); c.data(q, f, o); var l = new Date(); if ((o._since && o._since < l) || (o._until && o._until > l)) { this._addTarget(q) } this._updateCountdown(q, o) } }, _resetExtraLabels: function (n, l) { var m = false; for (var o in l) { if (o != "whichLabels" && o.match(/[Ll]abels/)) { m = true; break } } if (m) { for (var o in n) { if (o.match(/[Ll]abels[0-9]/)) { n[o] = null } } } }, _adjustSettings: function (t, r) { var o; var l = this._get(r, "serverSync"); var q = 0; var m = null; for (var p = 0; p < this._serverSyncs.length; p++) { if (this._serverSyncs[p][0] == l) { m = this._serverSyncs[p][1]; break } } if (m != null) { q = (l ? m : 0); o = new Date() } else { var n = (l ? l.apply(t, []) : null); o = new Date(); q = (n ? o.getTime() - n.getTime() : 0); this._serverSyncs.push([l, q]) } var s = this._get(r, "timezone"); s = (s == null ? -o.getTimezoneOffset() : s); r._since = this._get(r, "since"); if (r._since != null) { r._since = this.UTCDate(s, this._determineTime(r._since, null)); if (r._since && q) { r._since.setMilliseconds(r._since.getMilliseconds() + q) } } r._until = this.UTCDate(s, this._determineTime(this._get(r, "until"), o)); if (q) { r._until.setMilliseconds(r._until.getMilliseconds() + q) } r._show = this._determineShow(r) }, _destroyCountdown: function (m) { var l = c(m); if (!l.hasClass(this.markerClassName)) { return } this._removeTarget(m); l.removeClass(this.markerClassName).empty(); c.removeData(m, f) }, _pauseCountdown: function (l) { this._hold(l, "pause") }, _lapCountdown: function (l) { this._hold(l, "lap") }, _resumeCountdown: function (l) { this._hold(l, null) }, _hold: function (o, n) { var m = c.data(o, f); if (m) { if (m._hold == "pause" && !n) { m._periods = m._savePeriods; var l = (m._since ? "-" : "+"); m[m._since ? "_since" : "_until"] = this._determineTime(l + m._periods[0] + "y" + l + m._periods[1] + "o" + l + m._periods[2] + "w" + l + m._periods[3] + "d" + l + m._periods[4] + "h" + l + m._periods[5] + "m" + l + m._periods[6] + "s"); this._addTarget(o) } m._hold = n; m._savePeriods = (n == "pause" ? m._periods : null); c.data(o, f, m); this._updateCountdown(o, m) } }, _getTimesCountdown: function (m) { var l = c.data(m, f); return (!l ? null : (!l._hold ? l._periods : this._calculatePeriods(l, l._show, this._get(l, "significant"), new Date()))) }, _get: function (m, l) { return (m.options[l] != null ? m.options[l] : c.countdown._defaults[l]) }, _determineTime: function (o, l) { var n = function (r) { var q = new Date(); q.setTime(q.getTime() + r * 1000); return q }; var m = function (s) { s = s.toLowerCase(); var z = new Date(); var w = z.getFullYear(); var u = z.getMonth(); var x = z.getDate(); var r = z.getHours(); var q = z.getMinutes(); var y = z.getSeconds(); var v = /([+-]?[0-9]+)\s*(s|m|h|d|w|o|y)?/g; var t = v.exec(s); while (t) { switch (t[2] || "s") { case "s": y += parseInt(t[1], 10); break; case "m": q += parseInt(t[1], 10); break; case "h": r += parseInt(t[1], 10); break; case "d": x += parseInt(t[1], 10); break; case "w": x += parseInt(t[1], 10) * 7; break; case "o": u += parseInt(t[1], 10); x = Math.min(x, c.countdown._getDaysInMonth(w, u)); break; case "y": w += parseInt(t[1], 10); x = Math.min(x, c.countdown._getDaysInMonth(w, u)); break } t = v.exec(s) } return new Date(w, u, x, r, q, y, 0) }; var p = (o == null ? l : (typeof o == "string" ? m(o) : (typeof o == "number" ? n(o) : o))); if (p) { p.setMilliseconds(0) } return p }, _getDaysInMonth: function (l, m) { return 32 - new Date(l, m, 32).getDate() }, _normalLabels: function (l) { return l }, _generateHTML: function (w) { var u = this._get(w, "significant"); w._periods = (w._hold ? w._periods : this._calculatePeriods(w, w._show, u, new Date())); var m = false; var s = 0; var v = u; var o = c.extend({}, w._show); for (var l = j; l <= b; l++) { m |= (w._show[l] == "?" && w._periods[l] > 0); o[l] = (w._show[l] == "?" && !m ? null : w._show[l]); s += (o[l] ? 1 : 0); v -= (w._periods[l] > 0 ? 1 : 0) } var n = [false, false, false, false, false, false, false]; for (var l = b; l >= j; l--) { if (w._show[l]) { if (w._periods[l]) { n[l] = true } else { n[l] = v > 0; v-- } } } var A = this._get(w, "compact"); var y = this._get(w, "layout"); var x = (A ? this._get(w, "compactLabels") : this._get(w, "labels")); var r = this._get(w, "whichLabels") || this._normalLabels; var q = this._get(w, "timeSeparator"); var p = this._get(w, "description") || ""; var z = function (C) { var B = c.countdown._get(w, "compactLabels" + r(w._periods[C])); return (o[C] ? w._periods[C] + (B ? B[C] : x[C]) + " " : "") }; var t = function (C) { var B = c.countdown._get(w, "labels" + r(w._periods[C])); return ((!u && o[C]) || (u && n[C]) ? '' + w._periods[C] + "
" + (B ? B[C] : x[C]) + "
" : "") }; return (y ? this._buildLayout(w, o, y, A, u, n) : ((A ? '' + z(j) + z(d) + z(k) + z(h) + (o[g] ? this._minDigits(w._periods[g], 2) : "") + (o[e] ? (o[g] ? q : "") + this._minDigits(w._periods[e], 2) : "") + (o[b] ? (o[g] || o[e] ? q : "") + this._minDigits(w._periods[b], 2) : "") : '' + t(j) + t(d) + t(k) + t(h) + t(g) + t(e) + t(b)) + "" + (p ? '' + p + "" : ""))) }, _buildLayout: function (y, q, l, n, r, p) { var z = this._get(y, (n ? "compactLabels" : "labels")); var u = this._get(y, "whichLabels") || this._normalLabels; var t = function (A) { return (c.countdown._get(y, (n ? "compactLabels" : "labels") + u(y._periods[A])) || z)[A] }; var o = function (A, B) { return Math.floor(A / B) % 10 }; var v = { desc: this._get(y, "description"), sep: this._get(y, "timeSeparator"), yl: t(j), yn: y._periods[j], ynn: this._minDigits(y._periods[j], 2), ynnn: this._minDigits(y._periods[j], 3), y1: o(y._periods[j], 1), y10: o(y._periods[j], 10), y100: o(y._periods[j], 100), y1000: o(y._periods[j], 1000), ol: t(d), on: y._periods[d], onn: this._minDigits(y._periods[d], 2), onnn: this._minDigits(y._periods[d], 3), o1: o(y._periods[d], 1), o10: o(y._periods[d], 10), o100: o(y._periods[d], 100), o1000: o(y._periods[d], 1000), wl: t(k), wn: y._periods[k], wnn: this._minDigits(y._periods[k], 2), wnnn: this._minDigits(y._periods[k], 3), w1: o(y._periods[k], 1), w10: o(y._periods[k], 10), w100: o(y._periods[k], 100), w1000: o(y._periods[k], 1000), dl: t(h), dn: y._periods[h], dnn: this._minDigits(y._periods[h], 2), dnnn: this._minDigits(y._periods[h], 3), d1: o(y._periods[h], 1), d10: o(y._periods[h], 10), d100: o(y._periods[h], 100), d1000: o(y._periods[h], 1000), hl: t(g), hn: y._periods[g], hnn: this._minDigits(y._periods[g], 2), hnnn: this._minDigits(y._periods[g], 3), h1: o(y._periods[g], 1), h10: o(y._periods[g], 10), h100: o(y._periods[g], 100), h1000: o(y._periods[g], 1000), ml: t(e), mn: y._periods[e], mnn: this._minDigits(y._periods[e], 2), mnnn: this._minDigits(y._periods[e], 3), m1: o(y._periods[e], 1), m10: o(y._periods[e], 10), m100: o(y._periods[e], 100), m1000: o(y._periods[e], 1000), sl: t(b), sn: y._periods[b], snn: this._minDigits(y._periods[b], 2), snnn: this._minDigits(y._periods[b], 3), s1: o(y._periods[b], 1), s10: o(y._periods[b], 10), s100: o(y._periods[b], 100), s1000: o(y._periods[b], 1000) }; var x = l; for (var w = j; w <= b; w++) { var m = "yowdhms".charAt(w); var s = new RegExp("\\{" + m + "<\\}(.*)\\{" + m + ">\\}", "g"); x = x.replace(s, ((!r && q[w]) || (r && p[w]) ? "$1" : "")) } c.each(v, function (A, B) { var C = new RegExp("\\{" + A + "\\}", "g"); x = x.replace(C, B) }); return x }, _minDigits: function (m, l) { m = "" + m; if (m.length >= l) { return m } m = "0000000000" + m; return m.substr(m.length - l) }, _determineShow: function (m) { var n = this._get(m, "format"); var l = []; l[j] = (n.match("y") ? "?" : (n.match("Y") ? "!" : null)); l[d] = (n.match("o") ? "?" : (n.match("O") ? "!" : null)); l[k] = (n.match("w") ? "?" : (n.match("W") ? "!" : null)); l[h] = (n.match("d") ? "?" : (n.match("D") ? "!" : null)); l[g] = (n.match("h") ? "?" : (n.match("H") ? "!" : null)); l[e] = (n.match("m") ? "?" : (n.match("M") ? "!" : null)); l[b] = (n.match("s") ? "?" : (n.match("S") ? "!" : null)); return l }, _calculatePeriods: function (o, u, w, m) { o._now = m; o._now.setMilliseconds(0); var r = new Date(o._now.getTime()); if (o._since) { if (m.getTime() < o._since.getTime()) { o._now = m = r } else { m = o._since } } else { r.setTime(o._until.getTime()); if (m.getTime() > o._until.getTime()) { o._now = m = r } } var l = [0, 0, 0, 0, 0, 0, 0]; if (u[j] || u[d]) { var B = c.countdown._getDaysInMonth(m.getFullYear(), m.getMonth()); var C = c.countdown._getDaysInMonth(r.getFullYear(), r.getMonth()); var t = (r.getDate() == m.getDate() || (r.getDate() >= Math.min(B, C) && m.getDate() >= Math.min(B, C))); var s = function (E) { return (E.getHours() * 60 + E.getMinutes()) * 60 + E.getSeconds() }; var x = Math.max(0, (r.getFullYear() - m.getFullYear()) * 12 + r.getMonth() - m.getMonth() + ((r.getDate() < m.getDate() && !t) || (t && s(r) < s(m)) ? -1 : 0)); l[j] = (u[j] ? Math.floor(x / 12) : 0); l[d] = (u[d] ? x - l[j] * 12 : 0); m = new Date(m.getTime()); var v = (m.getDate() == B); var p = c.countdown._getDaysInMonth(m.getFullYear() + l[j], m.getMonth() + l[d]); if (m.getDate() > p) { m.setDate(p) } m.setFullYear(m.getFullYear() + l[j]); m.setMonth(m.getMonth() + l[d]); if (v) { m.setDate(p) } } var A = Math.floor((r.getTime() - m.getTime()) / 1000); var n = function (F, E) { l[F] = (u[F] ? Math.floor(A / E) : 0); A -= l[F] * E }; n(k, 604800); n(h, 86400); n(g, 3600); n(e, 60); n(b, 1); if (A > 0 && !o._since) { var y = [1, 12, 4.3482, 7, 24, 60, 60]; var z = b; var D = 1; for (var q = b; q >= j; q--) { if (u[q]) { if (l[z] >= D) { l[z] = 0; A = 1 } if (A > 0) { l[q]++; A = 0; z = q; D = 1 } } D *= y[q] } } if (w) { for (var q = j; q <= b; q++) { if (w && l[q]) { w-- } else { if (!w) { l[q] = 0 } } } } return l } }); function a(n, m) { c.extend(n, m); for (var l in m) { if (m[l] == null) { n[l] = null } } return n } c.fn.countdown = function (m) { var l = Array.prototype.slice.call(arguments, 1); if (m == "getTimes" || m == "settings") { return c.countdown["_" + m + "Countdown"].apply(c.countdown, [this[0]].concat(l)) } return this.each(function () { if (typeof m == "string") { c.countdown["_" + m + "Countdown"].apply(c.countdown, [this].concat(l)) } else { c.countdown._attachCountdown(this, m) } }) }; c.countdown = new i() })(jQuery); function initProductDescriptionTabs() { $(".detail_wrapper").hide(); $("ul.tit_tab li:first").addClass("current").show(); $(".detail_wrapper:first").show(); $("ul.tit_tab li").click(function () { $(this).addClass("current").siblings().removeClass("current"); var a = $(".tit_tab li").index(this); $(".detail_wrapper").hide(); $(".detail_wrapper").eq(a).show() }) } function selectabs(i,ii,sid) { $(".product_leftmenu ul li.current").removeClass("current"); $(".product_leftmenu ul li#leftmenu" + ii).addClass("current"); $("ul.tit_tab li.current").removeClass("current"); $("ul.tit_tab li#tit_tab" + i).addClass("current"); $(".detail_wrapper").hide(); $(".detail_wrapper#detail_wrapper" + i).show(); if (ii == 0 || ii == 2) { if (ii == 2) { $("html,body").animate({ scrollTop: 900 }, 1000); } else { $("html,body").animate({ scrollTop: 1000 }, 1000); } } else { var mao = $("#" + sid); //获得锚点 if (mao.length > 0) {//判断对象是否存在 var pos = mao.offset().top; var poshigh = mao.height(); $("html,body").animate({ scrollTop: pos - poshigh - 30 }, 1000); } } } function getParam(pname) { var params = location.search.substr(1); // 获取参数 平且去掉? var ArrParam = params.split('&'); if (ArrParam.length == 1) { //只有一个参数的情况 return params.split('=')[1]; } else { //多个参数参数的情况 for (var i = 0; i < ArrParam.length; i++) { if (ArrParam[i].split('=')[0] == pname) { return ArrParam[i].split('=')[1]; } } } } function openImageWindow(a) { window.open(a, "", "width=600,height=600,scrollbars=0") } function initDetailPageDocumentReadyAction() { jQuery("#productImgA").bind("click", function (b) { openImageWindow($("#productImgA").val()) }); initProductDescriptionTabs(); } function initGalleryViewEvent() { } jQuery(document).ready(function () { var zwidth = 500, zheight = 400; var width = parseInt($(this).width()); if (width <= 1260) { zwidth = 534; zheight = 400; } if (width <= 800) { zwidth = 386; zheight = 400; } jQuery("#productImgA").jqzoom({ zoomWidth: zwidth, zoomHeight: zheight, lens: false, title: false }); $(window).resize(function () { width = parseInt($(this).width()); if (width <= 1260) { zwidth = 534; zheight = 400; } if (width <= 800) { zwidth = 386; zheight = 400; } jQuery("#productImgA").jqzoom({ zoomWidth: zwidth, zoomHeight: zheight, lens: false, title: false }); }); if (isSeriesProduct == 0) { initGalleryViewEvent() } initDetailPageDocumentReadyAction(); initPurchaseBtnStatus(); }); function initPurchaseBtnStatus() { var b = jQuery("#doPurchaseBtn"); var b2 = jQuery("#doPurchaseBtn2"); if (b.size() > 0) { var a = b.attr("InventoryId"); if (a <= 0) { newBtnText = "已售完"; b.val(newBtnText); b.unbind("click"); b.attr("class", "input_none").attr("disabled", true); b2.unbind("click"); b2.val(""); b2.attr("class", "input_none").attr("disabled", true); } } } var currentTabPage; function initTabSwitch(h, i, j) { var g = jQuery(h); var f = jQuery(i); if (g && g.size() > 1) { jQuery(g).click(function () { var b = jQuery(h + "." + j); var a = jQuery(this); var c = g.index(b); var d = g.index(a); b.removeClass(j); a.addClass(j); f.eq(c).hide(); f.eq(d).show(); currentTabPage = d }) } } function increment(d) { if (d.size() > 0) { var a = d.val(); var c = /^[1-9]\d{0,2}$/g; if (!a.match(c)) { YHD.alert("输入的数量有误,应为[1-999]"); d.val(1); a = 1 } var b = parseInt(a) + 1; if (b > 999) { b = 999 } if (jQuery("#doPurchaseBtn").size() > 0) { var e = jQuery("#doPurchaseBtn").attr("InventoryId"); if (e != null) { e = parseInt(e); if (e > 0 && b > e) { YHD.alert("该商品限购 [" + e + "] 件,请修改购物数量,若给您带来不便,我们深表歉意。"); b = e } } } d.val(b) } } function decrement(d) { if (d.size() > 0) { var a = d.val(); var c = /^[1-9]\d{0,2}$/g; if (!a.match(c)) { YHD.alert("输入的数量有误,应为[1-999]"); d.val(1); a = 1 } var b = parseInt(a) - 1; if (b > 999) { b = 999 } if (b <= 0) { YHD.alert("输入的数量有误,应为[1-999]"); b = 1 } d.val(b) } } function inputOnlyNum(c, b, a) { c.value = c.value.replace(/\D+/g, ""); if (c.value > a) { c.value = a } if (c.value < b) { c.value = b } }