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>Complaint of Employee Misconduct 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">This form should be used exclusively to report employee misconduct. Complaints regarding Los Angeles Police Department policies and procedures, or police response time to a location, should be discussed with the watch commander at your local police station. Upon completion of this form, you may either return it in person to the nearest police station, or mail the top copy to LOS ANGELES POLICE DEPARTMENT. Internal Afairs Division, P.O. Box 30158, Los Angeles, CA 90033-4896. A preaddressed business reply envelope has been provided for your convenience. Keep the second copy for your records.</font></p>');
	prnWin.document.writeln('</td></tr>');
  	prnWin.document.writeln('</table>');
	
	prnWin.document.writeln('<TABLE WIDTH="640" BORDER="1" CELLSPACING="2" CELLPADDING="2">');	
	
	writeTitle(prnWin, formName, '', 2);
	writeFields(prnWin, formName, 'Name', 'NAME');
	writeFields(prnWin, formName, 'Phone', 'PHONE');
	writeFields(prnWin, formName, 'Time type', 'PHONE_TYPE');
	writeFields(prnWin, formName, 'Address', 'ADDRESS');
	writeFields(prnWin, formName, 'Language Spoken', 'LANGUAGE_SPOKEN');
	writeFields(prnWin, formName, 'Date of Occurrence', 'DATE_OF_OCCURRENCE');
	writeFields(prnWin, formName, 'Time of Occurrence', 'TIME_OF_OCCURRENCE');
	writeFields(prnWin, formName, 'Location of contact(2)', 'LOCATION_OF_OCCURRENCE');
	
	writeTitle(prnWin, formName, '', 2);
	writeFields(prnWin, formName, 'Names,badge numbers or serial numbers of employees involved (if known)', 'NAMES_BADGE_NUMBERS_OR_SERIAL_NUMBERS_OF_EMPLOYEES_INVOLVED');

	writeTitle(prnWin, formName, '', 2);
	writeFields(prnWin, formName, 'Names,addresses, and telephone numbers of witnesses present at the time of occurrence.(if known):', 'NAMES_ADDRESSES_AND_TELEPHONE_NUMBERS_OF_WITNESSES_PRESENT_AT_TIME_OF_OCCURRENCE');
	
	writeTitle(prnWin, formName, '', 2);
	writeFields(prnWin, formName, "Details - (Please state your complaint, including names, times, locations, witnesses, and any other information that would helpin investigating your complaint. If employee names are unknown, explain what each employee looked like.)", 'DETAILS_OF_COMPLAINT');
	
	writeTitle(prnWin, formName, '', 2);	
	prnWin.document.writeln('<TR ><TD COLSPAN="2">');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Signature</B><u>' + strLine + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Date</B><u>' + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('</TD>');
	prnWin.document.writeln('</TR>');
	
	writeTitle(prnWin, formName, '', 2);
	prnWin.document.writeln('<TR bgcolor="#FFFFCC"><TD COLSPAN="2">');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>DEPARTMENTAL USE ONLY</B></FONT><BR><BR>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>To be completed by the supervisor receiving this form.</B></FONT>');
	prnWin.document.writeln('<p><FONT FACE="ARIAL" SIZE="2"><B>Supervisor\'s Name</B><u>' + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Serial Number</B><u>' + strLine + strLine + '</u></FONT></p>');
    prnWin.document.writeln('<p><FONT FACE="ARIAL" SIZE="2"><B>Supervisor\'s Name</B><u>' + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Serial Number</B><u>' + strLine + strLine + '</u></FONT></p>');
	prnWin.document.writeln('</TD>');
	prnWin.document.writeln('</TR>');
	prnWin.document.writeln('<TR ><TD COLSPAN="2">');
	prnWin.document.writeln('<p><FONT FACE="ARIAL" SIZE="2"><B>Final disposition</B><u>' + strLine + strLine +  strLine + strLine +  strLine + strLine + '</u></FONT><BR>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2">(i.e. forwarded to IAD; 1.81 initiated; sent correspondence to complainant, etc.)</FONT><BR>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2">(Attach additional sheets, if necessary.)</FONT><BR>');
	prnWin.document.writeln('<p><FONT FACE="ARIAL" SIZE="2"><B>IAD No.</B><u>' + strLine + strLine + '</u></FONT>');
	prnWin.document.writeln('<FONT FACE="ARIAL" SIZE="2"><B>Div. No.</B><u>' + strLine + strLine + '</u></FONT></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="#FFFFFF"><B>' + strFieldDesc + '</B></FONT>');
	objWin.document.writeln('</TD>');
	objWin.document.writeln('</TR>');
}
