/**
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>.
* Author: Drew Diller
* Email: drew.diller@gmail.com
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/
* Version: 0.0.8a
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license
*
* Example usage:
* DD_belatedPNG.fix('.png_bg'); // argument is a CSS selector
* DD_belatedPNG.fixPng( someNode ); // argument is an HTMLDomElement
**/
var DD_belatedPNG = { ns: "DD_belatedPNG", imgSize: {}, delay: 10, nodesFixed: 0, createVmlNameSpace: function() { if (document.namespaces && !document.namespaces[this.ns]) { document.namespaces.add(this.ns, "urn:schemas-microsoft-com:vml") } }, createVmlStyleSheet: function() { var b, a; b = document.createElement("style"); b.setAttribute("media", "screen"); document.documentElement.firstChild.insertBefore(b, document.documentElement.firstChild.firstChild); if (b.styleSheet) { b = b.styleSheet; b.addRule(this.ns + "\\:*", "{behavior:url(#default#VML)}"); b.addRule(this.ns + "\\:shape", "position:absolute;"); b.addRule("img." + this.ns + "_sizeFinder", "behavior:none; border:none; position:absolute; z-index:-1; top:-10000px; visibility:hidden;"); this.screenStyleSheet = b; a = document.createElement("style"); a.setAttribute("media", "print"); document.documentElement.firstChild.insertBefore(a, document.documentElement.firstChild.firstChild); a = a.styleSheet; a.addRule(this.ns + "\\:*", "{display: none !important;}"); a.addRule("img." + this.ns + "_sizeFinder", "{display: none !important;}") } }, readPropertyChange: function() { var b, c, a; b = event.srcElement; if (!b.vmlInitiated) { return } if (event.propertyName.search("background") != -1 || event.propertyName.search("border") != -1) { DD_belatedPNG.applyVML(b) } if (event.propertyName == "style.display") { c = (b.currentStyle.display == "none") ? "none" : "block"; for (a in b.vml) { if (b.vml.hasOwnProperty(a)) { b.vml[a].shape.style.display = c } } } if (event.propertyName.search("filter") != -1) { DD_belatedPNG.vmlOpacity(b) } }, vmlOpacity: function(b) { if (b.currentStyle.filter.search("lpha") != -1) { var a = b.currentStyle.filter; a = parseInt(a.substring(a.lastIndexOf("=") + 1, a.lastIndexOf(")")), 10) / 100; b.vml.color.shape.style.filter = b.currentStyle.filter; b.vml.image.fill.opacity = a } }, handlePseudoHover: function(a) { setTimeout(function() { DD_belatedPNG.applyVML(a) }, 1) }, fix: function(a) { if (this.screenStyleSheet) { var c, b; c = a.split(","); for (b = 0; b < c.length; b++) { this.screenStyleSheet.addRule(c[b], "behavior:expression(DD_belatedPNG.fixPng(this))") } } }, applyVML: function(a) { a.runtimeStyle.cssText = ""; this.vmlFill(a); this.vmlOffsets(a); this.vmlOpacity(a); if (a.isImg) { this.copyImageBorders(a) } }, attachHandlers: function(i) { var d, c, g, e, b, f; d = this; c = { resize: "vmlOffsets", move: "vmlOffsets" }; if (i.nodeName == "A") { e = { mouseleave: "handlePseudoHover", mouseenter: "handlePseudoHover", focus: "handlePseudoHover", blur: "handlePseudoHover" }; for (b in e) { if (e.hasOwnProperty(b)) { c[b] = e[b] } } } for (f in c) { if (c.hasOwnProperty(f)) { g = function() { d[c[f]](i) }; i.attachEvent("on" + f, g) } } i.attachEvent("onpropertychange", this.readPropertyChange) }, giveLayout: function(a) { a.style.zoom = 1; if (a.currentStyle.position == "static") { a.style.position = "relative" } }, copyImageBorders: function(b) { var c, a; c = { borderStyle: true, borderWidth: true, borderColor: true }; for (a in c) { if (c.hasOwnProperty(a)) { b.vml.color.shape.style[a] = b.currentStyle[a] } } }, vmlFill: function(e) { if (!e.currentStyle) { return } else { var d, f, g, b, a, c; d = e.currentStyle } for (b in e.vml) { if (e.vml.hasOwnProperty(b)) { e.vml[b].shape.style.zIndex = d.zIndex } } e.runtimeStyle.backgroundColor = ""; e.runtimeStyle.backgroundImage = ""; f = true; if (d.backgroundImage != "none" || e.isImg) { if (!e.isImg) { e.vmlBg = d.backgroundImage; e.vmlBg = e.vmlBg.substr(5, e.vmlBg.lastIndexOf('")') - 5) } else { e.vmlBg = e.src } g = this; if (!g.imgSize[e.vmlBg]) { a = document.createElement("img"); g.imgSize[e.vmlBg] = a; a.className = g.ns + "_sizeFinder"; a.runtimeStyle.cssText = "behavior:none; position:absolute; left:-10000px; top:-10000px; border:none; margin:0; padding:0;"; c = function() { this.width = this.offsetWidth; this.height = this.offsetHeight; g.vmlOffsets(e) }; a.attachEvent("onload", c); a.src = e.vmlBg; a.removeAttribute("width"); a.removeAttribute("height"); document.body.insertBefore(a, document.body.firstChild) } e.vml.image.fill.src = e.vmlBg; f = false } e.vml.image.fill.on = !f; e.vml.image.fill.color = "none"; e.vml.color.shape.style.backgroundColor = d.backgroundColor; e.runtimeStyle.backgroundImage = "none"; e.runtimeStyle.backgroundColor = "transparent" }, vmlOffsets: function(d) { var h, n, a, e, g, m, f, l, j, i, k; h = d.currentStyle; n = { W: d.clientWidth + 1, H: d.clientHeight + 1, w: this.imgSize[d.vmlBg].width, h: this.imgSize[d.vmlBg].height, L: d.offsetLeft, T: d.offsetTop, bLW: d.clientLeft, bTW: d.clientTop }; a = (n.L + n.bLW == 1) ? 1 : 0; e = function(b, p, q, c, s, u) { b.coordsize = c + "," + s; b.coordorigin = u + "," + u; b.path = "m0,0l" + c + ",0l" + c + "," + s + "l0," + s + " xe"; b.style.width = c + "px"; b.style.height = s + "px"; b.style.left = p + "px"; b.style.top = q + "px" }; e(d.vml.color.shape, (n.L + (d.isImg ? 0 : n.bLW)), (n.T + (d.isImg ? 0 : n.bTW)), (n.W - 1), (n.H - 1), 0); e(d.vml.image.shape, (n.L + n.bLW), (n.T + n.bTW), (n.W), (n.H), 1); g = { X: 0, Y: 0 }; if (d.isImg) { g.X = parseInt(h.paddingLeft, 10) + 1; g.Y = parseInt(h.paddingTop, 10) + 1 } else { for (j in g) { if (g.hasOwnProperty(j)) { this.figurePercentage(g, n, j, h["backgroundPosition" + j]) } } } d.vml.image.fill.position = (g.X / n.W) + "," + (g.Y / n.H); m = h.backgroundRepeat; f = { T: 1, R: n.W + a, B: n.H, L: 1 + a }; l = { X: { b1: "L", b2: "R", d: "W" }, Y: { b1: "T", b2: "B", d: "H"} }; if (m != "repeat" || d.isImg) { i = { T: (g.Y), R: (g.X + n.w), B: (g.Y + n.h), L: (g.X) }; if (m.search("repeat-") != -1) { k = m.split("repeat-")[1].toUpperCase(); i[l[k].b1] = 1; i[l[k].b2] = n[l[k].d] } if (i.B > n.H) { i.B = n.H } d.vml.image.shape.style.clip = "rect(" + i.T + "px " + (i.R + a) + "px " + i.B + "px " + (i.L + a) + "px)" } else { d.vml.image.shape.style.clip = "rect(" + f.T + "px " + f.R + "px " + f.B + "px " + f.L + "px)" } }, figurePercentage: function(d, c, f, a) { var b, e; e = true; b = (f == "X"); switch (a) { case "left": case "top": d[f] = 0; break; case "center": d[f] = 0.5; break; case "right": case "bottom": d[f] = 1; break; default: if (a.search("%") != -1) { d[f] = parseInt(a, 10) / 100 } else { e = false } } d[f] = Math.ceil(e ? ((c[b ? "W" : "H"] * d[f]) - (c[b ? "w" : "h"] * d[f])) : parseInt(a, 10)); if (d[f] % 2 === 0) { d[f]++ } return d[f] }, fixPng: function(c) { c.style.behavior = "none"; var g, b, f, a, d; if (c.nodeName == "BODY" || c.nodeName == "TD" || c.nodeName == "TR") { return } c.isImg = false; if (c.nodeName == "IMG") { if (c.src.toLowerCase().search(/\.png$/) != -1) { c.isImg = true; c.style.visibility = "hidden" } else { return } } else { if (c.currentStyle.backgroundImage.toLowerCase().search(".png") == -1) { return } } g = DD_belatedPNG; c.vml = { color: {}, image: {} }; b = { shape: {}, fill: {} }; for (a in c.vml) { if (c.vml.hasOwnProperty(a)) { for (d in b) { if (b.hasOwnProperty(d)) { f = g.ns + ":" + d; c.vml[a][d] = document.createElement(f) } } c.vml[a].shape.stroked = false; c.vml[a].shape.appendChild(c.vml[a].fill); c.parentNode.insertBefore(c.vml[a].shape, c) } } c.vml.image.shape.fillcolor = "none"; c.vml.image.fill.type = "tile"; c.vml.color.fill.on = false; g.attachHandlers(c); g.giveLayout(c); g.giveLayout(c.offsetParent); c.vmlInitiated = true; g.applyVML(c) } }; try { document.execCommand("BackgroundImageCache", false, true) } catch (r) { } DD_belatedPNG.createVmlNameSpace(); DD_belatedPNG.createVmlStyleSheet();

/*
* jqModal - Minimalist Modaling with jQuery
*   (http://dev.iceburg.net/jquery/jqModal/)
*
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* $Version: 03/01/2009 +r14
*/
(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);
/*
* Copyright (c) 2009 Simo Kinnunen.
* Licensed under the MIT license.
*
* @version 1.03
*/

var Cufon = (function() { var m = function() { return m.replace.apply(null, arguments) }; var x = m.DOM = { ready: (function() { var C = false, E = { loaded: 1, complete: 1 }; var B = [], D = function() { if (C) { return } C = true; for (var F; F = B.shift(); F()) { } }; if (document.addEventListener) { document.addEventListener("DOMContentLoaded", D, false); window.addEventListener("pageshow", D, false) } if (!window.opera && document.readyState) { (function() { E[document.readyState] ? D() : setTimeout(arguments.callee, 10) })() } if (document.readyState && document.createStyleSheet) { (function() { try { document.body.doScroll("left"); D() } catch (F) { setTimeout(arguments.callee, 1) } })() } q(window, "load", D); return function(F) { if (!arguments.length) { D() } else { C ? F() : B.push(F) } } })(), root: function() { return document.documentElement || document.body } }; var n = m.CSS = { Size: function(C, B) { this.value = parseFloat(C); this.unit = String(C).match(/[a-z%]*$/)[0] || "px"; this.convert = function(D) { return D / B * this.value }; this.convertFrom = function(D) { return D / this.value * B }; this.toString = function() { return this.value + this.unit } }, addClass: function(C, B) { var D = C.className; C.className = D + (D && " ") + B; return C }, color: j(function(C) { var B = {}; B.color = C.replace(/^rgba\((.*?),\s*([\d.]+)\)/, function(E, D, F) { B.opacity = parseFloat(F); return "rgb(" + D + ")" }); return B }), fontStretch: j(function(B) { if (typeof B == "number") { return B } if (/%$/.test(B)) { return parseFloat(B) / 100 } return { "ultra-condensed": 0.5, "extra-condensed": 0.625, condensed: 0.75, "semi-condensed": 0.875, "semi-expanded": 1.125, expanded: 1.25, "extra-expanded": 1.5, "ultra-expanded": 2}[B] || 1 }), getStyle: function(C) { var B = document.defaultView; if (B && B.getComputedStyle) { return new a(B.getComputedStyle(C, null)) } if (C.currentStyle) { return new a(C.currentStyle) } return new a(C.style) }, gradient: j(function(F) { var G = { id: F, type: F.match(/^-([a-z]+)-gradient\(/)[1], stops: [] }, C = F.substr(F.indexOf("(")).match(/([\d.]+=)?(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)/ig); for (var E = 0, B = C.length, D; E < B; ++E) { D = C[E].split("=", 2).reverse(); G.stops.push([D[1] || E / (B - 1), D[0]]) } return G }), hasClass: function(C, B) { return RegExp("(?:^|\\s)" + B + "(?=\\s|$)").test(C.className) }, quotedList: j(function(E) { var D = [], C = /\s*((["'])([\s\S]*?[^\\])\2|[^,]+)\s*/g, B; while (B = C.exec(E)) { D.push(B[3] || B[1]) } return D }), recognizesMedia: j(function(G) { var E = document.createElement("style"), D, C, B; E.type = "text/css"; E.media = G; try { E.appendChild(document.createTextNode("/**/")) } catch (F) { } C = g("head")[0]; C.insertBefore(E, C.firstChild); D = (E.sheet || E.styleSheet); B = D && !D.disabled; C.removeChild(E); return B }), removeClass: function(D, C) { var B = RegExp("(?:^|\\s+)" + C + "(?=\\s|$)", "g"); D.className = D.className.replace(B, ""); return D }, supports: function(D, C) { var B = document.createElement("span").style; if (B[D] === undefined) { return false } B[D] = C; return B[D] === C }, textAlign: function(E, D, B, C) { if (D.get("textAlign") == "right") { if (B > 0) { E = " " + E } } else { if (B < C - 1) { E += " " } } return E }, textDecoration: function(G, F) { if (!F) { F = this.getStyle(G) } var C = { underline: null, overline: null, "line-through": null }; for (var B = G; B.parentNode && B.parentNode.nodeType == 1; ) { var E = true; for (var D in C) { if (!k(C, D) || C[D]) { continue } if (F.get("textDecoration").indexOf(D) != -1) { C[D] = F.get("color") } E = false } if (E) { break } F = this.getStyle(B = B.parentNode) } return C }, textShadow: j(function(F) { if (F == "none") { return null } var E = [], G = {}, B, C = 0; var D = /(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig; while (B = D.exec(F)) { if (B[0] == ",") { E.push(G); G = {}; C = 0 } else { if (B[1]) { G.color = B[1] } else { G[["offX", "offY", "blur"][C++]] = B[2] } } } E.push(G); return E }), textTransform: (function() { var B = { uppercase: function(C) { return C.toUpperCase() }, lowercase: function(C) { return C.toLowerCase() }, capitalize: function(C) { return C.replace(/\b./g, function(D) { return D.toUpperCase() }) } }; return function(E, D) { var C = B[D.get("textTransform")]; return C ? C(E) : E } })(), whiteSpace: (function() { var B = { inline: 1, "inline-block": 1, "run-in": 1 }; return function(E, C, D) { if (B[C.get("display")]) { return E } if (!D.previousSibling) { E = E.replace(/^\s+/, "") } if (!D.nextSibling) { E = E.replace(/\s+$/, "") } return E } })() }; n.ready = (function() { var B = !n.recognizesMedia("all"), E = false; var D = [], H = function() { B = true; for (var K; K = D.shift(); K()) { } }; var I = g("link"), J = g("style"); function C(K) { return K.disabled || G(K.sheet, K.media || "screen") } function G(M, P) { if (!n.recognizesMedia(P || "all")) { return true } if (!M || M.disabled) { return false } try { var Q = M.cssRules, O; if (Q) { search: for (var L = 0, K = Q.length; O = Q[L], L < K; ++L) { switch (O.type) { case 2: break; case 3: if (!G(O.styleSheet, O.media.mediaText)) { return false } break; default: break search } } } } catch (N) { } return true } function F() { if (document.createStyleSheet) { return true } var L, K; for (K = 0; L = I[K]; ++K) { if (L.rel.toLowerCase() == "stylesheet" && !C(L)) { return false } } for (K = 0; L = J[K]; ++K) { if (!C(L)) { return false } } return true } x.ready(function() { if (!E) { E = n.getStyle(document.body).isUsable() } if (B || (E && F())) { H() } else { setTimeout(arguments.callee, 10) } }); return function(K) { if (B) { K() } else { D.push(K) } } })(); function s(C) { var B = this.face = C.face; this.glyphs = C.glyphs; this.w = C.w; this.baseSize = parseInt(B["units-per-em"], 10); this.family = B["font-family"].toLowerCase(); this.weight = B["font-weight"]; this.style = B["font-style"] || "normal"; this.viewBox = (function() { var E = B.bbox.split(/\s+/); var D = { minX: parseInt(E[0], 10), minY: parseInt(E[1], 10), maxX: parseInt(E[2], 10), maxY: parseInt(E[3], 10) }; D.width = D.maxX - D.minX; D.height = D.maxY - D.minY; D.toString = function() { return [this.minX, this.minY, this.width, this.height].join(" ") }; return D })(); this.ascent = -parseInt(B.ascent, 10); this.descent = -parseInt(B.descent, 10); this.height = -this.ascent + this.descent } function f() { var C = {}, B = { oblique: "italic", italic: "oblique" }; this.add = function(D) { (C[D.style] || (C[D.style] = {}))[D.weight] = D }; this.get = function(H, I) { var G = C[H] || C[B[H]] || C.normal || C.italic || C.oblique; if (!G) { return null } I = { normal: 400, bold: 700}[I] || parseInt(I, 10); if (G[I]) { return G[I] } var E = { 1: 1, 99: 0}[I % 100], K = [], F, D; if (E === undefined) { E = I > 400 } if (I == 500) { I = 400 } for (var J in G) { if (!k(G, J)) { continue } J = parseInt(J, 10); if (!F || J < F) { F = J } if (!D || J > D) { D = J } K.push(J) } if (I < F) { I = F } if (I > D) { I = D } K.sort(function(M, L) { return (E ? (M > I && L > I) ? M < L : M > L : (M < I && L < I) ? M > L : M < L) ? -1 : 1 }); return G[K[0]] } } function r() { function D(F, G) { if (F.contains) { return F.contains(G) } return F.compareDocumentPosition(G) & 16 } function B(G) { var F = G.relatedTarget; if (!F || D(this, F)) { return } C(this) } function E(F) { C(this) } function C(F) { setTimeout(function() { m.replace(F, d.get(F).options, true) }, 10) } this.attach = function(F) { if (F.onmouseenter === undefined) { q(F, "mouseover", B); q(F, "mouseout", B) } else { q(F, "mouseenter", E); q(F, "mouseleave", E) } } } function u() { var C = [], D = {}; function B(H) { var E = [], G; for (var F = 0; G = H[F]; ++F) { E[F] = C[D[G]] } return E } this.add = function(F, E) { D[F] = C.push(E) - 1 }; this.repeat = function() { var E = arguments.length ? B(arguments) : C, F; for (var G = 0; F = E[G++]; ) { m.replace(F[0], F[1], true) } } } function A() { var D = {}, B = 0; function C(E) { return E.cufid || (E.cufid = ++B) } this.get = function(E) { var F = C(E); return D[F] || (D[F] = {}) } } function a(B) { var D = {}, C = {}; this.extend = function(E) { for (var F in E) { if (k(E, F)) { D[F] = E[F] } } return this }; this.get = function(E) { return D[E] != undefined ? D[E] : B[E] }; this.getSize = function(F, E) { return C[F] || (C[F] = new n.Size(this.get(F), E)) }; this.isUsable = function() { return !!B } } function q(C, B, D) { if (C.addEventListener) { C.addEventListener(B, D, false) } else { if (C.attachEvent) { C.attachEvent("on" + B, function() { return D.call(C, window.event) }) } } } function v(C, B) { var D = d.get(C); if (D.options) { return C } if (B.hover && B.hoverables[C.nodeName.toLowerCase()]) { b.attach(C) } D.options = B; return C } function j(B) { var C = {}; return function(D) { if (!k(C, D)) { C[D] = B.apply(null, arguments) } return C[D] } } function c(F, E) { var B = n.quotedList(E.get("fontFamily").toLowerCase()), D; for (var C = 0; D = B[C]; ++C) { if (i[D]) { return i[D].get(E.get("fontStyle"), E.get("fontWeight")) } } return null } function g(B) { return document.getElementsByTagName(B) } function k(C, B) { return C.hasOwnProperty(B) } function h() { var B = {}, D, F; for (var E = 0, C = arguments.length; D = arguments[E], E < C; ++E) { for (F in D) { if (k(D, F)) { B[F] = D[F] } } } return B } function o(E, M, C, N, F, D) { var K = document.createDocumentFragment(), H; if (M === "") { return K } var L = N.separate; var I = M.split(p[L]), B = (L == "words"); if (B && t) { if (/^\s/.test(M)) { I.unshift("") } if (/\s$/.test(M)) { I.push("") } } for (var J = 0, G = I.length; J < G; ++J) { H = z[N.engine](E, B ? n.textAlign(I[J], C, J, G) : I[J], C, N, F, D, J < G - 1); if (H) { K.appendChild(H) } } return K } function l(C, J) { var B = n.getStyle(v(C, J)).extend(J); var D = c(C, B), E, H, G, F, I; for (E = C.firstChild; E; E = G) { H = E.nodeType; G = E.nextSibling; if (H == 3) { if (F) { F.appendData(E.data); C.removeChild(E) } else { F = E } if (G) { continue } } if (F) { C.replaceChild(o(D, n.whiteSpace(F.data, B, F), B, J, E, C), F); F = null } if (H == 1 && E.firstChild) { if (n.hasClass(E, "cufon")) { z[J.engine](D, null, B, J, E, C) } else { arguments.callee(E, J) } } } } var t = " ".split(/\s+/).length == 0; var d = new A(); var b = new r(); var y = new u(); var e = false; var z = {}, i = {}, w = { enableTextDecoration: false, engine: null, forceHitArea: false, hover: false, hoverables: { a: true }, printable: true, selector: (window.Sizzle || (window.jQuery && function(B) { return jQuery(B) }) || (window.dojo && dojo.query) || (window.Ext && Ext.query) || (window.$$ && function(B) { return $$(B) }) || (window.$ && function(B) { return $(B) }) || (document.querySelectorAll && function(B) { return document.querySelectorAll(B) }) || g), separate: "words", textShadow: "none" }; var p = { words: /[^\S\u00a0]+/, characters: "", none: /^/ }; m.now = function() { x.ready(); return m }; m.refresh = function() { y.repeat.apply(y, arguments); return m }; m.registerEngine = function(C, B) { if (!B) { return m } z[C] = B; return m.set("engine", C) }; m.registerFont = function(D) { var B = new s(D), C = B.family; if (!i[C]) { i[C] = new f() } i[C].add(B); return m.set("fontFamily", '"' + C + '"') }; m.replace = function(D, C, B) { C = h(w, C); if (!C.engine) { return m } if (!e) { n.addClass(x.root(), "cufon-active cufon-loading"); n.ready(function() { n.addClass(n.removeClass(x.root(), "cufon-loading"), "cufon-ready") }); e = true } if (C.hover) { C.forceHitArea = true } if (typeof C.textShadow == "string") { C.textShadow = n.textShadow(C.textShadow) } if (typeof C.color == "string" && /^-/.test(C.color)) { C.textGradient = n.gradient(C.color) } if (!B) { y.add(D, arguments) } if (D.nodeType || typeof D == "string") { D = [D] } n.ready(function() { for (var F = 0, E = D.length; F < E; ++F) { var G = D[F]; if (typeof G == "string") { m.replace(C.selector(G), C, true) } else { l(G, C) } } }); return m }; m.set = function(B, C) { w[B] = C; return m }; return m })(); Cufon.registerEngine("canvas", (function() { var b = document.createElement("canvas"); if (!b || !b.getContext || !b.getContext.apply) { return } b = null; var a = Cufon.CSS.supports("display", "inline-block"); var e = !a && (document.compatMode == "BackCompat" || /frameset|transitional/i.test(document.doctype.publicId)); var f = document.createElement("style"); f.type = "text/css"; f.appendChild(document.createTextNode((".cufon-canvas{text-indent:0;}@media screen,projection{.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle;" + (e ? "" : "font-size:1px;line-height:1px;") + "}.cufon-canvas .cufon-alt{display:-moz-inline-box;display:inline-block;width:0;height:0;overflow:hidden;text-indent:-10000in;}" + (a ? ".cufon-canvas canvas{position:relative;}" : ".cufon-canvas canvas{position:absolute;}") + "}@media print{.cufon-canvas{padding:0;}.cufon-canvas canvas{display:none;}.cufon-canvas .cufon-alt{display:inline;}}").replace(/;/g, "!important;"))); document.getElementsByTagName("head")[0].appendChild(f); function d(p, h) { var n = 0, m = 0; var g = [], o = /([mrvxe])([^a-z]*)/g, k; generate: for (var j = 0; k = o.exec(p); ++j) { var l = k[2].split(","); switch (k[1]) { case "v": g[j] = { m: "bezierCurveTo", a: [n + ~ ~l[0], m + ~ ~l[1], n + ~ ~l[2], m + ~ ~l[3], n += ~ ~l[4], m += ~ ~l[5]] }; break; case "r": g[j] = { m: "lineTo", a: [n += ~ ~l[0], m += ~ ~l[1]] }; break; case "m": g[j] = { m: "moveTo", a: [n = ~ ~l[0], m = ~ ~l[1]] }; break; case "x": g[j] = { m: "closePath" }; break; case "e": break generate } h[g[j].m].apply(h, g[j].a) } return g } function c(m, k) { for (var j = 0, h = m.length; j < h; ++j) { var g = m[j]; k[g.m].apply(k, g.a) } } return function(ah, H, Z, D, L, ai) { var n = (H === null); if (n) { H = L.alt } var J = ah.viewBox; var p = Z.getSize("fontSize", ah.baseSize); var X = Z.get("letterSpacing"); X = (X == "normal") ? 0 : p.convertFrom(parseInt(X, 10)); var K = 0, Y = 0, W = 0, F = 0; var I = D.textShadow, U = []; if (I) { for (var ag = I.length; ag--; ) { var O = I[ag]; var T = p.convertFrom(parseFloat(O.offX)); var R = p.convertFrom(parseFloat(O.offY)); U[ag] = [T, R]; if (R < K) { K = R } if (T > Y) { Y = T } if (R > W) { W = R } if (T < F) { F = T } } } var al = Cufon.CSS.textTransform(H, Z).split(""), B; var o = ah.glyphs, E, r, ac; var h = 0, v, N = []; for (var ag = 0, ae = 0, ab = al.length; ag < ab; ++ag) { E = o[B = al[ag]] || ah.missingGlyph; if (!E) { continue } if (r) { h -= ac = r[B] || 0; N[ae - 1] -= ac } h += v = N[ae++] = ~ ~(E.w || ah.w) + X; r = E.k } if (v === undefined) { return null } Y += J.width - v; F += J.minX; var C, q; if (n) { C = L; q = L.firstChild } else { C = document.createElement("span"); C.className = "cufon cufon-canvas"; C.alt = H; q = document.createElement("canvas"); C.appendChild(q); if (D.printable) { var ad = document.createElement("span"); ad.className = "cufon-alt"; ad.appendChild(document.createTextNode(H)); C.appendChild(ad) } } var am = C.style; var Q = q.style; var m = p.convert(J.height); var ak = Math.ceil(m); var V = ak / m; var P = V * Cufon.CSS.fontStretch(Z.get("fontStretch")); var S = h * P; var aa = Math.ceil(p.convert(S + Y - F)); var t = Math.ceil(p.convert(J.height - K + W)); q.width = aa; q.height = t; Q.width = aa + "px"; Q.height = t + "px"; K += J.minY; Q.top = Math.round(p.convert(K - ah.ascent)) + "px"; Q.left = Math.round(p.convert(F)) + "px"; var A = Math.ceil(p.convert(S)) + "px"; if (a) { am.width = A; am.height = p.convert(ah.height) + "px" } else { am.paddingLeft = A; am.paddingBottom = (p.convert(ah.height) - 1) + "px" } var aj = q.getContext("2d"), M = m / J.height; aj.scale(M, M * V); aj.translate(-F, -K); aj.lineWidth = ah.face["underline-thickness"]; aj.save(); function s(i, g) { aj.strokeStyle = g; aj.beginPath(); aj.moveTo(0, i); aj.lineTo(h, i); aj.stroke() } var u = D.enableTextDecoration ? Cufon.CSS.textDecoration(ai, Z) : {}; if (u.underline) { s(-ah.face["underline-position"], u.underline) } if (u.overline) { s(ah.ascent, u.overline) } function af() { aj.scale(P, 1); for (var x = 0, k = 0, g = al.length; x < g; ++x) { var y = o[al[x]] || ah.missingGlyph; if (!y) { continue } if (y.d) { aj.beginPath(); if (y.code) { c(y.code, aj) } else { y.code = d("m" + y.d, aj) } aj.fill() } aj.translate(N[k++], 0) } aj.restore() } if (I) { for (var ag = I.length; ag--; ) { var O = I[ag]; aj.save(); aj.fillStyle = O.color; aj.translate.apply(aj, U[ag]); af() } } var z = D.textGradient; if (z) { var G = z.stops, w = aj.createLinearGradient(0, J.minY, 0, J.maxY); for (var ag = 0, ab = G.length; ag < ab; ++ag) { w.addColorStop.apply(w, G[ag]) } aj.fillStyle = w } else { aj.fillStyle = Z.get("color") } af(); if (u["line-through"]) { s(-ah.descent, u["line-through"]) } return C } })()); Cufon.registerEngine("vml", (function() { var e = document.namespaces; if (!e) { return } e.add("cvml", "urn:schemas-microsoft-com:vml"); e = null; var b = document.createElement("cvml:shape"); b.style.behavior = "url(#default#VML)"; if (!b.coordsize) { return } b = null; var g = (document.documentMode || 0) < 8; document.write(('<style type="text/css">.cufon-vml-canvas{text-indent:0;}@media screen{cvml\\:shape,cvml\\:rect,cvml\\:fill,cvml\\:shadow{behavior:url(#default#VML);display:block;antialias:true;position:absolute;}.cufon-vml-canvas{position:absolute;text-align:left;}.cufon-vml{display:inline-block;position:relative;vertical-align:' + (g ? "middle" : "text-bottom") + ";}.cufon-vml .cufon-alt{position:absolute;left:-10000in;font-size:1px;}a .cufon-vml{cursor:pointer}}@media print{.cufon-vml *{display:none;}.cufon-vml .cufon-alt{display:inline;}}</style>").replace(/;/g, "!important;")); function c(h, i) { return a(h, /(?:em|ex|%)$|^[a-z-]+$/i.test(i) ? "1em" : i) } function a(k, l) { if (/px$/i.test(l)) { return parseFloat(l) } var j = k.style.left, i = k.runtimeStyle.left; k.runtimeStyle.left = k.currentStyle.left; k.style.left = l.replace("%", "em"); var h = k.style.pixelLeft; k.style.left = j; k.runtimeStyle.left = i; return h } var f = {}; function d(o) { var p = o.id; if (!f[p]) { var m = o.stops, n = document.createElement("cvml:fill"), h = []; n.type = "gradient"; n.angle = 180; n.focus = "0"; n.method = "sigma"; n.color = m[0][1]; for (var l = 1, i = m.length - 1; l < i; ++l) { h.push(m[l][0] * 100 + "% " + m[l][1]) } n.colors = h.join(","); n.color2 = m[i][1]; f[p] = n } return f[p] } return function(aj, K, ad, G, O, ak, ab) { var o = (K === null); if (o) { K = O.alt } var M = aj.viewBox; var q = ad.computedFontSize || (ad.computedFontSize = new Cufon.CSS.Size(c(ak, ad.get("fontSize")) + "px", aj.baseSize)); var aa = ad.computedLSpacing; if (aa == undefined) { aa = ad.get("letterSpacing"); ad.computedLSpacing = aa = (aa == "normal") ? 0 : ~ ~q.convertFrom(a(ak, aa)) } var C, r; if (o) { C = O; r = O.firstChild } else { C = document.createElement("span"); C.className = "cufon cufon-vml"; C.alt = K; r = document.createElement("span"); r.className = "cufon-vml-canvas"; C.appendChild(r); if (G.printable) { var ag = document.createElement("span"); ag.className = "cufon-alt"; ag.appendChild(document.createTextNode(K)); C.appendChild(ag) } if (!ab) { C.appendChild(document.createElement("cvml:shape")) } } var ap = C.style; var V = r.style; var m = q.convert(M.height), am = Math.ceil(m); var Z = am / m; var T = Z * Cufon.CSS.fontStretch(ad.get("fontStretch")); var Y = M.minX, X = M.minY; V.height = am; V.top = Math.round(q.convert(X - aj.ascent)); V.left = Math.round(q.convert(Y)); ap.height = q.convert(aj.height) + "px"; var v = G.enableTextDecoration ? Cufon.CSS.textDecoration(ak, ad) : {}; var J = ad.get("color"); var ao = Cufon.CSS.textTransform(K, ad).split(""), B; var p = aj.glyphs, H, s, af; var h = 0, P = [], W = 0, x; var z, L = G.textShadow; for (var ai = 0, ah = 0, ae = ao.length; ai < ae; ++ai) { H = p[B = ao[ai]] || aj.missingGlyph; if (!H) { continue } if (s) { h -= af = s[B] || 0; P[ah - 1] -= af } h += x = P[ah++] = ~ ~(H.w || aj.w) + aa; s = H.k } if (x === undefined) { return null } var A = -Y + h + (M.width - x); var an = q.convert(A * T), ac = Math.round(an); var S = A + "," + M.height, n; var N = "r" + S + "ns"; var y = G.textGradient && d(G.textGradient); for (ai = 0, ah = 0; ai < ae; ++ai) { H = p[ao[ai]] || aj.missingGlyph; if (!H) { continue } if (o) { z = r.childNodes[ah]; while (z.firstChild) { z.removeChild(z.firstChild) } } else { z = document.createElement("cvml:shape"); r.appendChild(z) } z.stroked = "f"; z.coordsize = S; z.coordorigin = n = (Y - W) + "," + X; z.path = (H.d ? "m" + H.d + "xe" : "") + "m" + n + N; z.fillcolor = J; if (y) { z.appendChild(y.cloneNode(false)) } var al = z.style; al.width = ac; al.height = am; if (L) { var u = L[0], t = L[1]; var F = Cufon.CSS.color(u.color), D; var R = document.createElement("cvml:shadow"); R.on = "t"; R.color = F.color; R.offset = u.offX + "," + u.offY; if (t) { D = Cufon.CSS.color(t.color); R.type = "double"; R.color2 = D.color; R.offset2 = t.offX + "," + t.offY } R.opacity = F.opacity || (D && D.opacity) || 1; z.appendChild(R) } W += P[ah++] } var Q = z.nextSibling, w, E; if (G.forceHitArea) { if (!Q) { Q = document.createElement("cvml:rect"); Q.stroked = "f"; Q.className = "cufon-vml-cover"; w = document.createElement("cvml:fill"); w.opacity = 0; Q.appendChild(w); r.appendChild(Q) } E = Q.style; E.width = ac; E.height = am } else { if (Q) { r.removeChild(Q) } } ap.width = Math.max(Math.ceil(q.convert(h * T)), 0); if (g) { var U = ad.computedYAdjust; if (U === undefined) { var I = ad.get("lineHeight"); if (I == "normal") { I = "1em" } else { if (!isNaN(I)) { I += "em" } } ad.computedYAdjust = U = 0.5 * (a(ak, I) - parseFloat(ap.height)) } if (U) { ap.marginTop = Math.ceil(U) + "px"; ap.marginBottom = U + "px" } } return C } })());
/* Date.js minified */
Date.dayNames = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; Date.abbrDayNames = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']; Date.monthNames = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']; Date.abbrMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; Date.firstDayOfWeek = 1; Date.format = 'dd/mm/yyyy'; Date.fullYearStart = '20'; (function() {
    function add(name, method) { if (!Date.prototype[name]) { Date.prototype[name] = method; } }; add("isLeapYear", function() { var y = this.getFullYear(); return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0; }); add("isWeekend", function() { return this.getDay() == 0 || this.getDay() == 6; }); add("isWeekDay", function() { return !this.isWeekend(); }); add("getDaysInMonth", function() { return [31, (this.isLeapYear() ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][this.getMonth()]; }); add("getDayName", function(abbreviated) { return abbreviated ? Date.abbrDayNames[this.getDay()] : Date.dayNames[this.getDay()]; }); add("getMonthName", function(abbreviated) { return abbreviated ? Date.abbrMonthNames[this.getMonth()] : Date.monthNames[this.getMonth()]; }); add("getDayOfYear", function() { var tmpdtm = new Date("1/1/" + this.getFullYear()); return Math.floor((this.getTime() - tmpdtm.getTime()) / 86400000); }); add("getWeekOfYear", function() { return Math.ceil(this.getDayOfYear() / 7); }); add("setDayOfYear", function(day) { this.setMonth(0); this.setDate(day); return this; }); add("addYears", function(num) { this.setFullYear(this.getFullYear() + num); return this; }); add("addMonths", function(num) {
        var tmpdtm = this.getDate(); this.setMonth(this.getMonth() + num); if (tmpdtm > this.getDate())
            this.addDays(-this.getDate()); return this;
    }); add("addDays", function(num) { this.setTime(this.getTime() + (num * 86400000)); return this; }); add("addHours", function(num) { this.setHours(this.getHours() + num); return this; }); add("addMinutes", function(num) { this.setMinutes(this.getMinutes() + num); return this; }); add("addSeconds", function(num) { this.setSeconds(this.getSeconds() + num); return this; }); add("zeroTime", function() { this.setMilliseconds(0); this.setSeconds(0); this.setMinutes(0); this.setHours(0); return this; }); add("asString", function(format) {
        var r = format || Date.format; if (r.split('mm').length > 1) { r = r.split('mmmm').join(this.getMonthName(false)).split('mmm').join(this.getMonthName(true)).split('mm').join(_zeroPad(this.getMonth() + 1)) } else { r = r.split('m').join(this.getMonth() + 1); }
        r = r.split('yyyy').join(this.getFullYear()).split('yy').join((this.getFullYear() + '').substring(2)).split('dd').join(_zeroPad(this.getDate())).split('d').join(this.getDate()); return r;
    }); Date.fromString = function(s) {
        var f = Date.format; var d = new Date('01/01/1970'); if (s == '') return d; s = s.toLowerCase(); var matcher = ''; var order = []; var r = /(dd?d?|mm?m?|yy?yy?)+([^(m|d|y)])?/g; var results; while ((results = r.exec(f)) != null) {
            switch (results[1]) { case 'd': case 'dd': case 'm': case 'mm': case 'yy': case 'yyyy': matcher += '(\\d+\\d?\\d?\\d?)+'; order.push(results[1].substr(0, 1)); break; case 'mmm': matcher += '([a-z]{3})'; order.push('M'); break; }
            if (results[2]) { matcher += results[2]; }
        }
        var dm = new RegExp(matcher); var result = s.match(dm); for (var i = 0; i < order.length; i++) {
            var res = result[i + 1]; switch (order[i]) {
                case 'd': d.setDate(res); break; case 'm': d.setMonth(Number(res) - 1); break; case 'M': for (var j = 0; j < Date.abbrMonthNames.length; j++) { if (Date.abbrMonthNames[j].toLowerCase() == res) break; }
                    d.setMonth(j); break; case 'y': d.setYear(res); break;
            }
        }
        return d;
    }; var _zeroPad = function(num) { var s = '0' + num; return s.substring(s.length - 2) };
})(); var is = { ie: navigator.appName == 'Microsoft Internet Explorer', java: navigator.javaEnabled(), ns: navigator.appName == 'Netscape', ua: navigator.userAgent.toLowerCase(), version: parseFloat(navigator.appVersion.substr(21)) || parseFloat(navigator.appVersion), win: navigator.platform == 'Win32' }
is.mac = is.ua.indexOf('mac') >= 0; if (is.ua.indexOf('opera') >= 0) { is.ie = is.ns = false; is.opera = true; }
if (is.ua.indexOf('gecko') >= 0) { is.ie = is.ns = false; is.gecko = true; }

/* datepicker */


(function($) {
    $.fn.extend({
        renderCalendar: function(s) {
            var dc = function(a) {
                return document.createElement(a);
            };
            s = $.extend({}, $.fn.datePicker.defaults, s);
            if (s.showHeader != $.dpConst.SHOW_HEADER_NONE) {
                var headRow = $(dc('tr'));
                for (var i = Date.firstDayOfWeek; i < Date.firstDayOfWeek + 7; i++) {
                    var weekday = i % 7;
                    var day = Date.dayNames[weekday];
                    headRow.append(
jQuery(dc('th')).attr({ 'scope': 'col', 'abbr': day, 'title': day, 'class': (weekday == 0 || weekday == 6 ? 'weekend' : 'weekday') }).html(s.showHeader == $.dpConst.SHOW_HEADER_SHORT ? day.substr(0, 1) : day)
);
                }
            };
            var calendarTable = $(dc('table'))
.attr(
{
    'cellspacing': 0,
    'cellpadding': 0
}
)
.addClass('jCalendar')
.append(
(s.showHeader != $.dpConst.SHOW_HEADER_NONE ?
$(dc('thead'))
.append(headRow)
:
dc('thead')
)
);
            var tbody = $(dc('tbody'));
            var today = (new Date()).zeroTime();

            //current week needs to be retrieved from query string
            var queryStringValue = document.location.search.substring(document.location.search.indexOf('=') + 1);
            //need to parse string back into year,month,date object? 

            chosenDay = queryStringValue.substr(6, 2)
            chosenMonth = queryStringValue.substr(4, 2)
            chosenYear = queryStringValue.substr(0, 4)

            var chosenWeek = new Date(chosenYear, chosenMonth, chosenDay) //today variable will be added to all days in current week
            //nb: day is still wrong, its picking todays day of the week


            //alert(chosenWeek);
            var month = s.month == undefined ? today.getMonth() : s.month;
            var year = s.year || today.getFullYear();
            var currentDate = new Date(year, month, 1);
            var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
            if (firstDayOffset > 1) firstDayOffset -= 7;
            var weeksToDraw = Math.ceil(((-1 * firstDayOffset + 1) + currentDate.getDaysInMonth()) / 7);
            currentDate.addDays(firstDayOffset - 1);
            var doHover = function(firstDayInBounds) {
                return function() {
                    if (s.hoverClass) {
                        var $this = $(this);
                        if (!s.selectWeek) {
                            $this.addClass(s.hoverClass);
                        } else if (firstDayInBounds && !$this.is('.disabled')) {
                            $this.parent().addClass('activeWeekHover');
                        }
                    }
                }
            };
            var unHover = function() {
                if (s.hoverClass) {
                    var $this = $(this);
                    $this.removeClass(s.hoverClass);
                    $this.parent().removeClass('activeWeekHover');
                }
            };
            var w = 0;
            while (w++ < weeksToDraw) {
                var r = jQuery(dc('tr'));
                var firstDayInBounds = s.dpController ? currentDate > s.dpController.startDate : false;
                for (var i = 0; i < 7; i++) {
                    var thisMonth = currentDate.getMonth() == month;
                    var d = $(dc('td'))
.text(currentDate.getDate() + '')
.addClass((thisMonth ? 'current-month ' : 'other-month ') +
(currentDate.isWeekend() ? 'weekend ' : 'weekday ') +
(thisMonth && currentDate.getTime() == today.getTime() ? 'today ' : '')
)
.data('datePickerDate', currentDate.asString())
.hover(doHover(firstDayInBounds), unHover)
;
                    
                    r.append(d);
                    if (s.renderCallback) {
                        s.renderCallback(d, currentDate, month, year);
                    }
                    currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() + 1);
                }
                tbody.append(r);
            }
            calendarTable.append(tbody);
            return this.each(
function() {
    $(this).empty().append(calendarTable);
}
);
        },
        datePicker: function(s) {
            if (!$.event._dpCache) $.event._dpCache = [];
            s = $.extend({}, $.fn.datePicker.defaults, s);
            return this.each(
function() {
    var $this = $(this);
    var alreadyExists = true;
    if (!this._dpId) {
        this._dpId = $.event.guid++;
        $.event._dpCache[this._dpId] = new DatePicker(this);
        alreadyExists = false;
    }
    if (s.inline) {
        s.createButton = false;
        s.displayClose = false;
        s.closeOnSelect = false;
        $this.empty();
    }
    var controller = $.event._dpCache[this._dpId];
    controller.init(s);
    if (!alreadyExists && s.createButton) {
        controller.button = $('<a href="#" class="dp-choose-date" title="' + $.dpText.TEXT_CHOOSE_DATE + '">' + $.dpText.TEXT_CHOOSE_DATE + '</a>')
.bind(
'click',
function() {
    $this.dpDisplay(this);
    this.blur();
    return false;
}
);
        $this.after(controller.button);
    }
    if (!alreadyExists && $this.is(':text')) {
        $this
.bind(
'dateSelected',
function(e, selectedDate, $td) {
    this.value = selectedDate.asString();
}
).bind(
'change',
function() {
    if (this.value == '') {
        controller.clearSelected();
    } else {
        var d = Date.fromString(this.value);
        if (d) {
            controller.setSelected(d, true, true);
        }
    }
}
);
        if (s.clickInput) {
            $this.bind(
'click',
function() {
    $this.trigger('change');
    $this.dpDisplay();
}
);
        }
        var d = Date.fromString(this.value);
        if (this.value != '' && d) {
            controller.setSelected(d, true, true);
        }
    }
    $this.addClass('dp-applied');
}
)
        },
        dpSetDisabled: function(s) {
            return _w.call(this, 'setDisabled', s);
        },
        dpSetStartDate: function(d) {
            return _w.call(this, 'setStartDate', d);
        },
        dpSetEndDate: function(d) {
            return _w.call(this, 'setEndDate', d);
        },
        dpGetSelected: function() {
            var c = _getController(this[0]);
            if (c) {
                return c.getSelected();
            }
            return null;
        },
        dpSetSelected: function(d, v, m, e) {
            if (v == undefined) v = true;
            if (m == undefined) m = true;
            if (e == undefined) e = true;
            return _w.call(this, 'setSelected', Date.fromString(d), v, m, e);
        },
        dpSetDisplayedMonth: function(m, y) {
            return _w.call(this, 'setDisplayedMonth', Number(m), Number(y), true);
        },
        dpDisplay: function(e) {
            return _w.call(this, 'display', e);
        },
        dpSetRenderCallback: function(a) {
            return _w.call(this, 'setRenderCallback', a);
        },
        dpSetPosition: function(v, h) {
            return _w.call(this, 'setPosition', v, h);
        },
        dpSetOffset: function(v, h) {
            return _w.call(this, 'setOffset', v, h);
        },
        dpClose: function() {
            return _w.call(this, '_closeCalendar', false, this[0]);
        },
        _dpDestroy: function() {
        }
    });
    var _w = function(f, a1, a2, a3, a4) {
        return this.each(
function() {
    var c = _getController(this);
    if (c) {
        c[f](a1, a2, a3, a4);
    }
}
);
    };
    function DatePicker(ele) {
        this.ele = ele;
        this.displayedMonth = null;
        this.displayedYear = null;
        this.startDate = null;
        this.endDate = null;
        this.showYearNavigation = null;
        this.closeOnSelect = null;
        this.displayClose = null;
        this.rememberViewedMonth = null;
        this.selectMultiple = null;
        this.numSelectable = null;
        this.numSelected = null;
        this.verticalPosition = null;
        this.horizontalPosition = null;
        this.verticalOffset = null;
        this.horizontalOffset = null;
        this.button = null;
        this.renderCallback = [];
        this.selectedDates = {};
        this.inline = null;
        this.context = '#dp-popup';
        this.settings = {};
    };
    $.extend(
DatePicker.prototype,
{
    init: function(s) {
        this.setStartDate(s.startDate);
        this.setEndDate(s.endDate);
        this.setDisplayedMonth(Number(s.month), Number(s.year));
        this.setRenderCallback(s.renderCallback);
        this.showYearNavigation = s.showYearNavigation;
        this.closeOnSelect = s.closeOnSelect;
        this.displayClose = s.displayClose;
        this.rememberViewedMonth = s.rememberViewedMonth;
        this.selectMultiple = s.selectMultiple;
        this.numSelectable = s.selectMultiple ? s.numSelectable : 1;
        this.numSelected = 0;
        this.verticalPosition = s.verticalPosition;
        this.horizontalPosition = s.horizontalPosition;
        this.hoverClass = s.hoverClass;
        this.setOffset(s.verticalOffset, s.horizontalOffset);
        this.inline = s.inline;
        this.settings = s;
        if (this.inline) {
            this.context = this.ele;
            this.display();
        }
    },
    setStartDate: function(d) {
        if (d) {
            this.startDate = Date.fromString(d);
        }
        if (!this.startDate) {
            this.startDate = (new Date()).zeroTime();
        }
        this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
    },
    setEndDate: function(d) {
        if (d) {
            this.endDate = Date.fromString(d);
        }
        if (!this.endDate) {
            this.endDate = (new Date('12/31/2999'));
        }
        if (this.endDate.getTime() < this.startDate.getTime()) {
            this.endDate = this.startDate;
        }
        this.setDisplayedMonth(this.displayedMonth, this.displayedYear);
    },
    setPosition: function(v, h) {
        this.verticalPosition = v;
        this.horizontalPosition = h;
    },
    setOffset: function(v, h) {
        this.verticalOffset = parseInt(v) || 0;
        this.horizontalOffset = parseInt(h) || 0;
    },
    setDisabled: function(s) {
        $e = $(this.ele);
        $e[s ? 'addClass' : 'removeClass']('dp-disabled');
        if (this.button) {
            $but = $(this.button);
            $but[s ? 'addClass' : 'removeClass']('dp-disabled');
            $but.attr('title', s ? '' : $.dpText.TEXT_CHOOSE_DATE);
        }
        if ($e.is(':text')) {
            $e.attr('disabled', s ? 'disabled' : '');
        }
    },
    setDisplayedMonth: function(m, y, rerender) {
        if (this.startDate == undefined || this.endDate == undefined) {
            return;
        }
        var s = new Date(this.startDate.getTime());
        s.setDate(1);
        var e = new Date(this.endDate.getTime());
        e.setDate(1);
        var t;
        if ((!m && !y) || (isNaN(m) && isNaN(y))) {
            t = new Date().zeroTime();
            t.setDate(1);
        } else if (isNaN(m)) {
            t = new Date(y, this.displayedMonth, 1);
        } else if (isNaN(y)) {
            t = new Date(this.displayedYear, m, 1);
        } else {
            t = new Date(y, m, 1)
        }
        if (t.getTime() < s.getTime()) {
            t = s;
        } else if (t.getTime() > e.getTime()) {
            t = e;
        }
        var oldMonth = this.displayedMonth;
        var oldYear = this.displayedYear;
        this.displayedMonth = t.getMonth();
        this.displayedYear = t.getFullYear();
        if (rerender && (this.displayedMonth != oldMonth || this.displayedYear != oldYear)) {
            this._rerenderCalendar();
            $(this.ele).trigger('dpMonthChanged', [this.displayedMonth, this.displayedYear]);
        }
    },
    setSelected: function(d, v, moveToMonth, dispatchEvents) {
        if (d < this.startDate || d > this.endDate) {
            return;
        }
        var s = this.settings;
        if (s.selectWeek) {
            d = d.addDays(-(d.getDay() - Date.firstDayOfWeek + 7) % 7);
            if (d < this.startDate) {
                return;
            }
        }
        if (v == this.isSelected(d)) {
            return;
        }
        if (this.selectMultiple == false) {
            this.clearSelected();
        } else if (v && this.numSelected == this.numSelectable) {
            return;
        }
        if (moveToMonth && (this.displayedMonth != d.getMonth() || this.displayedYear != d.getFullYear())) {
            this.setDisplayedMonth(d.getMonth(), d.getFullYear(), true);
        }
        this.selectedDates[d.toString()] = v;
        this.numSelected += v ? 1 : -1;
        var selectorString = 'td.' + (d.getMonth() == this.displayedMonth ? 'current-month' : 'other-month');
        var $td;
        $(selectorString, this.context).each(
function() {
    if ($(this).data('datePickerDate') == d.asString()) {
        $td = $(this);
        if (s.selectWeek) {
            $td.parent()[v ? 'addClass' : 'removeClass']('selectedWeek');
        }
        $td[v ? 'addClass' : 'removeClass']('selected');
    }
}
);
        $('td', this.context).not('.selected')[this.selectMultiple && this.numSelected == this.numSelectable ? 'addClass' : 'removeClass']('unselectable');
        if (dispatchEvents) {
            var s = this.isSelected(d);
            $e = $(this.ele);
            var dClone = Date.fromString(d.asString());
            $e.trigger('dateSelected', [dClone, $td, s]);
            $e.trigger('change');
        }
    },
    isSelected: function(d) {
        return this.selectedDates[d.toString()];
    },
    getSelected: function() {
        var r = [];
        for (s in this.selectedDates) {
            if (this.selectedDates[s] == true) {
                r.push(Date.parse(s));
            }
        }
        return r;
    },
    clearSelected: function() {
        this.selectedDates = {};
        this.numSelected = 0;
        $('td.selected', this.context).removeClass('selected').parent().removeClass('selectedWeek');
    },
    display: function(eleAlignTo) {
        if ($(this.ele).is('.dp-disabled')) return;
        eleAlignTo = eleAlignTo || this.ele;
        var c = this;
        var $ele = $(eleAlignTo);
        var eleOffset = $ele.offset();
        var $createIn;
        var attrs;
        var attrsCalendarHolder;
        var cssRules;
        if (c.inline) {
            $createIn = $(this.ele);
            attrs = {
                'id': 'calendar-' + this.ele._dpId,
                'class': 'dp-popup dp-popup-inline'
            };
            $('.dp-popup', $createIn).remove();
            cssRules = {
        };
    } else {
        $createIn = $('body');
        attrs = {
            'id': 'dp-popup',
            'class': 'dp-popup'
        };
        cssRules = {
            'top': eleOffset.top + c.verticalOffset,
            'left': eleOffset.left + c.horizontalOffset - 48
        };
        var _checkMouse = function(e) {
            var el = e.target;
            var cal = $('#dp-popup')[0];
            while (true) {
                if (el == cal) {
                    return true;
                } else if (el == document) {
                    c._closeCalendar();
                    return false;
                } else {
                    el = $(el).parent()[0];
                }
            }
        };
        this._checkMouse = _checkMouse;
        c._closeCalendar(true);
        $(document).bind(
'keydown.datepicker',
function(event) {
    if (event.keyCode == 27) {
        c._closeCalendar();
    }
}
);
    }
    if (!c.rememberViewedMonth) {
        var selectedDate = this.getSelected()[0];
        if (selectedDate) {
            selectedDate = new Date(selectedDate);
            this.setDisplayedMonth(selectedDate.getMonth(), selectedDate.getFullYear(), false);

        }
    }
    $createIn
.append(
$('<div></div>')
.attr(attrs)
.css(cssRules)
.append(
$('<h2></h2>'),
$('<div class="dp-nav-prev"></div>')
.append(
$('<a class="dp-nav-prev-year" href="#" title="' + $.dpText.TEXT_PREV_YEAR + '"><img src="/images/interface/cal-first-arrow.gif" /></a>')
.bind(
'click',
function() {
    return c._displayNewMonth.call(c, this, 0, -1);
}
),
$('<a class="dp-nav-prev-month" href="#" title="' + $.dpText.TEXT_PREV_MONTH + '"><img src="/images/interface/cal-prev-arrow.gif" /></a>')
.bind(
'click',
function() {
    return c._displayNewMonth.call(c, this, -1, 0);
}
)
),
$('<div class="dp-nav-next"></div>')
.append(
$('<a class="dp-nav-next-year" href="#" title="' + $.dpText.TEXT_NEXT_YEAR + '"><img src="/images/interface/cal-final-arrow.gif" /></a>')
.bind(
'click',
function() {
    return c._displayNewMonth.call(c, this, 0, 1);
}
),
$('<a class="dp-nav-next-month" href="#" title="' + $.dpText.TEXT_NEXT_MONTH + '"><img src="/images/interface/cal-next-arrow.gif" /></a>')
.bind(
'click',
function() {
    return c._displayNewMonth.call(c, this, 1, 0);
}
)
),
$('<div class="dp-calendar"></div>')
)
.bgIframe()
);
    var $pop = this.inline ? $('.dp-popup', this.context) : $('#dp-popup');
    if (this.showYearNavigation == false) {
        $('.dp-nav-prev-year, .dp-nav-next-year', c.context).css('display', 'none');
    }
    if (this.displayClose) {
        $pop.append(
$('<a href="#" id="dp-close">' + $.dpText.TEXT_CLOSE + '</a>')
.bind(
'click',
function() {
    c._closeCalendar();
    return false;
}
)
);
    }
    c._renderCalendar();
    $(this.ele).trigger('dpDisplayed', $pop);
    if (!c.inline) {
        if (this.verticalPosition == $.dpConst.POS_BOTTOM) {
            $pop.css('top', eleOffset.top + $ele.height() - $pop.height() + c.verticalOffset);
        }
        if (this.horizontalPosition == $.dpConst.POS_RIGHT) {
            $pop.css('left', eleOffset.left + $ele.width() - $pop.width() + c.horizontalOffset);
        }
        $(document).bind('mousedown.datepicker', this._checkMouse);
    }
},
setRenderCallback: function(a) {
    if (a == null) return;
    if (a && typeof (a) == 'function') {
        a = [a];
    }
    this.renderCallback = this.renderCallback.concat(a);
},
cellRender: function($td, thisDate, month, year) {
    var c = this.dpController;
    var d = new Date(thisDate.getTime());
    $td.bind(
'click',
function() {
    var $this = $(this);
    if (!$this.is('.disabled')) {
        c.setSelected(d, !$this.is('.selected') || !c.selectMultiple, false, true);
        if (c.closeOnSelect) {
            c._closeCalendar();
        }
        if (!$.browser.msie) {
            $(c.ele).trigger('focus', [$.dpConst.DP_INTERNAL_FOCUS]);
        }
    }
}
);
    if (c.isSelected(d)) {
        $td.addClass('selected');
        if (c.settings.selectWeek) {
            $td.parent().addClass('selectedWeek');
        }
    } else if (c.selectMultiple && c.numSelected == c.numSelectable) {
        $td.addClass('unselectable');
    }
},
_applyRenderCallbacks: function() {
    var c = this;
    $('td', this.context).each(
function() {
    for (var i = 0; i < c.renderCallback.length; i++) {
        $td = $(this);
        c.renderCallback[i].apply(this, [$td, Date.fromString($td.data('datePickerDate')), c.displayedMonth, c.displayedYear]);
    }
}
);
    return;
},
_displayNewMonth: function(ele, m, y) {
    if (!$(ele).is('.disabled')) {
        this.setDisplayedMonth(this.displayedMonth + m, this.displayedYear + y, true);
    }
    ele.blur();
    return false;
},
_rerenderCalendar: function() {
    this._clearCalendar();
    this._renderCalendar();
},
_renderCalendar: function() {
    $('h2', this.context).html((new Date(this.displayedYear, this.displayedMonth, 1)).asString($.dpText.HEADER_FORMAT));
    $('.dp-calendar', this.context).renderCalendar(
$.extend(
{},
this.settings,
{
    month: this.displayedMonth,
    year: this.displayedYear,
    renderCallback: this.cellRender,
    dpController: this,
    hoverClass: this.hoverClass
})
);
    if (this.displayedYear == this.startDate.getFullYear() && this.displayedMonth == this.startDate.getMonth()) {
        $('.dp-nav-prev-year', this.context).addClass('disabled');
        $('.dp-nav-prev-month', this.context).addClass('disabled');
        $('.dp-calendar td.other-month', this.context).each(
function() {
    var $this = $(this);
    if (Number($this.text()) > 20) {
        $this.addClass('disabled');
    }
}
);
        var d = this.startDate.getDate();
        $('.dp-calendar td.current-month', this.context).each(
function() {
    var $this = $(this);
    if (Number($this.text()) < d) {
        $this.addClass('disabled');
    }
}
);
    } else {
        $('.dp-nav-prev-year', this.context).removeClass('disabled');
        $('.dp-nav-prev-month', this.context).removeClass('disabled');
        var d = this.startDate.getDate();
        if (d > 20) {
            var st = this.startDate.getTime();
            var sd = new Date(st);
            sd.addMonths(1);
            if (this.displayedYear == sd.getFullYear() && this.displayedMonth == sd.getMonth()) {
                $('.dp-calendar td.other-month', this.context).each(
function() {
    var $this = $(this);
    if (Date.fromString($this.data('datePickerDate')).getTime() < st) {
        $this.addClass('disabled');
    }
}
);
            }
        }
    }
    if (this.displayedYear == this.endDate.getFullYear() && this.displayedMonth == this.endDate.getMonth()) {
        $('.dp-nav-next-year', this.context).addClass('disabled');
        $('.dp-nav-next-month', this.context).addClass('disabled');
        $('.dp-calendar td.other-month', this.context).each(
function() {
    var $this = $(this);
    if (Number($this.text()) < 14) {
        $this.addClass('disabled');
    }
}
);
        var d = this.endDate.getDate();
        $('.dp-calendar td.current-month', this.context).each(
function() {
    var $this = $(this);
    if (Number($this.text()) > d) {
        $this.addClass('disabled');
    }
}
);
    } else {
        $('.dp-nav-next-year', this.context).removeClass('disabled');
        $('.dp-nav-next-month', this.context).removeClass('disabled');
        var d = this.endDate.getDate();
        if (d < 13) {
            var ed = new Date(this.endDate.getTime());
            ed.addMonths(-1);
            if (this.displayedYear == ed.getFullYear() && this.displayedMonth == ed.getMonth()) {
                $('.dp-calendar td.other-month', this.context).each(
function() {
    var $this = $(this);
    if (Number($this.text()) > d) {
        $this.addClass('disabled');
    }
}
);
            }
        }
    }
    this._applyRenderCallbacks();
},
_closeCalendar: function(programatic, ele) {
    if (!ele || ele == this.ele) {
        $(document).unbind('mousedown.datepicker');
        $(document).unbind('keydown.datepicker');
        this._clearCalendar();
        $('#dp-popup a').unbind();
        $('#dp-popup').empty().remove();
        if (!programatic) {
            $(this.ele).trigger('dpClosed', [this.getSelected()]);
        }
    }
},
_clearCalendar: function() {
    $('.dp-calendar td', this.context).unbind();
    $('.dp-calendar', this.context).empty();
}
}
);
    $.dpConst = {
        SHOW_HEADER_NONE: 0,
        SHOW_HEADER_SHORT: 1,
        SHOW_HEADER_LONG: 2,
        POS_TOP: 0,
        POS_BOTTOM: 1,
        POS_LEFT: 0,
        POS_RIGHT: 1,
        DP_INTERNAL_FOCUS: 'dpInternalFocusTrigger'
    };
    $.dpText = {
        TEXT_PREV_YEAR: 'Previous year',
        TEXT_PREV_MONTH: 'Previous month',
        TEXT_NEXT_YEAR: 'Next year',
        TEXT_NEXT_MONTH: 'Next month',
        TEXT_CLOSE: 'Close',
        TEXT_CHOOSE_DATE: 'Choose date',
        HEADER_FORMAT: 'mmmm yyyy'
    };
    $.dpVersion = '$Id: jquery.datePicker.js 70 2009-04-05 19:25:15Z kelvin.luck $';
    $.fn.datePicker.defaults = {
        month: undefined,
        year: undefined,
        showHeader: $.dpConst.SHOW_HEADER_SHORT,
        startDate: undefined,
        endDate: undefined,
        inline: false,
        renderCallback: null,
        createButton: true,
        showYearNavigation: true,
        closeOnSelect: true,
        displayClose: false,
        selectMultiple: false,
        numSelectable: Number.MAX_VALUE,
        clickInput: false,
        rememberViewedMonth: true,
        selectWeek: false,
        verticalPosition: $.dpConst.POS_TOP,
        horizontalPosition: $.dpConst.POS_LEFT,
        verticalOffset: 0,
        horizontalOffset: 0,
        hoverClass: 'dp-hover'
    };
    function _getController(ele) {
        if (ele._dpId) return $.event._dpCache[ele._dpId];
        return false;
    };
    if ($.fn.bgIframe == undefined) {
        $.fn.bgIframe = function() { return this; };
    };
    $(window)
.bind('unload', function() {
    var els = $.event._dpCache || [];
    for (var i in els) {
        $(els[i].ele)._dpDestroy();
    }
});
})(jQuery);
var is = {
    ie: navigator.appName == 'Microsoft Internet Explorer',
    java: navigator.javaEnabled(),
    ns: navigator.appName == 'Netscape',
    ua: navigator.userAgent.toLowerCase(),
    version: parseFloat(navigator.appVersion.substr(21)) ||
parseFloat(navigator.appVersion),
    win: navigator.platform == 'Win32'
}
is.mac = is.ua.indexOf('mac') >= 0;
if (is.ua.indexOf('opera') >= 0) {
    is.ie = is.ns = false;
    is.opera = true;
}
if (is.ua.indexOf('gecko') >= 0) {
    is.ie = is.ns = false;
    is.gecko = true;
}
/**
* SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
*
* SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
if (typeof deconcept == "undefined") var deconcept = {};
if (typeof deconcept.util == "undefined") deconcept.util = {};
if (typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
    if (!document.getElementById) { return; }
    this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
    this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
    this.params = {};
    this.variables = {};
    this.attributes = [];
    if (swf) { this.setAttribute('swf', swf); }
    if (id) { this.setAttribute('id', id); }
    if (w) { this.setAttribute('width', w); }
    if (h) { this.setAttribute('height', h); }
    if (ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
    this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
    if (!window.opera && document.all && this.installedVer.major > 7) {
        // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
        // fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
        if (!deconcept.unloadSet) {
            deconcept.SWFObjectUtil.prepUnload = function() {
                __flash_unloadHandler = function() { };
                __flash_savedUnloadHandler = function() { };
                window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
            }
            window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
            deconcept.unloadSet = true;
        }
    }
    if (c) { this.addParam('bgcolor', c); }
    var q = quality ? quality : 'high';
    this.addParam('quality', q);
    this.setAttribute('useExpressInstall', false);
    this.setAttribute('doExpressInstall', false);
    var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
    this.setAttribute('xiRedirectUrl', xir);
    this.setAttribute('redirectUrl', '');
    if (redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
    useExpressInstall: function(path) {
        this.xiSWFPath = !path ? "expressinstall.swf" : path;
        this.setAttribute('useExpressInstall', true);
    },
    setAttribute: function(name, value) {
        this.attributes[name] = value;
    },
    getAttribute: function(name) {
        return this.attributes[name] || "";
    },
    addParam: function(name, value) {
        this.params[name] = value;
    },
    getParams: function() {
        return this.params;
    },
    addVariable: function(name, value) {
        this.variables[name] = value;
    },
    getVariable: function(name) {
        return this.variables[name] || "";
    },
    getVariables: function() {
        return this.variables;
    },
    getVariablePairs: function() {
        var variablePairs = [];
        var key;
        var variables = this.getVariables();
        for (key in variables) {
            variablePairs[variablePairs.length] = key + "=" + variables[key];
        }
        return variablePairs;
    },
    getSWFHTML: function() {
        var swfNode = "";
        if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "PlugIn");
                this.setAttribute('swf', this.xiSWFPath);
            }
            swfNode = '<embed type="application/x-shockwave-flash" src="' + this.getAttribute('swf') + '" width="' + this.getAttribute('width') + '" height="' + this.getAttribute('height') + '" style="' + (this.getAttribute('style') || "") + '"';
            swfNode += ' id="' + this.getAttribute('id') + '" name="' + this.getAttribute('id') + '" ';
            var params = this.getParams();
            for (var key in params) { swfNode += [key] + '="' + params[key] + '" '; }
            var pairs = this.getVariablePairs().join("&");
            if (pairs.length > 0) { swfNode += 'flashvars="' + pairs + '"'; }
            swfNode += '/>';
        } else { // PC IE
            if (this.getAttribute("doExpressInstall")) {
                this.addVariable("MMplayerType", "ActiveX");
                this.setAttribute('swf', this.xiSWFPath);
            }
            swfNode = '<object id="' + this.getAttribute('id') + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getAttribute('width') + '" height="' + this.getAttribute('height') + '" style="' + (this.getAttribute('style') || "") + '">';
            swfNode += '<param name="movie" value="' + this.getAttribute('swf') + '" />';
            var params = this.getParams();
            for (var key in params) {
                swfNode += '<param name="' + key + '" value="' + params[key] + '" />';
            }
            var pairs = this.getVariablePairs().join("&");
            if (pairs.length > 0) { swfNode += '<param name="flashvars" value="' + pairs + '" />'; }
            swfNode += "</object>";
        }
        return swfNode;
    },
    write: function(elementId) {
        if (this.getAttribute('useExpressInstall')) {
            // check to see if we need to do an express install
            var expressInstallReqVer = new deconcept.PlayerVersion([6, 0, 65]);
            if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
                this.setAttribute('doExpressInstall', true);
                this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
                document.title = document.title.slice(0, 47) + " - Flash Player Installation";
                this.addVariable("MMdoctitle", document.title);
            }
        }
        if (this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))) {
            var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
            n.innerHTML = this.getSWFHTML();
            return true;
        } else {
            if (this.getAttribute('redirectUrl') != "") {
                document.location.replace(this.getAttribute('redirectUrl'));
            }
        }
        return false;
    }
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function() {
    var PlayerVersion = new deconcept.PlayerVersion([0, 0, 0]);
    if (navigator.plugins && navigator.mimeTypes.length) {
        var x = navigator.plugins["Shockwave Flash"];
        if (x && x.description) {
            PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
        }
    } else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0) { // if Windows CE
        var axo = 1;
        var counter = 3;
        while (axo) {
            try {
                counter++;
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + counter);
                //				document.write("player v: "+ counter);
                PlayerVersion = new deconcept.PlayerVersion([counter, 0, 0]);
            } catch (e) {
                axo = null;
            }
        }
    } else { // Win IE (non mobile)
        // do minor version lookup in IE, but avoid fp6 crashing issues
        // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
        try {
            var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        } catch (e) {
            try {
                var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
                PlayerVersion = new deconcept.PlayerVersion([6, 0, 21]);
                axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
            } catch (e) {
                if (PlayerVersion.major == 6) {
                    return PlayerVersion;
                }
            }
            try {
                axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            } catch (e) { }
        }
        if (axo != null) {
            PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
        }
    }
    return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion) {
    this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
    this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
    this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv) {
    if (this.major < fv.major) return false;
    if (this.major > fv.major) return true;
    if (this.minor < fv.minor) return false;
    if (this.minor > fv.minor) return true;
    if (this.rev < fv.rev) return false;
    return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
    getRequestParameter: function(param) {
        var q = document.location.search || document.location.hash;
        if (param == null) { return q; }
        if (q) {
            var pairs = q.substring(1).split("&");
            for (var i = 0; i < pairs.length; i++) {
                if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
                    return pairs[i].substring((pairs[i].indexOf("=") + 1));
                }
            }
        }
        return "";
    }
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
    var objects = document.getElementsByTagName("OBJECT");
    for (var i = objects.length - 1; i >= 0; i--) {
        objects[i].style.display = 'none';
        for (var x in objects[i]) {
            if (typeof objects[i][x] == 'function') {
                objects[i][x] = function() { };
            }
        }
    }
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; } }

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;

/**
* @author Stéphane Roucheray
* @extends jquery
*/


/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options = $.extend({}, options); // clone object since it's unexpected behavior if the expired property were changed
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // NOTE Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

