//initialize the globals
var keepTracker = 0;
var submitTracker = 0;
var truthCheck = "";
//make sure that people don't vote for too many
function wonderChecker(checkbox){
	if(checkbox.checked){
		keepTracker++;
	}
	else{
		keepTracker--;
	}
	if(keepTracker > 8){
		alert("You may only vote for 8 wonders");
		checkbox.checked = false;
		keepTracker--;
	}
}

function wonderSubmit(){
	var formThing = document.wonders.elements;
	for(i=0; i<formThing.length; i++){
		if(formThing[i].checked){
			submitTracker++
		}
	}
	if(submitTracker < 8){
		truthCheck = confirm("You have entered less that 8.\n Do you want to continue?");
	}
	return(truthCheck);
}

var myPopout = "";
function imagePopup(image){
	var manipulateName = image.src
	var path = manipulateName.substring(0,39);
	var fileName = manipulateName.substring(45)

	var imageShow = path+fileName;
	var imageHeight = parseInt(image.height)+310;
	var imageWidth = parseInt(image.width)+300;
	
	var caption = image.alt;
	myPopout = window.open("", "imageWindow", "width=500 resizable=1");
	myPopout.window.resizeTo(imageWidth,imageHeight);

	popUpWin = myPopout.document
	popUpWin.open();
	popUpWin.writeln("<div align='center'>");
	popUpWin.writeln("<img src='"+imageShow+"' style='cursor:pointer;' />");
	popUpWin.writeln("<p>"+caption+"</p>");
	popUpWin.writeln("<br />");
	popUpWin.writeln("<a href='#' onclick='window.close();'>Close Window</a>");
	popUpWin.writeln("</div>");
	myPopout.focus();
	popUpWin.close();

}
