// JavaScript Document

function open(url)
{
	var newwindow;
	newwindow=window.open(url,'name','height=400,width=200');
	if (window.focus) {newwindow.focus()}
}


function checkCount() {

	function count(catNumber) {

		var iCount;
		iCount = 0;
	
		for (i = 0; i < document.forms['frmvote'].elements['category['+catNumber+'][]'].length; i++) {
			if (document.forms['frmvote'].elements['category['+catNumber+'][]'][i].checked) {
				iCount = iCount + 1;
			}
		}
	
		if (iCount != 0 && iCount != 1) {
			error = error + "There are " + iCount + " selections checked in Category " + catNumber + ".\r\n";
			return error;
		}
	
	}

	var error = "";

	count(1);
	count(2); // Category 2
	count(3); // Category 3
	count(4);
	count(5);
	count(6);
	count(7);
	count(8);
	count(9);
	count(10);
	//count(11);
	//count(12);
	count(13);
	count(14);
	count(15);
	count(16);
	count(17);
	count(18);
	count(19);
	count(20);
	count(21);
	count(22);
	count(23);
	count(24);
	count(25);
	count(26);
	count(27);
	count(28);
	count(29);
	count(30);
	count(31);
	//count(32);
	count(33);
	count(34);
	count(35);
	count(36);
	//count(37);
	//count(38);
	//count(39);
	//count(40);
	// IF THERE IS NO ARRAY OF ELEMENTS IN ANY CATEGORY IT ATTEMPTS TO COUNT, THIS CODE WILL FAIL AND NOT REPORT ANY ERRORS.
	
	if (error) {
		error = error + "\r\nPlease note: you must VOTE FOR ONE (1) AND ONLY ONE contenders in any or all categories";
		alert (error);
		return false;
	}
	 
	return;

}