
var wSuccessURL="Info-Success.asp";
var wSuccessDownloadURL="Info-Success-Download.asp";
var wNewURL="";
var wURL=""; var gDocument="";
function openDocument()  {
	
       if (wNewURL!="") {
         	window.open(wNewURL)
	}
}
// **********************************************************  oForm = eval("document."+formID);  
function editFields() {
	var wNumberElements = document.DataForm.length;
	gDocument = document.URLUnencoded;
	// alert(gDocument);
	// alert(wNumberElements);
var wInformation = "";
//  var oForm = document.forms[0];
// oForm = document.getElementById("form");
// alert(oForm);
  wForm = "DataForm";
    var wHidden=""; var elementNext=""; var wName = ""; var wAlert=""; var wValue=""; var wPrefix="";
    var errorFound = false; var wTitle = ""; var wApplication; wEmail = ""; wEmailName = ""; wEmailValue = "";
    var wOptionName=""; var wOptionValue="";  var wOptionIndex=""; var wInfo=" <br/> "; wHiddenName="";
    
   // wTitle = document.getElementById("titleID").text;
   wTitle = document.getElementsByTagName("title")[0].text;
   
   
   // **********************************************************
    for ( var j = 0; j < DataForm.elements.length; j++ ) {
        elementNext = DataForm.elements[j];
 		wName= DataForm.elements[j].name;
		 wValue= DataForm.elements[j].value;
		
		wOptionIndex=DataForm.elements[j].selectedIndex;;
		
		wPrefix= DataForm.elements[j].name.substr(0,3);
		wEmailName= DataForm.elements[j].name.substr(0,8);
		wHiddenName= DataForm.elements[j].name.substr(0,11);
		if (wEmailName=="reqEmail") {
			wEmailValue= DataForm.elements[j].value;
		}
		if (wPrefix=="req") {
			wName= DataForm.elements[j].name.substr(3);
		}
		if (wHiddenName=="FromAddress") {
			// DataForm.elements[j].value = wEmailValue;
		}
	//  ****** end of basic assignment of name and value
	if (elementNext.type=="select-one")   {
		 wInfo = wInfo + " " + wName + ": <b> " + wValue + " </b> <br/> ";
		 wMsg = wName + " " + wValue + "Index = " + wOptionIndex;
		 // alert(wMsg);
	         	if (elementNext.selectedIndex > 0) {	
					wInformation = wInformation + " " + wName + ": <b> " + wValue + "</b> <br/> ";		
			}
			
        }
	//  ************************
        if ( (elementNext.type=="checkbox") || (elementNext.type=="radio")  )  {
         	if (elementNext.checked) {	
				wInformation = wInformation + " " + wName + ": <b> " + wValue + " </b> <br/> ";
					
		}
        }
        //  *** end of if checkbox or radio
         if ( (elementNext.type=="text") || (elementNext.type=="textarea") ) {
            if (errorFound == false) {
         	if (wValue != "") {
         		wInformation = wInformation + " " + wName + ": <b> " + wValue + " </b> <br/> ";
         	} else {
         	wAlert =  wPrefix;
		// alert(wAlert);
         		if (wPrefix=="req") {
         			errorFound = true;
				alert("All required fields in red must be entered.");
         			elementNext.focus();
         			
         		}
         	}
         
            }
         }
         
     }  // end for loop
     if (errorFound == false) {
     	wAlert =  wTitle + wInformation;
  // FOR ASP COMMENT OUT THE ALERT
	// alert(wAlert);
	wEmail = wInformation;
	document.DataForm.MessageText.value = wEmail;
	// openDocument();
// *********** The following defines the success page (Thank You page)var pURL="thanks.asp?System=<%=wSys%>";
	if (wNewURL=="") {
		wURL = wSuccessURL;
	} else {
		wURL = wSuccessDownloadURL;
	}
		document.DataForm.elements['OnSuccess'].value=wURL;
	// For HTML comment out the following ASP submit
	 document.DataForm.submit();
	 openDocument();
     }
}