function ValidateForm(f)
{
	alert("validate form")
	var error_message = "The following errors were detected while processing the form:"
	var num_errors = 0
	
	if(f.fTitle.length > 64)
	{
		error_message += "\nTitle can not exceed 64 characters."
		++num_errors
	}
	
	if(f.fTitle.value.length <= 0 )
	{
		error_message += "\nA title is required."
		++num_errors
	}
	
	if(f.fAuthor.value.length > 64)
	{
		 error_message += "\nAuthor can not exceed 64 characters."
		 ++num_errors
	}
	
	if(f.fAuthor.value.length <= 0)
	{
		error_message += "\nAn author is required."
		++num_errors
	}
	
	if(f.fTeaser.value.length > 500)
	{
		 error_message += "Teaser can not exceed 500 characters."
		 ++num_errors
	}
	
	if(f.fTeaser.value.length <= 0)
	{
		error_message += "\nA teaser is required."
		++num_errors
	}
	
	if(f.fMetaTitle.value.length > 64)
	{
		 error_message += "Meta Title can not exceed 64 characters."
		 ++num_errors
	}
	
	if(f.fMetaTitle.value.length <= 0)
	{
		error_message += "\nA meta title is required."
		++num_errors
	}
	
	if(f.fMetaKeywords.value.length > 300)
	{
		 error_message += "Meta Keywords can not exceed 300 characters."
		 ++num_errors
	}
	
	if(f.fMetaKeywords.value.length <= 0)
	{
		error_message += "\nMeta keywords are required."
		++num_errors
	}
	
	if(f.fMetaDescription.length > 200)
	{
		 error_message += "Meta description can not exceed 200 characters."
		 ++num_errors
	}
	
	if(f.fMetaDescription.length <= 0)
	{
		error_message += "\nA meta description is required."
		++num_errors
	}
	
	if(f.fArticle.length <= 0)
	{
		error_message += "\nAn article is required."
		++num_errors
	}
	
	if( num_errors > 0 )
	{
		alert( "The following errors were found in the form:\n" + error_message )
		return false
	}
	else
	{
		return true
	}
}

function previewarticle(f)
{
	var w = window.open('')
	d = w.document
	
	d.writeln("<html>")
	d.writeln("<head>")
	d.writeln("<title>" + f.fTitle.value + "</title>")
	d.writeln("</head>")
	d.writeln("<body>")
	d.writeln("<h1>" + f.fTitle.value + "</h1>")
	d.writeln("By: <i>" + f.fAuthor.value + "</i>")
	d.writeln("<br/>Posted on " + f.fMonth.value + "/" + f.fDay.value + "/" + f.fYear.value + " at " + f.fHour.value + ":" + f.fMinute.value)
	d.writeln("<p><hr/></p>")
	d.writeln(f.fArticle.value)
	d.writeln("</body>")
	d.writeln("</html>")
	
}

function checkcommentform(f)
{
	var error_message = "I was unable to process the following errors because:"
	var num_errors = 0
	
	if( f.cname.value.length > 64 )
	{
		error_message += "\nThe name that was entered can not exceed 64 characters."
		num_errors++
	}
	
	if( f.cname.value.length <= 0 )
	{
		error_message += "\nThe name field can not be blank."
		num_errors++
	}
	
	if( f.cemail.value.length > 128 )
	{
		error_message += "\nThe E-mail address that was entered can not exceed 128 characters."
		num_errors++
	}
	
	if( f.cemail.value.length <= 0 )
	{
		error_message += "\nThe E-mail address field can not be blank."
		num_errors++
	}
	
	if( f.csubject.value.length > 64 )
	{
		error_message += "\nThe subject that was entered can not exceed 64 characters."
		num_errors++
	}
	
	if( f.csubject.value.length <= 0 )
	{
		error_message += "\nThe subject field can not be blank."
		num_errors++
	}
	
	if( f.ccomment.value.length <= 0 )
	{
		error_message += "\nThe comment field can not be blank."
	}
	
	if( num_errors > 0 )
	{
		alert(error_message)
		return false
	}
	else 
	{
		return true
	}
}

function previewcomment(f)
{
	var w = window.open('')
	d = w.document
	
	d.writeln("<html>")
	d.writeln("<head>")
	d.writeln("</head>")
	d.writeln("<body>")
	d.writeln("<table>")
	d.writeln("<tr>")
	d.writeln("<td><b>Name:</b></td>")
	d.writeln("<td><a href=\"mailto:" + f.cemail.value + "\">" + f.cname.value + "</a></td>"")
	d.writeln("</tr>")
	d.writeln("<tr>")
	d.writeln("<td><b>Website:</b></td>")
	d.writeln("<td><a href=\"" + f.cwebsite.value + "\">" + f.cwebsite.value + "</a></td>")
	d.writeln("</tr>")
	d.writeln("<tr>")
	d.writeln("<td><b>Date:</b></td>")
	d.writeln("<td><font size=\"-1\"><i>Date will not be displayed until it's posted.</i></font></td>")
	d.writeln("</tr>")
	d.writeln("<tr>")
	d.writeln("<td><b>Subject:</b></td>")
	d.writeln("<td>" + f.csubject.value + "</td>")
	d.writeln("</tr>")
	d.writeln("<tr>")
	d.writeln("<td><b>Comment:</b></td>")
	d.writeln("<td>" + f.ccomment.value + "</td>")
	d.writeln("</body>")
	d.writeln("</html>")
}
	


function IsNumeric(strString)
{
   var strValidChars = "0123456789.-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

 
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
   


function fillindate(f)
{
	var d = new Date()
	f.fMonth.value = parseInt((d.getMonth() + 1))
	f.fDay.value = parseInt(d.getDate())
	f.fYear.value = parseInt(d.getFullYear())
	f.fHour.value = parseInt(d.getHours())
	f.fMinute.value = parseInt(d.getMinutes())	
}

 