//  Date Created: 01/19/2001
//  Created by Martyn van der Noordaa
//  Email: mnoordaa@carlsonsolutions.com

function Editform(feedbackForm) 
{

var ValidCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ- ";
var ValidLoginCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var ValidNumbers = "0123456789";
var radio_value = null;

// Clear the alert message from the last iteration (if applicable)
AlertMsg = "";
FocusSet = 0;
SelectionMade = 0; 

for (var i=0; i<4; i++) {
  if (feedbackForm.category[i].checked) {
    radio_value = feedbackForm.category[i].value;
    break 
  }
} 

// ** Category Check **
if (radio_value == null) {
  AlertMsg = AlertMsg + "\n" + "- Please select a feedback category.";
}

// ** Message Check **
if ((feedbackForm.comment.value.length) < 1) {
  AlertMsg = AlertMsg + "\n" + "- Feedback Message cannot be empty.";
}

// ** Email Format Check **
if (feedbackForm.email.value > "") {
  Location1 = feedbackForm.email.value.indexOf('@');
  Location2 = feedbackForm.email.value.indexOf('.', Location1);
  if (Location1 == -1 || Location2 == -1) {
    AlertMsg = AlertMsg + "\n- Please enter an E-mail address in the format 'name@wisconsin.gov'";
	if (FocusSet == 0) {
      feedbackForm.email.focus();
      feedbackForm.email.select();
      FocusSet = 1;
	}
}
			
/* Email Spaces Check */
if (feedbackForm.email.value.indexOf (' ') > -1) {
  AlertMsg = AlertMsg + "\n- E-mail address cannot contain spaces.";
  if (FocusSet == 0) {
    feedbackForm.email.focus();
    feedbackForm.email.select();
    FocusSet = 1;
  } 
} 
} else {
  AlertMsg = AlertMsg + "\n" + "- Please enter an E-Mail address.";
    if (FocusSet == 0) {
      feedbackForm.email.focus();
      feedbackForm.email.select();
      FocusSet = 1;
	} 
} 

	var inputText = feedbackForm.pwinput.value;
	if (inputText < 1 || inputText == 'null') {
		AlertMsg = AlertMsg + "\n" + "- Please enter Verfication Text."; 
	} else if (inputText != feedbackForm.frmunique_id.value) {
		AlertMsg = AlertMsg + "\n" + "- Verfication Text is not correct."; 
	}
		
// If we don't have a message to display(no errors), submit the form..
if (AlertMsg == ""){

} 
else {
  alert(AlertMsg);
  return false;
  }
}
