﻿(function($) { jQuery.fn.center = function() { this.css("position", "absolute"); this.css("top", ($(window).height() - this.height()) / 2 + $(window).scrollTop() + "px"); this.css("left", ($(window).width() - this.width()) / 2 + $(window).scrollLeft() + "px"); return this } })(jQuery); function DisplayMessage(a, b) { alert(b) } function serviceProxy(h) { var i = this; this.serviceUrl = h; this.invoke = function(c, d, e, f) { var g = i.serviceUrl + c; $.ajax({ url: g, data: d, type: "POST", timeout: 10000, dataType: "json", success: e, error: function(a) { if (!f) return; if (a.responseText) { var b = JSON.parse(a.responseText); if (b) f(b); else f({ Message: "Unknown server error." }) } return } }) } } var _tmplCache = {}; this.parseTemplate = function(a, b) { var c = ""; try { var d = _tmplCache[a]; if (!d) { var f = "var p=[],print=function(){p.push.apply(p,arguments);};" + "with(obj){p.push('" + a.replace(/[\r\t\n]/g, " ").replace(/'(?=[^#]*#>)/g, "\t").split("'").join("\\'").split("\t").join("'").replace(/<#=(.+?)#>/g, "',$1,'").split("<#").join("');").split("#>").join("p.push('") + "');}return p.join('');"; d = new Function("obj", f); _tmplCache[a] = d } return d(b) } catch (e) { c = e.message } return "< # ERROR: " + c.htmlEncode() + " # >" }; Array.prototype.contains = function(a) { var i = this.length; while (i--) { if (this[i] === a) { return true } } return false }; String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, "") }; String.prototype.LTrim = function() { return this.replace(/(^\s*)/g, "") }; String.prototype.RTrim = function() { return this.replace(/(\s*$)/g, "") }; function sharer(i, j, k) { var l = this; this._url = j; this._title = k; this._proxyUrl = i; this.email = function(c, d, e, f, g) { var p = new serviceProxy(l._proxyUrl); var h = { 'source': c, 'dest': d, 'name': e, 'url': _url, 'title': _title, 'body': f }; p.invoke("ShareEmail", h, function(a) { if (a) { var b = a.split("|"); if (b.length < 1) { return } if (g) { g(b) } } }, function(a) { alert(a) }) } } (function($) { $.fn.addcaption = function(e) { var f = { bgcolor: '#fff', fontcolor: '#333', font: 'Arial, Helvetica, sans-serif', fontsize: '10px;', margin: 'margin:5px;', align: 'float:right;', width: 'width:auto;', border: 'none;' }; var e = $.extend(f, e); return this.each(function() { if ($(this).attr('alt')) { var a = e.margin; if ($(this).attr('vspace') != -1 && $(this).attr('hspace') != -1) { a = 'margin:' + $(this).attr('vspace') + 'px ' + $(this).attr('hspace') + 'px;'; $(this).removeAttr('vspace').removeAttr('hspace') } else if ($(this).attr('vspace') != -1) { a = 'margin:' + $(this).attr('vspace') + 'px 0px;'; $(this).removeAttr('vspace') } else if ($(this).attr('hspace') != -1) { a = 'margin:0px ' + $(this).attr('hspace') + 'px;'; $(this).removeAttr('hspace') } var b = e.align; if ($(this).attr('align') && ($(this).attr('align').toLowerCase() == 'right' || $(this).attr('align').toLowerCase() == 'left')) { b = 'float:' + $(this).attr('align').toLowerCase() + ';' } if ($(this).attr('align')) { $(this).removeAttr('align') } var c = e.width; if ($(this).attr('width')) { c = 'width:' + $(this).attr('width') + 'px;' } var d = e.border; if ($(this).attr('border')) { d = 'border:' + $(this).attr('border') + 'px solid #000;'; $(this).removeAttr('border') } $(this).attr('style', 'margin:auto;border:none;'); $(this).wrap('<div class="imgcap"></div>'); $(this).parent('div').append('<div class="icpbx" style="width:' + (parseInt($(this).attr('width')) - 4) + 'px;">' + $(this).attr('alt') + '</div>'); if ($(this).parent('div').parent('a')) { if ($.browser.msie) { $(this).parent('div').attr('style', $(this).parent('div').attr('style') + 'cursor:pointer;'); $(this).parent('div').parent('a').attr('style', 'text-decoration:none;cursor:hand;') } else { $(this).parent('div').attr('style', $(this).parent('span').attr('style') + 'cursor:pointer;'); $(this).parent('div').parent('a').attr('style', 'text-decoration:none;cursor:pointer;') } } } }) } })(jQuery); (function($) { $.fn.tipsy = function(g) { g = $.extend({}, $.fn.tipsy.defaults, g); return this.each(function() { var f = $.fn.tipsy.elementOptions(this, g); $(this).hover(function() { $.data(this, 'cancel.tipsy', true); var a = $.data(this, 'active.tipsy'); if (!a) { a = $('<div class="tipsy"><div class="tipsy-inner"/></div>'); a.css({ position: 'absolute', zIndex: 100000 }); $.data(this, 'active.tipsy', a) } if ($(this).attr('title') || typeof ($(this).attr('original-title')) != 'string') { $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title') } var b; if (typeof f.title == 'string') { b = $(this).attr(f.title == 'title' ? 'original-title' : f.title) } else if (typeof f.title == 'function') { b = f.title.call(this) } a.find('.tipsy-inner')[f.html ? 'html' : 'text'](b || f.fallback); var c = $.extend({}, $(this).offset(), { width: this.offsetWidth, height: this.offsetHeight }); a.get(0).className = 'tipsy'; a.remove().css({ top: 0, left: 0, visibility: 'hidden', display: 'block' }).appendTo(document.body); var d = a[0].offsetWidth, actualHeight = a[0].offsetHeight; var e = (typeof f.gravity == 'function') ? f.gravity.call(this) : f.gravity; switch (e.charAt(0)) { case 'n': a.css({ top: c.top + c.height, left: c.left + c.width / 2 - d / 2 }).addClass('tipsy-north'); break; case 's': a.css({ top: c.top - actualHeight, left: c.left + c.width / 2 - d / 2 }).addClass('tipsy-south'); break; case 'e': a.css({ top: c.top + c.height / 2 - actualHeight / 2, left: c.left - d }).addClass('tipsy-east'); break; case 'w': a.css({ top: c.top + c.height / 2 - actualHeight / 2, left: c.left + c.width }).addClass('tipsy-west'); break } if (f.fade) { a.css({ opacity: 0, display: 'block', visibility: 'visible' }).animate({ opacity: 0.8 }) } else { a.css({ visibility: 'visible' }) } }, function() { $.data(this, 'cancel.tipsy', false); var b = this; setTimeout(function() { if ($.data(this, 'cancel.tipsy')) return; var a = $.data(b, 'active.tipsy'); if (f.fade) { a.stop().fadeOut(function() { $(this).remove() }) } else { a.remove() } }, 100) }) }) }; $.fn.tipsy.elementOptions = function(a, b) { return $.metadata ? $.extend({}, b, $(a).metadata()) : b }; $.fn.tipsy.defaults = { fade: false, fallback: '', gravity: 'n', html: false, title: 'title' }; $.fn.tipsy.autoNS = function() { return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n' }; $.fn.tipsy.autoWE = function() { return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w' } })(jQuery); (function(d) { var k = d.scrollTo = function(a, i, e) { d(window).scrollTo(a, i, e) }; k.defaults = { axis: 'xy', duration: parseFloat(d.fn.jquery) >= 1.3 ? 0 : 1 }; k.window = function(a) { return d(window)._scrollable() }; d.fn._scrollable = function() { return this.map(function() { var a = this, i = !a.nodeName || d.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1; if (!i) return a; var e = (a.contentWindow || a).document || a.ownerDocument || a; return d.browser.safari || e.compatMode == 'BackCompat' ? e.body : e.documentElement }) }; d.fn.scrollTo = function(n, j, b) { if (typeof j == 'object') { b = j; j = 0 } if (typeof b == 'function') b = { onAfter: b }; if (n == 'max') n = 9e9; b = d.extend({}, k.defaults, b); j = j || b.speed || b.duration; b.queue = b.queue && b.axis.length > 1; if (b.queue) j /= 2; b.offset = p(b.offset); b.over = p(b.over); return this._scrollable().each(function() { var q = this, r = d(q), f = n, s, g = {}, u = r.is('html,body'); switch (typeof f) { case 'number': case 'string': if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)) { f = p(f); break } f = d(f, this); case 'object': if (f.is || f.style) s = (f = d(f)).offset() } d.each(b.axis.split(''), function(a, i) { var e = i == 'x' ? 'Left' : 'Top', h = e.toLowerCase(), c = 'scroll' + e, l = q[c], m = k.max(q, i); if (s) { g[c] = s[h] + (u ? 0 : l - r.offset()[h]); if (b.margin) { g[c] -= parseInt(f.css('margin' + e)) || 0; g[c] -= parseInt(f.css('border' + e + 'Width')) || 0 } g[c] += b.offset[h] || 0; if (b.over[h]) g[c] += f[i == 'x' ? 'width' : 'height']() * b.over[h] } else { var o = f[h]; g[c] = o.slice && o.slice(-1) == '%' ? parseFloat(o) / 100 * m : o } if (/^\d+$/.test(g[c])) g[c] = g[c] <= 0 ? 0 : Math.min(g[c], m); if (!a && b.queue) { if (l != g[c]) t(b.onAfterFirst); delete g[c] } }); t(b.onAfter); function t(a) { r.animate(g, j, b.easing, a && function() { a.call(this, n, b) }) } }).end() }; k.max = function(a, i) { var e = i == 'x' ? 'Width' : 'Height', h = 'scroll' + e; if (!d(a).is('html,body')) return a[h] - d(a)[e.toLowerCase()](); var c = 'client' + e, l = a.ownerDocument.documentElement, m = a.ownerDocument.body; return Math.max(l[h], m[h]) - Math.min(l[c], m[c]) }; function p(a) { return typeof a == 'object' ? a : { top: a, left: a} } })(jQuery); (function(f) { var n; var e; var p = new Object(); var o; var x = new Array(""); var A = 0; var a = null; var s = null; var t = "\n"; var g = false; f.fn.bbcodeeditor = function(B) { e = f.extend({}, f.fn.bbcodeeditor.defaults, B); n = this; if (!f.browser.opera) { n.keydown(c) } else { n.keypress(c) } if (f.browser.msie) { f(document).mousedown(function(C) { if (s != null && s == n[0]) { a = document.selection.createRange() } s = C.target }) } if (f.browser.msie || f.browser.opera) { t = "\r\n" } if (e.bold != false) { e.bold.click(function() { r("bold text", "[b]", "[/b]") }) } if (e.italic != false) { e.italic.click(function() { r("italic text", "[i]", "[/i]") }) } if (e.underline != false) { e.underline.click(function() { r("underline text", "[u]", "[/u]") }) } if (e.link != false) { e.link.click(q) } if (e.quote != false) { e.quote.click(function() { r("quote", "[quote]", "[/quote]", true) }) } if (e.code != false) { e.code.click(function() { r("function(event) {", "[code]", "[/code]", true) }) } if (e.image != false) { e.image.click(h) } if (e.nlist != false) { e.nlist.click(function() { r("list item", "[list=1]" + t + "[*]", "[/list]", true) }) } if (e.blist != false) { e.blist.click(function() { r("list item", "[list]" + t + "[*]", "[/list]", true) }) } if (e.litem != false) { e.litem.click(function() { r("list item", "[*]", "", true) }) } if (e.usize != false) { e.usize.click(function() { j(true) }) } if (e.dsize != false) { e.dsize.click(function() { j(false) }) } if (e.back != false) { if (e.back_disable != false) { p.back = e.back[0].className } e.back.click(v); u(false) } if (e.forward != false) { if (e.forward_disable != false) { p.forward = e.forward[0].className } e.forward.click(l); m(false) } if (e.back != false || e.forward != false) { n.keyup(w) } f.fn.bbcodeeditor.preview(); window.onbeforeunload = k; return this }; function u(B) { if (!B) { if (e.back_disable == false) { e.back.css("opacity", 0.5) } else { if (e.back != false) { e.back[0].className = e.back_disable } } } else { if (e.back_disable == false) { e.back.css("opacity", 1) } else { if (e.back != false) { e.back[0].className = p.back } } } } function m(B) { if (!B) { if (e.forward_disable == false) { e.forward.css("opacity", 0.5) } else { if (e.forward != false) { e.forward[0].className = e.forward_disable } } } else { if (e.forward_disable == false) { e.forward.css("opacity", 1) } else { if (e.forward != false) { e.forward[0].className = p.forward } } } } function k(B) { if (e.exit_warning && !g && n[0].value != "") { var B = B || window.event; if (B) { B.returnValue = "You have started writing a post." } return "You have started writing a post." } } function w(B) { if (f.browser.msie) { a = document.selection.createRange() } if (B.keyCode != 17 && !(B.ctrlKey && (B.keyCode == 89 || B.keyCode == 90))) { if (n.val().length != 0) { u(true) } else { u(false) } if (A != 0) { x.slice(0, x.length - A); m(false); A = 0 } if (B.keyCode == 8 || B.keyCode == 13 || B.keyCode == 32 || B.keyCode == 46 || (B.ctrlKey && (B.keyCode == 67 || B.keyCode == 86))) { d() } f.fn.bbcodeeditor.preview() } } function c(L) { if (f.browser.msie) { a = document.selection.createRange() } if (e.keyboard && L.ctrlKey) { if (L.keyCode == 66 && e.bold != false) { L.preventDefault(); r("bold text", "[b]", "[/b]") } else { if (L.keyCode == 73 && e.italic != false) { L.preventDefault(); r("italic text", "[i]", "[/i]") } else { if (L.keyCode == 75 && e.code != false) { L.preventDefault(); r("function(event) {", "[code]", "[/code]", true) } else { if (L.keyCode == 76 && e.link != false) { L.preventDefault(); q() } else { if (L.keyCode == 80 && e.image != false) { L.preventDefault(); h() } else { if (L.keyCode == 81 && e.quote != false) { L.preventDefault(); r("quote", "[quote]", "[/quote]", true) } else { if (L.keyCode == 85 && e.underline != false) { L.preventDefault(); r("underline text", "[u]", "[/u]") } else { if (L.keyCode == 89 && e.forward != false) { L.preventDefault(); l() } else { if (L.keyCode == 90 && e.back != false) { L.preventDefault(); v() } } } } } } } } } } if (L.keyCode == 13) { var B = y().start; var Q = n[0].value.substring(0, B).lastIndexOf("\n"); Q = (Q == -1 ? 0 : Q + 1); var H = n[0].value.substring(Q, B).match(/^\t+/g); if (H != null) { L.preventDefault(); var D = i(); var M = t; for (var F = 0; F < H[0].length; F++) { M += "\t" } n[0].value = n[0].value.substring(0, B) + M + n[0].value.substring(B); z(B + M.length, B + M.length); b(D) } } else { if (L.keyCode == 9) { L.preventDefault(); var D = i(); d(); var I = y(); if (I.start != I.end && n[0].value.substr(I.start, 1) == "\n") { I.start++ } var H = n[0].value.substring(I.start, I.end).match(/\n/g); if (H != null) { var K = n[0].value.substring(0, I.start).lastIndexOf(t); var P = (K != -1 ? K : 0); if (!L.shiftKey) { var C = n[0].value.substring(P, I.end).replace(/\n/g, "\n\t"); n[0].value = (K == -1 ? "\t" : "") + n[0].value.substring(0, P) + C + n[0].value.substring(I.end); z(I.start + 1, I.end + H.length + 1) } else { var F = (n[0].value.substr((K != -1 ? K + t.length : 0), 1) == "\t" ? 1 : 0); var J = n[0].value.substring(P, I.end).match(/\n\t/g, "\n"); if (K == -1 && n[0].value.substr(0, 1) == "\t") { n[0].value = n[0].value.substr(1); J.push(0) } var C = n[0].value.substring(P, I.end).replace(/\n\t/g, "\n"); n[0].value = n[0].value.substring(0, P) + C + n[0].value.substring(I.end); z(I.start - F, I.end - (J != null ? J.length : 0)) } } else { if (!L.shiftKey) { n[0].value = n[0].value.substring(0, I.start) + "\t" + n[0].value.substring(I.start); z(I.start + 1, I.start + 1) } else { var O = n[0].value.substring(0, I.start).lastIndexOf("\n"); var N = (O == -1 ? 0 : O); var E = n[0].value.substring(N + 1).indexOf("\n"); if (E == -1) { E = n[0].value.length } else { E += N + 1 } if (O == -1) { var G = n[0].value.substring(N, E).match(/^\t/); var C = n[0].value.substring(N, E).replace(/^\t/, "") } else { var G = n[0].value.substring(N, E).match(/\n\t/); var C = n[0].value.substring(N, E).replace(/\n\t/, "\n") } n[0].value = n[0].value.substring(0, N) + C + n[0].value.substring(E); if (G != null) { z(I.start - (I.start - 1 > O ? 1 : 0), I.end - ((I.start - 1 > O || I.start != I.end) ? 1 : 0)) } } } b(D) } } } function i() { return { scrollTop: n.scrollTop(), scrollHeight: n[0].scrollHeight} } function b(B) { n.scrollTop(B.scrollTop + n[0].scrollHeight - B.scrollHeight) } function d() { A = 0; m(false); u(true); if (x[x.length - 1] != n[0].value) { x.push(n[0].value) } } function v() { var B = n.scrollTop(); if (A == 0) { d(); A++ } if (A != x.length) { A++; n[0].value = x[x.length - A]; f.fn.bbcodeeditor.preview(); m(true); if (A == x.length) { u(false) } } n.scrollTop(B) } function l() { var B = n.scrollTop(); if (A > 1) { n[0].value = x[x.length - --A]; f.fn.bbcodeeditor.preview(); u(true); if (A == 1) { m(false) } } n.scrollTop(B) } function r(F, G, J, C) { d(); var H = y(); var B = i(); if (C) { if (J != "[/list]" && G != "[*]") { G = G + t } if (G != "[*]") { J = t + J } if (H.start != 0 && n[0].value.substr(H.start - 1, 1) != t.substr(0, 1)) { G = t + G } if (n[0].value.length != H.end && n[0].value.substr(H.end, 1) != t.substr(0, 1)) { J = J + t } } if (H.start != H.end) { F = n[0].value; if (C) { var I = new RegExp("\\[" + J.substring((t.length == 2 ? 4 : 3), J.length - 1) + "(.*?)\\]" + t + (J == t + "[/list]" ? "\\[\\*\\]" : "") + "$"); var K = new RegExp("^" + t + "\\[/" + J.substring((t.length == 2 ? 4 : 3), J.length - 1) + "\\]") } else { var I = new RegExp("\\[" + J.substring(2, J.length - 1) + "([^\\]]*?)\\]$", "g"); var K = new RegExp("^\\[/" + J.substring(2, J.length - 1) + "\\]", "g") } var D = F.substring(0, H.start).match(I); var E = F.substring(H.end).match(K); if (D != null && E != null) { n[0].value = F.substring(0, H.start).replace(I, "") + F.substring(H.start, H.end) + F.substring(H.end).replace(K, ""); z(H.start - D[0].length, H.end - D[0].length) } else { n[0].value = n[0].value.substr(0, H.start) + G + n[0].value.substring(H.start, H.end) + J + n[0].value.substr(H.end); z(H.start + G.length, H.end + G.length) } } else { n[0].value = n[0].value.substring(0, H.start) + G + F + J + n[0].value.substring(H.end); z(H.start + G.length, H.start + G.length + F.length) } b(B); f.fn.bbcodeeditor.preview() } function z(F, C) { if (!f.browser.msie) { n[0].setSelectionRange(F, C); n.focus() } else { var B = n[0].value.substring(0, F).match(/\r/g); B = (B != null ? B.length : 0); var E = n[0].value.substring(F, C).match(/\r/g); E = (E != null ? E.length : 0); var D = n[0].createTextRange(); D.collapse(true); D.moveStart("character", F - B); D.moveEnd("character", C - F - E); D.select(); a = document.selection.createRange() } } function j(B) { if (B) { r("text", "[size=150]", "[/size]") } else { r("text", "[size=80]", "[/size]") } } function h() { var B = "http://"; r(B, "[img]", "[/img]") } function q(C) { var B = "http://"; r("link text", "[url=" + B + "]", "[/url]") } function y() { if (!f.browser.msie) { return { start: n[0].selectionStart, end: n[0].selectionEnd} } else { if (a == null) { return { start: n[0].value.length, end: n[0].value.length} } var M = a.duplicate(); var F = document.body.createTextRange(); F.moveToElementText(n[0]); F.setEndPoint("EndToStart", M); var D = document.body.createTextRange(); D.moveToElementText(n[0]); D.setEndPoint("StartToEnd", M); var H = false, C = false, L = false; var J, G, K, B, I, E; J = G = F.text; K = B = M.text; I = E = D.text; do { if (!H) { if (F.compareEndPoints("StartToEnd", F) == 0) { H = true } else { F.moveEnd("character", -1); if (F.text == J) { G += "\r\n" } else { H = true } } } if (!C) { if (M.compareEndPoints("StartToEnd", M) == 0) { C = true } else { M.moveEnd("character", -1); if (M.text == K) { B += "\r\n" } else { C = true } } } if (!L) { if (D.compareEndPoints("StartToEnd", D) == 0) { L = true } else { D.moveEnd("character", -1); if (D.text == I) { E += "\r\n" } else { L = true } } } } while ((!H || !C || !L)); return { start: G.length, end: G.length + B.length} } } f.fn.bbcodeeditor.defaults = { bold: false, italic: false, underline: false, link: false, quote: false, code: false, image: false, usize: false, nsize: false, nlist: false, blist: false, litem: false, back: false, back_disable: false, forward: false, forward_disable: false, exit_warning: false, preview: false, keyboard: true }; f.fn.bbcodeeditor.preview = function() { if (e.preview != false) { var B = n.val(); B = B.replace(/</g, "&lt;"); B = B.replace(/>/g, "&gt;"); B = B.replace(/[\r\n]/g, "%lb%"); var E = [/\[b\](.*?)\[\/b\]/gi, /\[i\](.*?)\[\/i\]/gi, /\[u\](.*?)\[\/u\]/gi, /\[size=(8\d|9\d|1\d\d|200)](.*?)\[\/size\]/gi, /\[url(?:\=?)(.*?)\](.*?)\[\/url\]/gi, /\[img(.*?)\](.*?)\[\/img\]/gi, /(?:%lb%|\s)*\[code(?:\=?)(?:.*?)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/code\](?:%lb%|\s)*/gi, /(?:%lb%|\s)*\[quote(?:\=?)(.*?)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/quote\](?:%lb%|\s)*/gi, /\[list(.*?)\](.*?)\[\*\](.*?)(?:%lb%|\s)*(\[\*\].*?\[\/list\]|\[\/list\])/i, /(?:%lb%|\s)*\[list\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/list\](?:%lb%|\s)*/gi, /(?:%lb%|\s)*\[list=(\d)\](?:%lb%|\s)*(.*?)(?:%lb%|\s)*\[\/list\](?:%lb%|\s)*/gi, /(?:%lb%){3,}/g]; var D = ["<b>$1</b>", "<i>$1</i>", "<u>$1</u>", '<span style="font-size:$1%;">$2</span>', '<a href="$1">$2</a>', '<img $1 src="$2" />', "<pre><code>$1</code></pre>", "<blockquote>$2</blockquote>", "[list$1]$2<li>$3</li>$4", "<ul>$1</ul>", "<ol start=$1>$2</ol>", "%lb%%lb%"]; for (var C in E) { B = B.replace(E[C], D[C]); if (C == 8) { while (B.match(E[C], D[C])) { B = B.replace(E[C], D[C]) } } } B = B.replace(/%lb%/g, "<br />"); e.preview.html(B) } }; f.fn.bbcodeeditor.pause = function() { if (!g) { g = true } else { g = false } } })(jQuery); var JSON = JSON || {}; (function() { function f(n) { return n < 10 ? '0' + n : n } if (typeof Date.prototype.toJSON !== 'function') { Date.prototype.toJSON = function(a) { return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null }; String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function(a) { return this.valueOf() } } var e = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, gap, indent, meta = { '\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"': '\\"', '\\': '\\\\' }, rep; function quote(b) { escapable.lastIndex = 0; return escapable.test(b) ? '"' + b.replace(escapable, function(a) { var c = meta[a]; return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4) }) + '"' : '"' + b + '"' } function str(a, b) { var i, k, v, length, mind = gap, partial, value = b[a]; if (value && typeof value === 'object' && typeof value.toJSON === 'function') { value = value.toJSON(a) } if (typeof rep === 'function') { value = rep.call(b, a, value) } switch (typeof value) { case 'string': return quote(value); case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) { return 'null' } gap += indent; partial = []; if (Object.prototype.toString.apply(value) === '[object Array]') { length = value.length; for (i = 0; i < length; i += 1) { partial[i] = str(i, value) || 'null' } v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']'; gap = mind; return v } if (rep && typeof rep === 'object') { length = rep.length; for (i = 0; i < length; i += 1) { k = rep[i]; if (typeof k === 'string') { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v) } } } } else { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = str(k, value); if (v) { partial.push(quote(k) + (gap ? ': ' : ':') + v) } } } } v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}'; gap = mind; return v } } if (typeof JSON.stringify !== 'function') { JSON.stringify = function(a, b, c) { var i; gap = ''; indent = ''; if (typeof c === 'number') { for (i = 0; i < c; i += 1) { indent += ' ' } } else if (typeof c === 'string') { indent = c } rep = b; if (b && typeof b !== 'function' && (typeof b !== 'object' || typeof b.length !== 'number')) { throw new Error('JSON.stringify'); } return str('', { '': a }) } } if (typeof JSON.parse !== 'function') { JSON.parse = function(c, d) { var j; function walk(a, b) { var k, v, value = a[b]; if (value && typeof value === 'object') { for (k in value) { if (Object.hasOwnProperty.call(value, k)) { v = walk(value, k); if (v !== undefined) { value[k] = v } else { delete value[k] } } } } return d.call(a, b, value) } e.lastIndex = 0; if (e.test(c)) { c = c.replace(e, function(a) { return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4) }) } if (/^[\],:{}\s]*$/.test(c.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { j = eval('(' + c + ')'); return typeof d === 'function' ? walk({ '': j }, '') : j } throw new SyntaxError('JSON.parse'); } } } ()); (function($) { $.fn.jqm = function(o) { var p = { overlay: 50, overlayClass: 'jqmOverlay', closeClass: 'jqmClose', trigger: '.jqModal', ajax: F, ajaxText: '', target: F, modal: F, toTop: F, onShow: F, onHide: F, onLoad: F }; return this.each(function() { if (this._jqm) return H[this._jqm].c = $.extend({}, H[this._jqm].c, o); s++; this._jqm = s; H[s] = { c: $.extend(p, $.jqm.params, o), a: F, w: $(this).addClass('jqmID' + s), s: s }; if (p.trigger) $(this).jqmAddTrigger(p.trigger) }) }; $.fn.jqmAddClose = function(e) { return hs(this, e, 'jqmHide') }; $.fn.jqmAddTrigger = function(e) { return hs(this, e, 'jqmShow') }; $.fn.jqmShow = function(t) { return this.each(function() { t = t || window.event; $.jqm.open(this._jqm, t) }) }; $.fn.jqmHide = function(t) { return this.each(function() { t = t || window.event; $.jqm.close(this._jqm, t) }) }; $.jqm = { hash: {}, open: function(s, t) { var h = H[s], c = h.c, cc = '.' + c.closeClass, z = (parseInt(h.w.css('z-index'))), z = (z > 0) ? z : 3000, o = $('<div></div>').css({ height: '100%', width: '100%', position: 'fixed', left: 0, top: 0, 'z-index': z - 1, opacity: c.overlay / 100 }); if (h.a) return F; h.t = t; h.a = true; h.w.css('z-index', z); if (c.modal) { if (!A[0]) L('bind'); A.push(s) } else if (c.overlay > 0) h.w.jqmAddClose(o); else o = F; h.o = (o) ? o.addClass(c.overlayClass).prependTo('body') : F; if (ie6) { $('html,body').css({ height: '100%', width: '100%' }); if (o) { o = o.css({ position: 'absolute' })[0]; for (var y in { Top: 1, Left: 1 }) o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'") } } if (c.ajax) { var r = c.target || h.w, u = c.ajax, r = (typeof r == 'string') ? $(r, h.w) : $(r), u = (u.substr(0, 1) == '@') ? $(t).attr(u.substring(1)) : u; r.html(c.ajaxText).load(u, function() { if (c.onLoad) c.onLoad.call(this, h); if (cc) h.w.jqmAddClose($(cc, h.w)); e(h) }) } else if (cc) h.w.jqmAddClose($(cc, h.w)); if (c.toTop && h.o) h.w.before('<span id="jqmP' + h.w[0]._jqm + '"></span>').insertAfter(h.o); (c.onShow) ? c.onShow(h) : h.w.show(); e(h); return F }, close: function(s) { var h = H[s]; if (!h.a) return F; h.a = F; if (A[0]) { A.pop(); if (!A[0]) L('unbind') } if (h.c.toTop && h.o) $('#jqmP' + h.w[0]._jqm).after(h.w).remove(); if (h.c.onHide) h.c.onHide(h); else { h.w.hide(); if (h.o) h.o.remove() } return F }, params: {} }; var s = 0, H = $.jqm.hash, A = [], ie6 = $.browser.msie && ($.browser.version == "6.0"), F = false, i = $('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({ opacity: 0 }), e = function(h) { if (ie6) if (h.o) h.o.html('<p style="width:100%;height:100%"/>').prepend(i); else if (!$('iframe.jqm', h.w)[0]) h.w.prepend(i); f(h) }, f = function(h) { try { $(':input:visible', h.w)[0].focus() } catch (_) { } }, L = function(t) { $()[t]("keypress", m)[t]("keydown", m)[t]("mousedown", m) }, m = function(e) { var h = H[A[A.length - 1]], r = (!$(e.target).parents('.jqmID' + h.s)[0]); if (r) f(h); return !r }, hs = function(w, t, c) { return w.each(function() { var s = this._jqm; $(t).each(function() { if (!this[c]) { this[c] = []; $(this).click(function() { for (var i in { jqmShow: 1, jqmHide: 1 }) for (var s in this[i]) if (H[this[i][s]]) H[this[i][s]].w[i](this); return F }) } this[c].push(s) }) }) } })(jQuery); if (window.jQuery) (function($) { if ($.browser.msie) try { document.execCommand("BackgroundImageCache", false, true) } catch (e) { }; $.fn.rating = function(i) { if (this.length == 0) return this; if (typeof arguments[0] == 'string') { if (this.length > 1) { var j = arguments; return this.each(function() { $.fn.rating.apply($(this), j) }) }; $.fn.rating[arguments[0]].apply(this, $.makeArray(arguments).slice(1) || []); return this }; var i = $.extend({}, $.fn.rating.options, i || {}); $.fn.rating.calls++; this.not('.star-rating-applied').addClass('star-rating-applied').each(function() { var a, input = $(this); var b = (this.name || 'unnamed-rating').replace(/\[|\]/g, '_').replace(/^\_+|\_+$/g, ''); var c = $(this.form || document.body); var d = c.data('rating'); if (!d || d.call != $.fn.rating.calls) d = { count: 0, call: $.fn.rating.calls }; var e = d[b]; if (e) a = e.data('rating'); if (e && a) a.count++; else { a = $.extend({}, i || {}, ($.metadata ? input.metadata() : ($.meta ? input.data() : null)) || {}, { count: 0, stars: [], inputs: [] }); a.serial = d.count++; e = $('<span class="star-rating-control"/>'); input.before(e); e.addClass('rating-to-be-drawn'); if (input.attr('disabled')) a.readOnly = true; e.append(a.cancel = $('<div class="rating-cancel"><a title="' + a.cancel + '">' + a.cancelValue + '</a></div>').mouseover(function() { $(this).rating('drain'); $(this).addClass('star-rating-hover') }).mouseout(function() { $(this).rating('draw'); $(this).removeClass('star-rating-hover') }).click(function() { $(this).rating('select') }).data('rating', a)) }; var f = $('<div class="star-rating rater-' + a.serial + '"><a title="' + (this.title || this.value) + '">' + this.value + '</a></div>'); e.append(f); if (this.id) f.attr('id', this.id); if (this.className) f.addClass(this.className); if (a.half) a.split = 2; if (typeof a.split == 'number' && a.split > 0) { var g = ($.fn.width ? f.width() : 0) || a.starWidth; var h = (a.count % a.split), spw = Math.floor(g / a.split); f.width(spw).find('a').css({ 'margin-left': '-' + (h * spw) + 'px' }) }; if (a.readOnly) f.addClass('star-rating-readonly'); else f.addClass('star-rating-live').mouseover(function() { $(this).rating('fill'); $(this).rating('focus') }).mouseout(function() { $(this).rating('draw'); $(this).rating('blur') }).click(function() { $(this).rating('select') }); if (this.checked) a.current = f; input.hide(); input.change(function() { $(this).rating('select') }); f.data('rating.input', input.data('rating.star', f)); a.stars[a.stars.length] = f[0]; a.inputs[a.inputs.length] = input[0]; a.rater = d[b] = e; a.context = c; input.data('rating', a); e.data('rating', a); f.data('rating', a); c.data('rating', d) }); $('.rating-to-be-drawn').rating('draw').removeClass('rating-to-be-drawn'); return this }; $.extend($.fn.rating, { calls: 0, focus: function() { var a = this.data('rating'); if (!a) return this; if (!a.focus) return this; var b = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null); if (a.focus) a.focus.apply(b[0], [b.val(), $('a', b.data('rating.star'))[0]]) }, blur: function() { var a = this.data('rating'); if (!a) return this; if (!a.blur) return this; var b = $(this).data('rating.input') || $(this.tagName == 'INPUT' ? this : null); if (a.blur) a.blur.apply(b[0], [b.val(), $('a', b.data('rating.star'))[0]]) }, fill: function() { var a = this.data('rating'); if (!a) return this; if (a.readOnly) return; this.rating('drain'); this.prevAll().andSelf().filter('.rater-' + a.serial).addClass('star-rating-hover') }, drain: function() { var a = this.data('rating'); if (!a) return this; if (a.readOnly) return; a.rater.children().filter('.rater-' + a.serial).removeClass('star-rating-on').removeClass('star-rating-hover') }, draw: function() { var a = this.data('rating'); if (!a) return this; this.rating('drain'); if (a.current) { a.current.data('rating.input').attr('checked', 'checked'); a.current.prevAll().andSelf().filter('.rater-' + a.serial).addClass('star-rating-on') } else $(a.inputs).removeAttr('checked'); a.cancel[a.readOnly || a.required ? 'hide' : 'show'](); this.siblings()[a.readOnly ? 'addClass' : 'removeClass']('star-rating-readonly') }, select: function(a) { var b = this.data('rating'); if (!b) return this; if (b.readOnly) return; b.current = null; if (typeof a != 'undefined') { if (typeof a == 'number') return $(b.stars[a]).rating('select'); if (typeof a == 'string') $.each(b.stars, function() { if ($(this).data('rating.input').val() == a) $(this).rating('select') }) } else b.current = this[0].tagName == 'INPUT' ? this.data('rating.star') : (this.is('.rater-' + b.serial) ? this : null); this.data('rating', b); this.rating('draw'); var c = $(b.current ? b.current.data('rating.input') : null); if (b.callback) b.callback.apply(c[0], [c.val(), $('a', b.current)[0]]) }, readOnly: function(a, b) { var c = this.data('rating'); if (!c) return this; c.readOnly = a || a == undefined ? true : false; if (b) $(c.inputs).attr("disabled", "disabled"); else $(c.inputs).removeAttr("disabled"); this.data('rating', c); this.rating('draw') }, disable: function() { this.rating('readOnly', true, true) }, enable: function() { this.rating('readOnly', false, false) } }); $.fn.rating.options = { cancel: 'Cancel Rating', cancelValue: '', split: 0, starWidth: 16 }; $(function() { $('input[type=radio].multi').rating() }) })(jQuery); (function($) { $.extend({ metadata: { defaults: { type: 'class', name: 'metadata', cre: /({.*})/, single: 'metadata' }, setType: function(a, b) { this.defaults.type = a; this.defaults.name = b }, get: function(a, b) { var c = $.extend({}, this.defaults, b); if (!c.single.length) c.single = 'metadata'; var d = $.data(a, c.single); if (d) return d; d = "{}"; if (c.type == "class") { var m = c.cre.exec(a.className); if (m) d = m[1] } else if (c.type == "elem") { if (!a.getElementsByTagName) return; var e = a.getElementsByTagName(c.name); if (e.length) d = $.trim(e[0].innerHTML) } else if (a.getAttribute != undefined) { var f = a.getAttribute(c.name); if (f) d = f } if (d.indexOf('{') < 0) d = "{" + d + "}"; d = eval("(" + d + ")"); $.data(a, c.single, d); return d } } }); $.fn.metadata = function(a) { return $.metadata.get(this[0], a) } })(jQuery);
