/*************************
 *** GALLERY FUNCTIONS ***
 *************************/
var treeID = document.location.search.split("ID=")[1].split("&",1);	//Get tree ID variable from URL

function changePhoto(imageID){	//Preload new images
	var newImage = document.getElementById("main-photo");
	var tmpImage = new Image();
	//newImage.src="../graphics/trees/ajax-loader.gif";
	//newImage.parentNode.style.border = "1px solid #f00;"
	tmpImage.src="/trees/graphics/trees/" + treeID + "/" + treeID + "_lg_" + imageID + ".jpg?";
	//tmpImage.onload = function(){
		//newImage.style.visibility = "hidden;"
		newImage.src=tmpImage.src;
		//newImage.style.visibility = "visible;"
	//}
}

function insertPhoto(){	//Display the first photo
	var loadAni = new Image();	//create Image object for loading animation
	loadAni.src="../graphics/trees/ajax-loader.gif;"	//load loading animation
	
	var treeImg = document.createElement("img");	//Create the large image
		treeImg.id = "main-photo";
		treeImg.alt = "";
		treeImg.title = "Tree Image";
	
	var newContent = document.createElement("div");	//Create new <div>
	newContent.id = "photo-place";
	newContent.appendChild(treeImg);	//insert the tree photo into this <div>
	
	var wall = document.getElementById("photo-gallery");	//wall is where we "hang" the image
	wall.appendChild(newContent);	//insert this code into the HTML
	var tmpImage = changePhoto(1);	//Preload the  first image, default is 1
}
