// JavaScript for EMMA

/* 	INSTRUCTIONS FOR ADDING NEW PROJECTS TO THE SCROLLING THUMBNAILS

 	There are four lines of code that need to be added below: preloader, image link, project link, and project title. 
	If we were to add a 7th project, the lines for doing so have been added and commented out below.
	"Commenting out" a line of code means that // has been placed in front of it, and the code on that particular line will not display/work/execute/parse
	
	After editing the four lines of code, you must increment the maxPic variable at the end by 1. So if we have 7 projects, then maxPic should = 7. 

*/


//image preloader. preloads the images
	p1 = new Image (104, 104);
	p2 = new Image (104, 104);
	p3 = new Image (104, 104);
	p4 = new Image (104, 104);
	p5 = new Image (104, 104);
	p6 = new Image (104, 104);
    p7 = new Image (104, 104); 
	//this simply preloads the image. the numbers are the thumbnail's dimensionsin pixels and should not be changed

//image link -- very important
	p1.src = "project7.jpg";
	p2.src = "project6.jpg";
	p3.src = "project4.jpg";
	p4.src = "project3.jpg";
	p5.src = "project2.jpg";
	p6.src = "project5.jpg";
    p7.src = "project1.jpg"; 
	// this is the filename for the thumbnail. it should reside in the /projects directory but does not have to follow this filename format.

//project links -- very important
	var proj = new Array();
		proj[1] = "project7/index.php";
		proj[2] = "project6/index.php";
		proj[3] = "project4/index.php";
		proj[4] = "project3/index.php";
		proj[5] = "project2/index.php";
		proj[6] = "project5/index.php";
        proj[7] = "project1/index.php"; 
		// this is the link for the project page. keep them all named index.php and maintain the folder naming convention of "project#/"

//project titles -- very important
	var desc = new Array();
		desc[1] = "The Jenkins Farm Project";
		desc[2] = "Murmur";
		desc[3] = "Wunderkammer";
		desc[4] = "Bebe Miller Residency";
		desc[5] = "Dance and Architecture";
		desc[6] = "New Ground 2006";
        desc[7] = "3MPH"; 
		// this is the title of the project as it will appear below its corresponding thumbnail. if there is a short version of the name, use that (as we're limited for space).

//total number of pictures -- very important
//increment this value one (1) for each project added.
		maxPic = 7; 


// stop editing things here. don't edit anything below this line. make sure you increment maxPic by 1 =)


//functions -- do not edit anything below here
count = 1;
function next() {
	count++;
	if (count > maxPic) { count = 1; }
		eval("document.p1.src=p" + count + ".src");
		document.getElementById('projl1').href = proj[count];
		document.getElementById("desc1").innerHTML = desc[count];
		sum = count + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p2.src=p" + sum + ".src");
		document.getElementById('projl2').href = proj[sum];
		document.getElementById("desc2").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p3.src=p" + sum + ".src");
		document.getElementById('projl3').href = proj[sum];
		document.getElementById("desc3").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p4.src=p" + sum + ".src");
		document.getElementById('projl4').href = proj[sum];
		document.getElementById("desc4").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p5.src=p" + sum + ".src");
		document.getElementById('projl5').href = proj[sum];
		document.getElementById("desc5").innerHTML = desc[sum];
	}
function back() {
	count--;
	if (count == 0) { count = maxPic; }
		eval("document.p1.src=p" + count + ".src");
		document.getElementById('projl1').href = proj[count];
		document.getElementById("desc1").innerHTML = desc[count];
		sum = count + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p2.src=p" + sum + ".src");
		document.getElementById('projl2').href = proj[sum];
		document.getElementById("desc2").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p3.src=p" + sum + ".src");
		document.getElementById('projl3').href = proj[sum];
		document.getElementById("desc3").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p4.src=p" + sum + ".src");
		document.getElementById('projl4').href = proj[sum];
		document.getElementById("desc4").innerHTML = desc[sum];
		sum = sum + 1;
	if (sum > maxPic) { sum = 1; }
		eval("document.p5.src=p" + sum + ".src");
		document.getElementById('projl5').href = proj[sum];
		document.getElementById("desc5").innerHTML = desc[sum];
	}
