// <!--	function transferData() {			window.document.client_form.income.value=display.document.totals.grandTotal.value;									display.close();			window.document.client_form.income_per.selectedIndex = 3;	}	function compute() {		var addedValue;		var periodInfo;				// Initialize the totals by setting them all to 0		for(var i=0;i< this.numSources;i++) {			this[i].total =0;		}		// Compute a subtotal for each income source	 		for(var i=0;i<familyTable.numPeople;i=(i+1)){	 			for(var j=0;j< this.numSources;j++) {					this[j][i].enteredNumber= (eval("display.document.incomeCalculator." + this[j].name  + i + ".value" ))-0					periodInfo = (eval("display.document.incomeCalculator.period" + this[j].name  + i));	 				this[j][i].period = periodInfo.options[periodInfo.selectedIndex].value;	 				this[j][i].computeAnnual();	 				this[j].total = this[j].total + this[j][i].annual;				}			}					if(this.grandTotal == "not computed") {			with(display.document) {				writeln('<form name="totals">') 									writeln('<a name="beginTotals"></a>')				// Write out the subtotal for each income source 				for(var i=0;i< this.numSources;i++) { 							write("<br> <br> <br>Total from ", this[i].label,"  $")					write('<input type="text" size="5" value="', this[i].total, '" name="total', i, '">')					write(' per year')					writeln('<br>');									}				//Compute the grand total				this.grandTotal = 0;				for(var i=0;i< this.numSources;i++) {						 this.grandTotal = this.grandTotal + this[i].total;				}													// Write out a textbox for the Grand Total 				write("<br> <br> <br>Grand Total")				write('<br>');				write('$<input type="text" name="grandTotal" value="' + this.grandTotal + '">')				write('<br>');				display.scrollBy(0,240); //Scroll down so the client can see the totals				 if(window.navigator.appName.indexOf('Netscape') > -1){					write('<input type="button" name="submitgrandtotal"  value="CONTINUE" > <p> <p> </form>');										totals.submitgrandtotal.onclick = function() {window.parent.transferData();};				 }			}		}		else {			this.grandTotal = 0;			// Update the display of the subtotals			// Then recompute the grandTotal and display it.					for(var i=0;i< this.numSources;i++) {				display.document.totals['total' + i].value=this[i].total;							 this.grandTotal = this.grandTotal + this[i].total;			}								display.document.totals.grandTotal.value=this.grandTotal;		}	 }	 		function buildRow() {		var nameString;		display.document.write("<p><b>Income from ", this.label, "</b><br><br>")		for(var i=0;i<familyTable.numPeople;i++){			display.document.write(" How much does ", familyTable.familyNames[i], " make from ", this.label, "?    $")			display.document.write(' <input type="text" value="0" name="', this.name, i, '">');			display.document.write(' <select name="period', this.name, i,'" size="1">')			display.document.write('<option value="12">monthly')			display.document.write('<option value="1">yearly')			display.document.write('<option value="52">weekly')			display.document.write('</select> <br> <br>')		}	}		function computeAnnual() {		this.annual=(this.enteredNumber * this.period);	}	function incomeElement() {		this.enteredNumber = 0;		this.period= "monthly";		this.annual=0;		this.computeAnnual=computeAnnual;	}		function row(name,label, numPeople) {		this.buildRow=buildRow;		this.name = name;		this.label = label;		this.total = 0;		for(var i=0;i<numPeople;i++){			this[i] =new incomeElement;		}	}		function nameArray(numPeople){		for(var i=0; i<numPeople;i++){			this[i] =""		}	}	function sourcesArray(numPeople){		this.numSources=4;		this.grandTotal = "not computed";			this.compute =compute;		this[0] =new row("wages", "wages", numPeople);		this[1] =new row("social_security", "social security (including disablility)", numPeople);		this[2] =new row("welfare","welfare and unemployment insurance", numPeople);			this[3] =new row("veterans","veterans benefits", numPeople);			this[4] =new row("gifts","gifts from other people", numPeople);		}			function tableObject (numPeople) {		this.numPeople=numPeople;		this.build =buildIncomeCalculator;		this.income = new sourcesArray(numPeople);		this.familyNames = new nameArray(numPeople);	}				function buildIncomeCalculator(numPeople) {				display.document.write('<head> <title> Income Calculator </title> </head>');		display.document.write('<form name="incomeCalculator">');						for(var i=0;i<this.income.numSources;i++) {			this.income[i].buildRow();		}		with(display.document) {				write('<p><p>');			write('<input type="button" name="submitnames" value="Calculate our income!">');			write('</form>');			display.document.incomeCalculator.submitnames.onclick = function() {familyTable.income.compute();}		}	}				function init() {		numPeople=prompt("How many people are there in your family who have any income?", "");		display = window.open("", "", "scrollbars");		// make sure the client didn't select the "cancel" button. 		if(numPeople==null){			display.close();}		else {			familyTable = new tableObject(numPeople);			with(display.document) {				write('<form name="namingPeople">'); 				write('<b> It may be helpful for you to give a name or nickname for each person in your family. <br> </b>');				write('<b> Or we can just call them person #1, person #2, etc. <br> </b>');				write('<table>');				for(var i=0;i< numPeople;i++) {					write('<td>');					write('<input type="text" name="person' + i + '" value="person #' +String(i+1)+ '">');					write('</td>');				} 				write('</table>');				write('<input type="button" value="CONTINUE" name="submission">');				write('</form>');				display.document.namingPeople.submission.onclick = function() {window.parent.assignNames();}				close();		}   // end of with statement				} // end of "If the client didn't select cancel..."	}		function assignNames() {		var familyNames = new nameArray(numPeople); 		for(var i=0;i<numPeople;i++){			familyTable.familyNames[i]=eval('display.document.namingPeople.person' + i + '.value')		}		familyTable.build(numPeople);	}		function verify(theForm) {		if(isNaN(parseInt(theForm.famincome.value))) {				window.alert('We are sorry. We cannot help you find housing until you enter a number in the box for income.');				theForm.famincome.focus();				theForm.famincome.select();				return false;		}		if(theForm.ClientCity.value.length == 0) {				window.alert('We are sorry. We cannot help you find housing until you tell us which city you are looking in.');				theForm.ClientCity.focus();				theForm.ClientCity.select();				return false;		}		return true;	}	// -->
