//
//

function frmValidate() {
//if (document.mainForm.portalId.selectedIndex == 0) {
//  alert("Please select an option.");
//  document.mainForm.portalId.focus();
//  return false;
//}

if (document.frmMain.realname.value == '') {
	alert ('Please enter a Contact Name');
	document.frmMain.realname.select();
	document.frmMain.realname.focus();
	return false;
}
if (document.frmMain.realname.value.length < 2) {
	alert("Contact Name should be at least 2 characters long.");
	document.frmMain.realname.select();
	document.frmMain.realname.focus();
	return false;
}

if (document.frmMain.email.value == '') {
	alert ('Please enter your E-mail address.');
	document.frmMain.email.select();
	document.frmMain.email.focus();
	return false;
}
EmailInput = document.frmMain.email.value;
EmailLength = EmailInput.length;
LastChar = EmailInput.charAt(EmailLength - 1)
CheckOne = EmailInput.indexOf("@");
CheckTwo = EmailInput.lastIndexOf(".");
CheckThree = EmailInput.indexOf(".");
CheckFour = EmailInput.indexOf("@.");
CheckFive = EmailInput.indexOf(".@");
CheckComma = EmailInput.indexOf(",");
CheckSlash = EmailInput.indexOf("/");
if ((CheckOne < 1) || (CheckTwo < 3) || (CheckThree < 1) || (CheckFour > -1) || (CheckFive > -1) || (CheckComma > -1) || (CheckSlash > -1) || (LastChar == ".")) {
	alert ("Please enter a valid E-mail address.")
	document.frmMain.email.select();
	document.frmMain.email.focus();
	return false;
}
return true;
}

function frmValidateField() {
if (document.mainForm.The_Comment == '') {
  alert("Please enter your comment");
  document.frmMain.The_Comment.select();
  document.frmMain.The_Comment.focus();
  return false;
}
return true;
}

var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1); 
var submitted=false;

function printPage() {
  if (pr) // NS4, IE5
    window.print()
  else if (da && !mac) // IE4 (Windows)
    vbPrintPage()
  else // other browsers
    alert("Sorry, your browser doesn't support this feature.");
  return false;
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}
