/* Copyright (c) 2007 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version: 1.0.2
 * Requires jQuery 1.1.3+
 * Docs: http://docs.jquery.com/Plugins/livequery
 */
(function($){$.extend($.fn,{livequery:function(type,fn,fn2){var self=this,q;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&type==query.type&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid))return(q=query)&&false;});q=q||new $.livequery(this.selector,this.context,type,fn,fn2);q.stopped=false;$.livequery.run(q.id);return this;},expire:function(type,fn,fn2){var self=this;if($.isFunction(type))fn2=fn,fn=type,type=undefined;$.each($.livequery.queries,function(i,query){if(self.selector==query.selector&&self.context==query.context&&(!type||type==query.type)&&(!fn||fn.$lqguid==query.fn.$lqguid)&&(!fn2||fn2.$lqguid==query.fn2.$lqguid)&&!this.stopped)$.livequery.stop(query.id);});return this;}});$.livequery=function(selector,context,type,fn,fn2){this.selector=selector;this.context=context||document;this.type=type;this.fn=fn;this.fn2=fn2;this.elements=[];this.stopped=false;this.id=$.livequery.queries.push(this)-1;fn.$lqguid=fn.$lqguid||$.livequery.guid++;if(fn2)fn2.$lqguid=fn2.$lqguid||$.livequery.guid++;return this;};$.livequery.prototype={stop:function(){var query=this;if(this.type)this.elements.unbind(this.type,this.fn);else if(this.fn2)this.elements.each(function(i,el){query.fn2.apply(el);});this.elements=[];this.stopped=true;},run:function(){if(this.stopped)return;var query=this;var oEls=this.elements,els=$(this.selector,this.context),nEls=els.not(oEls);this.elements=els;if(this.type){nEls.bind(this.type,this.fn);if(oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)$.event.remove(el,query.type,query.fn);});}else{nEls.each(function(){query.fn.apply(this);});if(this.fn2&&oEls.length>0)$.each(oEls,function(i,el){if($.inArray(el,els)<0)query.fn2.apply(el);});}}};$.extend($.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if($.livequery.running&&$.livequery.queue.length){var length=$.livequery.queue.length;while(length--)$.livequery.queries[$.livequery.queue.shift()].run();}},pause:function(){$.livequery.running=false;},play:function(){$.livequery.running=true;$.livequery.run();},registerPlugin:function(){$.each(arguments,function(i,n){if(!$.fn[n])return;var old=$.fn[n];$.fn[n]=function(){var r=old.apply(this,arguments);$.livequery.run();return r;}});},run:function(id){if(id!=undefined){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);}else
$.each($.livequery.queries,function(id){if($.inArray(id,$.livequery.queue)<0)$.livequery.queue.push(id);});if($.livequery.timeout)clearTimeout($.livequery.timeout);$.livequery.timeout=setTimeout($.livequery.checkQueue,20);},stop:function(id){if(id!=undefined)$.livequery.queries[id].stop();else
$.each($.livequery.queries,function(id){$.livequery.queries[id].stop();});}});$.livequery.registerPlugin('append','prepend','after','before','wrap','attr','removeAttr','addClass','removeClass','toggleClass','empty','remove');$(function(){$.livequery.play();});var init=$.prototype.init;$.prototype.init=function(a,c){var r=init.apply(this,arguments);if(a&&a.selector)r.context=a.context,r.selector=a.selector;if(typeof a=='string')r.context=c||document,r.selector=a;return r;};$.prototype.init.prototype=$.prototype;})(jQuery);
/**
 * Requires:
 *	jquery
 *	jquery-bgiframe.js
 *
 * Usage:
 *	jQuery.blockbox.show('<div>Testing!</div>');
 *	jQuery.blockbox.scrollAndResize()
 *	jQuery.blockbox.hide();
 */

jQuery(function($){
	jQuery.blockbox = {
		lastScroll:false
		,originalOverflow:false

		,show: function(content){
			jQuery.blockbox.lastScroll = jQuery.blockbox.getScroll();

			this.init();
			this.originalOverflow = $('html').css('overflow');

			$('#bgiframe').bgiframe();

			$('#overlay_content').html(content);
			$('#overlay_content,#overlay,#bgiframe').show();

			$('html').css({
				overflow:'hidden'
			});

			jQuery.blockbox.scrollTo(jQuery.blockbox.lastScroll [1]);

			this.scrollAndResize();



			$(window).bind('resize',this.scrollAndResize);

		}

		,hide: function(){
			$('#overlay,#overlay_content,#bgiframe').hide();
			$('html').css({
				overflow:this.originalOverflow?this.originalOverflow:'auto'
			});

			$(window).unbind('resize',this.scrollAndResize);

			jQuery.blockbox.scrollTo(this.lastScroll[1]);
			$('#bgiframe .bgiframe').remove();
		}

		,scrollAndResize: function(useLastScroll){
			var viewportwidth;
			var viewportheight;

			// the more standards compliant browsers
			// (mozilla/netscape/opera/IE7) use
			// window.innerWidth and window.innerHeight
			if(
				typeof window.innerWidth != 'undefined'
			){
				viewportwidth = window.innerWidth,
				viewportheight = window.innerHeight
			}

			// IE6 in standards compliant mode
			// (i.e. with a valid doctype as the first line in the document)
			else if(
				typeof document.documentElement != 'undefined'
				&& typeof document.documentElement.clientWidth !=
					'undefined' && document.documentElement.clientWidth != 0
			){
				viewportwidth = document.documentElement.clientWidth,
				viewportheight = document.documentElement.clientHeight
			}else if(	// IE7
				typeof document.body != 'undefined'
				&& typeof document.body.clientWidth !=
					'undefined' && document.body.clientWidth != 0
			){
				viewportwidth = document.body.clientWidth,
				viewportheight = document.body.clientHeight
			}

			// older versions of IE
			else{
				viewportwidth = document.getElementsByTagName('html')[0].clientWidth,
				viewportheight = document.getElementsByTagName('html')[0].clientHeight
			}

			$('#overlay,#overlay_content,#bgiframe')
				.css({
					top:jQuery.blockbox.lastScroll[1]
					,left:jQuery.blockbox.lastScroll[0]
				})
			;

			var scroll = jQuery.blockbox.lastScroll;
			var height = $('#overlay_content').height();
			var width = $('#overlay_content').width();

			var win_height = viewportheight;
			var win_width = viewportwidth;

			$('#overlay,#bgiframe').css({
				height: win_height
				,width: win_width
			});


			$('#overlay_content').css({
				top: (win_height - height)/2 + scroll[1]
				,left: (win_width - width)/2 + scroll[0]
			});

			jQuery.blockbox.scrollTo(scroll[1],scroll[0]);
		}
		,init: function(){
			if(!$('#overlay').size()){
				$('body').append('<div id="bgiframe"></div>');

				$('body').append('<div id="overlay"></div>');
				$('body').append('<div id="overlay_content"></div>');

				$('#overlay').css({
					opacity:.7
					,background:'black'
					,position:'absolute'
				});

				$('#overlay_content').css({
					background:'white'
					,position:'absolute'
				});
				$('#bgiframe').css('position','absolute');
			}
		}
		,scrollTo: function(scrOfY,scrOfX){
			if(
				typeof( document.body.scrollTop ) == 'number'
			){
				//Netscape compliant
				document.body.scrollTop = scrOfY;
				document.body.scrollLeft = scrOfX;
			}else if(
				document.body
				&& (
					document.body.scrollLeft
					|| document.body.scrollTop
				)
			){
				//DOM compliant
				document.body.scrollTop = scrOfY;
				document.body.scrollLeft = scrOfX;
			}else if(
				document.documentElement
				&& (
					document.documentElement.scrollLeft
					|| document.documentElement.scrollTop
				)
			){
				//IE6 standards compliant mode
				document.documentElement.scrollTop = scrOfY;
				document.documentElement.scrollLeft = scrOfX;
			}
		}
		,getScroll: function(){
			var scrOfX = 0, scrOfY = 0;
			if(
				typeof( window.pageYOffset ) == 'number'
			){
				//Netscape compliant
				scrOfY = window.pageYOffset;
				scrOfX = window.pageXOffset;
			}else if(
				document.body
				&& (
					document.body.scrollLeft
					|| document.body.scrollTop
				)
			){
				//DOM compliant
				scrOfY = document.body.scrollTop;
				scrOfX = document.body.scrollLeft;
			}else if(
				document.documentElement
				&& (
					document.documentElement.scrollLeft
					|| document.documentElement.scrollTop
				)
			){
				//IE6 standards compliant mode
				scrOfY = document.documentElement.scrollTop;
				scrOfX = document.documentElement.scrollLeft;
			}
			return [ scrOfX, scrOfY ];
		}
	}

	jQuery.fn.blockbox = function(n){
		jQuery.blockbox.show(
			this[0]
		);


		return $('#overlay_content').children();
	}
	jQuery.fn.blockbox.hide = function(){jQuery.blockbox.hide()};
});


function set_overlay_softwhite(  )
{
	$('#overlay').css({
		'opacity': '.70',
		'filter': 'alpha(opacity=60)',
		'background-color': 'white',
		'color': 'white'
	});
}
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-07-21 18:45:56 -0500 (Sat, 21 Jul 2007) $
 * $Rev: 2447 $
 *
 * Version 2.1.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * Date: 2/19/2008
 * @author Ariel Flesler
 * @version 1.3.3
 */
;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
/**
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(9($){$.1s.B=9(o){z 4.1b(9(){3h r(4,o)})};8 q={W:J,23:1,1X:1,u:7,15:3,17:7,1I:\'2O\',2b:\'2E\',1i:0,C:7,1h:7,1D:7,2x:7,2w:7,2v:7,2t:7,2r:7,2q:7,2o:7,1Q:\'<Y></Y>\',1P:\'<Y></Y>\',2k:\'2j\',2g:\'2j\',1L:7,1J:7};$.B=9(e,o){4.5=$.1a({},q,o||{});4.P=J;4.E=7;4.H=7;4.t=7;4.U=7;4.Q=7;4.N=!4.5.W?\'1E\':\'27\';4.F=!4.5.W?\'26\':\'25\';6(e.20==\'3p\'||e.20==\'3n\'){4.t=$(e);4.E=4.t.1p();6($.D.1e(4.E[0].D,\'B-H\')){6(!$.D.1e(4.E[0].3k.D,\'B-E\'))4.E=4.E.C(\'<Y></Y>\');4.E=4.E.1p()}10 6(!$.D.1e(4.E[0].D,\'B-E\'))4.E=4.t.C(\'<Y></Y>\').1p();8 a=e.D.3g(\' \');1n(8 i=0;i<a.O;i++){6(a[i].3c(\'B-3b\')!=-1){4.t.1y(a[i]);4.E.R(a[i]);1m}}}10{4.E=$(e);4.t=$(e).2m(\'32,2Z\')}4.H=4.t.1p();6(!4.H.O||!$.D.1e(4.H[0].D,\'B-H\'))4.H=4.t.C(\'<Y></Y>\').1p();4.Q=$(\'.B-13\',4.E);6(4.Q.u()==0&&4.5.1P!=7)4.Q=4.H.1w(4.5.1P).13();4.Q.R(4.D(\'B-13\'));4.U=$(\'.B-16\',4.E);6(4.U.u()==0&&4.5.1Q!=7)4.U=4.H.1w(4.5.1Q).13();4.U.R(4.D(\'B-16\'));4.H.R(4.D(\'B-H\'));4.t.R(4.D(\'B-t\'));4.E.R(4.D(\'B-E\'));8 b=4.5.17!=7?1k.1M(4.1j()/4.5.17):7;8 c=4.t.2m(\'1u\');8 d=4;6(c.u()>0){8 f=0,i=4.5.1X;c.1b(9(){d.1O(4,i++);f+=d.T(4,b)});4.t.y(4.N,f+\'S\');6(!o||o.u==L)4.5.u=c.u()}4.E.y(\'1x\',\'1B\');4.U.y(\'1x\',\'1B\');4.Q.y(\'1x\',\'1B\');4.2p=9(){d.16()};4.2s=9(){d.13()};$(2D).1W(\'2B\',9(){d.29()});6(4.5.1h!=7)4.5.1h(4,\'28\');4.1F()};8 r=$.B;r.1s=r.2z={B:\'0.2.2\'};r.1s.1a=r.1a=$.1a;r.1s.1a({1F:9(){4.A=7;4.G=7;4.Z=7;4.11=7;4.14=J;4.1c=7;4.M=7;4.V=J;6(4.P)z;4.t.y(4.F,4.1r(4.5.1X)+\'S\');8 p=4.1r(4.5.23);4.Z=4.11=7;4.1g(p,J)},24:9(){4.t.22();4.t.y(4.F,\'21\');4.t.y(4.N,\'21\');6(4.5.1h!=7)4.5.1h(4,\'24\');4.1F()},29:9(){6(4.M!=7&&4.V)4.t.y(4.F,r.K(4.t.y(4.F))+4.M);4.M=7;4.V=J;6(4.5.1D!=7)4.5.1D(4);6(4.5.17!=7){8 a=4;8 b=1k.1M(4.1j()/4.5.17),N=0,F=0;$(\'1u\',4.t).1b(9(i){N+=a.T(4,b);6(i+1<a.A)F=N});4.t.y(4.N,N+\'S\');4.t.y(4.F,-F+\'S\')}4.15(4.A,J)},2y:9(){4.P=1f;4.1q()},3m:9(){4.P=J;4.1q()},u:9(s){6(s!=L){4.5.u=s;6(!4.P)4.1q()}z 4.5.u},1e:9(i,a){6(a==L||!a)a=i;1n(8 j=i;j<=a;j++){8 e=4.I(j).I(0);6(!e||$.D.1e(e,\'B-19-1C\'))z J}z 1f},I:9(i){z $(\'.B-19-\'+i,4.t)},3l:9(i,s){8 e=4.I(i),1Y=0;6(e.O==0){8 c,e=4.1A(i),j=r.K(i);1o(c=4.I(--j)){6(j<=0||c.O){j<=0?4.t.2u(e):c.1V(e);1m}}}10 1Y=4.T(e);e.1y(4.D(\'B-19-1C\'));1U s==\'3j\'?e.3f(s):e.22().3d(s);8 a=4.5.17!=7?1k.1M(4.1j()/4.5.17):7;8 b=4.T(e,a)-1Y;6(i>0&&i<4.A)4.t.y(4.F,r.K(4.t.y(4.F))+b+\'S\');4.t.y(4.N,r.K(4.t.y(4.N))+b+\'S\');z e},1T:9(i){8 e=4.I(i);6(!e.O||(i>=4.A&&i<=4.G))z;8 d=4.T(e);6(i<4.A)4.t.y(4.F,r.K(4.t.y(4.F))+d+\'S\');e.1T();4.t.y(4.N,r.K(4.t.y(4.N))-d+\'S\')},16:9(){4.1z();6(4.M!=7&&!4.V)4.1S(J);10 4.15(((4.5.C==\'1R\'||4.5.C==\'G\')&&4.5.u!=7&&4.G==4.5.u)?1:4.A+4.5.15)},13:9(){4.1z();6(4.M!=7&&4.V)4.1S(1f);10 4.15(((4.5.C==\'1R\'||4.5.C==\'A\')&&4.5.u!=7&&4.A==1)?4.5.u:4.A-4.5.15)},1S:9(b){6(4.P||4.14||!4.M)z;8 a=r.K(4.t.y(4.F));!b?a-=4.M:a+=4.M;4.V=!b;4.Z=4.A;4.11=4.G;4.1g(a)},15:9(i,a){6(4.P||4.14)z;4.1g(4.1r(i),a)},1r:9(i){6(4.P||4.14)z;6(4.5.C!=\'18\')i=i<1?1:(4.5.u&&i>4.5.u?4.5.u:i);8 a=4.A>i;8 b=r.K(4.t.y(4.F));8 f=4.5.C!=\'18\'&&4.A<=1?1:4.A;8 c=a?4.I(f):4.I(4.G);8 j=a?f:f-1;8 e=7,l=0,p=J,d=0;1o(a?--j>=i:++j<i){e=4.I(j);p=!e.O;6(e.O==0){e=4.1A(j).R(4.D(\'B-19-1C\'));c[a?\'1w\':\'1V\'](e)}c=e;d=4.T(e);6(p)l+=d;6(4.A!=7&&(4.5.C==\'18\'||(j>=1&&(4.5.u==7||j<=4.5.u))))b=a?b+d:b-d}8 g=4.1j();8 h=[];8 k=0,j=i,v=0;8 c=4.I(i-1);1o(++k){e=4.I(j);p=!e.O;6(e.O==0){e=4.1A(j).R(4.D(\'B-19-1C\'));c.O==0?4.t.2u(e):c[a?\'1w\':\'1V\'](e)}c=e;8 d=4.T(e);6(d==0){3a(\'39: 38 1E/27 37 1n 36. 35 34 33 31 30 2Y. 2X...\');z 0}6(4.5.C!=\'18\'&&4.5.u!==7&&j>4.5.u)h.2W(e);10 6(p)l+=d;v+=d;6(v>=g)1m;j++}1n(8 x=0;x<h.O;x++)h[x].1T();6(l>0){4.t.y(4.N,4.T(4.t)+l+\'S\');6(a){b-=l;4.t.y(4.F,r.K(4.t.y(4.F))-l+\'S\')}}8 n=i+k-1;6(4.5.C!=\'18\'&&4.5.u&&n>4.5.u)n=4.5.u;6(j>n){k=0,j=n,v=0;1o(++k){8 e=4.I(j--);6(!e.O)1m;v+=4.T(e);6(v>=g)1m}}8 o=n-k+1;6(4.5.C!=\'18\'&&o<1)o=1;6(4.V&&a){b+=4.M;4.V=J}4.M=7;6(4.5.C!=\'18\'&&n==4.5.u&&(n-k+1)>=1){8 m=r.X(4.I(n),!4.5.W?\'1l\':\'1H\');6((v-m)>g)4.M=v-g-m}1o(i-->o)b+=4.T(4.I(i));4.Z=4.A;4.11=4.G;4.A=o;4.G=n;z b},1g:9(p,a){6(4.P||4.14)z;4.14=1f;8 b=4;8 c=9(){b.14=J;6(p==0)b.t.y(b.F,0);6(b.5.C==\'1R\'||b.5.C==\'G\'||b.5.u==7||b.G<b.5.u)b.2i();b.1q();b.1N(\'2h\')};4.1N(\'2V\');6(!4.5.1I||a==J){4.t.y(4.F,p+\'S\');c()}10{8 o=!4.5.W?{\'26\':p}:{\'25\':p};4.t.1g(o,4.5.1I,4.5.2b,c)}},2i:9(s){6(s!=L)4.5.1i=s;6(4.5.1i==0)z 4.1z();6(4.1c!=7)z;8 a=4;4.1c=2U(9(){a.16()},4.5.1i*2T)},1z:9(){6(4.1c==7)z;2S(4.1c);4.1c=7},1q:9(n,p){6(n==L||n==7){8 n=!4.P&&4.5.u!==0&&((4.5.C&&4.5.C!=\'A\')||4.5.u==7||4.G<4.5.u);6(!4.P&&(!4.5.C||4.5.C==\'A\')&&4.5.u!=7&&4.G>=4.5.u)n=4.M!=7&&!4.V}6(p==L||p==7){8 p=!4.P&&4.5.u!==0&&((4.5.C&&4.5.C!=\'G\')||4.A>1);6(!4.P&&(!4.5.C||4.5.C==\'G\')&&4.5.u!=7&&4.A==1)p=4.M!=7&&4.V}8 a=4;4.U[n?\'1W\':\'2f\'](4.5.2k,4.2p)[n?\'1y\':\'R\'](4.D(\'B-16-1v\')).1K(\'1v\',n?J:1f);4.Q[p?\'1W\':\'2f\'](4.5.2g,4.2s)[p?\'1y\':\'R\'](4.D(\'B-13-1v\')).1K(\'1v\',p?J:1f);6(4.U.O>0&&(4.U[0].1d==L||4.U[0].1d!=n)&&4.5.1L!=7){4.U.1b(9(){a.5.1L(a,4,n)});4.U[0].1d=n}6(4.Q.O>0&&(4.Q[0].1d==L||4.Q[0].1d!=p)&&4.5.1J!=7){4.Q.1b(9(){a.5.1J(a,4,p)});4.Q[0].1d=p}},1N:9(a){8 b=4.Z==7?\'28\':(4.Z<4.A?\'16\':\'13\');4.12(\'2x\',a,b);6(4.Z!=4.A){4.12(\'2w\',a,b,4.A);4.12(\'2v\',a,b,4.Z)}6(4.11!=4.G){4.12(\'2t\',a,b,4.G);4.12(\'2r\',a,b,4.11)}4.12(\'2q\',a,b,4.A,4.G,4.Z,4.11);4.12(\'2o\',a,b,4.Z,4.11,4.A,4.G)},12:9(a,b,c,d,e,f,g){6(4.5[a]==L||(1U 4.5[a]!=\'2e\'&&b!=\'2h\'))z;8 h=1U 4.5[a]==\'2e\'?4.5[a][b]:4.5[a];6(!$.2R(h))z;8 j=4;6(d===L)h(j,c,b);10 6(e===L)4.I(d).1b(9(){h(j,4,d,c,b)});10{1n(8 i=d;i<=e;i++)6(!(i>=f&&i<=g))4.I(i).1b(9(){h(j,4,i,c,b)})}},1A:9(i){z 4.1O(\'<1u></1u>\',i)},1O:9(e,i){8 a=$(e).R(4.D(\'B-19\')).R(4.D(\'B-19-\'+i));a.1K(\'2Q\',i);z a},D:9(c){z c+\' \'+c+(!4.5.W?\'-2P\':\'-W\')},T:9(e,d){8 a=e.2l!=L?e[0]:e;8 b=!4.5.W?a.1t+r.X(a,\'2d\')+r.X(a,\'1l\'):a.2c+r.X(a,\'2n\')+r.X(a,\'1H\');6(d==L||b==d)z b;8 w=!4.5.W?d-r.X(a,\'2d\')-r.X(a,\'1l\'):d-r.X(a,\'2n\')-r.X(a,\'1H\');$(a).y(4.N,w+\'S\');z 4.T(a)},1j:9(){z!4.5.W?4.H[0].1t-r.K(4.H.y(\'2N\'))-r.K(4.H.y(\'2M\')):4.H[0].2c-r.K(4.H.y(\'2L\'))-r.K(4.H.y(\'2K\'))},2J:9(i,s){6(s==L)s=4.5.u;z 1k.2I((((i-1)/s)-1k.3e((i-1)/s))*s)+1}});r.1a({2H:9(d){$.1a(q,d)},X:9(e,p){6(!e)z 0;8 a=e.2l!=L?e[0]:e;6(p==\'1l\'&&$.2G.2F){8 b={\'1x\':\'1B\',\'3i\':\'2C\',\'1E\':\'1i\'},1G,1Z;$.2a(a,b,9(){1G=a.1t});b[\'1l\']=0;$.2a(a,b,9(){1Z=a.1t});z 1Z-1G}z r.K($.y(a,p))},K:9(v){v=2A(v);z 3o(v)?0:v}})})(3q);',62,213,'||||this|options|if|null|var|function||||||||||||||||||||list|size||||css|return|first|jcarousel|wrap|className|container|lt|last|clip|get|false|intval|undefined|tail|wh|length|locked|buttonPrev|addClass|px|dimension|buttonNext|inTail|vertical|margin|div|prevFirst|else|prevLast|callback|prev|animating|scroll|next|visible|circular|item|extend|each|timer|jcarouselstate|has|true|animate|initCallback|auto|clipping|Math|marginRight|break|for|while|parent|buttons|pos|fn|offsetWidth|li|disabled|before|display|removeClass|stopAuto|create|block|placeholder|reloadCallback|width|setup|oWidth|marginBottom|animation|buttonPrevCallback|attr|buttonNextCallback|ceil|notify|format|buttonPrevHTML|buttonNextHTML|both|scrollTail|remove|typeof|after|bind|offset|old|oWidth2|nodeName|0px|empty|start|reset|top|left|height|init|reload|swap|easing|offsetHeight|marginLeft|object|unbind|buttonPrevEvent|onAfterAnimation|startAuto|click|buttonNextEvent|jquery|children|marginTop|itemVisibleOutCallback|funcNext|itemVisibleInCallback|itemLastOutCallback|funcPrev|itemLastInCallback|prepend|itemFirstOutCallback|itemFirstInCallback|itemLoadCallback|lock|prototype|parseInt|resize|none|window|swing|safari|browser|defaults|round|index|borderBottomWidth|borderTopWidth|borderRightWidth|borderLeftWidth|normal|horizontal|jcarouselindex|isFunction|clearTimeout|1000|setTimeout|onBeforeAnimation|push|Aborting|loop|ol|infinite|an|ul|cause|will|This|items|set|No|jCarousel|Array|skin|indexOf|append|floor|html|split|new|float|string|parentNode|add|unlock|OL|isNaN|UL|jQuery'.split('|'),0,{}))

/******blockbox*******/
function getPageSize(){
	try{
		var viewportwidth;
		var viewportheight;

		// the more standards compliant browsers
		// (mozilla/netscape/opera/IE7) use
		// window.innerWidth and window.innerHeight

		if(
			typeof window.innerWidth != 'undefined'
		){
			viewportwidth = window.innerWidth,
			viewportheight = window.innerHeight
		}

		// IE6 in standards compliant mode
		// (i.e. with a valid doctype as the first line in the document)
		else if(
			typeof document.documentElement != 'undefined'
			&& typeof document.documentElement.clientWidth !=
				'undefined' && document.documentElement.clientWidth != 0
		){
			viewportwidth = document.documentElement.clientWidth,
			viewportheight = document.documentElement.clientHeight
		}

		// older versions of IE
		else{
			viewportwidth = document.getElementsByTagName('html')[0].clientWidth,
			viewportheight = document.getElementsByTagName('html')[0].clientHeight
		}

		arrayPageSize = [viewportwidth,viewportheight];
		return arrayPageSize;
	}catch(e){return [1024,768];}
}

/*Function to open blockbox for particular image*/
function openCompositeLg(pos)
{
	try{
		if(!isNullOrUndefined(snap) && (parseInt(snap.length,10)  < (parseInt(pos,10)+1))){return false;}

		var pgSz = getPageSize();
		var y = pgSz[1];

		var blockboxHtml = createBlockbox(y*0.9,pos);

		$(blockboxHtml).blockbox().animate({'':''}, function() {
			$('#blkbx-mycarousel').openBlockbox(pos);
		});
	}catch(e){closeBlockbox(); return false;}
}

/*Function to generate the html string for blockbox*/
function createBlockbox(windowHeight,imgPos)
{
	var blkHtml =

	'<div class="mainContainer" style="height:'+windowHeight+'px">'+
		'<div id="innerContainer">'+
			'<div id="exitContainer">'+
				'<div style="position: relative; height: 16px; top: -5px;">'+
					'<div style="position: relative; float: left; text-align: left;" class="timeStamp" imageno="'+imgPos+'">&nbsp;</div>'+
					'<div style="position: relative; float: right; text-align: right;"><a id="blkbx-mycarousel-close" style="cursor: pointer;" onclick="closeBlockbox()">X</a></div>'+
				'</div>'+
			'</div>'+
			'<div id="blkbx-wrap">'+
				'<ul id="blkbx-mycarousel" class="jcarousel-skin-ie7"></ul>'+
			'</div>'+
			'<div id="blkbx-nav">'+
				'<div id="blkbx-mycarousel-first" style="float: left; width: 33%; text-align: left;"><a class="buttonActive" href="#"><< FIRST</a><a class="buttonDisabled"><< FIRST</a></div>'+
				'<div id="blkbx-mycarousel-prev" style="float: left; width: 16%; text-align: right;"><a class="buttonActive" href="#">< PREVIOUS</a><a class="buttonDisabled">< PREVIOUS</a></div>'+
				'<div id="blkbx-mycarousel-next" style="float: left; width: 16%; text-align: left;"><a class="buttonActive" href="#">NEXT ></a><a class="buttonDisabled">NEXT ></a></div>'+
				'<div id="blkbx-mycarousel-last" style="float: right; width: 33%; text-align: right;"><a class="buttonActive" href="#">LAST >></a><a class="buttonDisabled">LAST >></a></div>'+
			'</div>'+
		'</div>'+
	'</div>';

	return blkHtml;
}

/*Function to close blockbox*/
function closeBlockbox()
{
	$.blockbox.hide();
}

/*Function to close blockbox on click of the outer overlay*/
jQuery(function() {

	$('#overlay').livequery('click', function() {
		closeBlockbox();
	});

});

function mycarousel_itemLoadCallback(carousel, state)
{
	if(state == "init")
	{
		if(carousel.options.size == 2)	//only 1 image - do not scroll
		{
			$('body').allowNextButton(false);
			$('body').allowPrevButton(false);
		}
		else if((carousel.options.start+1) >= carousel.options.size)	// at end of carousel
	    {
	    	$('body').allowNextButton(false);
	    }
	    else if(carousel.options.start == 1)	// at beginning of carousel
	    {
	    	$('body').allowPrevButton(false);
	    }
	}

	if(state == "next" || state == "prev")
	{
		if(carousel.first == 1)	// at beginning of carousel
		{
			$('body').allowPrevButton(false);
			$('body').allowNextButton(true);
		}
		else if(carousel.last == carousel.options.size)	// at end of carousel
	    {
	    	$('body').allowNextButton(false);
	    	$('body').allowPrevButton(true);
	    }
	}

    for (var i = carousel.first; i <= carousel.last; i++)
    {
        if (carousel.has(i)) {
        	continue;
        }

        if (i > snap.length) {
        	 break;
        }

        carousel.add(i, mycarousel_getItemHTML(snap[i-1]));
    }

};

/*Function to build the html for each individual image*/
function mycarousel_getItemHTML(item)
{
	var imgHeight = item.height + "px";
	if(imgHeight=="0px"){
		if($.browser.msie){ imgHeight="600px";}
		else{ imgHeight = "auto";}
	}
    return '<img src="' + item.url + '" width="' + item.width + '" height="' + imgHeight + '" />';
};

jQuery.fn.extend({
	openBlockbox: function(startPosition) {
		return 	$(this).jcarousel({
	        size: snap.length+1,
	        scroll: 1,
	        start: startPosition+1,
	        initCallback: mycarousel_initCallback,
	        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
		});
	},allowPrevButton: function(val) {
		if(val) {
			$('#blkbx-mycarousel-prev .buttonDisabled').hide();
			$('#blkbx-mycarousel-first .buttonDisabled').hide();
			$('#blkbx-mycarousel-prev .buttonActive').css({'display':'inline'});
			$('#blkbx-mycarousel-first .buttonActive').css({'display':'inline'});
		}else{
			$('#blkbx-mycarousel-prev .buttonActive').hide();
			$('#blkbx-mycarousel-first .buttonActive').hide();
			$('#blkbx-mycarousel-prev .buttonDisabled').css({'display':'inline'});
			$('#blkbx-mycarousel-first .buttonDisabled').css({'display':'inline'});
		}
		return false;
	}, allowNextButton: function(val) {
		if(val) {
			$('#blkbx-mycarousel-next .buttonDisabled').hide();
			$('#blkbx-mycarousel-last .buttonDisabled').hide();
			$('#blkbx-mycarousel-next .buttonActive').css({'display':'inline'});
			$('#blkbx-mycarousel-last .buttonActive').css({'display':'inline'});
		}else{
			$('#blkbx-mycarousel-next .buttonActive').hide();
			$('#blkbx-mycarousel-last .buttonActive').hide();
			$('#blkbx-mycarousel-next .buttonDisabled').css({'display':'inline'});
			$('#blkbx-mycarousel-last .buttonDisabled').css({'display':'inline'});
		}
		return false;
	}, updateTimeStamp: function(pos) {
		if(!isNullOrUndefined(thumb))
		{
			if(pos < thumb.length)
			{
				$('#exitContainer .timeStamp').html(unixTimeToDate(thumb[pos]['taken']));
			}
		}
		return false;
	}

});

function mycarousel_initCallback(carousel) {

    jQuery('#blkbx-mycarousel-next .buttonActive').bind('click', function() {
        carousel.next();
        $(this).updateTimeStamp(parseInt(carousel.first,10)-1);
        $('body').allowPrevButton(true);
        return false;
    });

    jQuery('#blkbx-mycarousel-prev .buttonActive').bind('click', function() {
        carousel.prev();
        $(this).updateTimeStamp(parseInt(carousel.first,10)-1);
        $('body').allowNextButton(true);
        return false;
    });

    jQuery('#blkbx-mycarousel-first .buttonActive').bind('click', function() {
    	carousel.scroll($.jcarousel.intval(1));
    	$(this).updateTimeStamp(parseInt(carousel.first,10)-1);
    	$('body').allowPrevButton(false);
    	$('body').allowNextButton(true);
        return false;
    });

    jQuery('#blkbx-mycarousel-last .buttonActive').bind('click', function() {
    	carousel.scroll($.jcarousel.intval(carousel.options.size));
    	$(this).updateTimeStamp(parseInt(carousel.first,10)-1);
    	$('body').allowPrevButton(true);
    	$('body').allowNextButton(false);
        return false;
    });

};

/*GLOBALS*/
query = [];
thumb = [];
snap = [];
totalPgNo = 1;
genKey = 0;

/*jQuery on load functionality*/
jQuery(function()
{
	initJson(baseJsonUrl);	

	//ajax error message
	$("#msg").ajaxError(function(evt, request, settings){
		
		if(settings.type == "GET")
		{
			$('#topNav').hide();
			$('#scrollContainer').hide();
			$('#bottomNav').hide();
			$('.zoom').hide();
			
			$(this).append("<li>There are currently no historic thumbnails for the the requested domain.  Please choose another domain to continue.</li>");
			/*if(request.status == 404)
			{
				$(this).append("<li>There are currently no historic thumbnails for the the requested domain.  Please choose another domain to continue.</li>");
			}else{
				$(this).append("<li>An error has occured while loading this set of thumbnails, please submit again!</li>");
			}*/
		}else{
			$(this).append("<li>There are currently no historic thumbnails for the the requested domain.  Please choose another domain to continue.</li>");
			/*$(this).append("<li>An error has occured while loading this set of thumbnails, please submit again!</li>");*/
		}
	
	});	
	
});


/*Function to get the initial values from json*/
function initJson(jsonUrl)
{
	$.getJSON (jsonUrl, function(data) {
		
		totalPgNo = Math.ceil(data.datecount/(rowValue*2));
		$('.pgTotal').html(totalPgNo);
		
		/******************************************/
		query['domain']=data.domain;
		query['newest']=data.newest;
		
		genKey=data.generation;
		
		query['generation']=data.generation;
		query['datecount']=data.datecount;
		query['images']= data.images;
		query['oldest']=data.oldest;
		query['imagecount']=data.imagecount;	
		/******************************************/	
		
		parseImages();
		
		addTimeStamps();
	});
		
}

/*Function to parse array of images into snapshots and thumbnails*/
function parseImages()
{
	$.each(query['images'], function(){
		$.each(this, function(i){
			if(this.type=="thumbnail"){ thumb.push(this); }
			else if(this.type=="fullsize"){ snap.push(this); }
		});
	});
}

/*Function to load time stamps to images*/
jQuery(function()
{
	$('.timeStamp').livequery(function() {
		if(!isNullOrUndefined(thumb))
		{
			var imageLoc = $(this).attr('imageno');
			if(imageLoc < thumb.length)
			{
				$(this).css({'font-size':globalTableProps[globalTableIndex][1]}).html(unixTimeToDate(thumb[imageLoc]['taken']));
			}
		}
	});	
});

/*Function to add timestamps to first set of thumbnail images - for IE fix*/
function addTimeStamps()
{
	$('#mainWindow .timeStamp').animate({'':''},function() {
		if(!isNullOrUndefined(thumb))
		{
			var imageLoc = $(this).attr('imageno');
			if(imageLoc < thumb.length)
			{
				$(this).css({'font-size':globalTableProps[globalTableIndex][1]}).html(unixTimeToDate(thumb[imageLoc]['taken']));
			}
		}
	});		
}

/*Function to output true if the object is null or undefined*/
function isNullOrUndefined(obj)
{
	try{
		if(obj != null && obj != 'undefined'){ return false; }
		else{ return true; }
	}catch(e){return false;}
}

/*Function to convert a unix time to date time*/
function unixTimeToDate(gen)
{
	try{
		var unixTime = gen;
		var jsTime = unixTime * 1000;
		var theTime = new Date(jsTime);
		
		var theMonth = theTime.getUTCMonth()+1;
		var theDay = theTime.getUTCDate();
		var theYear = theTime.getUTCFullYear();
		
		return theYear + "-" + zeroPad(theMonth,2) + "-" + zeroPad(theDay,2);
	}catch(e){return "0000-00-00";}
}

/* Function to add required zero characters to fixed length fields*/
function zeroPad(num, width) {
  var num = num.toString();
  while (num.length < width)
  num = "0" + num;
  return num;
}
/*GLOBALS*/
currIndex = 0;
pagesVisited = [];

//scale, text, scrollWidth, scrollHeight
globalTableProps = [[0.5,12,610,415],
					[0.6,13,710,477],
					[0.7,14,810,520],
					[0.8,15,910,603],
					[0.9,16,1010,665],
					[1.0,17,1110,727],
					[1.1,18,1210,820],
					[1.2,19,1310,890]];
globalTableIndex = 2;

/*jQuery on load functionality*/
jQuery(function()
{
	//wait for json request to complete successfully before calling the next
	$('body').ajaxSuccess(function(evt, request, settings){
		if(settings.type=="GET")
		{
			loadTable(currIndex);
		}
	});

});

/*jQuery functions*/
jQuery.fn.extend({
	updateActive: function(val) {
    	return $(this).removeActive().addActive(val);
  	},
	removeActive: function() {
    	return $(this).removeClass('active');//.css({'background-color':'#386995'});
  	},
  	addActive: function(actPg) {
    	return $(this).attr('page',function(p){if(p==actPg){ $(this).updateActiveDetail(p); } });
  	},
  	updateActiveDetail: function(no) {
		return $(this).addClass('active').animate({'':''},function() {	//.css({'background-color':'purple'})
			$('#scrollContainer').scrollTo($(this),1000);
			$('.pgCurr').html((parseInt(no,10)+1));
		});
  	},
  	setActiveTo: function(pos) {
  		return 	$('#mainWindow').children(pos).animate({'':''},function() {
					var pageNumber = parseInt($(this).attr('page'),10);
					$('.thumbnailSet').updateActive(pageNumber);
					currIndex = pageNumber;
				});
  	}/*,
	scrollBoxEdit: function(w,h,display) {
		return $(this).css({'width':w,'height':h,'overflow':display}).animate({'':''},function() {$(this).scrollTo($('.active'),10);});
  	}*/

});

/*Function to load requested set of data*/
function loadTable(indexVal)
{
	currIndex = indexVal;

	$.post(
		"/?ajax=mImageDisplay&call=displayTable",
		{index:currIndex},
		function(response){
			pagesVisited.push(currIndex);

			$("#mainWindow").append(response);

			$('.thumbnailSet').updateActive(indexVal);
		}
	);
}

/*Function to get the previous set of thumbnails*/
/*function getPrevious()
{
	var prevPg = currIndex-1;

	if(pageExist(prevPg))
	{
		if(pageAvailable(prevPg))
		{
			$('.thumbnailSet').updateActive(prevPg);
		}
		else
		{
			loadTable(prevPg);
		}
	}
}*/

/*Function to get the next set of thumbnails*/
function getNext()
{
	var nextPg = currIndex+1;

	if(pageExist(nextPg))
	{
/*		if(pageAvailable(nextPg))
		{
			$('.thumbnailSet').updateActive(nextPg);
		}
		else*/
		if(!pageAvailable(nextPg)){
			loadTable(nextPg);
		}
	}
}

/*Function to find out if the page exists in the given set*/
function pageExist(pgNo)
{
	if(pgNo >= 0 && pgNo < totalPgNo){ return true; }
	else{ return false; }
}

/*Function to find out if the page has already been loaded*/
function pageAvailable(pg)
{
	var foundPg = false;
	$.each(pagesVisited, function() {
		if(this == pg)
		{
			foundPg = true;
			return false;
		}
	});

	if(foundPg)
	{
		//scroll to location
		currIndex = pg;	//set scrolled to page as the new current pg on success
		return true;
	}
	else //go to load page
	{
		return false;
	}
}

/*Function to update thumbnail tables to new sizes*/
function makeScale(factor)
{
	//clear error messages
	$('#msg').empty();

	var gtIndex = globalTableIndex + factor;

	var minScale = 0.35;
	var maxScale = 1.25;

	if(gtIndex >= 0 && gtIndex < globalTableProps.length)
	{
		var newGlobalScale = globalTableProps[gtIndex][0];
		var newGlobalText = globalTableProps[gtIndex][1];
	}else
	{
		var newGlobalScale = factor*10;
		var newGlobalText = factor*10;
	}

	if(newGlobalScale < minScale)
	{
		$('#msg').append("<li>Notice: Thumbnails are not available in a smaller size!</li>");
		return false;
	}else if(newGlobalScale > maxScale)
	{
		$('#msg').append("<li>Notice: Thumbnails cannot be enlarge any further.  Please click on an image to see the larger version.</li>");
		return false;
	}

	$.each($('.originalImage'),function() {
		var tempT = toScale(this, 'top', globalTableProps[globalTableIndex][0], newGlobalScale);
		$(this).css({'top':tempT});
	});

	$.each($('.imageWindowContainer'),function() {
		var tempW = toScale(this, 'width', globalTableProps[globalTableIndex][0], newGlobalScale);
		$(this).css({'width':tempW});

		var tempH = toScale(this, 'height', globalTableProps[globalTableIndex][0], newGlobalScale);
		$(this).css({'height':tempH});
	});


	$.each($('.originalImageContainer img'),function() {
		var tempW2 = toScale(this, 'width', globalTableProps[globalTableIndex][0], newGlobalScale);
		$(this).css({'width':(tempW2+'%')});
	});

	var tText = 0;
	$.each($('.timeStamp'),function() {
		tText = parseFloat($(this).css('font-size'),10);
		$(this).css({'font-size':newGlobalText});
	});

	$('#scrollContainer').scrollTo($('.active'),10);
	globalTableIndex = gtIndex;

}

/*Function to update values to new scales*/
function toScale(e, prop, oldScale, newScale)
{
	var tVal = 0;
	tVal = parseFloat($(e).css(prop),10);

	tVal = (tVal/oldScale)*newScale;
	return tVal;
}

/*Function to create html formatted string of thumbnails for IE 6 only - loads each individual image versus a composite image*/
function setupSrcIE6(index,params)
{
	//setup image properties
	var setWidth = params[0];				//width of the composite set of images - how many images across
	var setHeight = params[1];				//height of the composite set of images - how many images down

	var imgHeight = params[2];				//height of original image
	var imgWidth = params[3];				//width of original image

	var decScale = params[4];				//size we want the thumbnails to appear at compared to original
	var percScale = decScale*100;

	var totalImg = (setWidth*2)*setHeight;

	var innerStr = '';

		for(var i=0; i<totalImg;i++){

			if(i!=0 && i%setHeight==0)
			{
				if(thumb.length > (i+(index*totalImg)))
				{
					innerStr += '</tr><tr>';
				}else{
					$('#loadMore').hide();
					break;
				}
			}
			if(thumb.length > (i+(index*totalImg)))
			{
				var imgSrc = thumb[(i+(index*totalImg))].url;
				innerStr += '<td id="pos'+(i+(index*totalImg))+'">&nbsp;'+
					'<div class="imageWindowContainer" imageno="'+(i+(index*totalImg))+'" style="height: '+imgHeight*decScale+'px; width: '+imgWidth*decScale+'px;">&nbsp;'+	//*decScale
						'<div class="imageWindow">&nbsp;'+
							'<div class="originalImageContainer" style="width: '+imgWidth+'px; height: '+imgHeight+'px;">'+
								'<div class="originalImage-IE6" onclick="openCompositeLg('+(i+(index*totalImg))+')">'+
									'<img style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: '+percScale+'%;" src='+imgSrc+'/>'+
								'</div>'+
							'</div>'+
						'</div>'+
					'</div>'+
					'<div class="timeStamp" imageno="'+(i+(index*totalImg))+'">&nbsp;</div>'+
				'</td>'
			}else{
				$('#loadMore').hide();
				innerStr += '<td id="pos'+(i+(index*totalImg))+'">&nbsp;'+
					'<div class="imageWindowContainer" imageno="'+(i+(index*totalImg))+'" style="height: '+imgHeight*decScale+'px; width: '+imgWidth*decScale+'px;">&nbsp;'+	//*decScale
					'</div>'+
				'</td>';
			}

			//hide load more button if all are loaded
			if((thumb.length-1) == (i+(index*totalImg)))
			{
				$('#loadMore').hide();
			}
		}

	var htmlStr = '<table class="thumbnailSet" page="'+index+'" style="background-color: #386995;" cellpadding="10"><tr>'+innerStr+'</tr></table>';


	return htmlStr;
}

/*Function to create html formatted string of thumbnails - using composite of 8 images*/
function setupSrc(composite,index,params)
{
	//setup image properties
	var setWidth = params[0];				//width of the composite set of images - how many images across
	var setHeight = params[1];				//height of the composite set of images - how many images down

	var imgHeight = params[2];				//height of original image
	var imgWidth = params[3];				//width of original image

	var decScale = params[4];				//size we want the thumbnails to appear at compared to original
	var percScale = decScale*100;

	var totalImg = (setWidth*2)*setHeight;

	var innerStr = '';
		var authorization_prefix = query['newest'].url.split('/').slice(0,7).join('/') + '/';
		for(var i=0; i<totalImg;i++){

			if(i!=0 && i%setHeight==0)
			{
				if(thumb.length > (i+(index*totalImg)))
				{
					innerStr += '</tr><tr>';
				}else{
					$('#loadMore').hide();
					break;
				}
			}

			if(thumb.length > (i+(index*totalImg)))
			{
				innerStr += '<td id="pos'+(i+(index*totalImg))+'">&nbsp;'+
					'<div class="imageWindowContainer" imageno="'+(i+(index*totalImg))+'" style="height: '+imgHeight*decScale+'px; width: '+imgWidth*decScale+'px;">&nbsp;'+	//*decScale
						'<div class="imageWindow">&nbsp;'+
							'<div class="originalImageContainer" style="width: '+imgWidth+'px; height: '+imgHeight+'px;">'+
								'<div class="originalImage" style="top: '+(-i*imgHeight*decScale)+';" onclick="openCompositeLg('+(i+(index*totalImg))+')">'+
									'<img style="border: 0px none ; margin: 0px; padding: 0px; position: absolute; left: 0px; top: 0px; width: '+percScale+'%;" src='+authorization_prefix + composite+'/>'+
								'</div>'+
							'</div>'+
						'</div>'+
					'</div>'+
					'<div class="timeStamp" imageno="'+(i+(index*totalImg))+'">&nbsp;</div>'+
				'</td>';
			}else{
				$('#loadMore').hide();
				innerStr += '<td id="pos'+(i+(index*totalImg))+'">&nbsp;'+
					'<div class="imageWindowContainer" imageno="'+(i+(index*totalImg))+'" style="height: '+imgHeight*decScale+'px; width: '+imgWidth*decScale+'px;">&nbsp;'+	//*decScale
					'</div>'+
				'</td>';
			}

			//hide load more button if all are loaded
			if((thumb.length-1) == (i+(index*totalImg)))
			{
				$('#loadMore').hide();
			}

		}

	var htmlStr = '<table class="thumbnailSet" page="'+index+'" style="background-color: #386995;" cellpadding="10"><tr>'+innerStr+'</tr></table>';

	return htmlStr;
}

