/**
 * jQuery Lightbox
 * Version 0.5 - 11/29/2007
 * @author Warren Krewenki
 *
 * This package is distributed under the BSD license.
 * For full license information, see LICENSE.TXT
 *
 * Based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * Originally written to make use of the Prototype framework, and Script.acalo.us, now altered to use jQuery.
 *
 *
 **/

(function($){

	$.fn.lightbox = function(options){
		// build main options
		var opts = $.extend({}, $.fn.lightbox.defaults, options);
        
		return this.each(function(){
			$(this).click(function(){
    		    // initalize the lightbox
    		    initialize();
				start(this);
				return false;
			});
		});
		
	    /**
	     * initalize()
	     *
	     * @return void
	     * @author Warren Krewenki
	     */
	     
	    function initialize() {
		    $('#overlay').remove();
		    $('#lightbox').remove();
		    opts.inprogress = false;
		    
		    // if jsonData, build the imageArray from data provided in JSON format
            if(opts.jsonData && opts.jsonData.length > 0) {
                var parser = opts.jsonDataParser ? opts.jsonDataParser : $.fn.lightbox.parseJsonData;                
                opts.imageArray = [];
                opts.imageArray = parser(opts.jsonData);
	        }
		    
		    var outerImage = '<div id="outerImageContainer"><div id="imageContainer"><iframe id="lightboxIframe" /><img id="lightboxImage"><div id="hoverNav"><a href="javascript://" title="' + opts.strings.prevLinkTitle + '" id="prevLink"></a><a href="javascript://" id="nextLink" title="' + opts.strings.nextLinkTitle + '"></a></div><div id="loading"><a href="javascript://" id="loadingLink"><img src="'+opts.fileLoadingImage+'"></a></div></div></div>';
		    var imageData = '<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';

		    if (opts.displayHelp)
			    imageData += '<span id="helpDisplay">' + opts.strings.help + '</span>';

		    imageData += '<a href="javascript://" id="bottomNavClose" title="' + opts.strings.closeTitle + '"><img src="'+opts.fileBottomNavCloseImage+'"></a></div></div></div>';

		    var string;

		    if (opts.navbarOnTop) {
		      string = '<div id="overlay"></div><div id="lightbox">' + imageData + outerImage + '</div>';
		      $("body").append(string);
		      $("#imageDataContainer").addClass('ontop');
		    } else {
		      string = '<div id="overlay"></div><div id="lightbox">' + outerImage + imageData + '</div>';
		      $("body").append(string);
		    }

		    $("#overlay").click(function(){ end(); }).hide();
		    $("#lightbox").click(function(){ end();}).hide();
		    $("#loadingLink").click(function(){ end(); return false;});
		    $("#bottomNavClose").click(function(){ end(); return false; });
		    $('#outerImageContainer').width(opts.widthCurrent).height(opts.heightCurrent);
		    $('#imageDataContainer').width(opts.widthCurrent);
		
		    if (!opts.imageClickClose) {
        		$("#lightboxImage").click(function(){ return false; });
        		$("#hoverNav").click(function(){ return false; });
		    }
	    };
	    
	    function getPageSize() {
		    var jqueryPageSize = new Array($(document).width(),$(document).height(), $(window).width(), $(window).height());
		    return jqueryPageSize;
	    };
	    
	    function getPageScroll() {
		    var xScroll, yScroll;

		    if (self.pageYOffset) {
			    yScroll = self.pageYOffset;
			    xScroll = self.pageXOffset;
		    } else if (document.documentElement && document.documentElement.scrollTop){  // Explorer 6 Strict
			    yScroll = document.documentElement.scrollTop;
			    xScroll = document.documentElement.scrollLeft;
		    } else if (document.body) {// all other Explorers
			    yScroll = document.body.scrollTop;
			    xScroll = document.body.scrollLeft;
		    }

		    var arrayPageScroll = new Array(xScroll,yScroll);
		    return arrayPageScroll;
	    };
	    
	    function pause(ms) {
		    var date = new Date();
		    var curDate = null;
		    do{curDate = new Date();}
		    while(curDate - date < ms);
	    };
	    
	    function start(imageLink) {
		    $("select, embed, object").hide();
		    var arrayPageSize = getPageSize();
		    $("#overlay").hide().css({width: '100%', height: arrayPageSize[1]+'px', opacity : opts.overlayOpacity}).fadeIn();
		    imageNum = 0;

		    // if data is not provided by jsonData parameter
            if(!opts.jsonData) {
                opts.imageArray = [];
		        // if image is NOT part of a set..
		        if(!imageLink.rel || (imageLink.rel == '')){
			        // add single image to Lightbox.imageArray
			        opts.imageArray.push(new Array(imageLink.href, opts.displayTitle ? imageLink.title : ''));
		        } else {
		        // if image is part of a set..
			        $("a").each(function(){
				        if(this.href && (this.rel == imageLink.rel)){
					        opts.imageArray.push(new Array(this.href, opts.displayTitle ? this.title : ''));
				        }
			        });
		        }
		    }
		
		    if(opts.imageArray.length > 1) {
		        for(i = 0; i < opts.imageArray.length; i++){
				    for(j = opts.imageArray.length-1; j>i; j--){
					    if(opts.imageArray[i][0] == opts.imageArray[j][0]){
						    opts.imageArray.splice(j,1);
					    }
				    }
			    }
			    while(opts.imageArray[imageNum][0] != imageLink.href) { imageNum++;}
		    }

		    // calculate top and left offset for the lightbox
		    var arrayPageScroll = getPageScroll();
		    var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
		    var lightboxLeft = arrayPageScroll[0];
		    $('#lightbox').css({top: lightboxTop+'px', left: lightboxLeft+'px'}).show();


		    if (!opts.slideNavBar)
			    $('#imageData').hide();

		    changeImage(imageNum);
	    };
	    
	    function changeImage(imageNum) {
		    if(opts.inprogress == false){
			    opts.inprogress = true;
			    opts.activeImage = imageNum;	// update global var

			    // hide elements during transition
			    $('#loading').show();
			    $('#lightboxImage').hide();
			    $('#hoverNav').hide();
			    $('#prevLink').hide();
			    $('#nextLink').hide();

			    if (opts.slideNavBar) { // delay preloading image until navbar will slide up
				    // $('#imageDataContainer').slideUp(opts.navBarSlideSpeed, $.fn.doChangeImage);
				    $('#imageDataContainer').hide();
				    $('#imageData').hide();
				    doChangeImage();
			    } else {
			        doChangeImage();
			    }
		    }
	    };
	    
	    function doChangeImage() {

		    imgPreloader = new Image();

		    // once image is preloaded, resize image container
		    imgPreloader.onload=function(){
		        var newWidth = imgPreloader.width;
		        var newHeight = imgPreloader.height;


			    if (opts.fitToScreen) {
		            var arrayPageSize = getPageSize();
				    var ratio;
				    var initialPageWidth = arrayPageSize[2] - 2 * opts.borderSize;
				    var initialPageHeight = arrayPageSize[3] - 200;

				    if (imgPreloader.height > initialPageHeight)
				    {
					    newWidth = parseInt((initialPageHeight/imgPreloader.height) * imgPreloader.width);
					    newHeight = initialPageHeight;
				    }
				    else if (imgPreloader.width > initialPageWidth)
				    {
					    newHeight = parseInt((initialPageWidth/imgPreloader.width) * imgPreloader.height);
					    newWidth = initialPageWidth;
				    }
			    }

			    $('#lightboxImage').attr('src', opts.imageArray[opts.activeImage][0])
							       .width(newWidth).height(newHeight);
			    resizeImageContainer(newWidth, newHeight);
		    };

		    imgPreloader.src = opts.imageArray[opts.activeImage][0];
	    };
	    
	    function end() {
		    disableKeyboardNav();
		    $('#lightbox').hide();
		    $('#overlay').fadeOut();
		    $('select, object, embed').show();
	    };
	    
	    function preloadNeighborImages(){
		    if(opts.loopImages && opts.imageArray.length > 1) {
	            preloadNextImage = new Image();
	            preloadNextImage.src = opts.imageArray[(opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1][0]
	            
	            preloadPrevImage = new Image();
	            preloadPrevImage.src = opts.imageArray[(opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1][0]
	        } else {
		        if((opts.imageArray.length - 1) > opts.activeImage){
			        preloadNextImage = new Image();
			        preloadNextImage.src = opts.imageArray[opts.activeImage + 1][0];
		        }
		        if(opts.activeImage > 0){
			        preloadPrevImage = new Image();
			        preloadPrevImage.src = opts.imageArray[opts.activeImage - 1][0];
		        }
	        }
	    };
	    
	    function resizeImageContainer(imgWidth, imgHeight) {
		    // get current width and height
		    opts.widthCurrent = $("#outerImageContainer").outerWidth();
		    opts.heightCurrent = $("#outerImageContainer").outerHeight();
            
		    // get new width and height
		    var widthNew = (imgWidth  + (opts.borderSize * 2));
		    var heightNew = (imgHeight  + (opts.borderSize * 2));

		    // scalars based on change from old to new
		    opts.xScale = ( widthNew / opts.widthCurrent) * 100;
		    opts.yScale = ( heightNew / opts.heightCurrent) * 100;

		    // calculate size difference between new and old image, and resize if necessary
		    wDiff = opts.widthCurrent - widthNew;
		    hDiff = opts.heightCurrent - heightNew;

		    $('#imageDataContainer').animate({width: widthNew},opts.resizeSpeed,'linear');
		    $('#outerImageContainer').animate({width: widthNew},opts.resizeSpeed,'linear',function(){
			    $('#outerImageContainer').animate({height: heightNew},opts.resizeSpeed,'linear',function(){
				    showImage();
			    });
		    });

		    // if new and old image are same size and no scaling transition is necessary,
		    // do a quick pause to prevent image flicker.
		    if((hDiff == 0) && (wDiff == 0)){
			    if (jQuery.browser.msie){ pause(250); } else { pause(100);}
		    }

		    $('#prevLink').height(imgHeight);
		    $('#nextLink').height(imgHeight);
	    };
	    
	    function showImage() {
		    $('#loading').hide();
		    $('#lightboxImage').fadeIn("fast");
		    updateDetails();
		    preloadNeighborImages();

		    opts.inprogress = false;
	    };
	    
	    function updateDetails() {

		    $('#numberDisplay').html('');

		    if(opts.imageArray[opts.activeImage][1]){
			    $('#caption').html(opts.imageArray[opts.activeImage][1]).show();
		    }

		    // if image is part of set display 'Image x of x'
		    if(opts.imageArray.length > 1){
			    var nav_html;

			    nav_html = opts.strings.image + (opts.activeImage + 1) + opts.strings.of + opts.imageArray.length;

			    if (!opts.disableNavbarLinks) {
                    // display previous / next text links
                    if ((opts.activeImage) > 0 || opts.loopImages) {
                      nav_html = '<a title="' + opts.strings.prevLinkTitle + '" href="#" id="prevLinkText">' + opts.strings.prevLinkText + "</a>" + nav_html;
                    }

                    if (((opts.activeImage + 1) < opts.imageArray.length) || opts.loopImages) {
                      nav_html += '<a title="' + opts.strings.nextLinkTitle + '" href="#" id="nextLinkText">' + opts.strings.nextLinkText + "</a>";
                    }
                }

			    $('#numberDisplay').html(nav_html).show();
		    }

		    if (opts.slideNavBar) {
		        $("#imageData").slideDown(opts.navBarSlideSpeed);
		    } else {
			    $("#imageData").show();
		    }

		    var arrayPageSize = getPageSize();
		    $('#overlay').height(arrayPageSize[1]);
		    updateNav();
	    };
	    
	    function updateNav() {
		    if(opts.imageArray.length > 1){
			    $('#hoverNav').show();
                
                // if loopImages is true, always show next and prev image buttons 
                if(opts.loopImages) {
		            $('#prevLink,#prevLinkText').show().click(function(){
			            changeImage((opts.activeImage == 0) ? (opts.imageArray.length - 1) : opts.activeImage - 1); return false;
		            });
		            
		            $('#nextLink,#nextLinkText').show().click(function(){
			            changeImage((opts.activeImage == (opts.imageArray.length - 1)) ? 0 : opts.activeImage + 1); return false;
		            });
		        
		        } else {
			        // if not first image in set, display prev image button
			        if(opts.activeImage != 0){
				        $('#prevLink,#prevLinkText').show().click(function(){
					        changeImage(opts.activeImage - 1); return false;
				        });
			        }

			        // if not last image in set, display next image button
			        if(opts.activeImage != (opts.imageArray.length - 1)){
				        $('#nextLink,#nextLinkText').show().click(function(){

					        changeImage(opts.activeImage +1); return false;
				        });
			        }
                }
                
			    enableKeyboardNav();
		    }
	    };
	    
	    function keyboardAction(e) {
            var o = e.data.opts
		    var keycode = e.keyCode;
		    var escapeKey = 27;
            
		    var key = String.fromCharCode(keycode).toLowerCase();
            
		    if((key == 'x') || (key == 'o') || (key == 'c') || (keycode == escapeKey)){ // close lightbox
			    end();
		    } else if((key == 'p') || (keycode == 37)){ // display previous image
		        if(o.loopImages) {
		            disableKeyboardNav();
		            changeImage((o.activeImage == 0) ? (o.imageArray.length - 1) : o.activeImage - 1);
		        } 
		        else if(o.activeImage != 0){
				    disableKeyboardNav();
				    changeImage(o.activeImage - 1);
			    }
		    } else if((key == 'n') || (keycode == 39)){ // display next image
		        if (opts.loopImages) {
		            disableKeyboardNav();
		            changeImage((o.activeImage == (o.imageArray.length - 1)) ? 0 : o.activeImage + 1);
		        }
			    else if(o.activeImage != (o.imageArray.length - 1)){
				    disableKeyboardNav();
				    changeImage(o.activeImage + 1);
			    }
		    }
	    };
	    
	    function enableKeyboardNav() {
		    $(document).bind('keydown', {opts: opts}, keyboardAction);
	    };

	    function disableKeyboardNav() {
		    $(document).unbind('keydown');
	    };
	    
	};
    
    $.fn.lightbox.parseJsonData = function(data) {
        var imageArray = [];
        
        $.each(data, function(){
            imageArray.push(new Array(this.url, this.title));
        });
        
        return imageArray;
    };

	$.fn.lightbox.defaults = {
		fileLoadingImage : 'images/lightbox/loading.gif',
		fileBottomNavCloseImage : 'images/lighbox/closelabel.gif',
		overlayOpacity : 0.8,
		borderSize : 10,
		imageArray : new Array,
		activeImage : null,
		inprogress : false,
		resizeSpeed : 350,
		widthCurrent: 250,
		heightCurrent: 250,
		xScale : 1,
		yScale : 1,
		displayTitle: true,
		navbarOnTop: false,
		slideNavBar: false, // slide nav bar up/down between image resizing transitions
		navBarSlideSpeed: 350,
		displayHelp: false,
		strings : {
			help: ' \u2190 / P - previous image\u00a0\u00a0\u00a0\u00a0\u2192 / N - next image\u00a0\u00a0\u00a0\u00a0ESC / X - close image gallery',
			prevLinkTitle: 'previous image',
			nextLinkTitle: 'next image',
			prevLinkText:  '&laquo; Previous',
			nextLinkText:  'Next &raquo;',
			closeTitle: 'close image gallery',
			image: 'Image ',
			of: ' of '
		},
		fitToScreen: false,		// resize images if they are bigger than window
        disableNavbarLinks: false,
        loopImages: false,
        imageClickClose: true,
        jsonData: null,
        jsonDataParser: null
	};
	
})(jQuery);
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 *     http://www.opensource.org/licenses/mit-license.php
 *     http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
    $.fn.superfish = function(op){

        var sf = $.fn.superfish,
            c = sf.c,
            $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
            over = function(){
                var $$ = $(this), menu = getMenu($$);
                clearTimeout(menu.sfTimer);
                $$.showSuperfishUl().siblings().hideSuperfishUl();
            },
            out = function(){
                var $$ = $(this), menu = getMenu($$), o = sf.op;
                clearTimeout(menu.sfTimer);
                menu.sfTimer=setTimeout(function(){
                    o.retainPath=($.inArray($$[0],o.$path)>-1);
                    $$.hideSuperfishUl();
                    if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
                },o.delay);    
            },
            getMenu = function($menu){
                var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
                sf.op = sf.o[menu.serial];
                return menu;
            },
            addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
            
        return this.each(function() {
            var s = this.serial = sf.o.length;
            var o = $.extend({},sf.defaults,op);
            o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
                $(this).addClass([o.hoverClass,c.bcClass].join(' '))
                    .filter('li:has(ul)').removeClass(o.pathClass);
            });
            sf.o[s] = sf.op = o;
            
            $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
                if (o.autoArrows) addArrow( $('>a:first-child',this) );
            })
            .not('.'+c.bcClass)
                .hideSuperfishUl();
            
            var $a = $('a',this);
            $a.each(function(i){
                var $li = $a.eq(i).parents('li');
                $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
            });
            o.onInit.call(this);
            
        }).each(function() {
            var menuClasses = [c.menuClass];
            if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
            $(this).addClass(menuClasses.join(' '));
        });
    };

    var sf = $.fn.superfish;
    sf.o = [];
    sf.op = {};
    sf.IE7fix = function(){
        var o = sf.op;
        if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
            this.toggleClass(sf.c.shadowClass+'-off');
        };
    sf.c = {
        bcClass     : 'sf-breadcrumb',
        menuClass   : 'sf-js-enabled',
        anchorClass : 'sf-with-ul',
        arrowClass  : 'sf-sub-indicator',
        shadowClass : 'sf-shadow'
    };
    sf.defaults = {
        hoverClass    : 'sfHover',
        pathClass    : 'overideThisToUse',
        pathLevels    : 1,
        delay        : 800,
        animation    : {opacity:'show'},
        speed        : 'normal',
        autoArrows    : true,
        dropShadows : true,
        disableHI    : false,        // true disables hoverIntent detection
        onInit        : function(){}, // callback functions
        onBeforeShow: function(){},
        onShow        : function(){},
        onHide        : function(){}
    };
    $.fn.extend({
        hideSuperfishUl : function(){
            var o = sf.op,
                not = (o.retainPath===true) ? o.$path : '';
            o.retainPath = false;
            var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
                    .find('>ul').hide().css('visibility','hidden');
            o.onHide.call($ul);
            return this;
        },
        showSuperfishUl : function(){
            var o = sf.op,
                sh = sf.c.shadowClass+'-off',
                $ul = this.addClass(o.hoverClass)
                    .find('>ul:hidden').css('visibility','visible');
            sf.IE7fix.call($ul);
            o.onBeforeShow.call($ul);
            $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
            return this;
        }
    });

})(jQuery);
;(function($){$.fn.supersubs=function(options){var opts=$.extend({},$.fn.supersubs.defaults,options);return this.each(function(){var $$=$(this);var o=$.meta?$.extend({},opts,$$.data()):opts;var fontsize=$('<li id="menu-fontsize">&#8212;</li>').css({'padding':0,'position':'absolute','top':'-999em','width':'auto'}).appendTo($$).width();$('#menu-fontsize').remove();$ULs=$$.find('ul');$ULs.each(function(i){var $ul=$ULs.eq(i);var $LIs=$ul.children();var $As=$LIs.children('a');var liFloat=$LIs.css('white-space','nowrap').css('float');var emWidth=$ul.add($LIs).add($As).css({'float':'none','width':'auto'}).end().end()[0].clientWidth/fontsize;emWidth+=o.extraWidth;if(emWidth>o.maxWidth){emWidth=o.maxWidth;}
else if(emWidth<o.minWidth){emWidth=o.minWidth;}
emWidth+='em';$ul.css('width',emWidth);$LIs.css({'float':liFloat,'width':'100%','white-space':'normal'}).each(function(){var $childUl=$('>ul',this);var offsetDirection=$childUl.css('left')!==undefined?'left':'right';$childUl.css(offsetDirection,emWidth);});});});};$.fn.supersubs.defaults={minWidth:9,maxWidth:25,extraWidth:0};})(jQuery);
/**
 * Suggest Framework
 * Copyright (c) 2005-06 Matthew Ratzloff <matt@builtfromsource.com>
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This library 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
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

var sfw=new Array();String.prototype.decode=function(){return decodeURI(this);};String.prototype.encode=function(){var _1="";if(this==""){return this;}if(typeof encodeURIComponent=="function"){_1=encodeURIComponent(this);}else{var _2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";var _3=this.toUTF8();_1="";for(var i=0;i<_3.length;i++){if(_2.indexOf(_3.charAt(i))==-1){_1+="%"+_3.charCodeAt(i).toHex();}else{_1+=_3.charAt(i);}}}return _1;};String.prototype.toHex=function(){var _5="0123456789ABCDEF";return _5.charAt(this.value>>4)+_5.charAt(this.value&15);};String.prototype.toUTF8=function(){var a,b,i=0;var _7="";while(i<this.length){a=this.charCodeAt(i++);if(a>=56320&&a<57344){continue;}if(a>=55296&&a<56320){if(i>=this.length){continue;}b=this.charCodeAt(i++);if(s<56320||a>=56832){continue;}a=((a-55296)<<10)+(b-56320)+65536;}if(a<128){_7+=String.fromCharCode(a);}else{if(a<2048){_7+=String.fromCharCode(192+(a>>6),128+(a&63));}else{if(a<65536){_7+=String.fromCharCode(224+(a>>12),128+(a>>6&63),128+(a&63));}else{_7+=String.fromCharCode(240+(a>>18),128+(a>>12&63),128+(a>>6&63),128+(a&63));}}}}return _7;};String.prototype.trim=function(){return this.replace(/^[\s]+|[\s]+$/,"");};function sfwCreate(_8){if(sfw[_8].name&&sfw[_8].action){sfw[_8].inputContainer=document.getElementById(sfw[_8].name);sfw[_8].inputContainer.autocomplete="off";sfw[_8].inputContainer.onblur=function(){sfwHideOutput(_8);};sfw[_8].inputContainer.onclick=function(){sfwShowOutput(_8);};sfw[_8].inputContainer.onfocus=function(){sfwShowOutput(_8);};sfw[_8].inputContainer.onkeypress=function(_9){if(sfwGetKey(_9)==13){return false;}};sfw[_8].inputContainer.onkeydown=function(_a){sfwProcessKeys(_8,_a);};sfw[_8].outputContainer=document.createElement("div");sfw[_8].outputContainer.id=sfw[_8].name+"_list";sfw[_8].outputContainer.className="SuggestFramework_List";sfw[_8].outputContainer.style.position="absolute";sfw[_8].outputContainer.style.zIndex="10000";sfw[_8].outputContainer.style.width=sfw[_8].inputContainer.clientWidth+"px";sfw[_8].outputContainer.style.wordWrap="break-word";sfw[_8].outputContainer.style.cursor="default";sfw[_8].inputContainer.parentNode.insertBefore(sfw[_8].outputContainer,sfw[_8].inputContainer.nextSibling);sfw[_8].inputContainer.parentNode.insertBefore(document.createElement("br"),sfw[_8].outputContainer);if(sfw[_8].columns>1&&sfw[_8].capture>1){sfw[_8].hiddenInput=document.createElement("input");sfw[_8].hiddenInput.id="_"+sfw[_8].name;sfw[_8].hiddenInput.name="_"+sfw[_8].name;sfw[_8].hiddenInput.type="hidden";sfw[_8].inputContainer.parentNode.insertBefore(sfw[_8].hiddenInput,sfw[_8].inputContainer.nextSibling);}if(!sfwCreateConnection()){sfw[_8].proxy=document.createElement("iframe");sfw[_8].proxy.id="proxy";sfw[_8].proxy.style.width="0";sfw[_8].proxy.style.height="0";sfw[_8].proxy.style.display="none";document.body.appendChild(sfw[_8].proxy);if(window.frames&&window.frames["proxy"]){sfw[_8].proxy=window.frames["proxy"];}else{if(document.getElementById("proxy").contentWindow){sfw[_8].proxy=document.getElementById("proxy").contentWindow;}else{sfw[_8].proxy=document.getElementById("proxy");}}}sfwHideOutput(_8);sfwThrottle(_8);}else{throw "Suggest Framework Error: Instance \""+sfw[_8].name+"\" not initialized";}}function sfwCreateConnection(){var _b;try{_b=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){if(typeof XMLHttpRequest!="undefined"){_b=new XMLHttpRequest();}}return _b;}function sfwGetKey(e){return ((window.event)?window.event.keyCode:e.which);}function sfwHideOutput(_d){sfw[_d].outputContainer.style.display="none";}function sfwHighlight(_e,_f){sfw[_e].suggestionsIndex=_f;for(var i in sfw[_e].suggestions){var _11=document.getElementById(sfw[_e].name+"_suggestions["+i+"]").getElementsByTagName("td");for(var j in _11){_11[j].className="SuggestFramework_Normal";}}var _13=document.getElementById(sfw[_e].name+"_suggestions["+sfw[_e].suggestionsIndex+"]").getElementsByTagName("td");for(var i in _13){_13[i].className="SuggestFramework_Highlighted";}}function sfwIsHidden(_15){return ((sfw[_15].outputContainer.style.display=="none")?true:false);}function sfwProcessKeys(_16,e){var _18=40;var _19=38;var _1a=9;var _1b=13;var _1c=27;if(!sfwIsHidden(_16)){switch(sfwGetKey(e)){case _18:sfwSelectNext(_16);return;case _19:sfwSelectPrevious(_16);return;case _1b:sfwSelectThis(_16);return;case _1a:sfwSelectThis(_16);return;case _1c:sfwHideOutput(_16);return;default:return;}}}function sfwProcessProxyRequest(_1d){var _1e=((sfw[_1d].proxy.document)?sfw[_1d].proxy.document:sfw[_1d].proxy.contentDocument);_1e=_1e.body.innerHTML.replace(/\r|\n/g," ").trim();if(typeof eval(_1e)=="object"){sfwSuggest(_1d,eval(_1e));}else{setTimeout("sfwProcessProxyRequest("+_1d+")",100);}}function sfwProcessRequest(_1f){if(sfw[_1f].connection.readyState==4){if(sfw[_1f].connection.status==200){sfwSuggest(_1f,eval(sfw[_1f].connection.responseText));}}}function sfwQuery(_20){sfwThrottle(_20);var _21=sfw[_20].inputContainer.value;if(_21==""||_21==sfw[_20].previous){return;}sfw[_20].previous=_21;var url=sfw[_20].action+"?type="+sfw[_20].name+"&q="+_21.trim().encode();sfwRequest(_20,url);}function sfwRequest(_23,url){if(sfw[_23].connection=sfwCreateConnection()){sfw[_23].connection.onreadystatechange=function(){sfwProcessRequest(_23);};sfw[_23].connection.open("GET",url,true);sfw[_23].connection.send(null);}else{sfw[_23].proxy.location.replace(url);sfwProcessProxyRequest(_23);}}function sfwSelectThis(_25,_26){if(sfw[_25].columns>1&&sfw[_25].capture>1){sfw[_25].hiddenInput.value=sfw[_25].suggestions[sfw[_25].suggestionsIndex][sfw[_25].capture-1];}if(!isNaN(_26)){sfw[_25].suggestionsIndex=_26;}var _27=sfw[_25].suggestions[sfw[_25].suggestionsIndex];if(sfw[_25].columns>1){_27=_27[0];}sfw[_25].inputContainer.value=_27;sfw[_25].previous=_27;sfwHideOutput(_25);}function sfwSelectNext(_28){sfwSetTextSelectionRange(_28);if(typeof sfw[_28].suggestions[(sfw[_28].suggestionsIndex+1)]!="undefined"){if(typeof sfw[_28].suggestions[sfw[_28].suggestionsIndex]!="undefined"){document.getElementById(sfw[_28].name+"_suggestions["+sfw[_28].suggestionsIndex+"]").className="SuggestFramework_Normal";}sfw[_28].suggestionsIndex++;sfwHighlight(_28,sfw[_28].suggestionsIndex);}}function sfwSelectPrevious(_29){sfwSetTextSelectionRange(_29);if(typeof sfw[_29].suggestions[(sfw[_29].suggestionsIndex-1)]!="undefined"){if(typeof sfw[_29].suggestions[sfw[_29].suggestionsIndex]!="undefined"){document.getElementById(sfw[_29].name+"_suggestions["+sfw[_29].suggestionsIndex+"]").className="SuggestFramework_Normal";}sfw[_29].suggestionsIndex--;sfwHighlight(_29,sfw[_29].suggestionsIndex);}}function sfwSetTextSelectionRange(_2a,_2b,end){if(!_2b){var _2d=sfw[_2a].inputContainer.value.length;}if(!end){var end=sfw[_2a].inputContainer.value.length;}if(sfw[_2a].inputContainer.setSelectionRange){sfw[_2a].inputContainer.setSelectionRange(_2d,end);}else{if(sfw[_2a].inputContainer.createTextRange){var _2f=sfw[_2a].inputContainer.createTextRange();_2f.moveStart("character",_2d);_2f.moveEnd("character",end);_2f.select();}}}function sfwShowOutput(_30){if(typeof sfw[_30].suggestions!="undefined"&&sfw[_30].suggestions.length){sfw[_30].outputContainer.style.display="block";}}function sfwSuggest(_31,_32){sfw[_31].suggestions=_32;sfw[_31].suggestionsIndex=-1;sfw[_31].outputContainer.innerHTML="";var _33="<table style=\"width: 100%; margin: 0; padding: 0\" cellspacing=\"0\" cellpadding=\"0\">";if(sfw[_31].heading&&sfw[_31].suggestions.length){var _34=sfw[_31].suggestions.shift();var _35="<thead>";var _36="<tr>";for(var i=0;i<sfw[_31].columns;i++){var _38=(String)((sfw[_31].columns>1)?_34[i]:_34);var _39="<td class=\"SuggestFramework_Heading\"";if(sfw[_31].columns>1&&i==sfw[_31].columns-1){_39+=" style=\"text-align: right\"";}_39+=">"+_38.decode().trim()+"</td>";_36+=_39;}_36+="</tr>";_35+=_36;_35+="</thead>";_33+=_35;}var _3a="<tbody>";for(var i in sfw[_31].suggestions){var _3c="<tr id=\""+sfw[_31].name+"_suggestions["+i+"]\">";for(var j=0;j<sfw[_31].columns;j++){var _3e=(String)((sfw[_31].columns>1)?sfw[_31].suggestions[i][j]:sfw[_31].suggestions[i]);var _3f="<td class=\"SuggestFramework_Normal\"";if(sfw[_31].columns>1&&j==sfw[_31].columns-1){_3f+=" style=\"text-align: right\"";}_3f+=">"+_3e.decode().trim()+"</td>";_3c+=_3f;}_3c+="</tr>";_33+=_3c;}_3a+="</tbody>";_33+=_3a;_33+="</table>";sfw[_31].outputContainer.innerHTML=_33;for(var i in sfw[_31].suggestions){var row=document.getElementById(sfw[_31].name+"_suggestions["+i+"]");row.onmouseover=new Function("sfwHighlight("+_31+", "+i+")");row.onmousedown=new Function("sfwSelectThis("+_31+", "+i+")");}sfwShowOutput(_31);}function sfwThrottle(_42){setTimeout("sfwQuery("+_42+")",sfw[_42].delay);}function initializeSuggestFramework(){function getAttributeByName(_43,_44){if(typeof NamedNodeMap!="undefined"){if(_43.attributes.getNamedItem(_44)){return _43.attributes.getNamedItem(_44).value;}}else{return _43.getAttribute(_44);}}var _45=document.getElementsByTagName("input");try{for(var _46=0;_46<_45.length;_46++){if(getAttributeByName(_45[_46],"name")&&getAttributeByName(_45[_46],"type")=="text"&&getAttributeByName(_45[_46],"action")){sfw[_46]=new Object();sfw[_46].action=getAttributeByName(_45[_46],"action");sfw[_46].capture=1;sfw[_46].columns=1;sfw[_46].delay=1000;sfw[_46].heading=false;sfw[_46].name=getAttributeByName(_45[_46],"name");if(getAttributeByName(_45[_46],"capture")){sfw[_46].capture=getAttributeByName(_45[_46],"capture");}if(getAttributeByName(_45[_46],"columns")){sfw[_46].columns=getAttributeByName(_45[_46],"columns");}if(getAttributeByName(_45[_46],"delay")){sfw[_46].delay=getAttributeByName(_45[_46],"delay");}if(getAttributeByName(_45[_46],"heading")){sfw[_46].heading=getAttributeByName(_45[_46],"heading");}sfwCreate(_46);}}}catch(e){}}



function slideShow() {

	//Set the opacity of all images to 0
	$('#gallery a').css({opacity: 0.0});
	
	//Get the first image and display it (set it to full opacity)
	$('#gallery a:first').css({opacity: 1.0});
	
	//Set the caption background to semi-transparent
	$('#gallery .caption').css({opacity: 0.7});

	//Resize the width of the caption according to the image width
	$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
	
	//Get the caption of the first image from REL attribute and display it
	$('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	.animate({opacity: 0.7}, 400);
	
	//Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	setInterval('gallery()',9000);
	
}

function gallery() {
	
	//if no IMGs have the show class, grab the first image
	var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));

	//Get next image, if it reached the end of the slideshow, rotate it back to the first image
	var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
	
	//Get next image caption
	var caption = next.find('img').attr('rel');	
	
	//Set the fade in effect for the next image, show class has higher z-index
	next.css({opacity: 0.0})
	.addClass('show')
	.animate({opacity: 1.0}, 1000);

	//Hide the current image
	current.animate({opacity: 0.0}, 1000)
	.removeClass('show');
	
	//Set the opacity to 0 and height to 1px
	$('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
	
	//Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	$('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '26px'},500 );
	
	//Display the content
	$('#gallery .content').html(caption);
		
}

$(document).ready(function(){
  // Reset Font Size
  var originalFontSize = $('#bodycopy p').css('font-size');
  $(".resetFont").click(function(){
  $('#bodycopy p').css('font-size', originalFontSize);
  });
  // Increase Font Size
  $(".increaseFont").click(function(){
  	var currentFontSize = $('#bodycopy p').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('#bodycopy p').css('font-size', newFontSize);
	return false;
  });
  // Decrease Font Size
  $(".decreaseFont").click(function(){
  	var currentFontSize = $('#bodycopy p').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('#bodycopy p').css('font-size', newFontSize);
	return false;
  });
});
