// $Id: comment_form.js $
// $Date: 2010-01-01

function checkForm(form)
{
	if (form.comment.value.length==0)
	{
		alert("Please enter a comment");
		form.comment.focus();
		return false;
	}
	if (form.author.value.length==0)
	{
		alert("Please enter a name to appear on the site");
		form.author.focus();
		return false;
	}
	return true;
}

function saveDetails(form)
{
	if (form.rememberme.checked)
	{
		//alert("Saving details.." +   form.author.value);
		setCookie('commentSaved', 'yes', getExpDate(180,0,0));
		setCookie('commentAuthor',   form.author.value, getExpDate(180,0,0));
		setCookie('commentEmail',    form.email.value, getExpDate(180,0,0));
		setCookie('commentLocation', form.location.value, getExpDate(180,0,0));
	}
	else
	{
		setCookie('commentSaved', 'no', getExpDate(180,0,0));
		//deleteCookie('commentAuthor');
	}
}

function setDetails()
{
	//alert("Setting details");
	if (document.getElementById) 
	{
		var isSaved = getCookie('commentSaved');
		if (isSaved == 'yes')
		{
			document.getElementById("author").value   = getCookie('commentAuthor')   || '';
			document.getElementById("email").value    = getCookie('commentEmail')    || '';
			document.getElementById("location").value = getCookie('commentLocation') || '';
			document.getElementById("rememberme").checked = true;
		}
	}
}

