function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

/*function setMiddleCenter() {
	document.submissionForm.watermark_vertical[1].checked = true;
	document.submissionForm.watermark_horizontal[1].checked = true;
	document.submissionForm.watermark_vertical[0].disabled = true;
	document.submissionForm.watermark_vertical[2].disabled = true;
	document.submissionForm.watermark_horizontal[0].disabled = true;
	document.submissionForm.watermark_horizontal[2].disabled = true;
}

function clearMiddleCenter() {
	document.submissionForm.watermark_vertical[0].disabled = false;
	document.submissionForm.watermark_vertical[2].disabled = false;
	document.submissionForm.watermark_horizontal[0].disabled = false;
	document.submissionForm.watermark_horizontal[2].disabled = false;
}

function blockMiddleCenter() {
	document.submissionForm.watermark_vertical[1].disabled = true;
	document.submissionForm.watermark_horizontal[1].disabled = true;
	document.submissionForm.watermark_vertical[0].checked = true;
	document.submissionForm.watermark_horizontal[0].checked = true;
}
function unblockMiddleCenter() {
	document.submissionForm.watermark_vertical[1].disabled = false;
	document.submissionForm.watermark_horizontal[1].disabled = false;
}*/

function showMember(which) {
	if (which == 1) {
		document.getElementById('member1').style.visibility = 'visible';
		document.getElementById('member1').style.display = 'block';
		document.getElementById('member0').style.visibility = 'hidden';
		document.getElementById('member0').style.display = 'none';
	} else {
		document.getElementById('member0').style.visibility = 'visible';
		document.getElementById('member0').style.display = 'block';
		document.getElementById('member1').style.visibility = 'hidden';
		document.getElementById('member1').style.display = 'none';
	}
}

//these two functions need to be backchecked against the DOM to make sure the syntax is right.
//JEA 5/31/07
function hideCommons() {
	document.getElementById('CommonsOptions').style.visibility = 'hidden';
	document.getElementById('CommonsOptions').style.display = 'none';
}

function showCommons() {
	document.getElementById('CommonsOptions').style.visibility = 'visible';
	document.getElementById('CommonsOptions').style.display = 'block';
}
function hideWaters() {
	document.getElementById('WatermarkOptions').style.visibility = 'hidden';
	document.getElementById('WatermarkOptions').style.display = 'none';
}

function showWaters() {
	document.getElementById('WatermarkOptions').style.visibility = 'visible';
	document.getElementById('WatermarkOptions').style.display = 'block';
}

function validateForm() {
	var errors = "Errors are as follows:\n";
	var errorcount = 0;
	if (document.submissionForm.form_image.value=="")
	{
		errors += "You did not point the form to an image.\n";
		errorcount++;
	}
	var galleryArray = document.submissionForm['gallery[]'];
	var galleryPass = 0;
	for (var i = 0; i < galleryArray.length; i++) 
	{
		if (galleryArray[i].checked)
		{
			galleryPass++;
		}
	} 
	if (galleryPass < 1)
	{
		errors += "You did not select any games.\n";
		errorcount++;
	}

	if ((document.submissionForm.other.value!="Insert Other Game Here") && (document.submissionForm.other.value==""))
	{
		errors += "You tried to manually enter a game but did not enter the name.\n";
		errorcount++;
		document.submissionForm.other.value="Insert Other Game Here";
	}
	if ((document.submissionForm.form_month.value!="00") || (document.submissionForm.form_day.value!="00"))
	{
		if (document.submissionForm.form_month.value!="00")
		{
			if (document.submissionForm.form_day.value=="00")
			{
				errors += "You didn't choose a day, but you chose a month.\n";
				errorcount++;
			}
			var thirtyDays = new Array();
			thirtyDays[0] = '04';
			thirtyDays[1] = '06';
			thirtyDays[2] = '09';
			thirtyDays[3] = '11';
			
			var i;
			var inThirtyDay = false;
			for (i=0; i < thirtyDays.length; i++) {
				if (thirtyDays[i] === document.submissionForm.form_month.value) {
					var inThirtyDay = true;
				}
			}
			if ((inThirtyDay == true) && parseInt(document.submissionForm.form_day.value)>30)
			{
				errors += "You chose a day that doesn't exist in the month you chose.\n";
				errorcount++;
			}
			if (document.submissionForm.form_month.value=="02" && parseInt(document.submissionForm.form_day.value)>28 && ((parseInt(document.submissionForm.form_year.value)%4)!=0))
			{
				errors += "You chose a day that doesn't exist in the month you chose.\n";
				errorcount++;
			}
		}
	}
	if (errorcount > 0)
	{
		alert(errors);
		return false;
	} else
	{
		return true;
	}

}