/* blog.js */

function blogCommentFormValidation() {
  var element, errorMessage, comment, commenter;
  commenter=document.blogCommentForm.blogCommenter.value;
  comment=document.blogCommentForm.blogComment.value;
  if (comment.trim()=='your comments...' || comment.trim()=='') {
    createDiv('errorDiv','300px','115px','#c0c0c0','#e0e0e0','#006633');
    errorMessage="<div style='height: 50px;'><h6 style='color: #006633; margin-left: 1em; margin-right: 1em; text-align: center;'>I'm sorry... your comments appear to be blank!</h6></div><input type='button' value='OK' class='functionButton' onmouseover=\"this.className='functionButtonHover'\" onmouseout=\"this.className='functionButton'\" onclick=\"destroyDiv('errorDiv');\" />";
    element=document.getElementById('errorDiv');
    element.innerHTML=errorMessage;
    floatDiv('errorDiv');
    return;
  }
  if (commenter.trim()=='your name (optional)') document.blogCommentForm.blogCommenter.value='Blog Visitor';
  document.blogCommentForm.submit();
}

function getElementWithId(name) {
  if (document.getElementById) return(document.getElementById(name));
  if (document.all) return(document.all[name]);
}

function setBlogHeight() { if (getWindowHeight()<675) getElementWithId('blogIframe').style.height='500px'; else getElementWithId('blogIframe').style.height=((getWindowHeight()-175)+'px'); }

String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g, "");
};

