// Written on spec for potential use by OfficeFinder 11/26/2000
// Copyright 2000, John Nye, All Rights Reserved
// The following may be set for use:

// the dimensions of the popup window in pixels where
// popW is width and popH is height

var popW = 600;
var popH = 400;

// end of configuration variables

var noEmp = 0;
var ROTst = 0;
var exOrd = 0;
var noPrz = 0;
var noVPs = 0;
var noExs = 0;
var noPop = 0;
var noOpn = 0;
var noCf0 = 0;
var noCf1 = 0;
var noCf2 = 0;
var noCf3 = 0;
var noCf4 = 0;
var noCf5 = 0;
var noCf6 = 0;
var noCf7 = 0;
var noCf8 = 0;
var noCf9 = 0;
var noMal = 0;
var noRec = 0;
var noFil = 0;
var noLib = 0;
var noLr1 = 0;
var noLr2 = 0;
var noLr3 = 0;
var noLr4 = 0;
var noLr5 = 0;
var noCof = 0;


if ((document.domain == null) || (document.domain == '')) {
	var pagedomain = 'desktop.test';
}
else {
	var pagedomain = document.domain;
}

function checkThis(numb) {
	var retval = 0;
	for (var ix = 0; ix < numb.length; ix++) {
		var achar = numb.substr(ix, 1);
		if ((achar < '0') || (achar > '9')) retval += 1;
	}
	return retval;
}

function validateForm() {
	var aval = checkThis(document.SPACEform.employees.value);
	aval = aval + checkThis(document.SPACEform.extra.value);
	aval = aval + checkThis(document.SPACEform.Pres.value);
	aval = aval + checkThis(document.SPACEform.VP.value);
	aval = aval + checkThis(document.SPACEform.exec.value);
	aval = aval + checkThis(document.SPACEform.popen.value);
	aval = aval + checkThis(document.SPACEform.open.value);
	aval = aval + checkThis(document.SPACEform.conf0.value);
	aval = aval + checkThis(document.SPACEform.conf1.value);
	aval = aval + checkThis(document.SPACEform.conf2.value);
	aval = aval + checkThis(document.SPACEform.conf3.value);
	aval = aval + checkThis(document.SPACEform.conf4.value);
	aval = aval + checkThis(document.SPACEform.conf5.value);
	aval = aval + checkThis(document.SPACEform.conf6.value);
	aval = aval + checkThis(document.SPACEform.conf7.value);
	aval = aval + checkThis(document.SPACEform.conf8.value);
	aval = aval + checkThis(document.SPACEform.conf9.value);
	aval = aval + checkThis(document.SPACEform.mail.value);
	aval = aval + checkThis(document.SPACEform.reception.value);
	aval = aval + checkThis(document.SPACEform.fileRooms.value);
	aval = aval + checkThis(document.SPACEform.library.value);
	aval = aval + checkThis(document.SPACEform.lr1.value);
	aval = aval + checkThis(document.SPACEform.lr2.value);
	aval = aval + checkThis(document.SPACEform.lr3.value);
	aval = aval + checkThis(document.SPACEform.lr4.value);
	aval = aval + checkThis(document.SPACEform.lr5.value);
	aval = aval + checkThis(document.SPACEform.coffee.value);
	if (aval !=0) {
		alert('Invalid entries in the form');
		return false;
	}
	else {
		if (document.SPACEform.layout[0].checked == true) ROTst = document.SPACEform.layout[0].value;
		if (document.SPACEform.layout[1].checked == true) ROTst = document.SPACEform.layout[1].value;
		if (document.SPACEform.layout[2].checked == true) ROTst = document.SPACEform.layout[2].value;
		if ((document.SPACEform.employees.value != null) && (document.SPACEform.employees.value != '')) {
			noEmp = parseInt(document.SPACEform.employees.value);
		}
		else {
			noEmp = '';
		}
		if ((document.SPACEform.extra.value != null) && (document.SPACEform.extra.value != '')) {
			exOrd = parseInt(document.SPACEform.extra.value);
		}
		else {
			exOrd = '';
		}
		if ((document.SPACEform.Pres.value != null) && (document.SPACEform.Pres.value != '')) {
			noPrz = parseInt(document.SPACEform.Pres.value);
		}
		else {
			noPrz = '';
		}
		if ((document.SPACEform.VP.value != null) && (document.SPACEform.VP.value != '')) {
			noVPs = parseInt(document.SPACEform.VP.value);
		}
		else {
			noVPs = '';
		}
		if ((document.SPACEform.exec.value != null) && (document.SPACEform.exec.value != '')) {
			noExs = parseInt(document.SPACEform.exec.value);
		}
		else {
			noExs = '';
		}
		if ((document.SPACEform.popen.value != null) && (document.SPACEform.popen.value != '')) {
			noPop = parseInt(document.SPACEform.popen.value);
		}
		else {
			noPop = '';
		}
		if ((document.SPACEform.open.value != null) && (document.SPACEform.open.value != '')) {
			noOpn = parseInt(document.SPACEform.open.value);
		}
		else {
			noOpn = '';
		}
		if ((document.SPACEform.conf0.value != null) && (document.SPACEform.conf0.value != '')) {
			noCf0 = parseInt(document.SPACEform.conf0.value);
		}
		else {
			noCf0 = '';
		}
		if ((document.SPACEform.conf1.value != null) && (document.SPACEform.conf1.value != '')) {
			noCf1 = parseInt(document.SPACEform.conf1.value);
		}
		else {
			noCf1 = '';
		}
		if ((document.SPACEform.conf2.value != null) && (document.SPACEform.conf2.value != '')) {
			noCf2 = parseInt(document.SPACEform.conf2.value);
		}
		else {
			noCf2 = '';
		}
		if ((document.SPACEform.conf3.value != null) && (document.SPACEform.conf3.value != '')) {
			noCf3 = parseInt(document.SPACEform.conf3.value);
		}
		else {
			noCf3 = '';
		}
		if ((document.SPACEform.conf4.value != null) && (document.SPACEform.conf4.value != '')) {
			noCf4 = parseInt(document.SPACEform.conf4.value);
		}
		else {
			noCf4 = '';
		}
		if ((document.SPACEform.conf5.value != null) && (document.SPACEform.conf5.value != '')) {
			noCf5 = parseInt(document.SPACEform.conf5.value);
		}
		else {
			noCf5 = '';
		}
		if ((document.SPACEform.conf6.value != null) && (document.SPACEform.conf6.value != '')) {
			noCf6 = parseInt(document.SPACEform.conf6.value);
		}
		else {
			noCf6 = '';
		}
		if ((document.SPACEform.conf7.value != null) && (document.SPACEform.conf7.value != '')) {
			noCf7 = parseInt(document.SPACEform.conf7.value);
		}
		else {
			noCf7 = '';
		}
		if ((document.SPACEform.conf8.value != null) && (document.SPACEform.conf8.value != '')) {
			noCf8 = parseInt(document.SPACEform.conf8.value);
		}
		else {
			noCf8 = '';
		}
		if ((document.SPACEform.conf9.value != null) && (document.SPACEform.conf9.value != '')) {
			noCf9 = parseInt(document.SPACEform.conf9.value);
		}
		else {
			noCf9 = '';
		}
		if ((document.SPACEform.mail.value != null) && (document.SPACEform.mail.value != '')) {
			noMal = parseInt(document.SPACEform.mail.value);
		}
		else {
			noMal = '';
		}
		if ((document.SPACEform.reception.value != null) && (document.SPACEform.reception.value != '')) {
			noRec = parseInt(document.SPACEform.reception.value);
		}
		else {
			noRec = '';
		}
		if ((document.SPACEform.fileRooms.value != null) && (document.SPACEform.fileRooms.value != '')) {
			noFil = parseInt(document.SPACEform.fileRooms.value);
		}
		else {
			noFil = '';
		}
		if ((document.SPACEform.library.value != null) && (document.SPACEform.library.value != '')) {
			noLib = parseInt(document.SPACEform.library.value);
		}
		else {
			noLib = '';
		}
		if ((document.SPACEform.lr1.value != null) && (document.SPACEform.lr1.value != '')) {
			noLr1 = parseInt(document.SPACEform.lr1.value);
		}
		else {
			noLr1 = '';
		}
		if ((document.SPACEform.lr2.value != null) && (document.SPACEform.lr2.value != '')) {
			noLr2 = parseInt(document.SPACEform.lr2.value);
		}
		else {
			noLr2 = '';
		}
		if ((document.SPACEform.lr3.value != null) && (document.SPACEform.lr3.value != '')) {
			noLr3 = parseInt(document.SPACEform.lr3.value);
		}
		else {
			noLr3 = '';
		}
		if ((document.SPACEform.lr4.value != null) && (document.SPACEform.lr4.value != '')) {
			noLr4 = parseInt(document.SPACEform.lr4.value);
		}
		else {
			noLr4 = '';
		}
		if ((document.SPACEform.lr5.value != null) && (document.SPACEform.lr5.value != '')) {
			noLr5 = parseInt(document.SPACEform.lr5.value);
		}
		else {
			noLr5 = '';
		}
		if ((document.SPACEform.coffee.value != null) && (document.SPACEform.coffee.value != '')) {
			noCof = parseInt(document.SPACEform.coffee.value);
		}
		else {
			noCof = '';
		}
		return true;
	}
}

function paintReport(which) {
	var string='directories=0,location=0,menubar=0,toolbar=0,resizable=1,scrollbars=1,status=0,width=' + popW + ',height=' + popH;
	var repwin = open('', 'Report', string);
	repwin.document.open();
	repwin.document.writeln('<' + 'html><' + 'title>Report Window<' + '/title>');

	repwin.document.writeln('<' + 'script language=javascript>');
	repwin.document.writeln('function wInit() {');
	repwin.document.writeln('	document.CALCform.submit();');
	repwin.document.writeln('}');
	repwin.document.writeln('<' + '/script>');


	
	repwin.document.writeln('<' + 'body bgcolor="white" onLoad="wInit();">');


	repwin.document.writeln('<' + 'center>' + '<' + 'font size=+1>Calculating . . .<' + '/font>' + '<' + 'br>');

	repwin.document.writeln('<' + 'form name=CALCform action="http://www.officefinder.com/scripts/calc.cfm" method="post">');
	repwin.document.writeln('<' + 'input type=hidden name=employees value="' + noEmp + '">');
	repwin.document.writeln('<' + 'input type=hidden name=layout value="' + ROTst + '">');
	repwin.document.writeln('<' + 'input type=hidden name=extra value="' + exOrd + '">');
	repwin.document.writeln('<' + 'input type=hidden name=Pres value="' + noPrz + '">');
	repwin.document.writeln('<' + 'input type=hidden name=VP value="' + noVPs + '">');
	repwin.document.writeln('<' + 'input type=hidden name=exec value="' + noExs + '">');
	repwin.document.writeln('<' + 'input type=hidden name=popen value="' + noPop + '">');
	repwin.document.writeln('<' + 'input type=hidden name=open value="' + noOpn + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf0 value="' + noCf0 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf1 value="' + noCf1 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf2 value="' + noCf2 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf3 value="' + noCf3 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf4 value="' + noCf4 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf5 value="' + noCf5 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf6 value="' + noCf6 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf7 value="' + noCf7 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf8 value="' + noCf8 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=conf9 value="' + noCf9 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=mail value="' + noMal + '">');
	repwin.document.writeln('<' + 'input type=hidden name=reception value="' + noRec + '">');
	repwin.document.writeln('<' + 'input type=hidden name=fileRooms value="' + noFil + '">');
	repwin.document.writeln('<' + 'input type=hidden name=library value="' + noLib + '">');
	repwin.document.writeln('<' + 'input type=hidden name=lr1 value="' + noLr1 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=lr2 value="' + noLr2 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=lr3 value="' + noLr3 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=lr4 value="' + noLr4 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=lr5 value="' + noLr5 + '">');
	repwin.document.writeln('<' + 'input type=hidden name=coffee value="' + noCof + '">');

	repwin.document.writeln('<' + '/form>');
	repwin.document.writeln('<' + '/center>');
	repwin.document.close();
	repwin.focus();
}
document.writeln('<' + 'table border="0" width="450">');
document.writeln('<' + 'tr>');
document.writeln('<' + 'td><' + 'font size="2">The following form');
document.writeln('provides two methods of calculating your office space');
document.writeln('needs. The first is based upon general rules of thumb.');
document.writeln('The second goes into greater detail and is more accurate.');
document.writeln('Using both methods will provide you with a range of your');
document.writeln('probable requirement. Please note, the results will be in');
document.writeln('usable square footage. Any load factors will have to be');
document.writeln('added. <P><HR><P><CENTER>Would you like to have an office space calculator on your site?<BR><A HREF="calcMoreInfo.html">Click here</A> for more information!</CENTER><P><' + '/font><' + 'hr>');
document.writeln('<' + 'FORM name="SPACEform">');
document.writeln('<' + 'p align="center"><' + 'span style="letter-spacing: 1pt"><' + 'font size="4">&nbsp;Rules of Thumb Method<' + '/font><' + '/span><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2">Number of Employees:');
document.writeln('<' + 'input type="text" size="3" name="employees"><' + 'br>');
document.writeln('<' + 'br>');
document.writeln('<' + 'input type="radio" value="185" name="layout">Efficient');
document.writeln('<' + 'input type="radio" CHECKED value="220" name="layout">Typical');
document.writeln('<' + 'input type="radio" value="250" name="layout">Spacious<' + 'br>');
document.writeln('Extraordinary requirements: <' + 'input type="text"');
document.writeln('size="5" name="extra"> square feet<' + '/font><' + '/p>');
document.writeln('<' + 'hr>');
if (document.layers) {
	document.writeln('<' + 'p align="center"><' + 'font size="4">Detailed');
	document.writeln('Calculation Method<' + '/font><' + '/p>');
}
else {
	document.writeln('<' + 'p align="center"><' + 'span style="letter-spacing: 1pt"><' + 'font size="4">Detailed');
	document.writeln('Calculation Method<' + '/font><' + '/span><' + '/p>');
}
document.writeln('<' + 'p><' + 'i><' + 'font size="2">number<' + '/font><' + '/i><' + 'font size="2"><' + 'br>');
document.writeln('<' + 'i>of employees<' + '/i><' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="Pres"> ' + 'Typical');
document.writeln('President\'s office or Chairman of the Board' + ' (300');
document.writeln('sf) <' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="VP"> ' + 'Typical');
document.writeln('Vice-President\'s Office' + ' (200 sf)<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="exec"> ' + 'Typical');
document.writeln('Executive\'s Office' + ' (120 sf)<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="4" maxlength="4" name="popen">' + '  Partitioned');
document.writeln('Open Space' + '<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="4" maxlength="4" name="open">' + '  Open Area');
document.writeln('Bullpen' + '<' + '/font><' + '/p>');
document.writeln('<' + 'hr>');
document.writeln('<' + 'p><' + 'i><' + 'font size="2">Other Areas<' + '/font><' + '/i><' + '/p>');
document.writeln('<' + 'p>' + '<' + 'font size="2">Conference Rooms');
document.writeln('Seating for:<' + '/font> ' + '<' + 'font size="2"><' + 'br><' + 'input type="text" size="3"');
document.writeln('maxlength="3" name="conf0"><' + 'input type="text" size="3"');
document.writeln('maxlength="3" name="conf1"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="conf2"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf3"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf4"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf5"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf6"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf7"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf8"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="conf9"><' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="mail">' + '  Mail / Work');
document.writeln('Rooms 10 X 12 ft.' + '<' + '/font><' + '/p>');
document.writeln('<' + 'p>' + '<' + 'font size="2">Reception Area');
document.writeln('Seating: <' + 'input type="text" size="3" maxlength="3"');
document.writeln('name="reception"><' + '/font>' + '<' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="fileRooms">' + '  File Rooms 10');
document.writeln('X 12 ft. (up to 11 standard file cabinets)' + '<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="library">' + '  Libraries');
document.writeln('10 X 20 ft.' + '<' + '/font><' + '/p>');
document.writeln('<' + 'p> ' + '<' + 'font');
document.writeln('size="2"> Lunch Rooms Seating:<' + '/font>' + '<' + 'font');
document.writeln('size="2"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="lr1"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="lr2"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="lr3"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="lr4"><' + 'input');
document.writeln('type="text" size="3" maxlength="3" name="lr5"><' + 'br>');
document.writeln('(use 1 for kitchen without seating)<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'font size="2"><' + 'input type="text"');
document.writeln('size="3" maxlength="3" name="coffee">' + '  Coffee Bars' + '<' + '/font><' + '/p>');
document.writeln('<' + 'p><' + 'a name="submit"><' + 'font size="2" face="ARIAL"><' + '/font><' + '/a><' + 'font');
document.writeln('size="2" face="ARIAL"> <' + '/font><' + '/p>');
document.writeln('<' + 'p align="center"><' + 'font size="2" face="ARIAL"><' + 'input');
document.writeln('type="button" value="Prepare Estimates" onClick="');
document.writeln('var doReport = validateForm();');
document.writeln('if (doReport) paintReport(2);');
document.writeln('"><' + 'input');
document.writeln('type="reset" value="Clear Entries"><' + '/font><' + '/p>');
document.writeln('<' + '/form>');
document.writeln('<' + '/td>');
document.writeln('<' + '/tr>');
document.writeln('<' + '/table>');
