/*
	1312 vs. Evolution Print
	Gallery.js
	

	written by Mike "1312" (mike_at_welovetheweb.com)

	for We love the web ltd. (http://www.welovetheweb.com)
	
	design by The Designers Republic (http://www.thedesignersrepublic.com/)
	
	## jquery would have made this alot easier lol ##
	
*/

// http://osflash.org/flashjs/docs/usage/recjsf
// adapted to use swf object
 
var uid = "galleryFlashMovie";
var flashProxy = new FlashProxy(uid, '/swf/JavaScriptFlashGateway.swf');
var varTitle = "";
var varClient = "";

// functions to set the title, client and change li css class to current

function thumbNailSelect(theTitle,theClient,id) {
	setTitle(theTitle);
	setClient(theClient);
	setCurrent(id);
}

function setTitle(theTitle) {
	varTitle = theTitle;
	document.getElementById('galleryTitle').innerHTML = "<span class='alt' style='clear:left;float:left'>Title:</span><span style='width:250px;float:left;clear:right'> " + varTitle + "</span>";
}

function setClient(theClient) {
	varClient = theClient;
	document.getElementById('galleryClient').innerHTML = "<span class='alt' style='clear:left;float:left'>Client:</span><span style='width:250px;float:left;clear:right'> " + varClient  + "</span>";
}

function setCurrent(id) {		
	// first reset all list items
	// look for the list of the thumbs
	var ul = document.getElementById('thumbList');		
	var items = ul.getElementsByTagName('li');		
	// make array
	var idArray = new Array();
	// put the li (items) into the array
	for (i = 0; i < items.length; i++) {
	  idArray[i] = items[i].id;
	}
	// css class to give not current items
	var notCurrent = "";		
	// now go through the array
	// and give the notCurrent css class to each li	
	for (i = 0; i < idArray.length; i++) {
		var liNum = idArray[i];
		var liToReset = document.getElementById(liNum)
		liToReset.className = notCurrent;
	}		
	// now change the one we need to change
	var element;		
	var className = "current";
	element = document.getElementById(id);
	element.className = className;
}