// Validate product commment form

function validateForm(form) {
	if (document.layers||document.getElementById||document.all)
		return checkFields(form);
	else {
		return true;
	}
}
function isEmpty (fld) {
	if (fld == "" || fld == null)
		return true;
	else
		return false;
}

function checkFields(form) {
	missinginfo = "";
	if (isEmpty(form.nickname.value)) 
		missinginfo += "\n    Name";
	if (isEmpty(form.ctext.value)) 
		missinginfo += "\n    Comment";

	if (missinginfo != "") {
		missinginfo ="______________________________________\n" +
		"You must provide a:" +
		missinginfo + "\n______________________________________" +
		"\nPlease complete the form and resubmit.";
		alert(missinginfo);
		return false;
	}
	return true;
}

// Hide/show comments
function hidecomms() {
	document.getElementById('comments').style.visibility = 'hidden';
	document.getElementById('hideshow').innerHTML = '<a href="javascript:showcomms();">Show Comments</a>';
}
function showcomms() {
	document.getElementById('comments').style.visibility = 'visible';
	document.getElementById('hideshow').innerHTML = '<a href="javascript:hidecomms();">Hide Comments</a>';
}

