// script to add more image upload forms

var count = 1;

function addAnotherImage(n, type) {
	if(count < n) {
		var form = document.getElementById("imageuploads"); // obtain a reference to the imageuploads div element on the page
		var newform = document.createElement("div");
		if(type == "library") {
			newform.innerHTML = '<p>Image: <input type="file" name="file[]"> (Allowed types: jpeg, jpg, gif, png)</p><p>Description: <input name="description[]" type="text" size="35">';
		}
		else if(type == "projects") {
			newform.innerHTML = '<p>Image: <input type="file" size="29" name="file[]"> (Allowed types: jpeg, jpg, gif, png)</p>';
		}
		form.appendChild(newform);
		if(count == n-1) {
			document.getElementById("imageform").removeChild(document.getElementById("1moreimage"));
		}
		count++;
	}
	else {
		alert("You cannot upload any more images, maximum of 30 images in the gallery at a time.");
	}
}