
function LoadForm(url) {
document.write ("<div id='contactDiv' style='position: absolute; left: 140; top: 200; width: 275; height: 150; z-index: 2; background-color: #e7ebf7; border: 1px solid #133687; padding: 3px; display:none;'>");
document.write ("<form name='myContactForm' method='POST' action='sendmail.php'>");
document.write ("<table border='0' cellspacing='0' cellpadding='2' style='background-color:#e7ebf7; border-collapse: collapse;'  id='table1'>");
document.write ("<tr><td colspan='2' class='title'>Contact Form</td></tr>");
document.write ("<tr><td valign='top' class='small'>Name:</td><td valign='top' class='small'><input class='small' type='text' name='myname' size='32' tabindex='1'></td></tr>");
document.write ("<tr><td valign='top' class='small'>EMail:</td><td valign='top' class='small'><input class='small' type='text' name='email' size='32' tabindex='2'></td></tr>");
document.write ("<tr><td valign='top' class='small'>Phone:</td><td valign='top' class='small'><input class='small' type='text' name='phone' size='32' tabindex='3'></td></tr>");
document.write ("<tr><td valign='top' class='small'>Fax:</td><td valign='top' class='small'><input class='small' type='text' name='fax' size='32' tabindex='4'></td></tr>");
document.write ("<tr><td class='small' nowrap valign=top>Comments:&nbsp;&nbsp;</td><td valign='top'><textarea class='small' rows='3' name='comments' cols='33' tabindex='5'></textarea><input type='hidden' name='url' value='"+url+"'></td></tr>");
document.write ("<tr><td class='small'>&nbsp;</td><td class='small' valign='bottom'><a href='javascript:ProcessForm();'><img border='0' src='images/btn_submit_ltblue.gif' name='SubForm'  width='58' height='15'></a>&nbsp;&nbsp;&nbsp;&nbsp;");
document.write ("<a href='javascript:HideForm();'><img src='images/btn_cancel_ltblue.gif' name='myCancel'  width='60' height='15' border='0'></a></td></tr></table></form></div>");
document.write ("<div id='responseDiv' style='position: absolute; left: 140; top: 200; width: 275; height: 150; z-index: 3; background-color: #e7ebf7; border: 1px solid #133687; padding: 3px; display:none;'>");
document.write ("<table width='100%' border='0' cellspacing='0' cellpadding='2' style='background-color:#e7ebf7; border-collapse: collapse;'  id='table2'>");
document.write ("<tr><td height='175' align='center' valign='middle'><h3>Thank you,&nbsp;<span id='theName'></span>. <br>Your comments have been submitted.</h3></td></tr>");
document.write ("</table></div>");
}


function DisplayForm() {
document.getElementById('contactDiv').style.display = 'block';
document.myContactForm.myname.focus();
}


function HideForm() {
document.myContactForm.reset();
document.getElementById('contactDiv').style.display = 'none';
}

function ProcessForm() {

document.myContactForm.myname.value = trimString(document.myContactForm.myname.value);
document.myContactForm.email.value = trimString(document.myContactForm.email.value);
document.myContactForm.comments.value = trimString(document.myContactForm.comments.value);

     if (document.myContactForm.myname.value.length < 1) {
         alert ("Please enter your name.");
         document.myContactForm.myname.focus();
         return;
     }
  
     if (document.myContactForm.email.value.length < 1) {
         alert ("Please enter your email address.");
         document.myContactForm.email.focus();
         return;
     }    

     if (document.myContactForm.comments.value.length < 1) {
         alert ("Please enter your comment or question.");
         document.myContactForm.comments.focus();
         return;
     }

   var showName = document.myContactForm.myname.value;
   var node=document.createTextNode(showName);

   document.getElementById('theName').appendChild(node);
   document.getElementById('responseDiv').style.display = 'block';
	
   var myTimeout = window.setTimeout("showTime()", 2500);

}


function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function showTime() {
     document.myContactForm.submit();
}


