
// usage: log('inside coolFunc', this, arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  arguments.callee = arguments.callee.caller;  
  if(this.console) console.log( Array.prototype.slice.call(arguments) );
};
// make it safe to use console.log always
(function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,markTimeline,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();)b[a]=b[a]||c})(window.console=window.console||{});
// place any jQuery/helper plugins in here, instead of separate, slower script files.
/*
 * CrossSlide jQuery plugin v0.6.2
 *
 * Copyright 2007-2010 by Tobia Conforto <tobia.conforto@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 51
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
(function() {
    var d = jQuery,
        a = (d.fn.startAnimation ? "startAnimation" : "animate"),
        c = "pause plugin missing.";
    function e(h) {
        for (var g = 1; g < arguments.length; g++) {
            h = h.replace(new RegExp("\\{" + (g - 1) + "}", "g"), arguments[g])
        }
        return h
    }
    function f() {
        arguments[0] = "CrossSlide: " + arguments[0];
        throw new Error(e.apply(null, arguments))
    }
    function b(i) {
        var g = 1;
        var h = i.replace(/^\s*|\s*$/g, "").split(/\s+/);
        if (h.length > 3) {
            throw new Error()
        }
        if (h[0] == "center") {
            if (h.length == 1) {
                h = ["center", "center"]
            } else {
                if (h.length == 2 && h[1].match(/^[\d.]+x$/i)) {
                    h = ["center", "center", h[1]]
                }
            }
        }
        if (h.length == 3) {
            g = parseFloat(h[2].match(/^([\d.]+)x$/i)[1])
        }
        var j = h[0] + " " + h[1];
        if (j == "left top" || j == "top left") {
            return {
                xrel: 0,
                yrel: 0,
                zoom: g
            }
        }
        if (j == "left center" || j == "center left") {
            return {
                xrel: 0,
                yrel: 0.5,
                zoom: g
            }
        }
        if (j == "left bottom" || j == "bottom left") {
            return {
                xrel: 0,
                yrel: 1,
                zoom: g
            }
        }
        if (j == "center top" || j == "top center") {
            return {
                xrel: 0.5,
                yrel: 0,
                zoom: g
            }
        }
        if (j == "center center") {
            return {
                xrel: 0.5,
                yrel: 0.5,
                zoom: g
            }
        }
        if (j == "center bottom" || j == "bottom center") {
            return {
                xrel: 0.5,
                yrel: 1,
                zoom: g
            }
        }
        if (j == "right top" || j == "top right") {
            return {
                xrel: 1,
                yrel: 0,
                zoom: g
            }
        }
        if (j == "right center" || j == "center right") {
            return {
                xrel: 1,
                yrel: 0.5,
                zoom: g
            }
        }
        if (j == "right bottom" || j == "bottom right") {
            return {
                xrel: 1,
                yrel: 1,
                zoom: g
            }
        }
        return {
            xrel: parseInt(h[0].match(/^(\d+)%$/)[1]) / 100,
            yrel: parseInt(h[1].match(/^(\d+)%$/)[1]) / 100,
            zoom: g
        }
    }
    d.fn.crossSlide = function(i, k, l) {
        var g = this,
            j = this.width(),
            h = this.height();
        if (g.length != 1) {
            f("crossSlide() must be called on exactly 1 element")
        }
        g.get(0).crossSlideArgs = [i, k, l];
        k = d.map(k, function(m) {
            return d.extend({}, m)
        });
        if (!i.easing) {
            i.easing = i.variant ? "swing" : "linear"
        }
        if (!l) {
            l = function() {}
        }(function(o) {
            var m = 0;
            function n(q, p) {
                p.onload = function(r) {
                    m++;
                    k[q].width = p.width;
                    k[q].height = p.height;
                    if (m == k.length) {
                        o()
                    }
                };
                p.src = k[q].src;
                if (q + 1 < k.length) {
                    n(q + 1, new Image())
                }
            }
            n(0, new Image())
        })(function() {
            if (!i.fade) {
                f("missing fade parameter.")
            }
            if (i.speed && i.sleep) {
                f("you cannot set both speed and sleep at the same time.")
            }
            var A = Math.round(i.fade * 1000);
            if (i.sleep) {
                var z = Math.round(i.sleep * 1000)
            }
            if (i.speed) {
                var o = i.speed / 1000,
                    v = Math.round(A * o)
            }
            g.empty().css({
                overflow: "hidden",
                padding: 0
            });
            if (!/^(absolute|relative|fixed)$/.test(g.css("position"))) {
                g.css({
                    position: "relative"
                })
            }
            if (!g.width() || !g.height()) {
                f("container element does not have its own width and height")
            }
            if (i.shuffle) {
                k.sort(function() {
                    return Math.random() - 0.5
                })
            }
            for (var t = 0; t < k.length; ++t) {
                var m = k[t];
                if (!m.src) {
                    f("missing src parameter in picture {0}.", t + 1)
                }
                if (o) {
                    switch (m.dir) {
                    case "up":
                        m.from = {
                            xrel: 0.5,
                            yrel: 0,
                            zoom: 1
                        };
                        m.to = {
                            xrel: 0.5,
                            yrel: 1,
                            zoom: 1
                        };
                        var x = m.height - h - 2 * v;
                        break;
                    case "down":
                        m.from = {
                            xrel: 0.5,
                            yrel: 1,
                            zoom: 1
                        };
                        m.to = {
                            xrel: 0.5,
                            yrel: 0,
                            zoom: 1
                        };
                        var x = m.height - h - 2 * v;
                        break;
                    case "left":
                        m.from = {
                            xrel: 0,
                            yrel: 0.5,
                            zoom: 1
                        };
                        m.to = {
                            xrel: 1,
                            yrel: 0.5,
                            zoom: 1
                        };
                        var x = m.width - j - 2 * v;
                        break;
                    case "right":
                        m.from = {
                            xrel: 1,
                            yrel: 0.5,
                            zoom: 1
                        };
                        m.to = {
                            xrel: 0,
                            yrel: 0.5,
                            zoom: 1
                        };
                        var x = m.width - j - 2 * v;
                        break;
                    default:
                        f("missing or malformed dir parameter in picture {0}.", t + 1)
                    }
                    if (x <= 0) {
                        f("impossible animation: either picture {0} is too small or div is too large or fade duration too long.", t + 1)
                    }
                    m.time_ms = Math.round(x / o)
                } else {
                    if (!z) {
                        if (!m.from || !m.to || !m.time) {
                            f("missing either speed/sleep option, or from/to/time params in picture {0}.", t + 1)
                        }
                        try {
                            m.from = b(m.from)
                        } catch (w) {
                            f('malformed "from" parameter in picture {0}.', t + 1)
                        }
                        try {
                            m.to = b(m.to)
                        } catch (w) {
                            f('malformed "to" parameter in picture {0}.', t + 1)
                        }
                        if (!m.time) {
                            f('missing "time" parameter in picture {0}.', t + 1)
                        }
                        m.time_ms = Math.round(m.time * 1000)
                    }
                }
                if (m.from) {
                    d.each([m.from, m.to], function(p, C) {
                        C.width = Math.round(m.width * C.zoom);
                        C.height = Math.round(m.height * C.zoom);
                        C.left = Math.round((j - C.width) * C.xrel);
                        C.top = Math.round((h - C.height) * C.yrel)
                    })
                }
                var s, y;
                y = s = d(e('<img src="{0}"/>', m.src));
                if (m.href) {
                    y = d(e('<a href="{0}"></a>', m.href)).append(s)
                }
                if (m.onclick) {
                    y.click(m.onclick)
                }
                if (m.alt) {
                    s.attr("alt", m.alt)
                }
                if (m.rel) {
                    y.attr("rel", m.rel)
                }
                if (m.href && m.target) {
                    y.attr("target", m.target)
                }
                y.appendTo(g)
            }
            delete o;
            function n(D, C) {
                var E = [0, A / (D.time_ms + 2 * A), 1 - A / (D.time_ms + 2 * A), 1][C];
                return {
                    left: Math.round(D.from.left + E * (D.to.left - D.from.left)),
                    top: Math.round(D.from.top + E * (D.to.top - D.from.top)),
                    width: Math.round(D.from.width + E * (D.to.width - D.from.width)),
                    height: Math.round(D.from.height + E * (D.to.height - D.from.height))
                }
            }
            var u = g.find("img").css({
                position: "absolute",
                visibility: "hidden",
                top: 0,
                left: 0,
                border: 0
            });
            u.eq(0).css({
                visibility: "visible"
            });
            if (!z) {
                u.eq(0).css(n(k[0], i.variant ? 0 : 1))
            }
            var B = i.loop;
            function q(O, p) {
                if (O % 2 == 0) {
                    if (z) {
                        var E = O / 2,
                            S = (E - 1 + k.length) % k.length,
                            P = u.eq(E),
                            M = u.eq(S);
                        var L = function() {
                            l(E, P.get(0));
                            M.css("visibility", "hidden");
                            setTimeout(p, z)
                        }
                    } else {
                        var H = O / 2,
                            S = (H - 1 + k.length) % k.length,
                            R = u.eq(H),
                            M = u.eq(S),
                            F = k[H].time_ms,
                            N = n(k[H], i.variant ? 3 : 2);
                        var L = function() {
                            l(H, R.get(0));
                            M.css("visibility", "hidden");
                            R[a](N, F, i.easing, p)
                        }
                    }
                } else {
                    var D = Math.floor(O / 2),
                        G = Math.ceil(O / 2) % k.length,
                        Q = u.eq(D),
                        C = u.eq(G),
                        T = {},
                        K = {
                            visibility: "visible"
                        },
                        J = {};
                    if (G > D) {
                        K.opacity = 0;
                        J.opacity = 1;
                        if (i.doubleFade) {
                            T.opacity = 0
                        }
                    } else {
                        T.opacity = 0;
                        if (i.doubleFade) {
                            K.opacity = 0;
                            J.opacity = 1
                        }
                    }
                    if (!z) {
                        d.extend(K, n(k[G], 0));
                        if (!i.variant) {
                            d.extend(T, n(k[D], 3));
                            d.extend(J, n(k[G], 1))
                        }
                    }
                    if (d.isEmptyObject(J)) {
                        var L = function() {
                            l(G, C.get(0), D, Q.get(0));
                            C.css(K);
                            Q[a](T, A, "linear", p)
                        }
                    } else {
                        if (d.isEmptyObject(T)) {
                            var L = function() {
                                l(G, C.get(0), D, Q.get(0));
                                C.css(K);
                                C[a](J, A, "linear", p)
                            }
                        } else {
                            var L = function() {
                                l(G, C.get(0), D, Q.get(0));
                                C.css(K);
                                C[a](J, A, "linear");
                                Q[a](T, A, "linear", p)
                            }
                        }
                    }
                }
                if (i.loop && O == k.length * 2 - 2) {
                    var I = L;
                    L = function() {
                        if (--B) {
                            I()
                        }
                    }
                }
                if (O > 0) {
                    return q(O - 1, L)
                } else {
                    return L
                }
            }
            var r = q(k.length * 2 - 1, function() {
                return r()
            });
            r()
        });
        return g
    };
    d.fn.crossSlideFreeze = function() {
        this.find("img").stop()
    };
    d.fn.crossSlideStop = function() {
        this.find("img").stop().remove()
    };
    d.fn.crossSlideRestart = function() {
        this.find("img").stop().remove();
        d.fn.crossSlide.apply(this, this.get(0).crossSlideArgs)
    };
    d.fn.crossSlidePause = function() {
        if (!d.fn.pause) {
            f(c)
        }
        this.find("img").pause()
    };
    d.fn.crossSlideResume = function() {
        if (!d.fn.pause) {
            f(c)
        }
        this.find("img").resume()
    }
})();


/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
(function($){$.fn.lightBox=function(settings){settings=jQuery.extend({overlayBgColor:'#000',overlayOpacity:0.8,fixedNavigation:false,imageLoading:'/img/lightbox-ico-loading.gif',imageBtnPrev:'/img/lightbox-btn-prev.gif',imageBtnNext:'/img/lightbox-btn-next.gif',imageBtnClose:'/img/lightbox-btn-close.gif',imageBlank:'/img/lightbox-blank.gif',containerBorderSize:10,containerResizeSpeed:400,txtImage:'Image',txtOf:'of',keyToClose:'c',keyToPrev:'p',keyToNext:'n',imageArray:[],activeImage:0},settings);var jQueryMatchedObj=this;function _initialize(){_start(this,jQueryMatchedObj);return false;}
function _start(objClicked,jQueryMatchedObj){$('embed, object, select').css({'visibility':'hidden'});_set_interface();settings.imageArray.length=0;settings.activeImage=0;if(jQueryMatchedObj.length==1){settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));}else{for(var i=0;i<jQueryMatchedObj.length;i++){settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));}}
while(settings.imageArray[settings.activeImage][0]!=objClicked.getAttribute('href')){settings.activeImage++;}
_set_image_to_view();}
function _set_interface(){$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+settings.imageLoading+'"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="'+settings.imageBtnClose+'"></a></div></div></div></div>');var arrPageSizes=___getPageSize();$('#jquery-overlay').css({backgroundColor:settings.overlayBgColor,opacity:settings.overlayOpacity,width:arrPageSizes[0],height:arrPageSizes[1]}).fadeIn();var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]}).show();$('#jquery-overlay,#jquery-lightbox').click(function(){_finish();});$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function(){_finish();return false;});$(window).resize(function(){var arrPageSizes=___getPageSize();$('#jquery-overlay').css({width:arrPageSizes[0],height:arrPageSizes[1]});var arrPageScroll=___getPageScroll();$('#jquery-lightbox').css({top:arrPageScroll[1]+(arrPageSizes[3]/10),left:arrPageScroll[0]});});}
function _set_image_to_view(){$('#lightbox-loading').show();if(settings.fixedNavigation){$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}else{$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();}
var objImagePreloader=new Image();objImagePreloader.onload=function(){$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);objImagePreloader.onload=function(){};};objImagePreloader.src=settings.imageArray[settings.activeImage][0];};function _resize_container_image_box(intImageWidth,intImageHeight){var intCurrentWidth=$('#lightbox-container-image-box').width();var intCurrentHeight=$('#lightbox-container-image-box').height();var intWidth=(intImageWidth+(settings.containerBorderSize*2));var intHeight=(intImageHeight+(settings.containerBorderSize*2));var intDiffW=intCurrentWidth-intWidth;var intDiffH=intCurrentHeight-intHeight;$('#lightbox-container-image-box').animate({width:intWidth,height:intHeight},settings.containerResizeSpeed,function(){_show_image();});if((intDiffW==0)&&(intDiffH==0)){if($.browser.msie){___pause(250);}else{___pause(100);}}
$('#lightbox-container-image-data-box').css({width:intImageWidth});$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({height:intImageHeight+(settings.containerBorderSize*2)});};function _show_image(){$('#lightbox-loading').hide();$('#lightbox-image').fadeIn(function(){_show_image_data();_set_navigation();});_preload_neighbor_images();};function _show_image_data(){$('#lightbox-container-image-data-box').slideDown('fast');$('#lightbox-image-details-caption').hide();if(settings.imageArray[settings.activeImage][1]){$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();}
if(settings.imageArray.length>1){$('#lightbox-image-details-currentNumber').html(settings.txtImage+' '+(settings.activeImage+1)+' '+settings.txtOf+' '+settings.imageArray.length).show();}}
function _set_navigation(){$('#lightbox-nav').show();$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({'background':'transparent url('+settings.imageBlank+') no-repeat'});if(settings.activeImage!=0){if(settings.fixedNavigation){$('#lightbox-nav-btnPrev').css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnPrev').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnPrev+') left 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage-1;_set_image_to_view();return false;});}}
if(settings.activeImage!=(settings.imageArray.length-1)){if(settings.fixedNavigation){$('#lightbox-nav-btnNext').css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'}).unbind().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}else{$('#lightbox-nav-btnNext').unbind().hover(function(){$(this).css({'background':'url('+settings.imageBtnNext+') right 15% no-repeat'});},function(){$(this).css({'background':'transparent url('+settings.imageBlank+') no-repeat'});}).show().bind('click',function(){settings.activeImage=settings.activeImage+1;_set_image_to_view();return false;});}}
_enable_keyboard_navigation();}
function _enable_keyboard_navigation(){$(document).keydown(function(objEvent){_keyboard_action(objEvent);});}
function _disable_keyboard_navigation(){$(document).unbind();}
function _keyboard_action(objEvent){if(objEvent==null){keycode=event.keyCode;escapeKey=27;}else{keycode=objEvent.keyCode;escapeKey=objEvent.DOM_VK_ESCAPE;}
key=String.fromCharCode(keycode).toLowerCase();if((key==settings.keyToClose)||(key=='x')||(keycode==escapeKey)){_finish();}
if((key==settings.keyToPrev)||(keycode==37)){if(settings.activeImage!=0){settings.activeImage=settings.activeImage-1;_set_image_to_view();_disable_keyboard_navigation();}}
if((key==settings.keyToNext)||(keycode==39)){if(settings.activeImage!=(settings.imageArray.length-1)){settings.activeImage=settings.activeImage+1;_set_image_to_view();_disable_keyboard_navigation();}}}
function _preload_neighbor_images(){if((settings.imageArray.length-1)>settings.activeImage){objNext=new Image();objNext.src=settings.imageArray[settings.activeImage+1][0];}
if(settings.activeImage>0){objPrev=new Image();objPrev.src=settings.imageArray[settings.activeImage-1][0];}}
function _finish(){$('#jquery-lightbox').remove();$('#jquery-overlay').fadeOut(function(){$('#jquery-overlay').remove();});$('embed, object, select').css({'visibility':'visible'});}
function ___getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight);return arrayPageSize;};function ___getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll);return arrayPageScroll;};function ___pause(ms){var date=new Date();curDate=null;do{var curDate=new Date();}
while(curDate-date<ms);};return this.unbind('click').click(_initialize);};})(jQuery);

