﻿(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 serviceProxy(k) { var l = this; this.serviceUrl = k; this.invoke = function(d, e, f, g, h) { var i = JSON.stringify(e); var j = l.serviceUrl + d; $.ajax({ url: j, data: i, type: "POST", processData: false, contentType: "application/json; charset=utf-8", timeout: 10000, dataType: "text", success: function(a) { if (!f) return; var b = JSON.parse(a); if (h) { f(b); return } for (var c in b) { f(b[c]); break } }, error: function(a) { if (!g) return; if (a.responseText) { var b = JSON.parse(a.responseText); if (b) g(b); else g({ 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);