//' Software by DavidRegier.com. Unauthorized use of this code is prohibited
//' This code may be used and modified for use on the MauiConcierge.com domain only

//////////////////////////////////////// START THUMBNAILS: TN ///////////////////////////////////////

/*
ACCESSOR CLS: off, on, ssTnTitle
ACCESSOR FUN: getRGB, startFade
ACCESSOR VAR: IE, winIE, MZ
*/


//-------------------------------- OBJECT CONSTRUCTOR TN --------------------------------

function ThumbNails() {

	this.dissolveSF = 1;
	this.transNum = 2;
	this.transDur = 0.8;
	this.maxDissolveMZ = 800 * 800;

	// Do not edit past this line -------------------------
	initImagesArr();

	this.nImages = Images.length;
	this.maxIndex = this.nImages - 1;

	var maxWid = -1;

	for( var i = 0; i < this.nImages; i++ ) {
		var imgTitle = ( Images[ i ][ 3 ] ) ? Images[ i ][ 3 ] : "";
		Images[ i ][ 3 ] = imgTitle.replace( /'/g, "^^" );
		if( !Images[ i ][ 4 ] ) Images[ i ][ 4 ] = Settings.borderCol;
		checkImgName( Images[ i ][ 0 ] );
		if( Images[ i ][ 1 ] > maxWid ) maxWid = Images[ i ][ 1 ];
	}
	this.maxImgWid = maxWid + Settings.borderWid * 2;

	// Methods
	this.init = init;
	this.checkTnDim = checkTnDim;
	this.setSectVis = setSectVis;
	this.getNewIndex = getNewIndex;
	this.preloadNext = preloadNext;
	this.swapLgImg = swapLgImg;
	this.show = show;
	this.hideLgImg = hideLgImg;
	this.setImgTitle = setImgTitle;
	this.imgBorder = imgBorder;
	this.disableBackButton = disableBackButton;
	this.showNumImages = showNumImages;
	this.writeConsole = writeConsole;
	this.updateProgressBar = updateProgressBar;
	this.reportImgName = reportImgName;
	this.writeHtmlTN = writeHtmlTN;
	this.setFileSize = setFileSize;

	// Variables
	this.Link = null;
	this.scrollFromTop = 0;
	this.scrollFromLeft = 0;
	this.lgPhotoShowing = false;
	this.NextLgImage = null;
	this.nextImgTimer = 0;
	this.curIndex = -1;
	this.tnRemainingTN = 0;

	//------------------------------------- METHOD TN -------------------------------------

	function init() {
		this.showNumImages();
		this.checkTnDim();
	}
	//------------------------------------- METHOD TN -------------------------------------
	// Check tn dimensions - admin mode only

	this.checkTN = 1; this.checkTnTimer = 0; this.TnReal = null; this.TnSizeErr = "";
	function checkTnDim() {

		if( GetCookie( "userWithWritePrivileges" ) ) {
			if( this.TnReal == null ) {
				var TN = document.getElementById( "TN_" + this.checkTN );
				if( TN ) {
					TnReal = new Image();
					TnReal.src = TN.src;
				}
				else {
					TnReal = null;
					clearTimeout( this.checkTnTimer );
					if( this.TnSizeErr )
						DW.createWindow( [ "Thumbnail Dimension Error", "<div style='margin:0px 0px 4px 0px;' class='dwText'>Thumbnails must be " + Settings.TN.width + " x " + Settings.TN.height + " pixels:</div>" + this.TnSizeErr ], [ 0, 400, 0 ], null, null, 6, [ 4, 0, 0 ] );

				}
			}

			if( TnReal && TnReal.complete ) {
				var realWid = TnReal.width, realHgt = TnReal.height;
				if( realWid > 1 && realHgt > 1 && ( realWid != Settings.TN.width || realHgt != Settings.TN.height ) ) {
					var FileComponents = TnReal.src.split( "/" );
					var fileName = FileComponents[ FileComponents.length - 1 ];
					this.TnSizeErr += "<div style='margin:0px 0px 0px 8px;'>#" + this.checkTN + " " + fileName + " is " + realWid + " x " + realHgt + "</div>";
				}
				this.checkTN++;
				this.checkTnTimer = setTimeout( "TN.checkTnDim();", 100 );
			}
		}
	}
	//------------------------------------- METHOD TN -------------------------------------
	// Loops thru any section(s) that are to be hidden/re-shown when large image is displayed/hidden

	function setSectVis( sectName, className ) {
		var i = 0;
		while( document.getElementById( sectName + i ) ) {
			var PageSection = document.getElementById( sectName + i );
			PageSection.className = className;
			i++;
		}
	}
	//------------------------------------- METHOD TN -------------------------------------
	// Returns newIndex: This next image value is based on value of global TN.curIndex
	function getNewIndex( movingForward ) {

		if( movingForward )
			return ( this.curIndex < this.maxIndex ) ? this.curIndex + 1 : 0;
		else
			return ( this.curIndex > 0 ) ? this.curIndex - 1 : this.maxIndex;

	}

	//------------------------------------- METHOD TN -------------------------------------
	// Called onLoad of large Image
	function preloadNext() {
		var newIndex = this.getNewIndex( 1 );
		var PreLoadImage = new Image(Images[ newIndex ][ 1 ], Images[ newIndex ][ 2 ]);
		PreLoadImage.src = Settings.folder + Images[ newIndex ][ 0 ];
	}
	//------------------------------------- METHOD TN -------------------------------------
	// Called only when user clicks back "<<" & forward ">>" links on large images
	function swapLgImg( movingForward ) {

		var Img = document.getElementById( "imgLargeID" );
		if( Img ) {
			Img.onload = null;

			var newIndex = this.getNewIndex( movingForward );
			if( !this.NextLgImage ) {

				this.NextLgImage = new Image(Images[ newIndex ][ 1 ], Images[ newIndex ][ 2 ]);
				this.NextLgImage.src = Settings.folder + Images[ newIndex ][ 0 ];
			}

			if( this.NextLgImage.complete ) {

				document.getElementById( "imgLargeID" ).style.visibility = "hidden";
				var imgTitle = Images[ newIndex ][ 3 ];

				TN.setImgTitle( imgTitle, newIndex );

				Img.width = Images[ newIndex ][ 1 ];
				Img.height = Images[ newIndex ][ 2 ];
				Img.style.border = Settings.borderWid + "px solid rgb( " + getRGB( Images[ newIndex ][ 4 ] ) + " )";
				Img.src = this.NextLgImage.src;

				setTimeout( "document.getElementById( 'imgLargeID' ).style.visibility = 'visible'", 1 );
				checkDim( this.NextLgImage.src, Images[ newIndex ][ 1 ], Images[ newIndex ][ 2 ] );
				this.NextLgImage = null;
				clearInterval( this.nextImgTimer );
				this.nextImgTimer = 0;

				// curIndex is initially established onClick of any thumbnail, and then incremented/decremented here only
				// All other occurences of this variable are for "read-only" access to it's value
				this.curIndex = ( movingForward ) ? this.curIndex + 1 : this.curIndex - 1;
				if( this.curIndex > this.maxIndex )
					this.curIndex = 0;
				else if( this.curIndex < 0 )
					this.curIndex = this.maxIndex;

				this.preloadNext();

			}
			else { // Next image still loading

				// If stmt prevents multiple threads running this method concurrently which setInterval would allow
				if( this.nextImgTimer == 0 ) {
					eval( "this.nextImgTimer = setInterval( 'TN.swapLgImg( " + movingForward + " )', 250 );" );
					TN.setImgTitle( "Downloading image, please wait...", null );
				}
			}
		}
		else { // ERROR: Image not present
			this.NextLgImage = null;
			clearInterval( this.nextImgTimer );
			this.nextImgTimer = 0;
		}
	}
	//------------------------------------- METHOD TN -------------------------------------

	// Displays full size image on the current page
	function show( ImgInfoArr ) {

		this.lgPhotoShowing = true;
		// Record where page is scrolled to so it can be reset back later
		var ieCSS = ( IE && document.compatMode) ? document.compatMode ==  "CSS1Compat" : false;
		if( IE ) var IeBody = ieCSS ? document.documentElement : document.body;
		this.scrollFromTop = ( IE ) ? IeBody.scrollTop : window.pageYOffset;
		this.scrollFromLeft = ( IE ) ? IeBody.scrollLeft : window.pageXOffset;

		this.Link = ImgInfoArr[ 7 ];

		var sectName = ImgInfoArr[ 8 ];
		this.setSectVis( sectName, "off" );

		ImgInfoArr[ 5 ] = getRGB( ImgInfoArr[ 5 ] );
		var tableHgt = 1;

		tableHgt = ( IE ) ? IeBody.clientHeight - 60 : window.innerHeight - 60;
		var BodyStyle = document.body.style;
		BodyStyle.backgroundImage = "url( none )";
		//BodyStyle.backgroundColor = Settings.TN.bkgColOn;
		BodyStyle.marginTop = "0px";
		BodyStyle.marginRight = "0px";
		BodyStyle.marginBottom = "0px";
		BodyStyle.marginLeft = "0px";

		var html = "<DIV ID='bigID" + sectName + "'>" + "<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' WIDTH='100%' HEIGHT='" + tableHgt + "'><TR><TD ALIGN='center' VALIGN='middle'>";

			html +=
			"<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0'>" +
				"<TR>" +
					"<TD>" +
						"<A HREF='javascript:void(0);' ID='topFocalPt'></A><BR>" +
					"</TD>" +
				"</TR>" +
				"<TR>";

					var bkgStyle = " STYLE='background-color:" + Settings.TN.bkgColOn + ";'";

					var thisIndex = this.curIndex;
					var backMsg = "Back to thumbnails";
					var imgTitle = ImgInfoArr[ 4 ];

					html +=
					"<TD id='imgTD' ALIGN='center'" + bkgStyle + ">" +

						"<A HREF='javascript:TN.hideLgImg( \"" + sectName + "\" );' onMouseOver='self.status=this.title; return true;' onMouseOut='self.status=\"\"; return true;' TITLE='" + backMsg + "'" + bkgStyle + ">";

							var dissolveMZ = ( ImgInfoArr[ 2 ] * ImgInfoArr[ 3 ] <= this.maxDissolveMZ );

							html += "<IMG ID='imgLargeID' NAME='" + sectName + "ID' SRC='" + ImgInfoArr[ 0 ] + ImgInfoArr[ 1 ] + "' BORDER='0' WIDTH='" + ImgInfoArr[ 2 ] + "' HEIGHT='" + ImgInfoArr[ 3 ] + "' HSPACE=0 VSPACE=0 STYLE='border:" + ImgInfoArr[ 6 ] + "px solid rgb( " + ImgInfoArr[ 5 ] + " );" + getOpacity( TN.dissolveSF, dissolveMZ ) + "' onAbort='this.src=this.src;' onLoad='startFade( this, TN.transNum, TN.transDur, 0, TN.dissolveSF, " + dissolveMZ + " ); TN.setImgTitle( \"" + imgTitle + "\", " + thisIndex + " ); TN.preloadNext(); checkDim( this.src, " + ImgInfoArr[ 2 ] + ", " + ImgInfoArr[ 3 ] + " );' onContextMenu='" + ( ( Settings.disableRightClick ) ? "return false;" : "return true;" ) + "'>" +

						"</A>" +

					"</TD>" +
				"</TR>" +
				"<TR>" +
					"<TD ALIGN='center' class='tnLinks'>" +

						"<a href='javascript:TN.swapLgImg( 0 );' class='tnLinks' title='Back'>&lt;&lt;</a>&nbsp;&nbsp;" +

						"<a href='javascript:TN.hideLgImg( \"" + sectName + "\" );' class='tnLinks' title='" + backMsg + "'>Back to Thumbnails</a>&nbsp;&nbsp;" +

						"<a href='javascript:TN.swapLgImg( 1 );' class='tnLinks' title='Next'>&gt;&gt;</a>" +

					"</TD>" +
				"</TR>" +
				"<TR>" +
					"<TD ALIGN='center' width='100%'>" +
						"<DIV ID='imgTitleID' CLASS='tnLgImgTitle' style='width:" + this.maxImgWid + "px;'>Loading image, please wait..." + "</DIV>" +
					"</TD>" +
				"</TR>" +
				"<TR>" +
					"<TD>" +
						"<A HREF='javascript:void(0);' ID='botFocalPt'></A><BR>" +
					"</TD>" +
				"</TR>" +
			"</TABLE><BR>";

		html += "</TD></TR></TABLE><BR>";
		html += "</DIV>";
		var ImgConsole = document.getElementById( sectName );
		ImgConsole.innerHTML = html;
		ImgConsole.className = "on";
		var FocuserTop = document.getElementById( "topFocalPt" ); FocuserTop.focus();
		var FocuserBot = document.getElementById( "botFocalPt" ); FocuserBot.focus();
		return false;
	}

	//------------------------------------- METHOD TN -------------------------------------
	// Set page back to default state by hiding large image
	function hideLgImg( sectName ) {

		this.lgPhotoShowing = false;
		var ImgConsole = document.getElementById( "bigID" + sectName );
		ImgConsole.innerHTML = "";
		ImgConsole.className = "off";
		var BodyStyle = document.body.style;
		BodyStyle.backgroundImage = Settings.TN.PageStyle.bkgImg;
		//BodyStyle.backgroundColor = Settings.TN.PageStyle.bkgCol;
		BodyStyle.marginTop = Settings.TN.PageStyle.marTop;
		BodyStyle.marginRight = Settings.TN.PageStyle.marRgt;
		BodyStyle.marginBottom = Settings.TN.PageStyle.marBot;
		BodyStyle.marginLeft = Settings.TN.PageStyle.marLft;

		TN.setSectVis( sectName, "on" );
		if( typeof this.Link == "object" ) {
			this.Link.focus();
			this.Link.blur();
		}
		// Scroll window back to where it was before
		window.scroll( this.scrollFromLeft, this.scrollFromTop );
	}
	//------------------------------------- METHOD TN -------------------------------------

	function setImgTitle( imgTitle, newIndex ) {

		if( imgTitle == "*" )
			imgTitle = Settings.pageTitle;
		else if( imgTitle.indexOf( "*+" ) == 0 )
			imgTitle = Settings.pageTitle + imgTitle.split( "+" )[ 1 ];
		else if( imgTitle.indexOf( "+*" ) >= 0 )
			imgTitle = imgTitle.split( "+" )[ 0 ] + Settings.pageTitle;
		else if( imgTitle == "_" )
			imgTitle = Images[ newIndex ][ 0 ].split( "." )[ 0 ];

		if( newIndex != null ) {
			var colon = ( imgTitle != "&nbsp; <BR>" && imgTitle != "" ) ? ": " : "";
			imgTitle = ( newIndex + 1 ) + " of " + ( this.maxIndex + 1 ) + colon + imgTitle;
		}

		if( !imgTitle ) imgTitle = "&nbsp; <br>";
		var ImgTitle = document.getElementById( "imgTitleID" );
		imgTitle = imgTitle.replace( /\^\^/g, "'" );
		imgTitle = imgTitle.replace( /\^/g, "\"" );
		ImgTitle.innerHTML = imgTitle;

	}
	//------------------------------------- METHOD TN -------------------------------------
	function imgBorder( Img, color ) { if( Img.complete ) Img.style.borderColor = color; }

	//------------------------------------- METHOD TN -------------------------------------
	function disableBackButton() {
		if( this.lgPhotoShowing ) document.location.href = document.location.href;
	}

	//------------------------------------- METHOD TN -------------------------------------

	// Called onLoad of TN page

	function showNumImages() {
		if( this.nImages > -1 ) {
			if( Settings.TN.ProgressBar.hideOnSuccess )
				document.getElementById( "consoleTN" ).style.visibility = "hidden";
			setTimeout( 'self.status = TN.nImages + " Thumbnails loaded..."', 500 );
		}
	}
	//------------------------------------- METHOD TN -------------------------------------

	function writeConsole() {
		document.write( "<div id='consoleTN' style='line-height:14px;' align='" + Settings.TN.align + "'><div>&nbsp; </div><br></div>" );
	}
	//------------------------------------- METHOD TN -------------------------------------

	function updateProgressBar() {

		var Console = document.getElementById( "consoleTN" );

		try {
			if( this.tnRemainingTN >= 0 ) {
				var dBarWid = ( this.nImages - this.tnRemainingTN ) * ( Settings.TN.ProgressBar.width / this.nImages );
				var percentLoaded = parseInt( ( ( this.nImages - this.tnRemainingTN ) / this.nImages ) * 100 ) + "%";

				var pBar = "" +

				"<div style='width:" + Settings.TN.ProgressBar.width + "px; background-color:" + Settings.TN.ProgressBar.bgColor + "; text-align:left; z-index:0;'>" +
					"<div style='width:" + dBarWid + "px; background-color:" + Settings.TN.ProgressBar.progressColor + ";'>" +
						"&nbsp;" +
					"</div>" +
				"</div>" +

				"<div style='position:relative; top:-14px; left:0px; width:" + Settings.TN.ProgressBar.width + "px; text-align:center; z-index:1; font-family:arial,helvetica; font-size:8pt; color:" + Settings.TN.ProgressBar.fontColor + "; font-weight:bold'>" +
					"Loading Thumbnails " + percentLoaded +
				"</div>";

				Console.innerHTML = pBar;
				if( this.tnRemainingTN > 0 ) setTimeout( "TN.updateProgressBar()", 250 );
				else if( Settings.TN.ProgressBar.hideOnSuccess ) Console.style.visibility = "hidden";
			}
		}
		catch( Err ) {
			setTimeout( "TN.updateProgressBar()", 250 );
		}
	}
	//------------------------------------- METHOD TN -------------------------------------

	function setFileSize( imageNum ) {

		if( !this.ImgLg ) {
			this.ImgLg = new Image();
			this.ImgLg.src = Settings.folder + Images[ imageNum - 1 ][ 0 ];
		}
		if( this.ImgLg.complete ) {
			document.getElementById( "fileSizeTN" ).innerHTML = Math.round( this.ImgLg.fileSize / 1000 ) + " KB";
			this.ImgLg = null;
		}
		else
			setTimeout( "if( window.TN ) TN.setFileSize( " + imageNum + " );", 100 );


	}
	//------------------------------------- METHOD TN -------------------------------------

	function reportImgName( Link, imageNum, evt ) {
		if( GetCookie( "userWithWritePrivileges" ) ) {

			var Img = Images[ imageNum - 1 ];
			var ImgTN = Link.firstChild;
			var wid = Img[ 1 ], hgt = Img[ 2 ];
			var shape = ( wid > hgt ) ? "horizontal" : ( ( wid < hgt ) ? "vertical" : "square" );


			var htm = "" +

			"<table align='left' border='0' cellspacing='0' cellpadding='0'>" +
				"<tr>" +
					"<td align=center valign=top>" +
						"<img src='" + ImgTN.src + "' width='" + ImgTN.width + "' height='" + ImgTN.height + "'>" +
					"</td>" +
					"<td align=center valign=top style='padding:4px;'>" +
						"<table align='center' border='0' cellspacing='0' cellpadding='0' class='dwText'>" +
							"<tr><td align=right>Name:&nbsp;</td><td align=left>" + Img[ 0 ] + "</td></tr>" +
							"<tr><td align=right>Number:&nbsp;</td><td align=left>" + imageNum + " of " + TN.nImages + "</td></tr>" +
							"<tr><td align=right>Dimensions:&nbsp;</td><td align=left>" + wid + " &times; " + hgt + " px; " + shape + "</td></tr>" +
							( ( IE ) ? "<tr><td align=right>File Size:&nbsp;</td><td id='fileSizeTN' align=left></td></tr>" : "" ) +
							"<tr><td align=right valign=top>Caption:&nbsp;</td><td align=left>" + Img[ 3 ] + "</td></tr>" +
						"</table>" +
					"</td>" +
				"</table>";

			if( window.DW ) {
				DW.createWindow( [ "Large Image Properties", htm ], [ 0, 500, 0 ], Link, evt );
				if( IE ) this.setFileSize( imageNum );
			}

			return false;
		}
	}

	//------------------------------------- METHOD TN -------------------------------------

	function writeHtmlTN() {

		self.status = "Reading information in data-base...";

		if( dataFile ) {

			this.tnRemainingTN = this.nImages;

			self.status = "Rendering data as HTML, please wait...";

			var htm = "<div id='thumbnails0'>";

			var tnNum = 0;

			thePageTitle = Settings.pageTitle;
			thePageTitle = thePageTitle.replace( /\^\^/g, "&#39;" );
			thePageTitle = thePageTitle.replace( /\^/g, "&#34;" );

			if( thePageTitle ) htm += "<div class='ssTnTitle' align='center'>" + thePageTitle + "</div><div style='line-height:10px;'>&nbsp; </div>";

			htm += "<table align='center' border=0 cellpadding=0 cellspacing=0>";

			var nRows = Math.floor( this.nImages / Settings.TN.nImagesRow ) + 1;

			///////////////// START ROWS /////////////////
			for( var row = 0; row < nRows; row++ ) {

				htm += "<tr align='" + Settings.TN.align + "' valign='middle'><td nowrap>";

				///////////////// START TN's /////////////////
				for( var i = 0; i < Settings.TN.nImagesRow; i++ ) {

					var thisTnImgData = '';
					var writeTN = ( tnNum < this.nImages ) ? true : false;

					if( writeTN ) {

						// Create tnImageName from large image name
						var lgImageName = Images[ tnNum ][ 0 ], tnImageName = "";
						lastDotPos = lgImageName.lastIndexOf( "." );
						var fileExt = "TN" + lgImageName.substring( lastDotPos, lgImageName.length );
						tnImageName = lgImageName.split( "." )[ 0 ] + fileExt;

						var lgWid = Images[ tnNum ][ 1 ];
						var lgHgt = Images[ tnNum ][ 2 ];
						var imgTitle = Images[ tnNum ][ 3 ];
						imgTitle = imgTitle.replace( /\"/g, "^" );

						if( imgTitle == "*" )
							imgTitle = Settings.pageTitle;
						else if( imgTitle.indexOf( "*+" ) == 0 )
							imgTitle = Settings.pageTitle + imgTitle.split( "+" )[ 1 ];
						else if( imgTitle.indexOf( "+*" ) >= 0 )
							imgTitle = imgTitle.split( "+" )[ 0 ] + Settings.pageTitle;
						else if( imgTitle == "_" )
							imgTitle = lgImageName.split( "." )[ 0 ];


						var toolTip = imgTitle.replace( /<.*?>/g, "" ); // Remove HTML tags
						toolTip = toolTip.replace( /\^\^/g, "&#39;" );
						toolTip = toolTip.replace( /\^/g, "&#34;" );

						var lgBorderCol = Images[ tnNum ][ 4 ];
						var lgBorderWid = Settings.borderWid;
						var tn = Settings.folder + tnImageName;
						tnNum++;
					}

					var imageNum = row * Settings.TN.nImagesRow + i + 1;

					if( writeTN ) {

						var lgImgName = tnImageName.replace( /TN\./, "." );

						var toolTipColon = ( toolTip ) ? ": " : "";
						toolTip = imageNum + " of " + this.nImages + toolTipColon + toolTip;

						if( Settings.TN.enlargeInPopUp ) htm +=
							"<a href='" + Settings.folder + lgImgName + "' title=\""+ toolTip +"\" onClick='if( window.DW ) return largePic( \"" + imgTitle + "\", " + lgWid + ", " + lgHgt + ", this, event );' onContextMenu='return TN.reportImgName( this, " + imageNum + ", event );'>";

						else htm +=
							"<a href='" + Settings.folder + lgImgName + "' title=\""+ toolTip +"\" onClick='if( window.TN ) { TN.curIndex = " + ( imageNum - 1 ) + "; return TN.show( [ \"" + Settings.folder + "\", \"" + lgImgName + "\", " + lgWid + ", " + lgHgt + ", \"" + imgTitle + "\", \"" + lgBorderCol + "\", " + lgBorderWid + ", this, \"thumbnails\" ] ); }' onContextMenu='return TN.reportImgName( this, " + imageNum + ", event );'>";

						htm +=

							"<img src='" + tn + "' border='0' hspace='2' vspace='2' width='" + Settings.TN.width + "' HEIGHT='" + Settings.TN.height + ", ' title=\"" + toolTip + "\" style='border:1px solid " + Settings.TN.bordColOff + ";' onMouseover='if( window.TN ) TN.imgBorder(this,Settings.TN.bordColOn);' onMouseout='if( window.TN ) TN.imgBorder(this,Settings.TN.bordColOff);' onAbort='this.src=this.src;' onLoad='TN.tnRemainingTN--;' onContextMenu='" + ( ( Settings.disableRightClick ) ? "return false;" : "return true;" ) + "' id='TN_" + imageNum + "'>" +

						"</a>";
					}

				}
				///////////////// END TN"s /////////////////

				htm += "</td></tr>";


			///////////////// END ROWS /////////////////

			}

			htm += "</table></div><span id='thumbnails' class='off'></span>";

			document.write( htm );

			self.status = "";

		}
	}

}

//////////////////////////////////////// END THUMBNAILS: TN ///////////////////////////////////////
