// JavaScript Document
function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function signGuestbook()
{
    
    
	document.getElementById("heronamemsg").innerHTML = "";
	document.getElementById("herodescmsg").innerHTML = "";
	document.getElementById("submitmsg").innerHTML = ""
	
	
	
	if ((trim(document.myheroguestbook.myheroname.value).length > 0) && (trim(document.myheroguestbook.whyhero.value).length > 0)) {
		document.myheroguestbook.action = "guestbook1.asp?new=1";
		document.myheroguestbook.submit();
		return true;
	} else {
		if (trim(document.myheroguestbook.myheroname.value).length <= 0) {
			document.getElementById("heronamemsg").innerHTML = "You have not entered the name of your hero.";
		}
		
		if (trim(document.myheroguestbook.whyhero.value).length <= 0) {
			document.getElementById("herodescmsg").innerHTML = "You have not filled out why this person is your hero.";
		}
		document.getElementById("submitmsg").innerHTML = "Hero not submitted. You have not filled out the guestbook completely.";
		return false;
	}
	
}