// JavaScript Document
function popWin(image, w, h, angler, hometown, dateOfCatch, species, weightLength, whereCaught, bait) {
	myWin = window.open('', '_blank', 'width='+parseInt(w+80)+', height='+parseInt(h+140)+' scrollbars=0, status=0, menubar=0');
	myWin.document.write("<html>\n<head>");
	myWin.document.write("<title>Photo</title>\n</head>");
	myWin.document.write("<body style=\"color: #FFFFFF; background: #2e3192; margin: 0; padding: 0; font-family: Arial, Helvetica, Verdana, sans-serif;\">");
	myWin.document.write("<div style=\"text-align: center; padding-top: 20px;\"><img src=\""+image+"\" width=\""+w+"\" height=\""+h+"\" alt=\"\" style=\"border: 14px solid #FFFFFF;\"/></div>");
	myWin.document.write("<div style=\"text-align: center; font-size: 24px; font-weight: bold; padding-top: 10px;\">"+species+(weightLength != "" ? " - " + weightLength : "")+"</div>");
	myWin.document.write("<div style=\"text-align: center; font-size: 14px;\">");
	if (dateOfCatch != "" || angler != "" || whereCaught != "" || bait != "") {
		myWin.document.write("Caught");
		if (dateOfCatch != "") {
			myWin.document.write(" "+dateOfCatch);
		}
		if (angler != "") {
			myWin.document.write(" by "+angler);
		}
		if (hometown != "") {
			myWin.document.write(" of "+hometown);
		}
		if (whereCaught != "") {
			myWin.document.write(" at "+whereCaught);
		}
		if (bait != "") {
			myWin.document.write(" on "+bait);
		}
		
	}
	myWin.document.write("</div>");
	myWin.document.write("<div style=\"font-size: 10px; text-align: center; padding-top: 16px;\"><a href=\"javascript: window.close();\" style=\"color: #FFFFFF;\">Close Window</a></div>");
	myWin.document.write("</body>");
	myWin.document.write("</html>");
	return false;
}

function validateImage() {
	var img = document.getElementById('image').value;
	if (img != '') {
		var ext = img.substring(img.length-3,img.length);
		ext = ext.toLowerCase();
		if (ext != 'jpg') {
			alert('You selected a .'+ext+' file; please select a .jpg file instead!');
			return false;
		} else {
			return true;
		}
	} else {
		alert('You must select a file to upload.');
		return false;	
	}
}