﻿var validate; (function(d) { validate = function(g) { var f = true; d("*[validate=" + g + "]").each(function(h, j) { if (b(j)) { d(j).highlight(); if (f) { d(j).focus() } f = false } else { d(j).unhighlight() } }); return f }; function e() { if (!b(this)) { d(this).unhighlight() } else { d(this).highlight() } } function b(h) { var f = d(h); var g = f.find("input:radio, input:checkbox").size(); if (f.attr("disabled") || g > 0 && g == f.find("input:radio:disabled, input:checkbox:disabled").size()) { return "" } if (f.val() == "" && f.find("input:radio:checked, input:checkbox:checked").size() == 0) { return f.attr("require") ? "require" : "" } if (f.attr("regular") && f.attr("validExpress") && !new RegExp(f.attr("validExpress"), "m").test(f.val())) { return "regular" } if (f.attr("regular") && f.attr("invalidExpress") && new RegExp(f.attr("invalidExpress"), "m").test(f.val())) { return "regular" } if (f.attr("compare") && d("#" + f.attr("compareTo")).val() != f.val()) { return "compare" } if (f.attr("custom") && !new Function(f.attr("customFn")).call(h)) { return "custom" } if (f.attr("invalid") && f.val() == f.attr("invalidVal")) { return "invalid" } } function c() { var f = d(this); var h = f.offset().top + f.height() + 4; var g = f.offset().left + Math.max(f.width() - 260, 0); f.parents().each(function() { if (d(this).css("position") != "static" && (!d.browser.mozilla || d(this).css("display") != "table")) { var i = d(this).offset(); h -= i.top; g -= i.left; return false } }); f.parent().children(".alertbox").remove(); f.parent().append("<div class='alertbox' style='top:" + h + "px; left:" + g + "px;'><div>" + f.attr(b(this)) + "</div></div>") } function a() { d(this).parent().children(".alertbox").remove() } d.fn.highlight = function() { this.addClass("highlight").focus(c).blur(a).change(e); return this }; d.fn.unhighlight = function() { this.removeClass("highlight").unbind("focus", c).unbind("blur", a).parent().children(".alertbox").remove(); return this } })(jQuery); (function(c) { function r(b, d) { d = d === "x" ? l.width() : l.height(); return typeof b === "string" ? Math.round(b.match(/%/) ? d / 100 * parseInt(b, 10) : parseInt(b, 10)) : b } function $(b) { b = c.isFunction(b) ? b.call(i) : b; return a.photo || b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i) } function W() { for (var b in a) if (c.isFunction(a[b]) && b.substring(0, 2) !== "on") a[b] = a[b].call(i) } function X(b) { i = b; a = c(i).data(q); W(); var d = a.rel || i.rel; if (d && d !== "nofollow") { h = c(".cboxElement").filter(function() { return (c(this).data(q).rel || this.rel) === d }); j = h.index(i); if (j < 0) { h = h.add(i); j = h.length - 1 } } else { h = c(i); j = 0 } if (!C) { D = C = m; N = i; N.blur(); c().bind("keydown.cbox_close", function(e) { if (e.keyCode === 27) { e.preventDefault(); f.close() } }).bind("keydown.cbox_arrows", function(e) { if (h.length > 1) if (e.keyCode === 37) { e.preventDefault(); E.click() } else if (e.keyCode === 39) { e.preventDefault(); F.click() } }); a.overlayClose && s.css({ cursor: "pointer" }).one("click", f.close); c.event.trigger(aa); a.onOpen && a.onOpen.call(i); H.html(a.close); s.css({ opacity: a.opacity }).show(); a.w = r(a.initialWidth, "x"); a.h = r(a.initialHeight, "y"); f.position(0); O && l.bind("resize.cboxie6 scroll.cboxie6", function() { s.css({ width: l.width(), height: l.height(), top: l.scrollTop(), left: l.scrollLeft() }) }).trigger("scroll.cboxie6") } f.slideshow(); f.load() } var q = "colorbox", x = "hover", m = true, f, y = !c.support.opacity, O = y && !window.XMLHttpRequest, aa = "cbox_open", I = "cbox_load", P = "cbox_complete", Q = "resize.cbox_resize", s, k, t, o, R, S, T, U, h, l, n, J, K, L, Y, V, u, F, E, H, z, A, v, w, i, N, j, a, C, D, Z = { transition: "elastic", speed: 350, width: false, height: false, innerWidth: false, innerHeight: false, initialWidth: "400", initialHeight: "400", maxWidth: false, maxHeight: false, scalePhotos: m, scrolling: m, inline: false, html: false, iframe: false, photo: false, href: false, title: false, rel: false, opacity: 0.9, preloading: m, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: false, overlayClose: m, slideshow: false, slideshowAuto: m, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: false, onLoad: false, onComplete: false, onCleanup: false, onClosed: false }; f = c.fn.colorbox = function(b, d) { var e = this; if (!e.length) if (e.selector === "") { e = c(e); b.open = m } else return this; e.each(function() { var g = c.extend({}, c(this).data(q) ? c(this).data(q) : Z, b); c(this).data(q, g).addClass("cboxElement"); if (d) c(this).data(q).onComplete = d }); b && b.open && X(e); return this }; f.init = function() { function b(d) { return c('<div id="cbox' + d + '"/>') } l = c(window); k = c('<div id="colorbox"/>'); s = b("Overlay").hide(); t = b("Wrapper"); o = b("Content").append(n = b("LoadedContent").css({ width: 0, height: 0 }), K = b("LoadingOverlay"), L = b("LoadingGraphic"), Y = b("Title"), V = b("Current"), u = b("Slideshow"), F = b("Next"), E = b("Previous"), H = b("Close")); t.append(c("<div/>").append(b("TopLeft"), R = b("TopCenter"), b("TopRight")), c("<div/>").append(S = b("MiddleLeft"), o, T = b("MiddleRight")), c("<div/>").append(b("BottomLeft"), U = b("BottomCenter"), b("BottomRight"))).children().children().css({ "float": "left" }); J = c("<div style='position:absolute; top:0; left:0; width:0; height:0; overflow:hidden;'/>"); c("body").prepend(s, k.append(t), J); if (y) { k.addClass("cboxIE"); O && s.css("position", "absolute") } o.children().addClass(x).mouseover(function() { c(this).addClass(x) }).mouseout(function() { c(this).removeClass(x) }).hide(); z = R.height() + U.height() + o.outerHeight(m) - o.height(); A = S.width() + T.width() + o.outerWidth(m) - o.width(); v = n.outerHeight(m); w = n.outerWidth(m); k.css({ "padding-bottom": z, "padding-right": A }).hide(); F.click(f.next); E.click(f.prev); H.click(f.close); o.children().removeClass(x); c(".cboxElement").live("click", function(d) { if (d.button !== 0) return m; else { X(this); return false } }) }; f.position = function(b, d) { function e(B) { R[0].style.width = U[0].style.width = o[0].style.width = B.style.width; L[0].style.height = K[0].style.height = o[0].style.height = S[0].style.height = T[0].style.height = B.style.height } var g = l.height(); g = Math.max(g - a.h - v - z, 0) / 2 + l.scrollTop(); var p = Math.max(document.documentElement.clientWidth - a.w - w - A, 0) / 2 + l.scrollLeft(); b = k.width() === a.w + w && k.height() === a.h + v ? 0 : b; t[0].style.width = t[0].style.height = "9999px"; k.dequeue().animate({ width: a.w + w, height: a.h + v, top: g, left: p }, { duration: b, complete: function() { e(this); D = false; t[0].style.width = a.w + w + A + "px"; t[0].style.height = a.h + v + z + "px"; d && d() }, step: function() { e(this) } }) }; f.resize = function(b) { function d() { a.w = a.w || n.width(); a.w = a.mw && a.mw < a.w ? a.mw : a.w; return a.w } function e() { a.h = a.h || n.height(); a.h = a.mh && a.mh < a.h ? a.mh : a.h; return a.h } function g(G) { f.position(G, function() { if (C) { if (y) { B && n.fadeIn(100); k[0].style.removeAttribute("filter") } o.children().show(); if (a.iframe) n.append("<iframe id='cboxIframe'" + (a.scrolling ? " " : "scrolling='no'") + " name='iframe_" + (new Date).getTime() + "' frameborder=0 src='" + (a.href || i.href) + "' " + (y ? "allowtransparency='true'" : "") + " />"); K.hide(); L.hide(); u.hide(); if (h.length > 1) { V.html(a.current.replace(/\{current\}/, j + 1).replace(/\{total\}/, h.length)); F.html(a.next); E.html(a.previous); a.slideshow && u.show() } else { V.hide(); F.hide(); E.hide() } Y.html(a.title || i.title); c.event.trigger(P); a.onComplete && a.onComplete.call(i); a.transition === "fade" && k.fadeTo(M, 1, function() { y && k[0].style.removeAttribute("filter") }); l.bind(Q, function() { f.position(0) }) } }) } if (C) { var p, B, M = a.transition === "none" ? 0 : a.speed; l.unbind(Q); if (b) { n.remove(); n = c('<div id="cboxLoadedContent"/>').html(b); n.hide().appendTo(J).css({ width: d(), overflow: a.scrolling ? "auto" : "hidden" }).css({ height: e() }).prependTo(o); c("#cboxPhoto").css({ cssFloat: "none" }); O && c("select:not(#colorbox select)").filter(function() { return this.style.visibility !== "hidden" }).css({ visibility: "hidden" }).one("cbox_cleanup", function() { this.style.visibility = "inherit" }); a.transition === "fade" && k.fadeTo(M, 0, function() { g(0) }) || g(M); if (a.preloading && h.length > 1) { b = j > 0 ? h[j - 1] : h[h.length - 1]; p = j < h.length - 1 ? h[j + 1] : h[0]; c(p).data(q); c(b).data(q) } } else setTimeout(function() { var G = n.wrapInner("<div style='overflow:auto'></div>").children(); a.h = G.height(); n.css({ height: a.h }); G.replaceWith(G.children()); f.position(M) }, 1) } }; f.load = function() { var b, d, e, g = f.resize; D = m; i = h[j]; a = c(i).data(q); W(); c.event.trigger(I); a.onLoad && a.onLoad.call(i); a.h = a.height ? r(a.height, "y") - v - z : a.innerHeight ? r(a.innerHeight, "y") : false; a.w = a.width ? r(a.width, "x") - w - A : a.innerWidth ? r(a.innerWidth, "x") : false; a.mw = a.w; a.mh = a.h; if (a.maxWidth) { a.mw = r(a.maxWidth, "x") - w - A; a.mw = a.w && a.w < a.mw ? a.w : a.mw } if (a.maxHeight) { a.mh = r(a.maxHeight, "y") - v - z; a.mh = a.h && a.h < a.mh ? a.h : a.mh } b = a.href || c(i).attr("href"); K.show(); L.show(); H.show(); if (a.inline) { c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(I + " cbox_cleanup", function() { c(this).replaceWith(n.children()) }); g(c(b)) } else if (a.iframe) g(" "); else if (a.html) g(a.html); else if ($(b)) { d = new Image; d.onload = function() { var p; d.onload = null; d.id = "cboxPhoto"; c(d).css({ margin: "auto", border: "none", display: "block", cssFloat: "left" }); if (a.scalePhotos) { e = function() { d.height -= d.height * p; d.width -= d.width * p }; if (a.mw && d.width > a.mw) { p = (d.width - a.mw) / d.width; e() } if (a.mh && d.height > a.mh) { p = (d.height - a.mh) / d.height; e() } } if (a.h) d.style.marginTop = Math.max(a.h - d.height, 0) / 2 + "px"; g(d); h.length > 1 && c(d).css({ cursor: "pointer" }).click(f.next); if (y) d.style.msInterpolationMode = "bicubic" }; d.src = b } else c("<div />").appendTo(J).load(b, function(p, B) { B === "success" ? g(this) : g(c("<p>Request unsuccessful.</p>")) }) }; f.next = function() { if (!D) { j = j < h.length - 1 ? j + 1 : 0; f.load() } }; f.prev = function() { if (!D) { j = j > 0 ? j - 1 : h.length - 1; f.load() } }; f.slideshow = function() { function b() { u.text(a.slideshowStop).bind(P, function() { e = setTimeout(f.next, a.slideshowSpeed) }).bind(I, function() { clearTimeout(e) }).one("click", function() { d(); c(this).removeClass(x) }); k.removeClass(g + "off").addClass(g + "on") } var d, e, g = "cboxSlideshow_"; u.bind("cbox_closed", function() { u.unbind(); clearTimeout(e); k.removeClass(g + "off " + g + "on") }); d = function() { clearTimeout(e); u.text(a.slideshowStart).unbind(P + " " + I).one("click", function() { b(); e = setTimeout(f.next, a.slideshowSpeed); c(this).removeClass(x) }); k.removeClass(g + "on").addClass(g + "off") }; if (a.slideshow && h.length > 1) a.slideshowAuto ? b() : d() }; f.close = function() { c.event.trigger("cbox_cleanup"); a.onCleanup && a.onCleanup.call(i); C = false; c().unbind("keydown.cbox_close keydown.cbox_arrows"); l.unbind(Q + " resize.cboxie6 scroll.cboxie6"); s.css({ cursor: "auto" }).fadeOut("fast"); k.stop(m, false).fadeOut("fast", function() { n.remove(); k.css({ opacity: 1 }); o.children().hide(); try { N.focus() } catch (b) { } c.event.trigger("cbox_closed"); a.onClosed && a.onClosed.call(i) }) }; f.element = function() { return c(i) }; f.settings = Z; c(f.init) })(jQuery);
(function(d) { d.tools = d.tools || {}; d.tools.tabs = { version: "1.0.4", conf: { tabs: "a", current: "current", onBeforeClick: null, onClick: null, effect: "default", initialIndex: 0, event: "click", api: false, rotate: false }, addEffect: function(e, f) { c[e] = f } }; var c = { "default": function(f, e) { this.getPanes().hide().eq(f).show(); e.call() }, fade: function(g, e) { var f = this.getConf(), j = f.fadeOutSpeed, h = this.getPanes(); if (j) { h.fadeOut(j) } else { h.hide() } h.eq(g).fadeIn(f.fadeInSpeed, e) }, slide: function(f, e) { this.getPanes().slideUp(200); this.getPanes().eq(f).slideDown(400, e) }, ajax: function(f, e) { this.getPanes().eq(0).load(this.getTabs().eq(f).attr("href"), e) } }; var b; d.tools.tabs.addEffect("horizontal", function(f, e) { if (!b) { b = this.getPanes().eq(0).width() } this.getCurrentPane().animate({ width: 0 }, function() { d(this).hide() }); this.getPanes().eq(f).animate({ width: b }, function() { d(this).show(); e.call() }) }); function a(g, h, f) { var e = this, j = d(this), i; d.each(f, function(k, l) { if (d.isFunction(l)) { j.bind(k, l) } }); d.extend(this, { click: function(k, n) { var o = e.getCurrentPane(); var l = g.eq(k); if (typeof k == "string" && k.replace("#", "")) { l = g.filter("[href*=" + k.replace("#", "") + "]"); k = Math.max(g.index(l), 0) } if (f.rotate) { var m = g.length - 1; if (k < 0) { return e.click(m, n) } if (k > m) { return e.click(0, n) } } if (!l.length) { if (i >= 0) { return e } k = f.initialIndex; l = g.eq(k) } if (k === i) { return e } n = n || d.Event(); n.type = "onBeforeClick"; j.trigger(n, [k]); if (n.isDefaultPrevented()) { return } c[f.effect].call(e, k, function() { n.type = "onClick"; j.trigger(n, [k]) }); n.type = "onStart"; j.trigger(n, [k]); if (n.isDefaultPrevented()) { return } i = k; g.removeClass(f.current); l.addClass(f.current); return e }, getConf: function() { return f }, getTabs: function() { return g }, getPanes: function() { return h }, getCurrentPane: function() { return h.eq(i) }, getCurrentTab: function() { return g.eq(i) }, getIndex: function() { return i }, next: function() { return e.click(i + 1) }, prev: function() { return e.click(i - 1) }, bind: function(k, l) { j.bind(k, l); return e }, onBeforeClick: function(k) { return this.bind("onBeforeClick", k) }, onClick: function(k) { return this.bind("onClick", k) }, unbind: function(k) { j.unbind(k); return e } }); g.each(function(k) { d(this).bind(f.event, function(l) { e.click(k, l); return false }) }); if (location.hash) { e.click(location.hash) } else { if (f.initialIndex === 0 || f.initialIndex > 0) { e.click(f.initialIndex) } } h.find("a[href^=#]").click(function(k) { e.click(d(this).attr("href"), k) }) } d.fn.tabs = function(i, f) { var g = this.eq(typeof f == "number" ? f : 0).data("tabs"); if (g) { return g } if (d.isFunction(f)) { f = { onBeforeClick: f} } var h = d.extend({}, d.tools.tabs.conf), e = this.length; f = d.extend(h, f); this.each(function(l) { var j = d(this); var k = j.find(f.tabs); if (!k.length) { k = j.children() } var m = i.jquery ? i : j.children(i); if (!m.length) { m = e == 1 ? d(i) : j.parent().find(i) } g = new a(k, m, f); j.data("tabs", g) }); return f.api ? g : this } })(jQuery);
(function($) { $.extend($.fn, { swapClass: function(c1, c2) { var c1Elements = this.filter('.' + c1); this.filter('.' + c2).removeClass(c2).addClass(c1); c1Elements.removeClass(c1).addClass(c2); return this; }, replaceClass: function(c1, c2) { return this.filter('.' + c1).removeClass(c1).addClass(c2).end(); }, hoverClass: function(className) { className = className || "hover"; return this.hover(function() { $(this).addClass(className); }, function() { $(this).removeClass(className); }); }, heightToggle: function(animated, callback) { animated ? this.animate({ height: "toggle" }, animated, callback) : this.each(function() { jQuery(this)[jQuery(this).is(":hidden") ? "show" : "hide"](); if (callback) callback.apply(this, arguments); }); }, heightHide: function(animated, callback) { if (animated) { this.animate({ height: "hide" }, animated, callback); } else { this.hide(); if (callback) this.each(callback); } }, prepareBranches: function(settings) { if (!settings.prerendered) { this.filter(":last-child:not(ul)").addClass(CLASSES.last); this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide(); } return this.filter(":has(>ul)"); }, applyClasses: function(settings, toggler) { this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) { toggler.apply($(this).next()); }).add($("a", this)).hoverClass(); if (!settings.prerendered) { this.filter(":has(>ul:hidden)").addClass(CLASSES.expandable).replaceClass(CLASSES.last, CLASSES.lastExpandable); this.not(":has(>ul:hidden)").addClass(CLASSES.collapsable).replaceClass(CLASSES.last, CLASSES.lastCollapsable); this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() { var classes = ""; $.each($(this).parent().attr("class").split(" "), function() { classes += this + "-hitarea "; }); $(this).addClass(classes); }); } this.find("div." + CLASSES.hitarea).click(toggler); }, treeview: function(settings) { settings = $.extend({ cookieId: "treeview" }, settings); if (settings.add) { return this.trigger("add", [settings.add]); } if (settings.toggle) { var callback = settings.toggle; settings.toggle = function() { return callback.apply($(this).parent()[0], arguments); }; } function treeController(tree, control) { function handler(filter) { return function() { toggler.apply($("div." + CLASSES.hitarea, tree).filter(function() { return filter ? $(this).parent("." + filter).length : true; })); return false; }; } $("a:eq(0)", control).click(handler(CLASSES.collapsable)); $("a:eq(1)", control).click(handler(CLASSES.expandable)); $("a:eq(2)", control).click(handler()); } function toggler() { $(this).parent().find(">.hitarea").swapClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).swapClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().swapClass(CLASSES.collapsable, CLASSES.expandable).swapClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightToggle(settings.animated, settings.toggle); if (settings.unique) { $(this).parent().siblings().find(">.hitarea").replaceClass(CLASSES.collapsableHitarea, CLASSES.expandableHitarea).replaceClass(CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea).end().replaceClass(CLASSES.collapsable, CLASSES.expandable).replaceClass(CLASSES.lastCollapsable, CLASSES.lastExpandable).find(">ul").heightHide(settings.animated, settings.toggle); } } function serialize() { function binary(arg) { return arg ? 1 : 0; } var data = []; branches.each(function(i, e) { data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0; }); $.cookie(settings.cookieId, data.join("")); } function deserialize() { var stored = $.cookie(settings.cookieId); if (stored) { var data = stored.split(""); branches.each(function(i, e) { $(e).find(">ul")[parseInt(data[i]) ? "show" : "hide"](); }); } } this.addClass("treeview"); var branches = this.find("li").prepareBranches(settings); switch (settings.persist) { case "cookie": var toggleCallback = settings.toggle; settings.toggle = function() { serialize(); if (toggleCallback) { toggleCallback.apply(this, arguments); } }; deserialize(); break; case "location": var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); }); if (current.length) { current.addClass("selected").parents("ul, li").add(current.next()).show(); } break; } branches.applyClasses(settings, toggler); if (settings.control) { treeController(this, settings.control); $(settings.control).show(); } return this.bind("add", function(event, branches) { $(branches).prev().removeClass(CLASSES.last).removeClass(CLASSES.lastCollapsable).removeClass(CLASSES.lastExpandable).find(">.hitarea").removeClass(CLASSES.lastCollapsableHitarea).removeClass(CLASSES.lastExpandableHitarea); $(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler); }); } }); var CLASSES = $.fn.treeview.classes = { open: "open", closed: "closed", expandable: "expandable", expandableHitarea: "expandable-hitarea", lastExpandableHitarea: "lastExpandable-hitarea", collapsable: "collapsable", collapsableHitarea: "collapsable-hitarea", lastCollapsableHitarea: "lastCollapsable-hitarea", lastCollapsable: "lastCollapsable", lastExpandable: "lastExpandable", last: "last", hitarea: "hitarea" }; $.fn.Treeview = $.fn.treeview; })(jQuery);
(function($) { $.fn.tweetable = function(options) { var defaults = { limit: 1, username: 'martsweb', time: false }; var options = $.extend(defaults, options); return this.each(function(options) { var act = $(this); var api = "http://twitter.com/statuses/user_timeline/"; var count = "?count="; $.getJSON(api + defaults.username + ".json" + count + defaults.limit + "&callback=?", act, function(data) { $.each(data, function(i, item) { if (i == 0) { $(act).prepend('<ul class="tweetList"><li class="tweet_content_' + i + '">') } else { $('.tweetList').append('<li class="tweet_content_' + i + '">') } $('.tweet_content_' + i + '').append('<a href="http://www.twitter.com/martsweb" target="_blank"><span class="tweet_link_' + i + '">' + item.text.replace(/#(.*?)(\s|$)/g, '<span class="hash">#$1 </span></a>').replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig, '<a href="$&">$&</a> ').replace(/@(.*?)(\s|\(|\)|$)/g, '<a href="http://twitter.com/$1">@$1 </a>$2')); $('.loading').hide(); if (defaults.time == true) { $('.tweet_content_' + i).append('<br /><small> ' + item.created_at.substr(0, 10) + '</small>') } }) }) }) } })(jQuery);
jQuery.fn.truncate = function(max, settings) { settings = jQuery.extend({ chars: /\s/, trail: ["...", ""] }, settings); var myResults = {}; var ie = $.browser.msie; function fixIE(o) { if (ie) { o.style.removeAttribute("filter") } } return this.each(function() { var $this = jQuery(this); var myStrOrig = $this.html().replace(/\r\n/gim, ""); var myStr = myStrOrig; var myRegEx = /<\/?[^<>]*\/?>/gim; var myRegExArray; var myRegExHash = {}; var myResultsKey = $("*").index(this); while ((myRegExArray = myRegEx.exec(myStr)) != null) { myRegExHash[myRegExArray.index] = myRegExArray[0] } myStr = jQuery.trim(myStr.split(myRegEx).join("")); if (myStr.length > max) { var c; while (max < myStr.length) { c = myStr.charAt(max); if (c.match(settings.chars)) { myStr = myStr.substring(0, max); break } max-- } if (myStrOrig.search(myRegEx) != -1) { var endCap = 0; for (eachEl in myRegExHash) { myStr = [myStr.substring(0, eachEl), myRegExHash[eachEl], myStr.substring(eachEl, myStr.length)].join(""); if (eachEl < myStr.length) { endCap = myStr.length } } $this.html([myStr.substring(0, endCap), myStr.substring(endCap, myStr.length).replace(/<(\w+)[^>]*>.*<\/\1>/gim, "").replace(/<(br|hr|img|input)[^<>]*\/?>/gim, "")].join("")) } else { $this.html(myStr) } myResults[myResultsKey] = myStrOrig; $this.html(["<div class='truncate_less'>", $this.html(), settings.trail[0], "</div>"].join("")).find(".truncate_show", this).click(function() { if ($this.find(".truncate_more").length == 0) { $this.append(["<div class='truncate_more' style='display: none;'>", myResults[myResultsKey], settings.trail[1], "</div>"].join("")).find(".truncate_hide").click(function() { $this.find(".truncate_more").css("background", "#fff").fadeOut("normal", function() { $this.find(".truncate_less").css("background", "#fff").fadeIn("normal", function() { fixIE(this); $(this).css("background", "none") }); fixIE(this) }); return false }) } $this.find(".truncate_less").fadeOut("normal", function() { $this.find(".truncate_more").fadeIn("normal", function() { fixIE(this) }); fixIE(this) }); jQuery(".truncate_show", $this).click(function() { $this.find(".truncate_less").css("background", "#fff").fadeOut("normal", function() { $this.find(".truncate_more").css("background", "#fff").fadeIn("normal", function() { fixIE(this); $(this).css("background", "none") }); fixIE(this) }); return false }); return false }) } }) };
(function(w) { var E = w(window), u, g, F = -1, o, x, D, v, y, L, s, n = !window.XMLHttpRequest, e = window.opera && (document.compatMode == "CSS1Compat") && (w.browser.version >= 9.3), m = document.documentElement, l = {}, t = new Image(), J = new Image(), H, a, h, q, I, d, G, c, A, K; w(function() { w("body").append(w([H = w('<div id="lbOverlay" />')[0], a = w('<div id="lbCenter" />')[0], G = w('<div id="lbBottomContainer" />')[0]]).css("display", "none")); h = w('<div id="lbImage" />').appendTo(a).append(q = w('<div style="position: relative;" />').append([I = w('<a id="lbPrevLink" href="#" />').click(B)[0], d = w('<a id="lbNextLink" href="#" />').click(f)[0]])[0])[0]; c = w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="#" />').add(H).click(C)[0], A = w('<div id="lbCaption" />')[0], K = w('<div id="lbNumber" />')[0], w('<div style="clear: both;" />')[0]])[0] }); w.slimbox = function(O, N, M) { u = w.extend({ loop: false, overlayOpacity: 0.8, overlayFadeDuration: 400, resizeDuration: 400, resizeEasing: "swing", initialWidth: 250, initialHeight: 250, imageFadeDuration: 400, captionAnimationDuration: 400, counterText: "Image {x} of {y}", closeKeys: [27, 88, 67], previousKeys: [37, 80], nextKeys: [39, 78] }, M); if (typeof O == "string") { O = [[O, N]]; N = 0 } y = E.scrollTop() + ((e ? m.clientHeight : E.height()) / 2); L = u.initialWidth; s = u.initialHeight; w(a).css({ top: Math.max(0, y - (s / 2)), width: L, height: s, marginLeft: -L / 2 }).show(); v = n || (H.currentStyle && (H.currentStyle.position != "fixed")); if (v) { H.style.position = "absolute" } w(H).css("opacity", u.overlayOpacity).fadeIn(u.overlayFadeDuration); z(); k(1); g = O; u.loop = u.loop && (g.length > 1); return b(N) }; w.fn.slimbox = function(M, P, O) { P = P || function(Q) { return [Q.href, Q.title] }; O = O || function() { return true }; var N = this; return N.unbind("click").click(function() { var S = this, U = 0, T, Q = 0, R; T = w.grep(N, function(W, V) { return O.call(S, W, V) }); for (R = T.length; Q < R; ++Q) { if (T[Q] == S) { U = Q } T[Q] = P(T[Q], Q) } return w.slimbox(T, U, M) }) }; function z() { var N = E.scrollLeft(), M = e ? m.clientWidth : E.width(); w([a, G]).css("left", N + (M / 2)); if (v) { w(H).css({ left: N, top: E.scrollTop(), width: M, height: E.height() }) } } function k(M) { w("object").add(n ? "select" : "embed").each(function(O, P) { if (M) { w.data(P, "slimbox", P.style.visibility) } P.style.visibility = M ? "hidden" : w.data(P, "slimbox") }); var N = M ? "bind" : "unbind"; E[N]("scroll resize", z); w(document)[N]("keydown", p) } function p(O) { var N = O.keyCode, M = w.inArray; return (M(N, u.closeKeys) >= 0) ? C() : (M(N, u.nextKeys) >= 0) ? f() : (M(N, u.previousKeys) >= 0) ? B() : false } function B() { return b(x) } function f() { return b(D) } function b(M) { if (M >= 0) { F = M; o = g[F][0]; x = (F || (u.loop ? g.length : 0)) - 1; D = ((F + 1) % g.length) || (u.loop ? 0 : -1); r(); a.className = "lbLoading"; l = new Image(); l.onload = j; l.src = o } return false } function j() { a.className = ""; w(h).css({ backgroundImage: "url(" + o + ")", visibility: "hidden", display: "" }); w(q).width(l.width); w([q, I, d]).height(l.height); w(A).html(g[F][1] || ""); w(K).html((((g.length > 1) && u.counterText) || "").replace(/{x}/, F + 1).replace(/{y}/, g.length)); if (x >= 0) { t.src = g[x][0] } if (D >= 0) { J.src = g[D][0] } L = h.offsetWidth; s = h.offsetHeight; var M = Math.max(0, y - (s / 2)); if (a.offsetHeight != s) { w(a).animate({ height: s, top: M }, u.resizeDuration, u.resizeEasing) } if (a.offsetWidth != L) { w(a).animate({ width: L, marginLeft: -L / 2 }, u.resizeDuration, u.resizeEasing) } w(a).queue(function() { w(G).css({ width: L, top: M + s, marginLeft: -L / 2, visibility: "hidden", display: "" }); w(h).css({ display: "none", visibility: "", opacity: "" }).fadeIn(u.imageFadeDuration, i) }) } function i() { if (x >= 0) { w(I).show() } if (D >= 0) { w(d).show() } w(c).css("marginTop", -c.offsetHeight).animate({ marginTop: 0 }, u.captionAnimationDuration); G.style.visibility = "" } function r() { l.onload = null; l.src = t.src = J.src = o; w([a, h, c]).stop(true); w([I, d, h, G]).hide() } function C() { if (F >= 0) { r(); F = x = D = -1; w(a).hide(); w(H).stop().fadeOut(u.overlayFadeDuration, k) } return false } })(jQuery);
(function($) {
    // setup a namespace for us
    var nsp = 'EmbedPicasaGallery';

    // Public Variables and Methods
    $[nsp] = {
        defaultOptions: {
            matcher: RegExp('.+'),
            size: 144,
            msg_loading_list: 'Loading list from MARTS Google Picasa',
            msg_loading_album: 'Loading album from MARTS Google Picasa',
            msg_back: 'Back',
            album_title_tag: '<h3/>'
        }
    };
    // Private Variables and Functions in the _ object
    // note that this will refer to _ unless you
    // call using the call or apply methods
    var _ = {
};

$.fn[nsp] = function(user, opts) {
    var localOpts = $.extend(
            {}, // start with an empty map
            $[nsp].defaultOptions, // add defaults
            opts // add options
        );
    var Cache = {};

    function showOverview() {
        if (Cache.__overview) {
            Cache.__overview.show();
            return;
        }
        var $this = $(this);
        if (!Cache.__original) {
            Cache.__original = $this.clone(true);
        }

        $this.after($('<div/>').css('clear', 'left'));

        var meta_opts = localOpts;
        if ($.meta) {
            meta_opts = $.extend({}, localOpts, $this.data());
        }

        $this.text(meta_opts.msg_loading_list);
        var albumCount = 0;
        function appendImage(i, item) {
            var title = item.media$group.media$title.$t;
            if (title.match(meta_opts.matcher)) {
                albumCount++;
                $this.append($("<div/>")
                        .css({
                            float: 'left',
                            'margin-right': '13px',
                            'margin-bottom': '10px',
                            'width': '144px',
                            'color': '#000'
                        })
                        .click(function() {
                            showAlbum($this, meta_opts, item.gphoto$id.$t, title);
                        })
                        .hover(
                            function() { $(this).css("cursor", "pointer") },
                            function() { $(this).css("cursor", "default") }
                        )
                        .append($("<img/>").attr("src", item.media$group.media$thumbnail[0].url))
                        .append(
                            $('<div/>')
                            .css({
                                'font-size': '12px'
                            })
                            .html(title.replace(':','<br/>'))
                            .width(meta_opts.size)
                        )
                    );
            };
        }

        function renderAlbumList(data) {
            $this.empty();
            $.each(data.feed.entry, appendImage);
            if (albumCount == 1) {
                $this.children().eq(0).click();
                return;
            }
            var maxHeight = 0;
            $this.children()
                    .each(function() { var h = $('div', $(this)).outerHeight(); if (h > maxHeight) { maxHeight = h } })
                    .each(function() { $(this).height(maxHeight + meta_opts.size + 5) });

            Cache.__overview = $this;
        }

        $.getJSON('http://picasaweb.google.com/data/feed/api/user/'
                + user + '?kind=album&access=public&alt=json-in-script&thumbsize=' + meta_opts.size + 'c&callback=?',
                renderAlbumList
            );
    };

    function showAlbum($el, meta_opts, album, title) {
        $el.hide();
        if (Cache[album]) {
            Cache[album].show();
            return;
        };
        var $album = Cache.__original.clone(true);
        $el.after($album);
        $album.text(meta_opts.msg_loading_album);

        function appendImage(i, item) {
            var title = item.media$group.media$title.$t;
            var a = $("<a/>")
                   .attr("href", item.content.src)
                   .attr("title", title)
                   .append(
                        $("<img/>")
                        .attr("src", item.media$group.media$thumbnail[0].url)
                        .css({ 'border-width': '0px',
                            width: meta_opts.size + 'px',
                            height: meta_opts.size + 'px'
                        })
                    );
            $album.append(
                    $("<div/>")
                    .css({
                        float: 'left',
                        'margin-right': '13px',
                        'margin-bottom': '10px',
                        'width': '144px'
                    })
                    .append(a)
                );
        }

        function renderAlbum(data) {
            $album.empty();
            $album.append($(meta_opts.album_title_tag).text(title))

            if (Cache.__overview) {
                $album.append($("<div/>")
                       .attr("class", "pic-thumb")
                       .css({ 'border-width': '0px',
                           float: 'left',
                           'margin-right': '13px',
                           'margin-bottom': '10px',
                           width: meta_opts.size + 'px',
                           height: meta_opts.size + 'px'
                       })
                       .append($("<div/>")
                           .html('<br/><img src="images/back.png" />')
                           .click(function() { $album.hide(); showOverview() })
                           .css({ 'border-style': 'outset',
                               'border-width': '1px',
                               'text-align': 'center',
                               'width': (meta_opts.size - 2) + 'px',
                               'height': (meta_opts.size - 2) + 'px'
                           })
                       )
                    );
            }
            $.each(data.feed.entry, appendImage);

            function linkMapper(el) {
                return [
                        el.href,
                        '<a href="' + el.href + '">' + el.title + '</a>'
                    ]
            }

            if ($.fn.slimbox) {
                $('a', $album).slimbox({}, linkMapper);
            }

            Cache[album] = $album;
        }

        $.getJSON('http://picasaweb.google.com/data/feed/api/user/'
                + user + '/albumid/'
                + album + '?kind=photo&access=public&alt=json-in-script&thumbsize=' + meta_opts.size + 'c&imgmax=800&callback=?',
                renderAlbum
           );
    };

    return this.each(showOverview);
};
})(jQuery);

$(document).ready(function() {

    if (document.all && !window.opera && !window.XMLHttpRequest && $.browser.msie) {
        // stupid jquery ie6 detection
        try { document.execCommand("BackgroundImageCache", false, true); }
        catch (err) { }
    }

    $("a[rel^='lightbox']").slimbox({/* Put custom options here */
}, null, function(el) {
    return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});

//$("#pics").EmbedPicasaGallery('loguon');
$("#pics").EmbedPicasaGallery('martsgallery');
$("#header-right").tweetable();
});

