function checkZip() {
				 if ((document.form1.zip.value.length != 5) && (document.form1.zip.value != '5-digit Zip Code')) {
				 		alert('Please enter a five digit zip code only.');
						return false;
				 } else {
				 	  if (document.form1.zip.value == '5-digit Zip Code') {
				 	  	 document.form1.zip.value = '';
						}
				 	  return true;
				 }
}

function explainOpen(name) {
				 var url = "help.php?name=" +name;
				 var explain = window.open(url,'help','width=450,height=300,scrollbars=yes,resizeable=no');
				 explain.focus();
}

function addValue(id,type) {
				 var url = "thanks.php?id=" +id+ "&type=" +type;
				 var explain = window.open(url,'help','width=450,height=300,scrollbars=yes,resizeable=no');
				 explain.focus();
}

function setpics() {
				 if (document.form1.io[2].checked) {
				 		document.io.src = 'dontknow.jpg';
				 }
				 if (document.form1.io[1].checked) {
				 		document.io.src = 'inside-01.jpg';
				 }
				 if (document.form1.io[0].checked) {
				 	  document.io.src = 'outside-01.jpg';
				 }
				 if (document.form1.hf[2].checked) {
				 		document.hf.src = 'dontknow.jpg';
				 }
				 if (document.form1.hf[1].checked) {
				 		document.hf.src = 'full.jpg';
				 } 
				 if (document.form1.hf[0].checked) {
				 	  document.hf.src = 'half.jpg';
				 }
				 if (document.form1.pub[2].checked) {
				 		document.pub.src = 'dontknow.jpg';
				 }
				 if (document.form1.pub[1].checked) {
				 		document.pub.src = 'private.jpg';
				 }
				 if (document.form1.pub[0].checked) {
				 	  document.pub.src = 'public.jpg';
				 }
}

function setLesspics() {
   if (document.form1.io) {
				 if (document.form1.io[2].checked) {
				 		document.io.src = 'dontknow.jpg';
				 }
				 if (document.form1.io[1].checked) {
				 		document.io.src = 'inside-01.jpg';
				 }
				 if (document.form1.io[0].checked) {
				 	  document.io.src = 'outside-01.jpg';
				 }
	 }
	 if (document.form1.hf) {
				 if (document.form1.hf[2].checked) {
				 		document.hf.src = 'dontknow.jpg';
				 }
				 if (document.form1.hf[1].checked) {
				 		document.hf.src = 'full.jpg';
				 } 
				 if (document.form1.hf[0].checked) {
				 	  document.hf.src = 'half.jpg';
				 }
	 }
	 if (document.form1.pub) {
				 if (document.form1.pub[2].checked) {
				 		document.pub.src = 'dontknow.jpg';
				 }
				 if (document.form1.pub[1].checked) {
				 		document.pub.src = 'private.jpg';
				 }
				 if (document.form1.pub[0].checked) {
				 	  document.pub.src = 'public.jpg';
				 }
	 }
}

function verifyFormAdd() {
				 if (document.form1.address.value == 'Address') {
				 		alert('You must enter an address for this court.  It can either be an exact address or a pair of intersecting streets.  As long as the courts are visible from the address given');
						return false;
				 }
				 return true;
}

var cellSet = new Array();
function changeCell(cellName,cellno) {
				 cellSet[cellName] = 0;
				 var table = cellName+cellno;
				 document.all[table].style.backgroundColor = 'CCCCFF';
}
function resetCell(cellName) {
				 var reset = 1;
				 while (reset <= 10) {
				 			 var table = cellName+reset;
							 document.all[table].style.backgroundColor = 'CCCCCC';
							 document.all[table].style.color = 'black';
							 document.all[table].style.fontWeight = 'normal';
							 reset++;
				 }
}
function setCell(cellName,cellno) {
				 resetCell(cellName);
				 var table = "";
				 eachCell('1',cellName,cellno);
				 document.form1[cellName].value = cellno;
				 table = cellName+cellno;
				 document.all[table].style.color = 'white';
				 document.all[table].style.fontWeight = 'bold';
				 cellSet[cellName] = cellno;
}

function setCell2(cellName,cellno) {
				 resetCell(cellName);
				 var table = "";
				 eachCell('1',cellName,cellno);
				 table = cellName+cellno;
				 document.all[table].style.color = 'white';
				 document.all[table].style.fontWeight = 'bold';
				 cellSet[cellName] = cellno;
}

function eachCell(count,cellName,cellno) {
				 while (count <= cellno) {
				 			    table = cellName+count;
                  count++;
									document.all[table].style.backgroundColor = 'blue';
									//setTimeout('eachCell(count,cellno)',1000);
         }
}

function changeBack(cellName,cellno) {
 				 var table = cellName+cellno;
				 cellno = parseInt(cellno);
				 cellSet[cellName] = parseInt(document.form1[cellName].value);
				 if (cellSet[cellName] == '0') {
				 		document.all[table].style.backgroundColor = 'CCCCCC';
				 } else {
				 	  if (cellno <= cellSet[cellName]) {
							 document.all[table].style.backgroundColor = 'blue';
						} else {
							 document.all[table].style.backgroundColor = 'CCCCCC';
						}
				 }
}

function verifyFormReview() {
				 if (document.form2.pass1.value != document.form2.pass2.value) {
				 		alert('Your password entries do not match. Please re-enter them.');
						return false;
				 }
				 if ((document.form2.pass1.value == '') || (document.form2.pass2.value == '')) {
				 		alert('You must enter both password values.');
						return false;
				 }
				 if ((document.form2.email.value == '') || (document.form2.email.value == 'Email Address')) {
				 		alert('You must enter an email address so that we can contact you for password purposes or other correspondence.  Your email address will not be given to anyone without your explicit permission');
						return false;
				 }
				 return true;
}

function enable() {
			if (document.form1.adv.checked) {
				 		document.images.io.src = 'dontknow.jpg';
						document.images.hf.src = 'dontknow.jpg';
						document.images.pub.src = 'dontknow.jpg';
						
				 		document.form1.pub[0].disabled = false;
						document.form1.pub[1].disabled = false;
						document.form1.pub[2].disabled = false;
						document.form1.io[0].disabled = false;
						document.form1.io[1].disabled = false;
						document.form1.io[2].disabled = false;
						document.form1.hf[0].disabled = false;
						document.form1.hf[1].disabled = false;
						document.form1.hf[2].disabled = false;
						document.all.options[0].style.color = '#000000';
						document.all.options[1].style.color = '#000000';
						document.all.options[2].style.color = '#000000';
						document.all.options[3].style.color = '#000000';
						document.all.options[4].style.color = '#000000';
						document.all.options[5].style.color = '#000000';
						document.all.options[6].style.color = '#000000';
						document.all.options[7].style.color = '#000000';
						document.all.options[8].style.color = '#000000';
			} else {
						document.form1.pub[2].checked = true;
						document.form1.io[2].checked = true;
						document.form1.hf[2].checked = true;
						document.images.io.src = 'dontknow_grey.jpg';
						document.images.hf.src = 'dontknow_grey.jpg';
						document.images.pub.src = 'dontknow_grey.jpg';
						
				 	  document.form1.pub[0].disabled = true;
						document.form1.pub[1].disabled = true;
						document.form1.pub[2].disabled = true;
						document.form1.io[0].disabled = true;
						document.form1.io[1].disabled = true;
						document.form1.io[2].disabled = true;
						document.form1.hf[0].disabled = true;
						document.form1.hf[1].disabled = true;
						document.form1.hf[2].disabled = true;
						document.all.options[0].style.color = '#CCCCCC';
						document.all.options[1].style.color = '#CCCCCC';
						document.all.options[2].style.color = '#CCCCCC';
						document.all.options[3].style.color = '#CCCCCC';
						document.all.options[4].style.color = '#CCCCCC';
						document.all.options[5].style.color = '#CCCCCC';
						document.all.options[6].style.color = '#CCCCCC';
						document.all.options[7].style.color = '#CCCCCC';
						document.all.options[8].style.color = '#CCCCCC';
			}
}			

function mid_image() {
				 document.write("<img src='rucker-02.jpg'>");
}	 
function change_font(panel) {
				 panel.style.color = 'blue';
				 panel.style.textDecoration = 'underline';
}
function return_font(panel) {
				 panel.style.color = '2C1D00';
				 panel.style.textDecoration = 'none';
}

function mid_image() {
				 if (document.images.mid.src == 'http://www.basketballnyc.com/rucker-02.jpg') {
				   document.images.mid.src = 'cage-01.jpg';					 
				 } else {
				 	 document.images.mid.src = 'rucker-02.jpg';
				 }
}

function changeMap(bor) {
				 var url = 'temp.php?map=' + bor;
				 document.location.href = url;
}

function setTotal() {
				 if (document.form1.qty.value != '') {
				 		var subtotal = Monify(document.form1.qty.value * 19.99);
				 		document.form1.stotal.value = '$' + subtotal;
						var total = Monify(parseFloat(subtotal) + 3.99);
						document.form2.amount.value = total;
						document.form1.tot.value = '$' + total;
				 } 
}

function Monify(value)
{
 var str = "" + Math.round(value * 100);
 var len = str.length;

 return (str=="0")?"":(str.substring(0,len-2)+"."+str.substring(len-2,len));
}