// JavaScript Document

var imgThumbArray = new Array();
var slideArray = new Array();
var slideIndex = 0;
var imgFolder = "../images/events/art_in_ch09/";
var ext = ".jpg";

//                  slideItem(fileName,thumbName,title,artist 1,artist 2,photo credits,website 1, webname 1, website 2, webname 2, no caption boolean)
slideArray[0] = new slideItem("john_booth_chairs","john_booth_chairs_thumb","children's chairs","reclaimed furniture","john booth",null,"studio junction","http://www.bookhou.com","bookhou.com",null,null,false);
slideArray[1] = new slideItem("coe_waito_cluster","coe_waio_thumb","cluster","porcelain","coe&waito",null,"studio junction","http://www.coeandwaito.com","coeandwaito.com",null,null,false);
slideArray[2] = new slideItem("scott_eunson_rubble","scott_eunson_thumb","rubble","various sheet stock","scott eunson",null,"studio junction","http://www.scotteunson.com","scotteunson.com",null,null,false);
slideArray[3] = new slideItem("steven_henderson_table","steven_henderson_thumb","table","reclaimed wood","steven henderson",null,"studio junction","mailto: st_even_hend@hotmail.com","e: steven henderson",null,null,false);
slideArray[4] = new slideItem("arounna_khounnoraj_field","arounna_khounnoraj_thumb","field","paper","arounna khounnoraj",null,"studio junction","http://www.bookhou.com","bookhou.com",null,null,false);
slideArray[5] = new slideItem("liz_kis_kissme","liz_kis_kissme_thumb","kiss me","soap stone","liz kis",null,"studio junction","http://www.kiskis.ca","kiskis.ca",null,null,false);
slideArray[6] = new slideItem("steve_krug","steve_krug_thumb","wash your hands","print","steve krug",null,"steve krug","http://www.krugfoto.com","krugfoto.com",null,null,false);
slideArray[7] = new slideItem("kai_kruger_chair","kai_kruger_chair_thumb","chair","leather + plywood","kai kruger","clayton mcmaster","studio junction","http://www.kaileather.com","kai leather","http://www.claytonmcmaster.com","claytonmcmaster.com",false);
slideArray[8] = new slideItem("lin_albinger_collapse","lin_albinger_collapse_thumb","a game we played to the brink of collapse","paper + glass","joe lin","megan albinger","joe lin","joe.cheyu.lin@gmail.com","e: joe lin","malbinger@gmail.com","e: megan albinger",false);
slideArray[9] = new slideItem("lubo_table","lubo_table_thumb","melo's table","reclaimed fir","LUBO",null,"studio junction","http://www.lubodesign.com","lubo design",null,null,false);
slideArray[10] = new slideItem("andrea_mastrandrea","andrea_mastrandrea_thumb","catering by PAPERspace studio","food!","andrea mastrandrea",null,"andrea mastrandrea","http://www.paperspacestudio.com","paperspace studio",null,null,false);
slideArray[11] = new slideItem("clay_mcmaster_chair","clay_mcmaster_chair_thumb","reclaimed wood + leather","chair","clayton mcmaster","kai kruger","studio junction","http://www.claytonmcmaster.com","claytonmcmaster.com","http://www.kaileather.com","kai leather",false);
slideArray[12] = new slideItem("pda_stackaroo","pda_stackaroo_thumb","stackaroo","reclaimed lawn chairs","parkdale design association",null,"studio junction","http://www.parkdaledesignassociation.com","parkdale design assoc.",null,null,false);
slideArray[13] = new slideItem("lisa_petrocco","lisa_petrocco_thumb","diptych",null,"lisa petrocco",null,"studio junction","http://www.lisapetrocco.com","lisapetrocco.com",null,null,false);
slideArray[14] = new slideItem("orest_tataryn_blue","orest_tataryn_orange_thumb","lights","mixed media","orest tataryn",null,"studio junction","http://www.oresttataryn.com","oresttataryn.com",null,null,false);
slideArray[15] = new slideItem("TISC","TISC_thumb","paper plates","paper","Andrea Mastrandrea","LiMing Rao","TISC","http://www.TISC.ca","tisc.ca",null,null,false);
slideArray[16] = new slideItem("cecilia_varga","cecilia_varga_thumb","door","mixed media","cecilia varga",null,"studio junction","mailto: cecilia_varga@hotmail.com","e: cecilia varga",null,null,false);
slideArray[17] = new slideItem("andrew_waller","andrew_waller_thumb","untitled","ink on paper","andrew waller",null,"studio junction","mailto: wallercore@yahoo.ca","e: andrew waller",null,null,false);
//aux. slides
slideArray[18] = new slideItem("john_booth_table",null,null,"reclaimed furniture","john booth",null,"studio junction","http://www.bookhou.com","bookhou.com",null,null,false);
slideArray[19] = new slideItem("coe_waito_closeup",null,null,"porcelain","coe&waito",null,"studio junction","http://www.coeandwaito.com","coeandwaito.com",null,null,false);
slideArray[20] = new slideItem("liz_kis_sora",null,null,"soap stone","liz kis",null,"studio junction","http://www.kiskis.ca","kiskis.ca",null,null,false);
slideArray[21] = new slideItem("orest_tataryn_two",null,null,"mixed media","orest tataryn",null,"studio junction","http://www.oresttataryn.com","oresttataryn.com",null,null,false);
slideArray[22] = new slideItem("orest_tataryn_orange",null,null,"mixed media","orest tataryn",null,"studio junction","http://www.oresttataryn.com","oresttataryn.com",null,null,false);
slideArray[23] = new slideItem("orest_tataryn_blue_oblique",null,null,"mixed media","orest tataryn",null,"studio junction","http://www.oresttataryn.com","oresttataryn.com",null,null,false);
slideArray[24] = new slideItem("steven_henderson_const_1",null,null,"reclaimed wood","steven henderson",null,"studio junction","mailto: st_even_hend@hotmail.com","e: steven henderson",null,null,false);
slideArray[25] = new slideItem("steven_henderson_const_2",null,null,"reclaimed wood","steven henderson",null,"studio junction","mailto: st_even_hend@hotmail.com","e: steven henderson",null,null,false);
slideArray[26] = new slideItem("steven_henderson_spoon",null,null,"reclaimed wood","steven henderson",null,"studio junction","mailto: st_even_hend@hotmail.com","e: steven henderson",null,null,false);

function slideItem(fileName,thumbName,title,material,artist1,artist2,photo,web1,wName1,web2,wName2,noCap)
{
	this.fileName = fileName + ext;
	this.thumbName = thumbName + ext;
	this.title = title;
	this.material = material
	this.artist1 = artist1;
	this.artist2 = artist2;
	this.photo = photo;
	this.web1 = web1;
	this.wName1 = wName1;
	this.web2 = web2;
	this.wName2= wName2;
	this.noCap = noCap;
}

function writeSlideShow(container)
{
	var mHTML = "";
	var oddCount = 0;
	
	for (i=0;i<slideArray.length;i++)
	{
		if (slideArray[i].title != null && !(slideArray[i].noCap))
		{
			if (slideArray[i].artist2 != null)
			{
				mHTML += '<li><a href="#" onclick="this.blur(); showSlideImg(' + i + ')"><img src="'
				+ imgFolder + slideArray[i].thumbName +
				'" class="thumbnailArt" /></a><p>'
				+ slideArray[i].artist1 + ' + ' + slideArray[i].artist2 +
				'</p><a href="'
				+ slideArray[i].web1 + '" target="_blank">' + slideArray[i].wName1 + '</a>';
				
				if (slideArray[i].web2 != null)
				{
					mHTML += ' :: <a href="'
					+ slideArray[i].web2 + '" target="_blank">' + slideArray[i].wName2 + '</a>';
				}
				mHTML += '</li>';
			}
			else
			{
				mHTML += '<li><a href="#" onclick="this.blur(); showSlideImg(' + i + ')"><img src="'
				+ imgFolder + slideArray[i].thumbName +
				'" class="thumbnailArt" /></a><p>'
				+ slideArray[i].artist1 +
				'</p><a href="'
				+ slideArray[i].web1 + '" target="_blank">' + slideArray[i].wName1 + '</a></li>';
			}

		}
/*		else
		{
		mHTML += '<li><a href="#" onclick="this.blur(); showSlideImg(' + i + ')"><img src="'
		+ imgFolder + slideArray[i].thumbName +
		'" class="thumbnailArt" /></a><p>&nbsp;</p></li>';
		}
*/	}

	if (Math.round(oddCount/2) != oddCount/2)
	{
		mHTML += '<li class="lastRowSpacer"><a href="#" onclick="this.blur(); "><img src="'
		+ imgFolder + slideArray[0].thumbName +
		'" class="thumbnailArt" /></a>&nbsp;<br /><br /><br /></li>';
	}
	
	document.getElementById(container).innerHTML = mHTML;
}

function showSlideImg(index)
{
	var mHTML = genCaption(index,mHTML);
		
	document.getElementById("slideImg").src = imgFolder+slideArray[index].fileName;
	document.getElementById("imgCap").innerHTML = mHTML;

return true;
}

function shuffleImg()
{
	var i=Math.round(Math.random( ) * (slideArray.length-1));
	var mHTML = genCaption(i,mHTML);
	document.getElementById("slideImg").src = imgFolder+slideArray[i].fileName;
	document.getElementById("imgCap").innerHTML = mHTML;
	
	return true;
}

function genCaption(index,mHTML)
{
	mHTML = "<table>";
	if (slideArray[index].artist1 != null)
	{
		mHTML +=
		"<tr><td>artist : &nbsp;</td><td>" 
		+ slideArray[index].artist1;
		if (slideArray[index].artist2 != null)
		{
			mHTML +=
			" + " + slideArray[index].artist2 ;
		}
	}
		
	if (slideArray[index].photo != null)
	{
		mHTML += 
		"</td></tr><tr><td>photo : &nbsp;</td><td>" 
		+ slideArray[index].photo;
	}

	mHTML += "</td></tr></table>";
	
	
	return mHTML;
}
