function FormToText(formName) {
	var strLine = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
	prnWin = window.open('', 'Win');
	prnWin.document.open();
	prnWin.document.writeln('<HTML><BODY>');
	prnWin.document.writeln('<TITLE>OFFICE OF THE INSPECTOR GENERAL</TITLE>');
	prnWin.document.writeln('<table width="640" border="0" cellspacing="0" cellpadding="0">');
    prnWin.document.writeln('<tr bgcolor="#000066">');
    prnWin.document.writeln('<td><font color="#FFFFFF" face="Courier New, Courier, mono" size="2"><b>Los Angeles Police Department - Office of the Inspector General</b></font></td>');
    prnWin.document.writeln('</td></tr>');
	prnWin.document.writeln('<tr>');
	prnWin.document.writeln('<td><p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>Employee Commendation Form<br>');
    prnWin.document.writeln('</b></font><font size=2><i>Instructions: This is a printable version of the form you just filled out. Click <a href="javascript:close()">here</a> to close this window after printing.</i></font></p>');
	prnWin.document.writeln('<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">If you would like to commend an employee for the Los Angeles Police Department, please fill out this form. Your may either mail this form or return it to any police facility. You may also comment an employee by writing a a letter to the Chief of Police, Los Angeles Police Department, P.O. Box 30158, Los Angeles, CA 90030, or to the commanding officer of the police station in your area. Verbal commendations may be given to any Department supervisor. Your comments will be reviewed by the concerned commanding officer and the commended employee.</font></p>');
  	prnWin.document.writeln('<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">The Los Angeles Police Department thanks you for your interest and for taking the time to complete this form.</font><br>');
	prnWin.document.writeln('</td></tr>');
	prnWin.document.writeln('</table>');
	
	prnWin.document.writeln('<TABLE WIDTH="640" BORDER="1" CELLSPACING="2" CELLPADDING="2">');	
	writeTitle(prnWin, formName, '1.', 2);
	writeFields(prnWin, formName, 'Date of contact with employee', 'DATE_OF_CONTACT_WITH_EMPLOYEE');
	writeFields(prnWin, formName, 'Time of contact with employee', 'TIME_OF_CONTACT_WITH_EMPLOYEE');
	writeFields(prnWin, formName, 'Time type', 'TIMETYPE');
	writeFields(prnWin, formName, 'Location of contact(1)', 'LOCATION_OF_CONTACT_LINE_1');
	writeFields(prnWin, formName, 'Location of contact(2)', 'LOCATION_OF_CONTACT_LINE_2');
	
	writeTitle(prnWin, formName, "2. Employee's name, serial number (if known) and assignment (name of police station or location where employee is assigned):", 2);
	writeFields(prnWin, formName, 'Name(1)', 'EMPLOYEE_1_NAME');
	writeFields(prnWin, formName, 'Serial number(1)', 'EMPLOYEE_1_SERIAL_NUMBER');
	writeFields(prnWin, formName, 'Assignment(1)', 'EMPLOYEE_1_ASSIGNMENT');
	writeFields(prnWin, formName, 'Name(2)', 'EMPLOYEE_2_NAME');
	writeFields(prnWin, formName, 'Serial number(2)', 'EMPLOYEE_2_SERIAL_NUMBER');
	writeFields(prnWin, formName, 'Assignment(2)', 'EMPLOYEE_2_ASSIGNMENT');
	writeFields(prnWin, formName, 'Name(3)', 'EMPLOYEE_3_NAME');
	writeFields(prnWin, formName, 'Serial number(3)', 'EMPLOYEE_3_SERIAL_NUMBER');
	writeFields(prnWin, formName, 'Assignment(3)', 'EMPLOYEE_3_ASSIGNMENT');
	
	writeTitle(prnWin, formName, '3. What initiated your contact with the employee?', 2);
	writeFields(prnWin, formName, 'Contact Type:', 'WHAT_INITIATED_YOUR_CONTACT_WITH_THE_EMPLOYEE');
	writeFields(prnWin, formName, 'If "Other" is marked:', 'OTHER_CONTACT_INITIATION');
	
	
	writeTitle(prnWin, formName, '4', 2);
	writeFields(prnWin, formName, "What would you like to commend about the employee's performance?", 'WHAT_WOULD_YOU_LIKE_TO_COMMEND_ABOUT_THE_EMPLOYEES_PERFORMANCE');
	
	writeTitle(prnWin, formName, '', 2);
	writeFields2(prnWin, formName, 'Print your name', 'NAME');
	writeFields2(prnWin, formName, 'Address', 'ADDRESS');
	writeFields2(prnWin, formName, 'City', 'CITY');
	writeFields2(prnWin, formName, 'Zip code', 'ZIP_CODE');
	writeFields2(prnWin, formName, 'Telephone Number', 'TELEPHONE_NUMBER');
	prnWin.document.writeln('<TR bgcolor="#FFFFCC" ><TD COLSPAN="2">');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Your Signature</B><u>' + strLine + strLine + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Date</B><u>' + strLine + '</u></FONT>');
	prnWin.document.writeln('</TD>');
	prnWin.document.writeln('</TR>');
	
	writeTitle(prnWin, formName, '', 2);
	prnWin.document.writeln('<TR ><TD COLSPAN="2"><BR><BR>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Employee\'s Signature</B><u>' + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<p><FONT FACE="ARIAL" SIZE="2"><B>Commanding Officer\'s Signature</B><u>' + strLine + strLine + '</u></FONT></p><p></p>');
	prnWin.document.writeln('</TD>');
	prnWin.document.writeln('</TR>');
	prnWin.document.writeln('</TABLE>');
	prnWin.document.writeln('</BODY></HTML>');	
	prnWin.document.close();
	return false;
}

function writeFields(objWin, formName, strFieldDesc, objField) {
	objWin.document.writeln('<TR><TD WIDTH="140" VALIGN="TOP">');
	objWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>' + strFieldDesc + '</B></FONT>');
	objWin.document.writeln('</TD>');
	objWin.document.writeln('<TD WIDTH="500" VALIGN="TOP">');
	var strType = eval("objWin.opener.document." + formName + "." + objField + ".type");	
	if (strType == "text" || strType == "textarea") {
		objWin.document.writeln('<FONT FACE="ARIAL" SIZE="2">' + eval("objWin.opener.document." + formName + "." + objField + ".value") + '&nbsp;</FONT>');
	} else {				
		for (i = 0; i<eval("objWin.opener.document." + formName + "." + objField + ".length"); i++) {
			if (eval("objWin.opener.document." + formName + "." + objField + "[i].checked")) {
				objWin.document.writeln('<FONT FACE="ARIAL" SIZE="2">' + eval("objWin.opener.document." + formName + "." + objField + "[i].value") + '&nbsp;</FONT>');
				break;
			}
		}
	}
	objWin.document.writeln('</TD>');
	objWin.document.writeln('</TR>');
}

function writeFields2(objWin, formName, strFieldDesc, objField) {
	objWin.document.writeln('<TR bgcolor="#FFFFCC"><TD WIDTH="140" VALIGN="TOP">');
	objWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>' + strFieldDesc + '</B></FONT>');
	objWin.document.writeln('</TD>');
	objWin.document.writeln('<TD WIDTH="500" VALIGN="TOP">');
	var strType = eval("objWin.opener.document." + formName + "." + objField + ".type");	
	if (strType == "text" || strType == "textarea") {
		objWin.document.writeln('<FONT FACE="ARIAL" SIZE="2">' + eval("objWin.opener.document." + formName + "." + objField + ".value") + '&nbsp;</FONT>');
	} 
	objWin.document.writeln('</TD>');
	objWin.document.writeln('</TR>');
}
function writeTitle(objWin, formName, strFieldDesc, fntSize) {
	objWin.document.writeln('<TR bgcolor="#CCCCFF"><TD COLSPAN="2">');
	objWin.document.writeln('<FONT FACE="ARIAL" SIZE="' + fntSize + '" COLOR="#000000"><B>' + strFieldDesc + '</B></FONT>');
	objWin.document.writeln('</TD>');
	objWin.document.writeln('</TR>');
}
