(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())
+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')
+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}
return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))
offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);
;(function($){var helper={},current,title,tID,tIDremove,removeDelay,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,removeDelay:200,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip-settings",settings);this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";})
.hover(save,hide)
.click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')
$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)
return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>')
.appendTo(document.body)
.hide();if($.fn.bgiframe)
helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);$(helper.parent).hover(function(){$.tooltip.blocked=true},function(event){$.tooltip.blocked=false;hide(event);});}
function settings(element){return $.data(element,"tooltip-settings");}
function handle(event){if(settings(this).delay)
tID=setTimeout(show,settings(this).delay);else
show();if(tIDremove)
removeToolTip();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}
function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))
return;current=this;title=this.tooltipText;removeDelay=settings(this).removeDelay;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}
helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)
helper.body.append("<br/>");helper.body.append(part);}
helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}
if(settings(this).showURL&&$(this).url())
helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)
helper.parent.fixPNG();handle.apply(this,arguments);}
function show(){tID=null;if(tIDremove)
removeToolTip(0);tIDremove=null;helper.parent.fadeIn(100);update();}
function update(event){if($.tooltip.blocked)
return;if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}
if(current==null){$(document.body).unbind('mousemove',update);return;}
helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event&&!settings(current).topElem){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;helper.parent.css({left:left+'px',top:top+'px'});}
else if(event&&settings(current).topElem){var elementOffset=$(event.target).offset();left=elementOffset.left+settings(current).left;top=elementOffset.top+settings(current).top;helper.parent.css({left:left+'px',top:top+'px'});}
var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}
if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}
function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}
function hide(event){if($.tooltip.blocked)
return;if(tIDremove)
return;if(tID)
clearTimeout(tID);current=null;if(removeDelay)
tIDremove=setTimeout(removeToolTip,removeDelay);else
removeToolTip();if($(this).data("fixPNG"))
helper.parent.unfixPNG();}
function removeToolTip(delay){if(delay!==0)
delay=100;if(tIDremove){clearTimeout(tIDremove);tIDremove=null;}
if($.tooltip.blocked)
return;helper.parent.hide().removeClass($.tooltip.defaults.extraClass);}
$.fn.Tooltip=$.fn.tooltip;})(jQuery);
Array.prototype.removeDuplicates=function(){for(var i=1;i<this.length;i++){if(this[i][0]==this[i-1][0]){this.splice(i,1);}}};Array.prototype.empty=function(){for(var i=0;i<=this.length;i++){this.shift();}};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};function LyteBox(){this.theme='blue';this.hideFlash=true;this.outerBorder=true;this.resizeSpeed=8;this.maxOpacity=80;this.navType=1;this.autoResize=true;this.doAnimations=true;this.minWidth=800;this.minHeight=400;this.borderSize=12;this.slideInterval=4000;this.showNavigation=true;this.showClose=true;this.showDetails=true;this.showPlayPause=true;this.autoEnd=true;this.pauseOnNextClick=false;this.pauseOnPrevClick=true;if(this.resizeSpeed>10){this.resizeSpeed=10;}
if(this.resizeSpeed<1){resizeSpeed=1;}
this.resizeDuration=(11-this.resizeSpeed)*0.15;this.resizeWTimerArray=new Array();this.resizeWTimerCount=0;this.resizeHTimerArray=new Array();this.resizeHTimerCount=0;this.showContentTimerArray=new Array();this.showContentTimerCount=0;this.overlayTimerArray=new Array();this.overlayTimerCount=0;this.imageTimerArray=new Array();this.imageTimerCount=0;this.timerIDArray=new Array();this.timerIDCount=0;this.slideshowIDArray=new Array();this.slideshowIDCount=0;this.imageArray=new Array();this.activeImage=null;this.slideArray=new Array();this.activeSlide=null;this.frameArray=new Array();this.activeFrame=null;this.checkFrame();this.isSlideshow=false;this.isLyteframe=false;if(jQuery.browser.msie)this.ie=true;else this.ie=false;this.ie7=(this.ie&&window.XMLHttpRequest);this.initialize();}
LyteBox.prototype.initialize=function(){this.updateLyteboxItems();var objBody=this.doc.getElementsByTagName("body").item(0);if(this.doc.getElementById('lbOverlay')){objBody.removeChild(this.doc.getElementById("lbOverlay"));objBody.removeChild(this.doc.getElementById("lbMain"));}
var objOverlay=this.doc.createElement("div");objOverlay.setAttribute('id','lbOverlay');objOverlay.setAttribute((this.ie?'className':'class'),this.theme);if((this.ie&&!this.ie7)||(this.ie7&&this.doc.compatMode=='BackCompat')){objOverlay.style.position='absolute';}
objOverlay.style.display='none';objBody.appendChild(objOverlay);var objLytebox=this.doc.createElement("div");objLytebox.setAttribute('id','lbMain');objLytebox.style.display='none';objBody.appendChild(objLytebox);var objOuterContainer=this.doc.createElement("div");objOuterContainer.setAttribute('id','lbOuterContainer');objOuterContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objOuterContainer);var objIframeContainer=this.doc.createElement("div");objIframeContainer.setAttribute('id','lbIframeContainer');objIframeContainer.style.display='none';objOuterContainer.appendChild(objIframeContainer);var objIframe=this.doc.createElement("iframe");objIframe.setAttribute('id','lbIframe');objIframe.setAttribute('name','lbIframe');objIframe.style.display='none';objIframeContainer.appendChild(objIframe);var objImageContainer=this.doc.createElement("div");objImageContainer.setAttribute('id','lbImageContainer');objOuterContainer.appendChild(objImageContainer);var objLyteboxImage=this.doc.createElement("img");objLyteboxImage.setAttribute('id','lbImage');objImageContainer.appendChild(objLyteboxImage);var objLoading=this.doc.createElement("div");objLoading.setAttribute('id','lbLoading');objOuterContainer.appendChild(objLoading);var objDetailsContainer=this.doc.createElement("div");objDetailsContainer.setAttribute('id','lbDetailsContainer');objDetailsContainer.setAttribute((this.ie?'className':'class'),this.theme);objLytebox.appendChild(objDetailsContainer);var objDetailsData=this.doc.createElement("div");objDetailsData.setAttribute('id','lbDetailsData');objDetailsData.setAttribute((this.ie?'className':'class'),this.theme);objDetailsContainer.appendChild(objDetailsData);var objDetails=this.doc.createElement("div");objDetails.setAttribute('id','lbDetails');objDetailsData.appendChild(objDetails);var objCaption=this.doc.createElement("span");objCaption.setAttribute('id','lbCaption');objDetails.appendChild(objCaption);var objHoverNav=this.doc.createElement("div");objHoverNav.setAttribute('id','lbHoverNav');objImageContainer.appendChild(objHoverNav);var objBottomNav=this.doc.createElement("div");objBottomNav.setAttribute('id','lbBottomNav');objDetailsData.appendChild(objBottomNav);var objPrev=this.doc.createElement("a");objPrev.setAttribute('id','lbPrev');objPrev.setAttribute((this.ie?'className':'class'),this.theme);objPrev.setAttribute('href','#');objHoverNav.appendChild(objPrev);var objNext=this.doc.createElement("a");objNext.setAttribute('id','lbNext');objNext.setAttribute((this.ie?'className':'class'),this.theme);objNext.setAttribute('href','#');objHoverNav.appendChild(objNext);var objNumberDisplay=this.doc.createElement("span");objNumberDisplay.setAttribute('id','lbNumberDisplay');objDetails.appendChild(objNumberDisplay);var objNavDisplay=this.doc.createElement("span");objNavDisplay.setAttribute('id','lbNavDisplay');objNavDisplay.style.display='none';objDetails.appendChild(objNavDisplay);var objClose=this.doc.createElement("a");objClose.setAttribute('id','lbClose');objClose.setAttribute((this.ie?'className':'class'),this.theme);objClose.setAttribute('href','#');objBottomNav.appendChild(objClose);var objPause=this.doc.createElement("a");objPause.setAttribute('id','lbPause');objPause.setAttribute((this.ie?'className':'class'),this.theme);objPause.setAttribute('href','#');objPause.style.display='none';objBottomNav.appendChild(objPause);var objPlay=this.doc.createElement("a");objPlay.setAttribute('id','lbPlay');objPlay.setAttribute((this.ie?'className':'class'),this.theme);objPlay.setAttribute('href','#');objPlay.style.display='none';objBottomNav.appendChild(objPlay);};LyteBox.prototype.updateLyteboxItems=function(){var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');for(var i=0;i<anchors.length;i++){var anchor=anchors[i];var relAttribute=String(anchor.getAttribute('rel'));if(anchor.getAttribute('href')){if(relAttribute.toLowerCase().match('lytebox')){anchor.onclick=function(){myLytebox.start(this,false,false);return false;}}else if(relAttribute.toLowerCase().match('lyteshow')){anchor.onclick=function(){myLytebox.start(this,true,false);return false;}}else if(relAttribute.toLowerCase().match('lyteframe')){anchor.onclick=function(){myLytebox.start(this,false,true);return false;}}}}};LyteBox.prototype.start=function(imageLink,doSlide,doFrame){if(this.ie&&!this.ie7){this.toggleSelects('hide');}
if(this.hideFlash){this.toggleFlash('hide');}
this.isLyteframe=(doFrame?true:false);var pageSize=this.getPageSize();var winWidth=pageSize[2]*.8;winWidth=(winWidth<this.minWidth)?this.minWidth:winWidth;var winHeight=pageSize[3]*.8;winHeight=(winHeight<this.minHeight)?this.minHeight:winHeight;var objOverlay=this.doc.getElementById('lbOverlay');var objBody=this.doc.getElementsByTagName("body").item(0);objOverlay.style.height=pageSize[1]+"px";objOverlay.style.display='';this.appear('lbOverlay',(this.doAnimations?0:this.maxOpacity));var anchors=(this.isFrame)?window.parent.frames[window.name].document.getElementsByTagName('a'):document.getElementsByTagName('a');if(this.isLyteframe){this.frameArray=[];this.frameNum=0;if((imageLink.getAttribute('rel')=='lyteframe')){var rev=imageLink.getAttribute('rev');this.frameArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title'),(rev==null||rev==''?'width: '+winWidth+'px; height: '+winHeight+'px; scrolling: auto;':rev)));}else{if(imageLink.getAttribute('rel').indexOf('lyteframe')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){var rev=anchor.getAttribute('rev');this.frameArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title'),(rev==null||rev==''?'width: '+winWidth+'px; height: '+winHeight+'px; scrolling: auto;':rev)));}}
this.frameArray.removeDuplicates();while(this.frameArray[this.frameNum][0]!=imageLink.getAttribute('href')){this.frameNum++;}}}}else{this.imageArray=[];this.imageNum=0;this.slideArray=[];this.slideNum=0;if((imageLink.getAttribute('rel')=='lytebox')){this.imageArray.push(new Array(imageLink.getAttribute('href'),imageLink.getAttribute('title')));}else{if(imageLink.getAttribute('rel').indexOf('lytebox')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.imageArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.imageArray.removeDuplicates();while(this.imageArray[this.imageNum][0]!=imageLink.getAttribute('href')){this.imageNum++;}}
if(imageLink.getAttribute('rel').indexOf('lyteshow')!=-1){for(var i=0;i<anchors.length;i++){var anchor=anchors[i];if(anchor.getAttribute('href')&&(anchor.getAttribute('rel')==imageLink.getAttribute('rel'))){this.slideArray.push(new Array(anchor.getAttribute('href'),anchor.getAttribute('title')));}}
this.slideArray.removeDuplicates();while(this.slideArray[this.slideNum][0]!=imageLink.getAttribute('href')){this.slideNum++;}}}}
var object=this.doc.getElementById('lbMain');object.style.top=(this.getPageScroll()+(pageSize[3]/ 15)) + "px";
		object.style.display = '';
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbMain').onclick = function(e) {
		var e = e;
		if (!e) {
			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
				e = window.parent.window.event;
			} else {
				e = window.event;
			}
		}
		var id = (e.target ? e.target.id : e.srcElement.id);
		if (id == 'lbMain') { myLytebox.end(); return false; }
	}
	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }	
	this.isSlideshow = doSlide;
	this.isPaused = (this.slideNum != 0 ? true : false);
	if (this.isSlideshow && this.showPlayPause && this.isPaused) {
		this.doc.getElementById('lbPlay').style.display = '';
		this.doc.getElementById('lbPause').style.display = 'none';
	}
	if (this.isLyteframe) {
		this.changeContent(this.frameNum);
	} else {
		if (this.isSlideshow) {
			this.changeContent(this.slideNum);
		} else {
			this.changeContent(this.imageNum);
		}
	}
};
LyteBox.prototype.changeContent = function(imageNum) {
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.activeImage = this.activeSlide = this.activeFrame = imageNum;
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbLoading').style.display = '';
	this.doc.getElementById('lbImage').style.display = 'none';
	this.doc.getElementById('lbIframe').style.display = 'none';
	this.doc.getElementById('lbPrev').style.display = 'none';
	this.doc.getElementById('lbNext').style.display = 'none';
	this.doc.getElementById('lbIframeContainer').style.display = 'none';
	this.doc.getElementById('lbDetailsContainer').style.display = 'none';
	this.doc.getElementById('lbNumberDisplay').style.display = 'none';
	if (this.navType == 2 || this.isLyteframe) {
		object = this.doc.getElementById('lbNavDisplay');
		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#"id="lbPrev2"class="' + this.theme + '"style="display: none;">&laquo;prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b><span id="lbNext2_Off"style="display: none;"class="' + this.theme + '">next&raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
		object.style.display = 'none';
	}
	if (this.isLyteframe) {
		var iframe = myLytebox.doc.getElementById('lbIframe');
		var styles = this.frameArray[this.activeFrame][2];
		var aStyles = styles.split(';');
		for (var i = 0; i < aStyles.length; i++) {
			if (aStyles[i].indexOf('width:') >= 0) {
				var w = aStyles[i].replace('width:', '');
				iframe.width = w.trim();
			} else if (aStyles[i].indexOf('height:') >= 0) {
				var h = aStyles[i].replace('height:', '');
				iframe.height = h.trim();
			} else if (aStyles[i].indexOf('scrolling:') >= 0) {
				var s = aStyles[i].replace('scrolling:', '');
				iframe.scrolling = s.trim();
			} else if (aStyles[i].indexOf('border:') >= 0) {
				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
				//var b = aStyles[i].replace('border:', '');
				//iframe.style.border = b.trim();
			}
		}
		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
	} else {
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (myLytebox.autoResize) {
				var pagesize = myLytebox.getPageSize();
				var x = pagesize[2] - 150;
				var y = pagesize[3] - 150;
				if (imageWidth > x) {
					imageHeight = Math.round(imageHeight * (x / imageWidth));
					imageWidth = x; 
					if (imageHeight > y) { 
						imageWidth = Math.round(imageWidth * (y / imageHeight));
						imageHeight = y; 
					}
				} else if (imageHeight > y) { 
					imageWidth = Math.round(imageWidth * (y / imageHeight));
					imageHeight = y; 
					if (imageWidth > x) {
						imageHeight = Math.round(imageHeight * (x / imageWidth));
						imageWidth = x;
					}
				}
			}
			var lbImage = myLytebox.doc.getElementById('lbImage')
			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
			lbImage.width = imageWidth;
			lbImage.height = imageHeight;
			myLytebox.resizeContainer(imageWidth, imageHeight);
			imgPreloader.onload = function() {};
		}
		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
	}
};
LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;
	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
	if (!(hDiff == 0)) {
		this.hDone = false;
		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
	} else {
		this.hDone = true;
	}
	if (!(wDiff == 0)) {
		this.wDone = false;
		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
	} else {
		this.wDone = true;
	}
	if ((hDiff == 0) && (wDiff == 0)) {
		if (this.ie){ this.pause(250); } else { this.pause(100); } 
	}
	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
	this.doc.getElementById('lbNext').style.height = imgHeight + "px";
	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
	this.showContent();
};
LyteBox.prototype.showContent = function() {
	if (this.wDone && this.hDone) {
		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
		if (this.outerBorder) {
			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
		}
		this.doc.getElementById('lbLoading').style.display = 'none';
		if (this.isLyteframe) {
			this.doc.getElementById('lbIframe').style.display = '';
			this.appear('lbIframe', (this.doAnimations ? 0 : 100));
		} else {
			this.doc.getElementById('lbImage').style.display = '';
			this.appear('lbImage', (this.doAnimations ? 0 : 100));
			this.preloadNeighborImages();
		}
		if (this.isSlideshow) {
			if(this.activeSlide == (this.slideArray.length - 1)) {
				if (this.autoEnd) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
				}
			} else {
				if (!this.isPaused) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
				}
			}
			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
			this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
		} else {
			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
				this.doc.getElementById('lbNavDisplay').style.display = '';
			} else {
				this.doc.getElementById('lbNavDisplay').style.display = 'none';
			}
			this.doc.getElementById('lbClose').style.display = '';
			this.doc.getElementById('lbDetails').style.display = '';
			this.doc.getElementById('lbPause').style.display = 'none';
			this.doc.getElementById('lbPlay').style.display = 'none';
		}
		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
		try {
			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
		} catch(e) { }
	} else {
		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
	}
};
LyteBox.prototype.updateDetails = function() {
	var object = this.doc.getElementById('lbCaption');
	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
	object.style.display = '';
	object.innerHTML = (sTitle == null ? '' : sTitle);
	this.updateNav();
	this.doc.getElementById('lbDetailsContainer').style.display = '';
	object = this.doc.getElementById('lbNumberDisplay');
	if (this.isSlideshow && this.slideArray.length > 1) {
		object.style.display = '';
		object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
	} else if (this.imageArray.length > 1 && !this.isLyteframe) {
		object.style.display = '';
		object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
	} else if (this.frameArray.length > 1 && this.isLyteframe) {
		object.style.display = '';
//		object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length;
		object.innerHTML = eval(this.activeFrame + 1) + " of " + this.frameArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = '';
	} else {
		this.doc.getElementById('lbNavDisplay').style.display = 'none';
	}
	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
};
LyteBox.prototype.updateNav = function() {
	if (this.isSlideshow) {
		if (this.activeSlide != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if (this.activeSlide != (this.slideArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	} else if (this.isLyteframe) {
		if(this.activeFrame != 0) {
			var object = this.doc.getElementById('lbPrev2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
				}
		} else {
			this.doc.getElementById('lbPrev2_Off').style.display = '';
		}
		if(this.activeFrame != (this.frameArray.length - 1)) {
			var object = this.doc.getElementById('lbNext2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
				}
		} else {
			this.doc.getElementById('lbNext2_Off').style.display = '';
		}		
	} else {
		if(this.activeImage != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if(this.activeImage != (this.imageArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	}
	this.enableKeyboardNav();
};
LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };
LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };
LyteBox.prototype.keyboardAction = function(e) {
	var keycode = key = escape = null;
	keycode	= (e == null) ? event.keyCode : e.which;
	key		= String.fromCharCode(keycode).toLowerCase();
	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
	if ((key == 'x') || (key == 'c') || (keycode == escape)) {
		myLytebox.end();
	} else if ((key == 'p') || (keycode == 37)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide - 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame - 1);
			}
		} else {
			if(myLytebox.activeImage != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage - 1);
			}
		}
	} else if ((key == 'n') || (keycode == 39)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide + 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame + 1);
			}
		} else {
			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage + 1);
			}
		}
	}
};
LyteBox.prototype.preloadNeighborImages = function() {
	if (this.isSlideshow) {
		if ((this.slideArray.length - 1) > this.activeSlide) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
		}
		if(this.activeSlide > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
		}
	} else {
		if ((this.imageArray.length - 1) > this.activeImage) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
		}
		if(this.activeImage > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
		}
	}
};
LyteBox.prototype.togglePlayPause = function(hideID, showID) {
	if (this.isSlideshow && hideID == "lbPause") {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.doc.getElementById(hideID).style.display = 'none';
	this.doc.getElementById(showID).style.display = '';
	if (hideID == "lbPlay") {
		this.isPaused = false;
		if (this.activeSlide == (this.slideArray.length - 1)) {
			this.end();
		} else {
			this.changeContent(this.activeSlide + 1);
		}
	} else {
		this.isPaused = true;
	}
};
LyteBox.prototype.end = function(caller) {
	var closeClick = (caller == 'slideshow' ? false : true);
	if (this.isSlideshow && this.isPaused && !closeClick) { return; }
	this.disableKeyboardNav();
	this.doc.getElementById('lbMain').style.display = 'none';
	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
	this.toggleSelects('visible');
	if (this.hideFlash) { this.toggleFlash('visible'); }
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	if (this.isLyteframe) {
		 this.initialize();
	}
};
LyteBox.prototype.checkFrame = function() {
	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
		this.isFrame = true;
		this.lytebox = "window.parent." + window.name + ".myLytebox";
		this.doc = parent.document;
	} else {
		this.isFrame = false;
		this.lytebox = "myLytebox";
		this.doc = document;
	}
};
LyteBox.prototype.getPixelRate = function(cur, img) {
	var diff = (img > cur) ? img - cur : cur - img;
	if (diff >= 0 && diff <= 100) { return 10; }
	if (diff > 100 && diff <= 200) { return 15; }
	if (diff > 200 && diff <= 300) { return 20; }
	if (diff > 300 && diff <= 400) { return 25; }
	if (diff > 400 && diff <= 500) { return 30; }
	if (diff > 500 && diff <= 600) { return 35; }
	if (diff > 600 && diff <= 700) { return 40; }
	if (diff > 700) { return 45; }
};
LyteBox.prototype.appear = function(id, opacity) {
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + (opacity + 10) + ")";
	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		this.updateDetails();
	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
		return;
	} else if (opacity >= 100 && id == 'lbDetailsContainer') {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
	} else {
		if (id == 'lbOverlay') {
			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);
		} else {
			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);
		}
	}
};
LyteBox.prototype.fade = function(id, opacity) {
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
	if (opacity <= 0) {
		try {
			object.display = 'none';
		} catch(err) { }
	} else if (id == 'lbOverlay') {
		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);
	} else {
		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);
	}
};
LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
	if (!this.hDone) {
		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
		return;
	}
	var object = this.doc.getElementById(id);
	var timer = speed ? speed : (this.resizeDuration/2);
	var newW = (this.doAnimations ? curW : maxW);
	object.style.width = (newW) + "px";
	if (newW < maxW) {
		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
	} else if (newW > maxW) {
		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
	}
	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
	if (parseInt(object.style.width) == maxW) {
		this.wDone = true;
		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
	}
};
LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
	var timer = speed ? speed : (this.resizeDuration/2);
	var object = this.doc.getElementById(id);
	var newH = (this.doAnimations ? curH : maxH);
	object.style.height = (newH) + "px";
	if (newH < maxH) {
		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
	} else if (newH > maxH) {
		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
	}
	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
	if (parseInt(object.style.height) == maxH) {
		this.hDone = true;
		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
	}
};
LyteBox.prototype.getPageScroll = function() {
	if (self.pageYOffset) {
		return this.isFrame ? parent.pageYOffset : self.pageYOffset;
	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
		return this.doc.documentElement.scrollTop;
	} else if (document.body) {
		return this.doc.body.scrollTop;
	}
};
LyteBox.prototype.getPageSize = function() {	
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.doc.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
		xScroll = this.doc.body.scrollWidth;
		yScroll = this.doc.body.scrollHeight;
	} else {
		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
	}
	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.doc.documentElement.clientWidth;
		windowHeight = this.doc.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
	}
	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};
LyteBox.prototype.toggleFlash = function(state) {
	var objects = this.doc.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	var embeds = this.doc.getElementsByTagName("embed");
	for (var i = 0; i < embeds.length; i++) {
		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				objects = parent.frames[i].window.document.getElementsByTagName("object");
				for (var j = 0; j < objects.length; j++) {
					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
			try {
				embeds = parent.frames[i].window.document.getElementsByTagName("embed");
				for (var j = 0; j < embeds.length; j++) {
					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.toggleSelects = function(state) {
	var selects = this.doc.getElementsByTagName("select");
	for (var i = 0; i < selects.length; i++ ) {
		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				selects = parent.frames[i].window.document.getElementsByTagName("select");
				for (var j = 0; j < selects.length; j++) {
					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.pause = function(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) { return; }
	}
};
if (window.addEventListener) {
	window.addEventListener("load",initLytebox,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",initLytebox);
} else {
	window.onload = function() {initLytebox();}
}
function initLytebox() { myLytebox = new LyteBox(); }//***********************************************************************************************************************************/
//	LyteBox v3.22
//
//	 Author: Markus F. Hay
//  Website: http://www.dolem.com/lytebox
//	   Date: October 2, 2007
//	License: Creative Commons Attribution 3.0 License (http://creativecommons.org/licenses/by/3.0/)
// Browsers: Tested successfully on WinXP with the following browsers (using no DOCTYPE and Strict/Transitional/Loose DOCTYPES):
//				* Firefox: 2.0.0.7, 1.5.0.12
//				* Internet Explorer: 7.0, 6.0 SP2, 5.5 SP2
//				* Opera: 9.23
//
// Releases: For up-to-date and complete release information, visit http://www.dolem.com/forum/showthread.php?tid=62
//				* v3.22 (10/02/07)
//				* v3.21 (09/30/07)
//				* v3.20 (07/12/07)
//				* v3.10 (05/28/07)
//				* v3.00 (05/15/07)
//				* v2.02 (11/13/06)
//
//   Credit: LyteBox was originally derived from the Lightbox class (v2.02) that was written by Lokesh Dhakar. For more
//			 information please visit http://huddletogether.com/projects/lightbox2/
//***********************************************************************************************************************************/
Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } };
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } };
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); };

function LyteBox() {
	/*** Start Global Configuration ***/
		this.theme				= 'blue';	// themes: grey (default), red, green, blue, gold
		this.hideFlash			= true;		// controls whether or not Flash objects should be hidden
		this.outerBorder		= true;		// controls whether to show the outer grey (or theme) border
		this.resizeSpeed		= 8;		// controls the speed of the image resizing (1=slowest and 10=fastest)
		this.maxOpacity			= 80;		// higher opacity = darker overlay, lower opacity = lighter overlay
		this.navType			= 1;		// 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
		this.autoResize			= true;		// controls whether or not images should be resized if larger than the browser window dimensions
		this.doAnimations		= true;		// controls whether or not "animate" Lytebox, i.e. resize transition between images, fade in/out effects, etc.
		this.minWidth			= 800;		// Minimum Width of default box, if not over written by rev in link
		this.minHeight			= 400;		// Minimum Height of default box, if not over written by rev in link
		
		this.borderSize			= 12;		// if you adjust the padding in the CSS, you will need to update this variable -- otherwise, leave this alone...
	/*** End Global Configuration ***/
	
	/*** Configure Slideshow Options ***/
		this.slideInterval		= 4000;		// Change value (milliseconds) to increase/decrease the time between "slides" (10000 = 10 seconds)
		this.showNavigation		= true;		// true to display Next/Prev buttons/text during slideshow, false to hide
		this.showClose			= true;		// true to display the Close button, false to hide
		this.showDetails		= true;		// true to display image details (caption, count), false to hide
		this.showPlayPause		= true;		// true to display pause/play buttons next to close button, false to hide
		this.autoEnd			= true;		// true to automatically close Lytebox after the last image is reached, false to keep open
		this.pauseOnNextClick	= false;	// true to pause the slideshow when the "Next" button is clicked
        this.pauseOnPrevClick 	= true;		// true to pause the slideshow when the "Prev" button is clicked
	/*** End Slideshow Configuration ***/
	
	if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
	if(this.resizeSpeed < 1) { resizeSpeed = 1; }
	this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
	this.resizeWTimerArray		= new Array();
	this.resizeWTimerCount		= 0;
	this.resizeHTimerArray		= new Array();
	this.resizeHTimerCount		= 0;
	this.showContentTimerArray	= new Array();
	this.showContentTimerCount	= 0;
	this.overlayTimerArray		= new Array();
	this.overlayTimerCount		= 0;
	this.imageTimerArray		= new Array();
	this.imageTimerCount		= 0;
	this.timerIDArray			= new Array();
	this.timerIDCount			= 0;
	this.slideshowIDArray		= new Array();
	this.slideshowIDCount		= 0;
	this.imageArray	 = new Array();
	this.activeImage = null;
	this.slideArray	 = new Array();
	this.activeSlide = null;
	this.frameArray	 = new Array();
	this.activeFrame = null;
	this.checkFrame();
	this.isSlideshow = false;
	this.isLyteframe = false;
	
	if (jQuery.browser.msie) this.ie = true;
	else this.ie = false;

	this.ie7 = (this.ie && window.XMLHttpRequest);	
	this.initialize();
}
LyteBox.prototype.initialize = function() {
	this.updateLyteboxItems();
	var objBody = this.doc.getElementsByTagName("body").item(0);	
	if (this.doc.getElementById('lbOverlay')) {
		objBody.removeChild(this.doc.getElementById("lbOverlay"));
		objBody.removeChild(this.doc.getElementById("lbMain"));
	}
	var objOverlay = this.doc.createElement("div");
		objOverlay.setAttribute('id','lbOverlay');
		objOverlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		if ((this.ie && !this.ie7) || (this.ie7 && this.doc.compatMode == 'BackCompat')) {
			objOverlay.style.position = 'absolute';
		}
		objOverlay.style.display = 'none';
		objBody.appendChild(objOverlay);
	var objLytebox = this.doc.createElement("div");
		objLytebox.setAttribute('id','lbMain');
		objLytebox.style.display = 'none';
		objBody.appendChild(objLytebox);
	var objOuterContainer = this.doc.createElement("div");
		objOuterContainer.setAttribute('id','lbOuterContainer');
		objOuterContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objOuterContainer);
	var objIframeContainer = this.doc.createElement("div");
		objIframeContainer.setAttribute('id','lbIframeContainer');
		objIframeContainer.style.display = 'none';
		objOuterContainer.appendChild(objIframeContainer);
	var objIframe = this.doc.createElement("iframe");
		objIframe.setAttribute('id','lbIframe');
		objIframe.setAttribute('name','lbIframe');
		objIframe.style.display = 'none';
		objIframeContainer.appendChild(objIframe);
	var objImageContainer = this.doc.createElement("div");
		objImageContainer.setAttribute('id','lbImageContainer');
		objOuterContainer.appendChild(objImageContainer);
	var objLyteboxImage = this.doc.createElement("img");
		objLyteboxImage.setAttribute('id','lbImage');
		objImageContainer.appendChild(objLyteboxImage);
	var objLoading = this.doc.createElement("div");
		objLoading.setAttribute('id','lbLoading');
		objOuterContainer.appendChild(objLoading);
	var objDetailsContainer = this.doc.createElement("div");
		objDetailsContainer.setAttribute('id','lbDetailsContainer');
		objDetailsContainer.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objLytebox.appendChild(objDetailsContainer);
	var objDetailsData =this.doc.createElement("div");
		objDetailsData.setAttribute('id','lbDetailsData');
		objDetailsData.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objDetailsContainer.appendChild(objDetailsData);
	var objDetails = this.doc.createElement("div");
		objDetails.setAttribute('id','lbDetails');
		objDetailsData.appendChild(objDetails);
	var objCaption = this.doc.createElement("span");
		objCaption.setAttribute('id','lbCaption');
		objDetails.appendChild(objCaption);
	var objHoverNav = this.doc.createElement("div");
		objHoverNav.setAttribute('id','lbHoverNav');
		objImageContainer.appendChild(objHoverNav);
	var objBottomNav = this.doc.createElement("div");
		objBottomNav.setAttribute('id','lbBottomNav');
		objDetailsData.appendChild(objBottomNav);
	var objPrev = this.doc.createElement("a");
		objPrev.setAttribute('id','lbPrev');
		objPrev.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPrev.setAttribute('href','#');
		objHoverNav.appendChild(objPrev);
	var objNext = this.doc.createElement("a");
		objNext.setAttribute('id','lbNext');
		objNext.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objNext.setAttribute('href','#');
		objHoverNav.appendChild(objNext);
	var objNumberDisplay = this.doc.createElement("span");
		objNumberDisplay.setAttribute('id','lbNumberDisplay');
		objDetails.appendChild(objNumberDisplay);
	var objNavDisplay = this.doc.createElement("span");
		objNavDisplay.setAttribute('id','lbNavDisplay');
		objNavDisplay.style.display = 'none';
		objDetails.appendChild(objNavDisplay);
	var objClose = this.doc.createElement("a");// Change this
		objClose.setAttribute('id','lbClose');
		objClose.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objClose.setAttribute('href','#');
		objBottomNav.appendChild(objClose);
	var objPause = this.doc.createElement("a");
		objPause.setAttribute('id','lbPause');
		objPause.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPause.setAttribute('href','#');
		objPause.style.display = 'none';
		objBottomNav.appendChild(objPause);
	var objPlay = this.doc.createElement("a");
		objPlay.setAttribute('id','lbPlay');
		objPlay.setAttribute((this.ie ? 'className' : 'class'), this.theme);
		objPlay.setAttribute('href','#');
		objPlay.style.display = 'none';
		objBottomNav.appendChild(objPlay);
};
LyteBox.prototype.updateLyteboxItems = function() {	
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
	for (var i = 0; i < anchors.length; i++) {
		var anchor = anchors[i];
		var relAttribute = String(anchor.getAttribute('rel'));
		if (anchor.getAttribute('href')) {
			if (relAttribute.toLowerCase().match('lytebox')) {
				anchor.onclick = function () { myLytebox.start(this, false, false); return false; }
			} else if (relAttribute.toLowerCase().match('lyteshow')) {
				anchor.onclick = function () { myLytebox.start(this, true, false); return false; }
			} else if (relAttribute.toLowerCase().match('lyteframe')) {
				anchor.onclick = function () { myLytebox.start(this, false, true); return false; }
			}
		}
	}
};
LyteBox.prototype.start = function(imageLink, doSlide, doFrame) {
	if (this.ie && !this.ie7) {	this.toggleSelects('hide');	}
	if (this.hideFlash) { this.toggleFlash('hide'); }
	this.isLyteframe = (doFrame ? true : false);
	var pageSize	= this.getPageSize();// Array(pageWidth, pageHeight, windowWidth, windowHeight);
	// Create Window Width and Height be 80% of window size or minWidth and minHeight.
	// NOTE: This will be overwritten by rev attribute if defined
	var winWidth = pageSize[2] * .8;// Setting default to 80 percent
	winWidth = (winWidth < this.minWidth) ? this.minWidth : winWidth;// 800
	var winHeight = pageSize[3] * .8;// Setting default to 80 percent
	winHeight = (winHeight < this.minHeight) ? this.minHeight : winHeight;//400
	
	var objOverlay	= this.doc.getElementById('lbOverlay');
	var objBody		= this.doc.getElementsByTagName("body").item(0);
	objOverlay.style.height = pageSize[1] + "px";
	objOverlay.style.display = '';
	this.appear('lbOverlay', (this.doAnimations ? 0 : this.maxOpacity));
	var anchors = (this.isFrame) ? window.parent.frames[window.name].document.getElementsByTagName('a') : document.getElementsByTagName('a');
	if (this.isLyteframe) {
		this.frameArray = [];
		this.frameNum = 0;
		if ((imageLink.getAttribute('rel') == 'lyteframe')) {
			var rev = imageLink.getAttribute('rev');
			this.frameArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title'), (rev == null || rev == '' ? 'width: ' + winWidth + 'px; height: ' + winHeight + 'px; scrolling: auto;' : rev)));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lyteframe') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						var rev = anchor.getAttribute('rev');
						this.frameArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title'), (rev == null || rev == '' ? 'width: ' + winWidth + 'px; height: ' + winHeight + 'px; scrolling: auto;' : rev)));
					}
				}
				this.frameArray.removeDuplicates();
				while(this.frameArray[this.frameNum][0] != imageLink.getAttribute('href')) { this.frameNum++; }
			}
		}
	} else {
		this.imageArray = [];
		this.imageNum = 0;
		this.slideArray = [];
		this.slideNum = 0;
		if ((imageLink.getAttribute('rel') == 'lytebox')) {
			this.imageArray.push(new Array(imageLink.getAttribute('href'), imageLink.getAttribute('title')));
		} else {
			if (imageLink.getAttribute('rel').indexOf('lytebox') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.imageArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
					}
				}
				this.imageArray.removeDuplicates();
				while(this.imageArray[this.imageNum][0] != imageLink.getAttribute('href')) { this.imageNum++; }
			}
			if (imageLink.getAttribute('rel').indexOf('lyteshow') != -1) {
				for (var i = 0; i < anchors.length; i++) {
					var anchor = anchors[i];
					if (anchor.getAttribute('href') && (anchor.getAttribute('rel') == imageLink.getAttribute('rel'))) {
						this.slideArray.push(new Array(anchor.getAttribute('href'), anchor.getAttribute('title')));
					}
				}
				this.slideArray.removeDuplicates();
				while(this.slideArray[this.slideNum][0] != imageLink.getAttribute('href')) { this.slideNum++; }
			}
		}
	}
	var object = this.doc.getElementById('lbMain');
		object.style.top = (this.getPageScroll() + (pageSize[3] / 15)) + "px";
		object.style.display = '';
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbOverlay').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbMain').onclick = function(e) {
		var e = e;
		if (!e) {
			if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
				e = window.parent.window.event;
			} else {
				e = window.event;
			}
		}
		var id = (e.target ? e.target.id : e.srcElement.id);
		if (id == 'lbMain') { myLytebox.end(); return false; }
	}
	this.doc.getElementById('lbClose').onclick = function() { myLytebox.end(); return false; }
	this.doc.getElementById('lbPause').onclick = function() { myLytebox.togglePlayPause("lbPause", "lbPlay"); return false; }
	this.doc.getElementById('lbPlay').onclick = function() { myLytebox.togglePlayPause("lbPlay", "lbPause"); return false; }	
	this.isSlideshow = doSlide;
	this.isPaused = (this.slideNum != 0 ? true : false);
	if (this.isSlideshow && this.showPlayPause && this.isPaused) {
		this.doc.getElementById('lbPlay').style.display = '';
		this.doc.getElementById('lbPause').style.display = 'none';
	}
	if (this.isLyteframe) {
		this.changeContent(this.frameNum);
	} else {
		if (this.isSlideshow) {
			this.changeContent(this.slideNum);
		} else {
			this.changeContent(this.imageNum);
		}
	}
};
LyteBox.prototype.changeContent = function(imageNum) {
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.activeImage = this.activeSlide = this.activeFrame = imageNum;
	if (!this.outerBorder) {
		this.doc.getElementById('lbOuterContainer').style.border = 'none';
		this.doc.getElementById('lbDetailsContainer').style.border = 'none';
	} else {
		this.doc.getElementById('lbOuterContainer').style.borderBottom = '';
		this.doc.getElementById('lbOuterContainer').setAttribute((this.ie ? 'className' : 'class'), this.theme);
	}
	this.doc.getElementById('lbLoading').style.display = '';
	this.doc.getElementById('lbImage').style.display = 'none';
	this.doc.getElementById('lbIframe').style.display = 'none';
	this.doc.getElementById('lbPrev').style.display = 'none';
	this.doc.getElementById('lbNext').style.display = 'none';
	this.doc.getElementById('lbIframeContainer').style.display = 'none';
	this.doc.getElementById('lbDetailsContainer').style.display = 'none';
	this.doc.getElementById('lbNumberDisplay').style.display = 'none';
	if (this.navType == 2 || this.isLyteframe) {
		object = this.doc.getElementById('lbNavDisplay');
		object.innerHTML = '&nbsp;&nbsp;&nbsp;<span id="lbPrev2_Off" style="display: none;" class="' + this.theme + '">&laquo; prev</span><a href="#" id="lbPrev2" class="' + this.theme + '" style="display: none;">&laquo; prev</a> <b id="lbSpacer" class="' + this.theme + '">||</b> <span id="lbNext2_Off" style="display: none;" class="' + this.theme + '">next &raquo;</span><a href="#" id="lbNext2" class="' + this.theme + '" style="display: none;">next &raquo;</a>';
		object.style.display = 'none';
	}
	if (this.isLyteframe) {
		var iframe = myLytebox.doc.getElementById('lbIframe');
		var styles = this.frameArray[this.activeFrame][2];
		var aStyles = styles.split(';');
		for (var i = 0; i < aStyles.length; i++) {
			if (aStyles[i].indexOf('width:') >= 0) {
				var w = aStyles[i].replace('width:', '');
				iframe.width = w.trim();
			} else if (aStyles[i].indexOf('height:') >= 0) {
				var h = aStyles[i].replace('height:', '');
				iframe.height = h.trim();
			} else if (aStyles[i].indexOf('scrolling:') >= 0) {
				var s = aStyles[i].replace('scrolling:', '');
				iframe.scrolling = s.trim();
			} else if (aStyles[i].indexOf('border:') >= 0) {
				// Not implemented yet, as there are cross-platform issues with setting the border (from a GUI standpoint)
				//var b = aStyles[i].replace('border:', '');
				//iframe.style.border = b.trim();
			}
		}
		this.resizeContainer(parseInt(iframe.width), parseInt(iframe.height));
	} else {
		imgPreloader = new Image();
		imgPreloader.onload = function() {
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (myLytebox.autoResize) {
				var pagesize = myLytebox.getPageSize();
				var x = pagesize[2] - 150;
				var y = pagesize[3] - 150;
				if (imageWidth > x) {
					imageHeight = Math.round(imageHeight * (x / imageWidth));
					imageWidth = x; 
					if (imageHeight > y) { 
						imageWidth = Math.round(imageWidth * (y / imageHeight));
						imageHeight = y; 
					}
				} else if (imageHeight > y) { 
					imageWidth = Math.round(imageWidth * (y / imageHeight));
					imageHeight = y; 
					if (imageWidth > x) {
						imageHeight = Math.round(imageHeight * (x / imageWidth));
						imageWidth = x;
					}
				}
			}
			var lbImage = myLytebox.doc.getElementById('lbImage')
			lbImage.src = (myLytebox.isSlideshow ? myLytebox.slideArray[myLytebox.activeSlide][0] : myLytebox.imageArray[myLytebox.activeImage][0]);
			lbImage.width = imageWidth;
			lbImage.height = imageHeight;
			myLytebox.resizeContainer(imageWidth, imageHeight);
			imgPreloader.onload = function() {};
		}
		imgPreloader.src = (this.isSlideshow ? this.slideArray[this.activeSlide][0] : this.imageArray[this.activeImage][0]);
	}
};
LyteBox.prototype.resizeContainer = function(imgWidth, imgHeight) {
	this.wCur = this.doc.getElementById('lbOuterContainer').offsetWidth;
	this.hCur = this.doc.getElementById('lbOuterContainer').offsetHeight;
	this.xScale = ((imgWidth  + (this.borderSize * 2)) / this.wCur) * 100;
	this.yScale = ((imgHeight  + (this.borderSize * 2)) / this.hCur) * 100;
	var wDiff = (this.wCur - this.borderSize * 2) - imgWidth;
	var hDiff = (this.hCur - this.borderSize * 2) - imgHeight;
	if (!(hDiff == 0)) {
		this.hDone = false;
		this.resizeH('lbOuterContainer', this.hCur, imgHeight + this.borderSize*2, this.getPixelRate(this.hCur, imgHeight));
	} else {
		this.hDone = true;
	}
	if (!(wDiff == 0)) {
		this.wDone = false;
		this.resizeW('lbOuterContainer', this.wCur, imgWidth + this.borderSize*2, this.getPixelRate(this.wCur, imgWidth));
	} else {
		this.wDone = true;
	}
	if ((hDiff == 0) && (wDiff == 0)) {
		if (this.ie){ this.pause(250); } else { this.pause(100); } 
	}
	this.doc.getElementById('lbPrev').style.height = imgHeight + "px";
	this.doc.getElementById('lbNext').style.height = imgHeight + "px";
	this.doc.getElementById('lbDetailsContainer').style.width = (imgWidth + (this.borderSize * 2) + (this.ie && this.doc.compatMode == "BackCompat" && this.outerBorder ? 2 : 0)) + "px";
	this.showContent();
};
LyteBox.prototype.showContent = function() {
	if (this.wDone && this.hDone) {
		for (var i = 0; i < this.showContentTimerCount; i++) { window.clearTimeout(this.showContentTimerArray[i]); }
		if (this.outerBorder) {
			this.doc.getElementById('lbOuterContainer').style.borderBottom = 'none';
		}
		this.doc.getElementById('lbLoading').style.display = 'none';
		if (this.isLyteframe) {
			this.doc.getElementById('lbIframe').style.display = '';
			this.appear('lbIframe', (this.doAnimations ? 0 : 100));
		} else {
			this.doc.getElementById('lbImage').style.display = '';
			this.appear('lbImage', (this.doAnimations ? 0 : 100));
			this.preloadNeighborImages();
		}
		if (this.isSlideshow) {
			if(this.activeSlide == (this.slideArray.length - 1)) {
				if (this.autoEnd) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.end('slideshow')", this.slideInterval);
				}
			} else {
				if (!this.isPaused) {
					this.slideshowIDArray[this.slideshowIDCount++] = setTimeout("myLytebox.changeContent("+(this.activeSlide+1)+")", this.slideInterval);
				}
			}
			this.doc.getElementById('lbHoverNav').style.display = (this.showNavigation && this.navType == 1 ? '' : 'none');
			this.doc.getElementById('lbClose').style.display = (this.showClose ? '' : 'none');
			this.doc.getElementById('lbDetails').style.display = (this.showDetails ? '' : 'none');
			this.doc.getElementById('lbPause').style.display = (this.showPlayPause && !this.isPaused ? '' : 'none');
			this.doc.getElementById('lbPlay').style.display = (this.showPlayPause && !this.isPaused ? 'none' : '');
			this.doc.getElementById('lbNavDisplay').style.display = (this.showNavigation && this.navType == 2 ? '' : 'none');
		} else {
			this.doc.getElementById('lbHoverNav').style.display = (this.navType == 1 && !this.isLyteframe ? '' : 'none');
			if ((this.navType == 2 && !this.isLyteframe && this.imageArray.length > 1) || (this.frameArray.length > 1 && this.isLyteframe)) {
				this.doc.getElementById('lbNavDisplay').style.display = '';
			} else {
				this.doc.getElementById('lbNavDisplay').style.display = 'none';
			}
			this.doc.getElementById('lbClose').style.display = '';
			this.doc.getElementById('lbDetails').style.display = '';
			this.doc.getElementById('lbPause').style.display = 'none';
			this.doc.getElementById('lbPlay').style.display = 'none';
		}
		this.doc.getElementById('lbImageContainer').style.display = (this.isLyteframe ? 'none' : '');
		this.doc.getElementById('lbIframeContainer').style.display = (this.isLyteframe ? '' : 'none');
		try {
			this.doc.getElementById('lbIframe').src = this.frameArray[this.activeFrame][0];
		} catch(e) { }
	} else {
		this.showContentTimerArray[this.showContentTimerCount++] = setTimeout("myLytebox.showContent()", 200);
	}
};
LyteBox.prototype.updateDetails = function() {
	var object = this.doc.getElementById('lbCaption');
	var sTitle = (this.isSlideshow ? this.slideArray[this.activeSlide][1] : (this.isLyteframe ? this.frameArray[this.activeFrame][1] : this.imageArray[this.activeImage][1]));
	object.style.display = '';
	object.innerHTML = (sTitle == null ? '' : sTitle);
	this.updateNav();
	this.doc.getElementById('lbDetailsContainer').style.display = '';
	object = this.doc.getElementById('lbNumberDisplay');
	if (this.isSlideshow && this.slideArray.length > 1) {
		object.style.display = '';
		object.innerHTML = "Image " + eval(this.activeSlide + 1) + " of " + this.slideArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 && this.showNavigation ? '' : 'none');
	} else if (this.imageArray.length > 1 && !this.isLyteframe) {
		object.style.display = '';
		object.innerHTML = "Image " + eval(this.activeImage + 1) + " of " + this.imageArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = (this.navType == 2 ? '' : 'none');
	} else if (this.frameArray.length > 1 && this.isLyteframe) {
		object.style.display = '';
//		object.innerHTML = "Page " + eval(this.activeFrame + 1) + " of " + this.frameArray.length;
		object.innerHTML = eval(this.activeFrame + 1) + " of " + this.frameArray.length;
		this.doc.getElementById('lbNavDisplay').style.display = '';
	} else {
		this.doc.getElementById('lbNavDisplay').style.display = 'none';
	}
	this.appear('lbDetailsContainer', (this.doAnimations ? 0 : 100));
};
LyteBox.prototype.updateNav = function() {
	if (this.isSlideshow) {
		if (this.activeSlide != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnPrevClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if (this.activeSlide != (this.slideArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					if (myLytebox.pauseOnNextClick) { myLytebox.togglePlayPause("lbPause", "lbPlay"); }
					myLytebox.changeContent(myLytebox.activeSlide + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	} else if (this.isLyteframe) {
		if(this.activeFrame != 0) {
			var object = this.doc.getElementById('lbPrev2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame - 1); return false;
				}
		} else {
			this.doc.getElementById('lbPrev2_Off').style.display = '';
		}
		if(this.activeFrame != (this.frameArray.length - 1)) {
			var object = this.doc.getElementById('lbNext2');
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeFrame + 1); return false;
				}
		} else {
			this.doc.getElementById('lbNext2_Off').style.display = '';
		}		
	} else {
		if(this.activeImage != 0) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbPrev2') : this.doc.getElementById('lbPrev'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage - 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbPrev2_Off').style.display = ''; }
		}
		if(this.activeImage != (this.imageArray.length - 1)) {
			var object = (this.navType == 2 ? this.doc.getElementById('lbNext2') : this.doc.getElementById('lbNext'));
				object.style.display = '';
				object.onclick = function() {
					myLytebox.changeContent(myLytebox.activeImage + 1); return false;
				}
		} else {
			if (this.navType == 2) { this.doc.getElementById('lbNext2_Off').style.display = ''; }
		}
	}
	this.enableKeyboardNav();
};
LyteBox.prototype.enableKeyboardNav = function() { document.onkeydown = this.keyboardAction; };
LyteBox.prototype.disableKeyboardNav = function() { document.onkeydown = ''; };
LyteBox.prototype.keyboardAction = function(e) {
	var keycode = key = escape = null;
	keycode	= (e == null) ? event.keyCode : e.which;
	key		= String.fromCharCode(keycode).toLowerCase();
	escape  = (e == null) ? 27 : e.DOM_VK_ESCAPE;
	if ((key == 'x') || (key == 'c') || (keycode == escape)) {
		myLytebox.end();
	} else if ((key == 'p') || (keycode == 37)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide - 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame - 1);
			}
		} else {
			if(myLytebox.activeImage != 0) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage - 1);
			}
		}
	} else if ((key == 'n') || (keycode == 39)) {
		if (myLytebox.isSlideshow) {
			if(myLytebox.activeSlide != (myLytebox.slideArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeSlide + 1);
			}
		} else if (myLytebox.isLyteframe) {
			if(myLytebox.activeFrame != (myLytebox.frameArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeFrame + 1);
			}
		} else {
			if(myLytebox.activeImage != (myLytebox.imageArray.length - 1)) {
				myLytebox.disableKeyboardNav();
				myLytebox.changeContent(myLytebox.activeImage + 1);
			}
		}
	}
};
LyteBox.prototype.preloadNeighborImages = function() {
	if (this.isSlideshow) {
		if ((this.slideArray.length - 1) > this.activeSlide) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.slideArray[this.activeSlide + 1][0];
		}
		if(this.activeSlide > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.slideArray[this.activeSlide - 1][0];
		}
	} else {
		if ((this.imageArray.length - 1) > this.activeImage) {
			preloadNextImage = new Image();
			preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
		}
		if(this.activeImage > 0) {
			preloadPrevImage = new Image();
			preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
		}
	}
};
LyteBox.prototype.togglePlayPause = function(hideID, showID) {
	if (this.isSlideshow && hideID == "lbPause") {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	this.doc.getElementById(hideID).style.display = 'none';
	this.doc.getElementById(showID).style.display = '';
	if (hideID == "lbPlay") {
		this.isPaused = false;
		if (this.activeSlide == (this.slideArray.length - 1)) {
			this.end();
		} else {
			this.changeContent(this.activeSlide + 1);
		}
	} else {
		this.isPaused = true;
	}
};
LyteBox.prototype.end = function(caller) {
	var closeClick = (caller == 'slideshow' ? false : true);
	if (this.isSlideshow && this.isPaused && !closeClick) { return; }
	this.disableKeyboardNav();
	this.doc.getElementById('lbMain').style.display = 'none';
	this.fade('lbOverlay', (this.doAnimations ? this.maxOpacity : 0));
	this.toggleSelects('visible');
	if (this.hideFlash) { this.toggleFlash('visible'); }
	if (this.isSlideshow) {
		for (var i = 0; i < this.slideshowIDCount; i++) { window.clearTimeout(this.slideshowIDArray[i]); }
	}
	if (this.isLyteframe) {
		 this.initialize();
	}
};
LyteBox.prototype.checkFrame = function() {
	if (window.parent.frames[window.name] && (parent.document.getElementsByTagName('frameset').length <= 0)) {
		this.isFrame = true;
		this.lytebox = "window.parent." + window.name + ".myLytebox";
		this.doc = parent.document;
	} else {
		this.isFrame = false;
		this.lytebox = "myLytebox";
		this.doc = document;
	}
};
LyteBox.prototype.getPixelRate = function(cur, img) {
	var diff = (img > cur) ? img - cur : cur - img;
	if (diff >= 0 && diff <= 100) { return 10; }
	if (diff > 100 && diff <= 200) { return 15; }
	if (diff > 200 && diff <= 300) { return 20; }
	if (diff > 300 && diff <= 400) { return 25; }
	if (diff > 400 && diff <= 500) { return 30; }
	if (diff > 500 && diff <= 600) { return 35; }
	if (diff > 600 && diff <= 700) { return 40; }
	if (diff > 700) { return 45; }
};
LyteBox.prototype.appear = function(id, opacity) {
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + (opacity + 10) + ")";
	if (opacity == 100 && (id == 'lbImage' || id == 'lbIframe')) {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		this.updateDetails();
	} else if (opacity >= this.maxOpacity && id == 'lbOverlay') {
		for (var i = 0; i < this.overlayTimerCount; i++) { window.clearTimeout(this.overlayTimerArray[i]); }
		return;
	} else if (opacity >= 100 && id == 'lbDetailsContainer') {
		try { object.removeAttribute("filter"); } catch(e) {}	/* Fix added for IE Alpha Opacity Filter bug. */
		for (var i = 0; i < this.imageTimerCount; i++) { window.clearTimeout(this.imageTimerArray[i]); }
		this.doc.getElementById('lbOverlay').style.height = this.getPageSize()[1] + "px";
	} else {
		if (id == 'lbOverlay') {
			this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+20) + ")", 1);
		} else {
			this.imageTimerArray[this.imageTimerCount++] = setTimeout("myLytebox.appear('" + id + "', " + (opacity+10) + ")", 1);
		}
	}
};
LyteBox.prototype.fade = function(id, opacity) {
	var object = this.doc.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
	if (opacity <= 0) {
		try {
			object.display = 'none';
		} catch(err) { }
	} else if (id == 'lbOverlay') {
		this.overlayTimerArray[this.overlayTimerCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-20) + ")", 1);
	} else {
		this.timerIDArray[this.timerIDCount++] = setTimeout("myLytebox.fade('" + id + "', " + (opacity-10) + ")", 1);
	}
};
LyteBox.prototype.resizeW = function(id, curW, maxW, pixelrate, speed) {
	if (!this.hDone) {
		this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + curW + ", " + maxW + ", " + pixelrate + ")", 100);
		return;
	}
	var object = this.doc.getElementById(id);
	var timer = speed ? speed : (this.resizeDuration/2);
	var newW = (this.doAnimations ? curW : maxW);
	object.style.width = (newW) + "px";
	if (newW < maxW) {
		newW += (newW + pixelrate >= maxW) ? (maxW - newW) : pixelrate;
	} else if (newW > maxW) {
		newW -= (newW - pixelrate <= maxW) ? (newW - maxW) : pixelrate;
	}
	this.resizeWTimerArray[this.resizeWTimerCount++] = setTimeout("myLytebox.resizeW('" + id + "', " + newW + ", " + maxW + ", " + pixelrate + ", " + (timer+0.02) + ")", timer+0.02);
	if (parseInt(object.style.width) == maxW) {
		this.wDone = true;
		for (var i = 0; i < this.resizeWTimerCount; i++) { window.clearTimeout(this.resizeWTimerArray[i]); }
	}
};
LyteBox.prototype.resizeH = function(id, curH, maxH, pixelrate, speed) {
	var timer = speed ? speed : (this.resizeDuration/2);
	var object = this.doc.getElementById(id);
	var newH = (this.doAnimations ? curH : maxH);
	object.style.height = (newH) + "px";
	if (newH < maxH) {
		newH += (newH + pixelrate >= maxH) ? (maxH - newH) : pixelrate;
	} else if (newH > maxH) {
		newH -= (newH - pixelrate <= maxH) ? (newH - maxH) : pixelrate;
	}
	this.resizeHTimerArray[this.resizeHTimerCount++] = setTimeout("myLytebox.resizeH('" + id + "', " + newH + ", " + maxH + ", " + pixelrate + ", " + (timer+.02) + ")", timer+.02);
	if (parseInt(object.style.height) == maxH) {
		this.hDone = true;
		for (var i = 0; i < this.resizeHTimerCount; i++) { window.clearTimeout(this.resizeHTimerArray[i]); }
	}
};
LyteBox.prototype.getPageScroll = function() {
	if (self.pageYOffset) {
		return this.isFrame ? parent.pageYOffset : self.pageYOffset;
	} else if (this.doc.documentElement && this.doc.documentElement.scrollTop){
		return this.doc.documentElement.scrollTop;
	} else if (document.body) {
		return this.doc.body.scrollTop;
	}
};
LyteBox.prototype.getPageSize = function() {	
	var xScroll, yScroll, windowWidth, windowHeight;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = this.doc.scrollWidth;
		yScroll = (this.isFrame ? parent.innerHeight : self.innerHeight) + (this.isFrame ? parent.scrollMaxY : self.scrollMaxY);
	} else if (this.doc.body.scrollHeight > this.doc.body.offsetHeight){
		xScroll = this.doc.body.scrollWidth;
		yScroll = this.doc.body.scrollHeight;
	} else {
		xScroll = this.doc.getElementsByTagName("html").item(0).offsetWidth;
		yScroll = this.doc.getElementsByTagName("html").item(0).offsetHeight;
		xScroll = (xScroll < this.doc.body.offsetWidth) ? this.doc.body.offsetWidth : xScroll;
		yScroll = (yScroll < this.doc.body.offsetHeight) ? this.doc.body.offsetHeight : yScroll;
	}
	if (self.innerHeight) {
		windowWidth = (this.isFrame) ? parent.innerWidth : self.innerWidth;
		windowHeight = (this.isFrame) ? parent.innerHeight : self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		windowWidth = this.doc.documentElement.clientWidth;
		windowHeight = this.doc.documentElement.clientHeight;
	} else if (document.body) {
		windowWidth = this.doc.getElementsByTagName("html").item(0).clientWidth;
		windowHeight = this.doc.getElementsByTagName("html").item(0).clientHeight;
		windowWidth = (windowWidth == 0) ? this.doc.body.clientWidth : windowWidth;
		windowHeight = (windowHeight == 0) ? this.doc.body.clientHeight : windowHeight;
	}
	var pageHeight = (yScroll < windowHeight) ? windowHeight : yScroll;
	var pageWidth = (xScroll < windowWidth) ? windowWidth : xScroll;
	return new Array(pageWidth, pageHeight, windowWidth, windowHeight);
};
LyteBox.prototype.toggleFlash = function(state) {
	var objects = this.doc.getElementsByTagName("object");
	for (var i = 0; i < objects.length; i++) {
		objects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	var embeds = this.doc.getElementsByTagName("embed");
	for (var i = 0; i < embeds.length; i++) {
		embeds[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				objects = parent.frames[i].window.document.getElementsByTagName("object");
				for (var j = 0; j < objects.length; j++) {
					objects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
			try {
				embeds = parent.frames[i].window.document.getElementsByTagName("embed");
				for (var j = 0; j < embeds.length; j++) {
					embeds[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.toggleSelects = function(state) {
	var selects = this.doc.getElementsByTagName("select");
	for (var i = 0; i < selects.length; i++ ) {
		selects[i].style.visibility = (state == "hide") ? 'hidden' : 'visible';
	}
	if (this.isFrame) {
		for (var i = 0; i < parent.frames.length; i++) {
			try {
				selects = parent.frames[i].window.document.getElementsByTagName("select");
				for (var j = 0; j < selects.length; j++) {
					selects[j].style.visibility = (state == "hide") ? 'hidden' : 'visible';
				}
			} catch(e) { }
		}
	}
};
LyteBox.prototype.pause = function(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime) { return; }
	}
};
if (window.addEventListener) {
	window.addEventListener("load",initLytebox,false);
} else if (window.attachEvent) {
	window.attachEvent("onload",initLytebox);
} else {
	window.onload = function() {initLytebox();}
}
function initLytebox() { myLytebox = new LyteBox(); }

(function($){var trailing_whitespace=true;$.fn.truncate=function(options){var opts=$.extend({},$.fn.truncate.defaults,options);$(this).each(function(){var content_length=$.trim(squeeze($(this).text())).length;if(content_length<=opts.maxLength)
return;var actual_maxLength=opts.maxLength-opts.more.length-1;var truncated_node=recursivelyTruncate(this,actual_maxLength);if(opts.fitToWord==true)
truncated_node=truncated_node.html(truncated_node.html().replace(/\s+\S+$/,""));var full_node=$(this);truncated_node.insertAfter(full_node);truncated_node.find('p:last').add(truncated_node).eq(0).append(' <a href="#show more content" class="show-more">'+opts.more+'</a>');full_node.hide();full_node.find('p:last').add(full_node).eq(0).append(' <a href="#show less content" class="show-less">'+opts.less+'</a>');truncated_node.find('a:last').click(function(){truncated_node.hide();full_node.show();repositionElements();return false;});full_node.find('a:last').click(function(){truncated_node.show();full_node.hide();repositionElements();return false;});});}
$.fn.truncate.defaults={maxLength:100,more:'More&nbsp;»',less:'«&nbsp;Less',fitToWord:true};function recursivelyTruncate(node,maxLength){return(node.nodeType==3)?truncateText(node,maxLength):truncateNode(node,maxLength);}
function truncateNode(node,maxLength){var node=$(node);var new_node=node.clone().html("");node.contents().each(function(){var remaining_length=maxLength-new_node.text().length;if(remaining_length==0)return;new_node.append(recursivelyTruncate(this,remaining_length));});return new_node;}
function truncateText(node,maxLength){var text=squeeze(node.data);if(trailing_whitespace)
text=text.replace(/^ /,'');trailing_whitespace=!!text.match(/ $/);return text.slice(0,maxLength);}
function squeeze(string){return string.replace(/\s+/g,' ');}})(jQuery);
(function($){$.fn.getRangeAt=function(){var selectionParent=this;var range=$.fn.range;range.ClearVariables();range.setRange();if(this[0]==document){}
else{var checkFirst;if(selectionParent.length>1){for(var i=0,end=selectionParent.length;i<end;i++){checkFirst=$(range.startContainer).parents().index(selectionParent[i]);if(checkFirst>=0){selectionParent=$(selectionParent[i]);break;}}}
else checkFirst=$(range.startContainer).parents().index(selectionParent);var checkLast=$(range.endContainer).parents().index(selectionParent);if((checkFirst==-1||checkLast==-1)){range.ClearVariables();return false;};};return range;};$.fn.wrapSelection=function(options){var range=$.fn.range;var defaults={selectPrefix:'hltmp_',fitToWord:true,wrapRange:false,regexElementBlockers:new RegExp(/^BR$/),regexWordCharacterBasic:new RegExp(/^[A-Za-z0-9'\-]$/),regexWordCharacterFull:new RegExp(/^[A-Za-z0-9':,\-]$/),regexWordPunc:new RegExp(/^[:,]$/),regexWordNumbers:new RegExp(/^[0-9]$/)};var opts=$.extend({},defaults,options);opts.selectClass=opts.selectPrefix+new Date().getTime();setWrapRange(this,opts.wrapRange);if(range.startContainer&&range.endContainer){if(opts.fitToWord)FitToWord();SplitText();var myCount=doWrap();if(myCount)range.ClearAllRanges();else range.ClearVariables();return $('.'+opts.selectClass);}
else{return $([]);};function setWrapRange(element,newRange){var range=$.fn.range;if(newRange)
range=newRange;else
$(element).getRangeAt();if(range.startContainer.nodeType==1&&range.startOffset==0){range.startContainer=range.startContainer.firstChild;if(range.startContainer.nodeType!=3)
range.startContainer=$.fn.wrapSelection.dom.GetNextTextNode(range.startContainer);range.startOffset=0;range.endContainer=range.endContainer.lastChild;if(range.endContainer.nodeType!=3)
range.endContainer=$.fn.wrapSelection.dom.GetNextTextNode(range.endContainer);range.endOffset=range.endContainer.length;}
else{if(range.startContainer.nodeType==1){range.startContainer=$.fn.wrapSelection.dom.GetPreviousTextNode(range.startContainer.childNodes[range.startOffset]);range.startOffset=range.startContainer.nodeValue.length;}
if(range.endContainer.nodeType==1){range.endContainer=$.fn.wrapSelection.dom.GetNextTextNode(range.endContainer.childNodes[range.endOffset]);range.endOffset=0;}}};function SplitText(){var range=$.fn.range;var myIsSameNode=(range.startContainer==range.endContainer);if(range.startContainer.nodeType==3&&range.startOffset>0){var myNew=range.startContainer.splitText(range.startOffset);if(myIsSameNode){range.endContainer=myNew;range.endOffset=range.endOffset-range.startContainer.length;}
range.startContainer=myNew;range.startOffset=0;}
if(range.endContainer.nodeType==3&&range.endOffset<range.endContainer.length){range.endContainer.splitText(range.endOffset);range.endOffset=range.endContainer.length;}};function FitToWord(){var range=$.fn.range;var myStart=fitToStartWord(range.startContainer,range.startOffset,'normal');var myEnd=fitToEndWord(range.endContainer,range.endOffset,'normal');range.startContainer=myStart.container;range.startOffset=myStart.offset;range.endContainer=myEnd.container;range.endOffset=myEnd.offset;};function fitToEndWord(myContainer,myOffset,myType){var myChar='';if(myOffset>0)myChar=myContainer.nodeValue.substr(myOffset-1,1);else{var myReverse=getPrevChar(myContainer,myOffset);if(opts.regexWordCharacterFull.test(myReverse.character)){myChar=myContainer.nodeValue.substr(myOffset,0,1);myOffset=1;}}
if(opts.regexWordCharacterBasic.test(myChar)){if(myType=='normal'){var myNormal=getNextChar(myContainer,myOffset-1);if(opts.regexWordCharacterFull.test(myNormal.character)){return fitToEndWord(myNormal.container,myNormal.offset+1,'normal');}}
return{container:myContainer,offset:myOffset};}
else if(myType=='normal'&&opts.regexWordPunc.test(myChar)){var myNormal=getNextChar(myContainer,myOffset);if(opts.regexWordNumbers.test(myNormal.character))return fitToEndWord(myNormal.container,myNormal.offset,'normal');else return{container:myContainer,offset:myOffset-1};}
var myReverse=getPrevChar(myContainer,myOffset-1);if(myReverse.character.length==1)return fitToEndWord(myReverse.container,myReverse.offset+1,'reverse');else return{container:myContainer,offset:myOffset};};function fitToStartWord(myContainer,myOffset,myType){var myChar=myContainer.nodeValue.substr(myOffset,1);if(opts.regexWordCharacterBasic.test(myChar)){if(myType=='normal'){var myPrev=getPrevChar(myContainer,myOffset);if(opts.regexWordCharacterFull.test(myPrev.character)){return fitToStartWord(myPrev.container,myPrev.offset,'normal');}}
return{container:myContainer,offset:myOffset};}
else if(myType=='normal'&&opts.regexWordPunc.test(myChar)){var myPrev=getPrevChar(myContainer,myOffset);if(opts.regexWordNumbers.test(myPrev.character))return fitToStartWord(myPrev.container,myPrev.offset,'normal');}
var myNext=getNextChar(myContainer,myOffset);if(myNext.character==''){myContainer=$.fn.wrapSelection.dom.GetNextTextNode(myContainer);return fitToStartWord(myContainer,0);}
else if(myNext.character.length==1)return fitToStartWord(myNext.container,myNext.offset,'reverse');else return{container:myContainer,offset:myOffset};};function getNextChar(myContainer,myOffset){if(myOffset<0){var myPrevContainer=$.fn.wrapSelection.dom.GetPreviousTextNode(myContainer);if(myPrevContainer){myContainer=myPrevContainer;myOffset=myContainer.length;}}
if(myOffset<myContainer.length-1){return{container:myContainer,offset:myOffset+1,character:myContainer.nodeValue.substr(myOffset+1,1)};}
else{var myNext=$.fn.wrapSelection.dom.GetNextTextNode(myContainer,myContainer.parentNode);if(!myNext)return{container:myContainer,offset:myOffset,character:''};var myNextElement=$.fn.wrapSelection.dom.GetNextSiblingElement(myContainer);while(myNextElement&&$.fn.compareDocumentPosition(myNext,myNextElement)&2){if(myNextElement.nodeName.match(opts.regexElementBlockers))return{container:myContainer,offset:myOffset,character:''};myNextElement=$.fn.wrapSelection.dom.GetNextSiblingElement(myNextElement);}
return{container:myNext,offset:0,character:myNext.nodeValue.substr(0,1)};}};function getPrevChar(myContainer,myOffset){if(myOffset>0){return{container:myContainer,offset:myOffset-1,character:myContainer.nodeValue.substr(myOffset-1,1)};}
else{var myPrev=$.fn.wrapSelection.dom.GetPreviousTextNode(myContainer);if(!myPrev)return{container:myContainer,offset:myOffset,character:''};var myPrevElement=$.fn.wrapSelection.dom.GetPreviousSiblingElement(myContainer);while(myPrevElement&&$.fn.compareDocumentPosition(myPrev,myPrevElement)&4){if(myPrevElement.nodeName.match(opts.regexElementBlockers))return{container:myContainer,offset:myOffset,character:''};myPrevElement=$.fn.wrapSelection.dom.GetPreviousSiblingElement(myPrevElement);}
return{container:myPrev,offset:myPrev.length-1,character:myPrev.nodeValue.substr(myPrev.length-1,1)};}};function doWrap(){var myRange=$.fn.range;if(!myRange.startContainer||!myRange.endContainer)return false;var myNodes=myRange.GetContainedNodes();var iLength=myNodes.length;var myNodesSurrounded=0;for(var i=0;i<iLength;i++){if(!myNodes[i][0])continue;var myParent=myNodes[i][0].parentNode;var myParentName=myParent.nodeName;for(var j=0,jLength=myNodes[i].length;j<jLength;j++){var myNode=myNodes[i][j];var myNodeName=myNode.nodeName;if(myParentName=='div'&&myNodeName=='div')
{var myChildNodes=myNode.childNodes;var myLength=myChildNodes.length;myNodesSurrounded+=doWrap(myChildNodes[0],myChildNodes[myLength-1]);}
else if(myParentName=='DIV'){if(myNode.nodeType!=1)continue;var myChildNodes=myNode.childNodes;var mySpan=makeSpanElement();while(myChildNodes.length>0)mySpan.appendChild(myChildNodes[0]);myNode.appendChild(mySpan);}
else
{if(j==0){var mySpan=makeSpanElement();myParent.insertBefore(mySpan,myNodes[i][0]);}
mySpan.appendChild(myNode);}
myNodesSurrounded++;}}
return myNodesSurrounded;};function makeSpanElement(){var mySpan=document.createElement('span');mySpan.className=opts.selectClass;return mySpan;};};$.fn.range={onlySpacesMatch:new RegExp(/[^\t\r\n ]/),containedNodes:null,selection:null,commonAncestorContainer:null,startContainer:null,startOffset:null,endContainer:null,endOffset:null,collapsed:true,setRange:function(){if(window.getSelection){this.selection=window.getSelection();}
else if(document.selection){this.selection=document.selection.createRange();}
if(this.selection.rangeCount==0){return;}
else if(this.selection.getRangeAt){var range=this.selection.getRangeAt(0);}
else{var range=document.createRange();range.setStart(this.selection.anchorNode,this.selection.anchorOffset);range.setEnd(this.selection.focusNode,this.selection.focusOffset);}
if(!range.toString().match(this.onlySpacesMatch))return false;this.startContainer=range.startContainer;this.startOffset=range.startOffset;this.endContainer=range.endContainer;this.endOffset=range.endOffset;this.collapsed=range.collapsed;},ClearAllRanges:function(){if(!$.fn.range.selection)return;$.fn.range.selection.removeAllRanges();$.fn.range.ClearVariables();},ClearVariables:function(){this.selection=null;this.commonAncestorContainer=null;this.containedNodes=null;this.startContainer=null;this.startOffset=null;this.endContainer=null;this.endOffset=null;this.collapsed=true;},GetContainedNodes:function(){return this.doGetContainedNodes();},doGetContainedNodes:function(){if(this.containedNodes)return this.containedNodes;if(!this.startContainer||!this.endContainer)return[];var myStart=this.startContainer;var myEnd=this.endContainer;var myNodes=new Array([]);var myNode=myStart;var myPosition=$.fn.compareDocumentPosition(myStart,myEnd);var myParent=myNode.parentNode;var i=0;while((myPosition&4)||myPosition==0){if(myPosition&16)myNode=myNode.firstChild;else{if(myParent!=myNode.parentNode){i++;myNodes[i]=new Array;myParent=myNode.parentNode;}
myNodes[i].push(myNode);myNode=$.fn.wrapSelection.dom.GetNextSiblingOrParent(myNode);if(myPosition==0)break;}
myPosition=$.fn.compareDocumentPosition(myNode,myEnd);}
this.containedNodes=myNodes;return myNodes;}};$.fn.wrapSelection.dom={GetNextSiblingElement:function(myNode){return $.fn.wrapSelection.dom.getElementOrder(myNode,'next');},GetNextSiblingOrParent:function(myNode){return $.fn.wrapSelection.dom.getSiblingOrParentOrder(myNode,'next');},GetNextTextNode:function(myNode,myParent){while(myNode=$.fn.wrapSelection.dom.getNodeOrder(myNode,myParent,'next')){if(myNode.nodeType==3)return myNode;}
return myNode;},GetPreviousSiblingElement:function(myNode){return this.getElementOrder(myNode,'previous');},GetPreviousSiblingElement:function(myNode){return this.getElementOrder(myNode,'previous');},GetPreviousTextNode:function(myNode,myParent){while(myNode=$.fn.wrapSelection.dom.getNodeOrder(myNode,myParent,'previous')){if(myNode.nodeType==3)return myNode;}
return myNode;},getElementOrder:function(myNode,myType){myType+='Sibling';while(myNode[myType]&&myNode[myType].nodeType!=1){myNode=myNode[myType];}
return myNode[myType];},getSiblingOrParentOrder:function(myNode,myOrder){var mySibling=myOrder+'Sibling';if(myNode[mySibling])return myNode[mySibling];else if(myNode.parentNode)return this.getSiblingOrParentOrder(myNode.parentNode,myOrder)
else return null;},getNodeOrder:function(myNode,myParent,myOrder){if(typeof myParent=='undefined')myParent=document.body;if(myNode.hasChildNodes())return(myOrder=='next')?myNode.firstChild:myNode.lastChild;if(myNode==myParent)return null;var mySibling=(myOrder=='next')?'nextSibling':'previousSibling';if(myNode[mySibling])return myNode[mySibling];while(myNode=myNode.parentNode){if(myNode==myParent)return null;if(myNode[mySibling])return myNode[mySibling];}
return null;}};if($.browser.msie){$.extend($.fn.range,{ClearAllRanges:function(){if(this.selection)
this.selection.empty();this.ClearVariables();},setRange:function(){this.selection=document.selection;var myRange=this.selection.createRange();var myText=myRange.text;if(!myText.length)return false;if(!myText.match(this.onlySpacesMatch))return false;var myStart=this.getInitialContainer(myRange.duplicate(),'start');var myStartIndex=$.fn.wrapSelection.dom.SourceIndex(myStart.container,'string');var myEnd=this.getInitialContainer(myRange.duplicate(),'end');if(myStartIndex==$.fn.wrapSelection.dom.SourceIndex(myEnd.container,'string'))myStart.container=myEnd.container;this.startContainer=myStart.container;this.startOffset=myStart.offset;this.endContainer=myEnd.container;this.endOffset=myEnd.offset;this.collapsed=(myStart.container==myEnd.container&&myStart.offset==myEnd.offset);myRange.select();return true;},getInitialContainer:function(myRange,myType){if(myType=='start')myRange.collapse(true);else myRange.collapse(false);var myParent=myRange.parentElement();myRange.pasteHTML('<span id="range-temp"></span>');var myTemp=$('#range-temp')[0];var myOffset=0;var myNode=$.fn.wrapSelection.dom.GetNextTextNode(myTemp,myTemp.parentNode);if(!myNode){myNode=$.fn.wrapSelection.dom.GetPreviousTextNode(myTemp,myTemp.parentNode);myOffset=myNode.length;}
myTemp.parentNode.removeChild(myTemp);if(myType=="start"){if(myNode.previousSibling&&myNode.previousSibling.nodeType==3){var myPrev=myParent.removeChild(myNode.previousSibling);myOffset+=myPrev.length;myNode.insertData(0,myPrev.nodeValue);}}
else{if(myNode.previousSibling&&myNode.previousSibling.nodeType==3){var myPrev=myNode.previousSibling;myOffset+=myPrev.length;myParent.removeChild(myNode);myPrev.appendData(myNode.nodeValue);myNode=myPrev;}}
return{container:myNode,offset:myOffset};}});$.extend($.fn.wrapSelection.dom,{SourceIndex:function(myNode,myType){var myOut=[];do{var myOffset=0;while(myNode.previousSibling){myNode=myNode.previousSibling;myOffset++;}
myOut.unshift(myOffset);}
while(myNode=myNode.parentNode);if(myType&&myType=='string')
return myOut.join('.');return myOut;}});};$.fn.compareDocumentPosition=function(node1,node2){if("compareDocumentPosition"in document.documentElement){$.fn.compareDocumentPosition=function(node1,node2){return node1.compareDocumentPosition(node2);};}
else if("sourceIndex"in document.documentElement&&"contains"in document.documentElement){$.fn.compareDocumentPosition=function(node1,node2){if(node1==node2)return 0;if(getRootParent(node1)!=getRootParent(node2))return 1;if("sourceIndex"in node1&&"sourceIndex"in node2){return comparePosition(node1,node2);}
if(node1==document)return 20;else if(node2==document)return 10;var useNode1=getUseNode(node1),useNode2=getUseNode(node2);var result=comparePosition(useNode1,useNode2);if(node1!=useNode1)useNode1.parentNode.removeChild(useNode1);if(node2!=useNode2)useNode2.parentNode.removeChild(useNode2);return result;function comparePosition(node1,node2){return(node1.contains(node2)&&16)+
(node2.contains(node1)&&8)+
(node1.sourceIndex>=0&&node2.sourceIndex>=0?(node1.sourceIndex<node2.sourceIndex&&4)+
(node1.sourceIndex>node2.sourceIndex&&2):1);}
function getUseNode(node){if("sourceIndex"in node)return node;return node.parentNode.insertBefore(document.createComment(""),node);}};}
else{$.fn.compareDocumentPosition=function(node1,node2){if(node1==node2)return 0;if(getRootParent(node1)!=getRootParent(node2))return 1;if(node1==document||("contains"in node1&&"contains"in node2&&node1.contains(node2))){return 20;}
else if(node2==document||("contains"in node1&&"contains"in node2&&node2.contains(node1))){return 10;}
return compareOffsetStrings(getOffsetString(node1),getOffsetString(node2));function compareOffsetStrings(offset1,offset2){if(offset1.length==offset2.length){return(offset1<offset2)?4:2;}
else if(offset1.length<offset2.length){var offset2start=offset2.substr(0,offset1.length);if(offset1==offset2start)return 20;return compareOffsetStrings(offset1,offset2start);}
else{var result=compareOffsetStrings(offset2,offset1);return(result&4)?result>>1:result<<1;}}
function getOffsetString(node){var offsets=[];do{var offset=0,prev=node;while(prev=prev.previousSibling){offset++;}
var padLength=node.parentNode.childNodes.length.toString().length;var offsetLength=offset.toString().length;if(padLength>offsetLength){for(;offsetLength<=padLength;offsetLength++){offset="0"+offset;}}
offsets.unshift(offset);}
while((node=node.parentNode)&&node!=document);return offsets.join(".");}}}
function getRootParent(node){do{var parent=node;}
while(node=node.parentNode);return parent;}
return $.fn.compareDocumentPosition(node1,node2);};})(jQuery);
(function($){$.fn.verseNote=function(options){var defaults={noteID:'note',noteTitleID:'note-title',noteContentID:'note-content'};VersesInfo=[];var opts=$.extend({},defaults,options);getVersePositions();if($("#autosave").length==0)return;$('#mynotes').append('<input id="addNote" type="button" value="Add Note" />');$('#addNote').bind("click",getElementPositions);$('#addNote').bind("click",createNote);$(window).bind('resize',getVersePositions);return this;function createNote(e){var myVerse=getVerse(e);if(!myVerse)return false;var noteHTML='';var tmpID=new Date().getTime();var classID='notetmp_'+tmpID;var titleID='note_title_'+tmpID;var contentID='notes_content_'+tmpID;var verseIDParts=$(myVerse.node).attr('id').split(/-/);verseID=verseIDParts[1];var header=$("div.passagetitle h2[id$=-"+verseID+"]");var headId=$(header).attr('id');headId=headId.substr(1).split('-');if(headId.length>2){var start_id=headId[0];var end_id=headId[1];}
else{var start_id=headId[0];var end_id=headId[0];}
noteHTML+="<div id='"+classID+"' class='note-container "+classID+"'>";noteHTML+="<div class='titlebar'>";noteHTML+="<h3 id='"+titleID+"' class='notes-title "+classID+"'>"+$(header).text()+"</h3>";noteHTML+="<div class='actions'>";noteHTML+="<a href='#' class='note-delete' onclick=\"javascript:deleteNote(this)\" title='Delete this note'>Delete this note</a>";noteHTML+="</div>";noteHTML+="</div>";noteHTML+="<div id='"+contentID+"' class='note-content "+classID+"'></div>";noteHTML+="</div>";$('#addNote').before(noteHTML);var noteContainer=$('#'+classID)[0];$.data(noteContainer,'start_id',start_id);$.data(noteContainer,'end_id',end_id);openEditor($("#"+contentID));}
function handleOpenEditor(e){e.stopPropagation()
openEditor(this);}
function openEditor(node){var id=$(node).attr("id");var noteParent=$(node).parent();var noteContentID=id;var contentText=$('#'+noteContentID).html();$.data(noteParent[0],'tmpData',contentText);$('#'+noteContentID)
.after('<input type="button" id="cancelNote" value="Cancel" onClick="javascript:cancelNote(this);" />')
.after('<input type="button" id="saveNote" value="Save" onClick="javascript:editableBlur();"/>');tinyMCE.execCommand("mceAddControl",true,id);setTimeout(function(){tinyMCE.activeEditor.focus();$(document).one("click",editableBlur)},10);$(noteParent).bind("click",function(e){e.stopPropagation();});$(node).bind("dblclick",handleOpenEditor);$("#addNote").hide();}
function createVerseNumber(verse){var a_verse=verse.split(':');if(a_verse.length>1)var num=$.trim(a_verse[1]);else var num=$.trim(a_verse[0]);return num;}
function getVerse(e){var found=[];var y=e.pageY;var len=VersesInfo.length;for(i=0;i<len;i++){v=VersesInfo[i];if(y>=v.top&&y<=v.bottom){if(v.middleY<y)difference=y-v.middleY;else difference=v.middleY-y;v.proximity=difference*v.lines;found.push(v);}}
if(found.length>0){found.sort(sortMyVerses);return found[0];}
else return VersesInfo[0];}
function sortMyVerses(a,b){var A=a.proximity;var B=b.proximity;if(A<B)return-1;if(A>B)return 1;if(A==B)return 0;}
function getVerseID(wordNode){var verseId=$(wordNode).attr('id');return verseId.substr(1,8);}
function getVersePositions(){VersesInfo=[];var lineHeightHalf=25/2;$('.chapter-num, .verse-num').each(function(){offset=$(this).offset();height=$(this).height();VersesInfo.push({verse:$(this).text(),node:this,verseNum:createVerseNumber($(this).text()),verseID:getVerseID(this),top:offset.top-lineHeightHalf,middleY:offset.top+(height/2),height:height,bottom:offset.top+height+lineHeightHalf,parent:this.parentNode});})
var len=VersesInfo.length;for(i=0;i<len;i++){lineAdjust=0;current=VersesInfo[i];next=VersesInfo[i+1];if(i<len-1){if(current.parent===next.parent)bottom=next.bottom;else bottom=next.bottom-13-25;VersesInfo[i].bottom=bottom;}
VersesInfo[i].lines=Math.floor((VersesInfo[i].bottom-VersesInfo[i].top)/25);}
}};})(jQuery);
(function($){$.fn.textEdit=function(options){var myVerses=[];var defaults={saveCallback:false};var opts=$.extend({},defaults,options);$(this).bind("click",makeTextBox);return this;function clearOptions(){opts.id='';opts.id='';}
function makeTextBox(){var $this=$(this);var id=$this.attr('id');var myText=$this.text();$this.hide();$this.before("<input type='text' name='text-"+id+"' id='text-"+id+"' value='"+myText+"' />");var textbox=$("[id='text-"+id+"']");textbox.bind("blur",returnToText);}
function returnToText(){var $this=$(this);var id=$this.attr('id');var match=/text-/;var id=id.replace(match,'');var myText=$this[0].value;$this.remove();var title=$("[id='"+id+"']");title.text(myText);title.show();if(opts.saveCallback)opts.saveCallback();}};})(jQuery);
(function(){var opts;jQuery.fn.wordOffset=function(options){opts=jQuery.extend({},jQuery.fn.wrapSelection.defaults,options);if(this.size()==0)return this;var myClasses=this.attr('class').split(' ');var classSelector='.'+myClasses[0];var first=getIdAndOffset(classSelector+':first',"prepend");var last=getIdAndOffset(classSelector+':last',"append");offset={firstId:first.id,firstOffset:zeroPad(first.offset,2),lastId:last.id,lastOffset:zeroPad(last.offset,2)};return offset;};function zeroPad(n,digits){n=n.toString();while(n.length<digits){n='0'+n;}
return n;}
function getIdAndOffset(selector,prependOrAppend){var parent=getBlockContainer($(selector));var clone=parent
.clone()
.find(opts.cleanText)
.remove()
.end();clone
.find(selector)
[prependOrAppend]('<span id="'+opts.tempId+'"></span>');var idNumber=getVerseId(clone.find("#"+opts.tempId));clone
.find('#'+idNumber)
.parents()
.andSelf()
.each(function(){$(this).makeParentSpans().prevAll().remove();});clone
.find("#"+opts.tempId)
.parents()
.andSelf()
.each(function(){$(this).makeParentSpans().nextAll().remove();});var idNode=$('#'+idNumber);var verse=getVerseFromId(idNumber);var parentId=parent.attr('id');var parentVerseId=getVerseFromId(parentId);if(parentVerseId==verse){idNumber=parentId;verse=getVerseFromId(idNumber);}
var verseWordCount=clone.wordCount();var verseOffset=getOffsetFromId(idNumber);verseOffset=(verseOffset>0)?verseOffset-1:verseOffset;if(prependOrAppend=='append'&&verseWordCount>0)verseWordCount=verseWordCount-1;var isChapter=idNode.is('.chapter-num');if(isChapter&&verseWordCount==0)var offset=0;else var offset=verseWordCount+verseOffset;return{"id":verse,"offset":offset};}
function getVerseId(node){var idNode;var parent=getBlockContainer(node);var spanSearch=$(parent).find('span');var selectIndex=spanSearch.index(node);spanSearch=spanSearch
.filter(':lt('+selectIndex+')')
.filter('[id]:last');idNode=(spanSearch.length>0)?spanSearch[spanSearch.length-1]:parent;return $(idNode).attr('id');}
function getBlockContainer(myNode){return $(myNode).parents(opts.blockContainer).eq(0);}
function getVerseFromId(verseId){return verseId.substr(1,8);};function getOffsetFromId(verseId){var array=verseId.split(/[_.-]/);return(array.length==3)?parseInt(array[1]):0;};jQuery.fn.wordCount=function(){var hasVerseChapter=$(this).find('span').is('.chapter-num, .verse-num');var string=this.text()
.replace(/[:,]/g,' ')
.replace(/[\u201C\u201D\u2018\u2019]/g,'')
.replace(/^[\s\u2014\u00A0]+|[\s\u2014\u00A0]+$/g,'');var count=(string!='')?string.split(/[\s\u2014\u00A0]+/).length:0;return(hasVerseChapter)?count:count+1;};jQuery.fn.wrapSelection.defaults={blockContainer:'p, h3, h4',cleanText:".footnote,.cf",tempId:'tmpNode'};})();(function(){jQuery.fn.makeParentSpans=function(){this.parent().contents()
.not("[nodeType=1]")
.each(function()
{$(this).wrap("<span />");});return this;};})();
(function($){var UNDO_STACK=new Array();var REDO_STACK=new Array();$(document).bind('keydown',ctrlz);$(document).bind('keydown',ctrly);$.fn.undoRedo=function(undoCallback,redoCallback,undoParams){if(this.size()==0)return this;var undoObj={undoCallback:undoCallback,redoCallback:redoCallback,thisObj:this};undoObj=jQuery.extend({},undoObj,undoParams);UNDO_STACK.push(undoObj);REDO_STACK.length=0;return this;};$.fn.undo=function(){if(!hasNext(UNDO_STACK))return false;var undo=UNDO_STACK.pop();var undoTmp=undo.undoCallback(undo);undo=(undoTmp)?undoTmp:undo;REDO_STACK.push(undo);return undo.thisObj;}
$.fn.redo=function(){if(!hasNext(REDO_STACK))return false;var redo=REDO_STACK.pop();var redoTmp=redo.redoCallback(redo);redo=(redoTmp)?redoTmp:redo;UNDO_STACK.push(redo);return redo.thisObj;}
function hasNext(STACK){return(STACK.length>0);}
function ctrlz(e){if(hasNext(UNDO_STACK)&&e.ctrlKey){e=$.event.fix(e);if(String.fromCharCode(e.which).toLowerCase()=='z'){$.fn.undo();}}}
function ctrly(e){if(hasNext(REDO_STACK)&&e.ctrlKey){e=$.event.fix(e);if(String.fromCharCode(e.which).toLowerCase()=='y'){$.fn.redo();}}}})(jQuery);
(function($){$.fn.extend({unHighlight:function(obj){var myClass=obj.myClass;$(obj.thisObj).removeClass(myClass);if(obj.lastClass!=''){$(obj.thisObj).addClass(obj.lastClass);obj.saveObj.method='active';obj.saveObj.hlClass=obj.lastClass;}
else{obj.saveObj._method='delete';obj.saveObj.hlClass=obj.lastClass;}
saveUser('annotations','highlights',obj.saveObj);return jQuery.extend({},obj,{myClass:myClass});},reHighlight:function(obj){$(obj.thisObj).removeClass(obj.lastClass);$(obj.thisObj)
.addClass(obj.myClass);obj.saveObj.method='active';obj.saveObj.hlClass=obj.myClass;saveUser('annotations','highlights',obj.saveObj);return jQuery.extend({},obj,{myClass:obj.myClass});}})})(jQuery);
(function($){$.fn.floatingToolbar=function(e,options){var defaults={toolbar:$(this)[0],$toolbar:$(this),maxDistance:400,top:-50,closeToolbar:false};var opts=jQuery.extend({},defaults,options);var myMiddle={};if(opts.closeToolbar||opts.range.collapsed){closeToolbar();return false;};e.preventDefault();var myNode=opts.toolbar;var $myNode=opts.$toolbar;myNode.isOver=0;myNode.options=options;var height=$myNode.height();var width=$myNode.width();leftVal=e.pageX-(width/2)+"px";topVal=e.pageY-(height/2)+opts.top+"px";$myNode
.css({left:leftVal,top:topVal})
.show();myMiddle.x=(myNode.offsetLeft*2+myNode.offsetWidth)/2;myMiddle.y=(myNode.offsetTop*2+myNode.offsetHeight)/2;$(opts.toolbar).bind('mouseover.fltToolbar',function(){$(this).css('opacity',1);this.isOver=1;});$(opts.toolbar).bind('mouseout.fltToolbar',function(){$(opts.toolbar)[0].isOver=0;});checkVisibility(e);$().bind("mousemove.fltToolbar",checkVisibility);function closeToolbar(){opts.toolbar.isOver=0;opts.toolbar.options=null;$(opts.toolbar).hide();$(opts.toolbar).unbind('mouseover.fltToolbar');$(opts.toolbar).unbind('mouseout.fltToolbar');$().unbind('mousemove.fltToolbar');};function checkVisibility(e){if(!$(opts.toolbar)[0])return;if($(opts.toolbar)[0].isOver)return;var myX=e.pageX;var myY=e.pageY;var myDistance=Math.sqrt(Math.pow(myMiddle.y-myY,2)+Math.pow(myMiddle.x-myX,2));setOpacityByDistance(myDistance);}
function setOpacityByDistance(myDistance){var myMax=opts.maxDistance;var $myNode=opts.$toolbar;myDistance=1-myDistance/myMax;if(myDistance>0)$myNode.css('opacity',myDistance);else myNode.style.opacity=0;}};})(jQuery);
(function($){function toIntegersAtLease(n)
{return n<10?'0'+n:n;}
Date.prototype.toJSON=function(date)
{return this.getUTCFullYear()+'-'+
toIntegersAtLease(this.getUTCMonth())+'-'+
toIntegersAtLease(this.getUTCDate());};var escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'}
$.quoteString=function(string)
{if(escapeable.test(string))
{return'"'+string.replace(escapeable,function(a)
{var c=meta[a];if(typeof c==='string'){return c;}
c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"'}
return'"'+string+'"';}
$.toJSON=function(o,compact)
{var type=typeof(o);if(type=="undefined")
return"undefined";else if(type=="number"||type=="boolean")
return o+"";else if(o===null)
return"null";if(type=="string")
{return $.quoteString(o);}
if(type=="object"&&typeof o.toJSON=="function")
return o.toJSON(compact);if(type!="function"&&typeof(o.length)=="number")
{var ret=[];for(var i=0;i<o.length;i++){ret.push($.toJSON(o[i],compact));}
if(compact)
return"["+ret.join(",")+"]";else
return"["+ret.join(", ")+"]";}
if(type=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}
ret=[];for(var k in o){var name;var type=typeof(k);if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;val=$.toJSON(o[k],compact);if(typeof(val)!="string"){continue;}
if(compact)
ret.push(name+":"+val);else
ret.push(name+": "+val);}
return"{"+ret.join(", ")+"}";}
$.compactJSON=function(o)
{return $.toJSON(o,true);}
$.evalJSON=function(src)
{return eval("("+src+")");}
$.secureEvalJSON=function(src)
{var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");}})(jQuery);
