
/**
	***---------------------------------------------------------***
	*	ThumbnailTools.js
	***---------------------------------------------------------***
	*	Artware Studios
	*	Send A Blessing
	*	27 July 2007	tb
	*
	*	This file includes Javascript utility functiions 
	*		for the page  thumbnailPage.php .
	*/

var previewWindow = null;
function previewCard(theCardID)
{//Opens previewWindow & plays card.
//	parent.mainFrame.stopFeaturedCard();	//Does not stop movie from playing.
	var theURL = "http://www.sendablessing.com/previewCardPage.php?cid=" + theCardID;
	if ( (previewWindow == null) || (previewWindow.closed) )
	{
		previewWindow = window.open(theURL,'previewWindow','height=750,width=1000,top=10,left=20');
	}
	else
	{
		previewWindow.resizeTo(950, 768);
		previewWindow.location.href = theURL;
	}
}//function previewCard(theCardID)

function displayAboutCard(theCardID)
{//Displays information about the card in the  previewWindow .  Called from the preview window.
	var theURL = "aboutCardPage.php?cid=" + theCardID;
	if ( (previewWindow == null) || (previewWindow.closed) )
	{
		previewWindow = window.open(theURL,'previewWindow','height=750,width=650,top=10,left=20');
	}
	else
	{
		previewWindow.resizeTo(650, 750);
		previewWindow.location.href = theURL;
	}
}//function displayAboutCard(theCardID)

function changeImage(theImageName, theFileName)
{
	document[theImageName].src = theFileName;
}//function changeImage(theImageName, theFileName)

function writeThumbnail(theIndex, theCardArray)
{//The parameter references an element in the JS cardArray.
	var theCardID = theCardArray[theIndex].cardID;					//HAS NO PROPERTIES
	var theCardName = theCardArray[theIndex].cardName;
	var theDisplayName = theCardArray[theIndex].displayName;
	var thePosted = theCardArray[theIndex].posted;
	var theThumbHTML = '';
	if (thePosted == "1")
	{
		theThumbHTML += '<div id="thumbNailIconBar"></div>';
		theThumbHTML += '<div id="thumbNail">';
		theThumbHTML += '<a href="#"';
		theThumbHTML += ' onclick="previewCard(' + theCardID + ')"';
		theImageName = "'" + theCardName + "Th'";
		theOutFileName = "'http://www.sendablessing.com/images/thumbnails/" + theCardName + "_Th.gif'";
		theOverFileName = "'http://www.sendablessing.com/images/thumbnails/" + theCardName + "_Th_Over.gif'";
		theThumbHTML += ' onmouseover="changeImage(' + theImageName + ', ' +  theOverFileName + ')"';
		theThumbHTML += ' onmouseout="changeImage(' + theImageName + ', ' +  theOutFileName + ')">';
		theThumbHTML += ' <img border=0 name="' + theCardName + 'Th" src="http://www.sendablessing.com/images/thumbnails/' + theCardName + '_Th.gif" alt="' + theDisplayName + '" title="' + theDisplayName + '" height="86" width="86"/></a>';
		theThumbHTML += '</div>';
	}//if (posted)
	else
	{
		theThumbHTML += '<div id="thumbNailIconBar"></div>';
		theThumbHTML += '<div id="thumbNail">';
//		theThumbHTML += '<a href="#">';
		theThumbHTML += ' <img border=0 name="' + theCardName + 'Th" src="http://www.sendablessing.com/images/thumbnails/' + theCardName + '_Th.gif"  alt="' + theCardName + '" height="86" width="86"/>';
		theThumbHTML += '</div>';
	}//else
	document.write(theThumbHTML);
}//function writeThumbnail(theIndex)
/***	Functions for  thumbnailPage.php	***   ***   ***	Functions for  thumbnailPage.php	***   ***/

function writeThumbsHTML(theNumberOfCards, theCardArray)
{
	for (var i=0; i<theNumberOfCards; i++)
	{
		writeThumbnail(i, theCardArray);
	}
}//function writeThumbsHTML()


