function loadC() {
	alert("This is just to check and see whether this works or not!!!");
}

/*======================================================================
	prelimObj(ecode,maxrecords,pagesize,recordcount,pobjArray)()
	
	Description: Client side preliminary object that will contains everything and 
		do everything.
		
		// Properties:
		//		[from server]
		//		searchtype = Search Type
		//		criteria = criteria used to generate the query
		//		aveprice = ave price
		//		ecode = Error Code [ -1: too many records, 0: no record found, 1: okay ]
		//		maxrecords = Preset value of maxrecords that can be display...used when ecode=-1
		//		pagesize = Preset value for the number of records per page
		//		recordcount = Total number of records in dataset
		//		pobjArray = Dataset array...content is in prelim
		//
		//		[locally]
		//		bof = binary indicator of beginning of recordset
		//		eof = binary indicator of end of recordset
		//		dir = binary indicator of direction - Ascenting or Descenting from the dataset array
		//		sortNameArray = array of sortable fieldnames to be displayed
		//		sortElmArray = array of sortable fieldnames by its Object's Element Name
		//		pagenum = current page number
		//		currSortElm = the current sorting element (indexed based on the sortNameArray)
		//
		
		// Method:
		//		coutput() = Output the data section to the client's "display" frame
		//		setSort() = Set the sort order and resort...and redraw page
		//		sort() = sorting routine...just resort based on the properties
		//		precomp() = comparsion routine used within the sort() function
		//		selectAll() = select all the records to be purchased
		//		clearAll() = clear all selected records
		//		moveNext() = move to the next page
		//		movePrev() = move to the previous page
		//		warnBof() = Warning at BOF of dataset
		//		warnEof() = Warning at EOF of dataset
		//		toggle() = Toggle the state of selection of a given record
		//		searchTip() = perform the searchTip button's function
		//		userProfile() = perform the user profile button's function
		//		buy() = collect all selected propid and submit to purchase
	     	
====================================================================== */
function prelimObj(searchtype,criteria,aveprice,ecode,maxrecords,pagesize,recordcount,logon,p_base,p_fee,cq,freeq,dq,dqmax,mqmax,pobjArray) {
	// Properties [from server]
	this.searchtype = searchtype;
	this.criteria = criteria;
	this.aveprice = aveprice;
	this.ecode = ecode;
	this.maxrecords = maxrecords;
	this.pagesize = pagesize;
	this.recordcount = recordcount;
	this.logon = logon;
	this.p_base = p_base;
	this.p_fee = p_fee;
	this.cq = cq;		// Period/Monthly Q count
	this.dq = dq;		// Daily Q count
	this.dqmax = dqmax;	// Daily Max Q limits
	this.mqmax = mqmax;	// Monthly Max Q limits
	this.freeq = freeq;
	this.pobjArray = pobjArray;
	
	// Properties [locally]
	if (recordcount > pobjArray.length) {
		this.eof = false;
	} else {
		this.eof = true;
	}

	this.bof = true;

	this.dir = false;
	this.sortNameArray = new Array("Address","Price","Date","Use");
	this.sortElmArray = new Array("orgSort","price","date","use");
	this.pagenum = 0;
	this.currSortElm = 0;

	// Methods
	this.coutput = prelimClientOutPut;
	this.setSort = prelimSetSort;
	this.sort = prelimSort;
	this.precomp = prelimCompare;
	this.checkboxsetting = true;
	this.selectAll = prelimSelectAll;
	this.clearAll = prelimClearAll;
	this.moveNext = prelimMoveNext;
	this.movePrev = prelimMovePrev;
	this.warnBof = prelimWarnBof;
	this.warnEof = prelimWarnEof;
	this.toggle = prelimToggle;
	this.userProfile = prelimUserProfile;
	this.searchTip = prelimSearchTip;
	this.buy = prelimBuy;
}


/*======================================================================
	prelimClientOutPut()
	
	Description: Method within the prelimObj that will formats the data 
	in the user's browser.

====================================================================== */
function prelimClientOutPut() {

	dDoc = self.display.document;
	
	dDoc.close();
	dDoc.open();
	
	// closed the popup window...
	if (parent.pwin != null) {
		parent.pwin.close();
		parent.pwin = null;
	}

	var searchtype = supportedSearches(this.searchtype);
	
	prelimClientOutputHeader(this.searchtype);

	switch (parseInt(this.ecode)) {
		// -1 = over limit
		// 0 = no record find
		// others (1) = okay...
		case -1:
			//dDoc.writeln("<table width=\"100%\" border=0><tr><td bgcolor=#e0e0e0><span class=medblackb>Search Error - Too Many Records</span></td></tr></table><p>");
			dDoc.writeln("<table width=100%><tr><td>");
			dDoc.writeln("<span class=medblackb>Too Many Records</span>");
			dDoc.writeln("<br><span class=medblack>");
			dDoc.writeln("Your search yielded "+this.recordcount+" records.");
			dDoc.writeln("<br>A full record set is limited to 300 records");
			dDoc.writeln("<p>Please go back to your search criteria page and refine your search.  Try a different set of search parameters that will yield ");
			dDoc.writeln("fewer records.  For example, if you searched for all sales over a three year period, try just one year.  ");
			dDoc.writeln("If you want the other two years, you can do those in a separate search.<p>");
			dDoc.writeln("Return to <a href=\"frame.asp?search=refine\" target=\"_top\" class=reglink>"+ searchtype +" Search</a> Page.");
			dDoc.writeln("<p>Please Note:  If you require a large volume of data, please contact The Warren Group's Data Solutions team at 617-896-5392, Monday-Friday, (9:00 a.m.-5:00 p.m.), or email <a href=\"mailto:datasolutions@thewarrengroup.com\">datasolutions@thewarrengroup.com</a>.");
			dDoc.writeln("</span>");
			dDoc.writeln("</td></tr></table>")
			break;
		case 0:
			//dDoc.writeln("<table width=\"100%\" border=0><tr><td bgcolor=#e0e0e0><span class=medblackb>Search Error - No Records</span></td></tr></table><p>");
			dDoc.writeln("<table width=100%><tr><td>");
			dDoc.writeln("<span class=medblackb>Search Error:</span>  <span class=medblack>No Records</span>");
			dDoc.writeln("<br><span class=medblack>");
			dDoc.writeln("Your search yielded 0 records.");
			dDoc.writeln("<p>Please return to your search criteria page and refine your search.  A different set of search parameters may yield records.");
			dDoc.writeln("<ul>Helpful hints:");
			dDoc.writeln("<li>Widen the sale date or price range");
			dDoc.writeln("<li>Investigate alternative spellings of street, buyer or seller names, try typing just the first few letters.");
			dDoc.writeln("<li>Make the search less specific.  Visit <a href=\"/geos/\">Geographic Coverage</a> to learn exactly what fields of data area available in the town(s) you selected.");
			dDoc.writeln("</ul>");
			dDoc.writeln("Return to <a href=\"frame.asp?search=refine\" target=\"_top\" span class=reglink>"+ searchtype +" Search</a> Page.");
			dDoc.writeln("</span>");
			dDoc.writeln("</td></tr></table>")
			break;
		default:
			var sstart;
			var send;
			// start with the starting record number = pagenumber * pagesize
			sstart = this.pagenum * this.pagesize;
			// check to make sure that the end will not go beyond the dataset
			var tmp = sstart + this.pagesize;
			if (tmp >= this.recordcount) {
				send = this.recordcount;
				this.eof = true;
			} else {
				send = tmp;
				this.eof = false;
			}
			if (sstart == 0) {
				this.bof = true;
			} else {
				this.bof = false;
			}
			var s1 = sstart;
			var s2 = send;

			var sortArray = new Array();
			
			for (i = 0; i < this.sortNameArray.length; i++) {
			
				sortArray[i] = new Object();
				
				sortArray[i].name = this.sortNameArray[i];
				sortArray[i].value = this.sortElmArray[i];
				
			}
			
			var formTag;
			
			formTag = formTagGetFullRecords(this.logon, this.p_base, this.cq, this.freeq, this.dq, this.dqmax, this.mqmax)
			
			// clientPanel(0, this.searchtype, this.pagesize, this.aveprice, 0, this.pobjArray, parseInt(s1+1), s2, this.recordcount, this.bof, this.eof, null, 0, 0, sortArray, this.currSortElm, this.dir, this.checkboxsetting, this.reportOptions, -1, false, "", "", formTag)
			// TKC - 1/20/2009 - Modified to add the Distressed Radius Search flag after rsearch flag - this will always be false like radius search since this is just the free result set call
			// TKC - 4/2010 - removed report options 
			// clientPanel(0, this.searchtype, this.pagesize, this.aveprice, 0, this.pobjArray, parseInt(s1+1), s2, this.recordcount, this.bof, this.eof, null, 0, 0, sortArray, this.currSortElm, this.dir, this.checkboxsetting, this.reportOptions, -1, false, false, "", "", formTag)
			clientPanel(0, this.searchtype, this.pagesize, this.aveprice, 0, this.pobjArray, parseInt(s1+1), s2, this.recordcount, this.bof, this.eof, null, 0, 0, sortArray, this.currSortElm, this.dir, this.checkboxsetting, -1, false, false, "", "", formTag)
			break;
			
	}
	dDoc.writeln("<br>");
	prelimClientOutputFooter();
	dDoc.close();
}
function supportedSearches(searchType) {
	switch (searchType) {
	case "Quick":
		return "Address";
	case "Comparable":
	case "Advanced":
		return "Comp/Custom";
	case "Address":
	case "Name":
	case "Mortgage":
		return searchType;
	default:
		return "Unknown";
	}
}
function formTagGetFullRecords(logon, p_base, cq, freeq, dq, dqmax, mqmax) {

	var valid = 0;
	
	var name, target, method, action

	name = "";
	target = "";
	method = "";
	action = "";

	if (logon == false) {
		method = "post";
		action = "paidmustsignin.asp";
		target = "_top";
	} else {
		// First do check on exceeding of number of allowed Queries...for Day Pass/Cash/Promo...
		if (cq >= freeq) {
			method = "post";
			action = "exceedq.asp";
			target = "_top";
		} else {
			// Check to see if it has exceed the daily allowed Q count...
			if (dq > dqmax) {
				method = "get";
				action = "sorry_dailyQover.html"
				target = "_top";
			} else {		// if okay, then check to see if it has exceed the monthly allowed Q count...
				if (cq > mqmax) {
					method = "get";
					action = "sorry_monthlyQover.html";
					target = "_top";
				} else { // Okay, then see if it needs to go to notify page or skip that all together...
					// P_Base - prompt if necessary...
					if (p_base == "Y") {
						name = "fbot";
						method = "post";
						action = "purchase.asp";
					} else {
						name = "fbot";
						method = "post";
						action = "finalquery.asp"
						target = "data";
						//KEB TT4711 7 July 2005  changed target  for testing
						//target = "_blank";
					}
					valid = 1;
				}
			}
		}
	}
	
	if (valid) {
		return "<form style=\"margin:0px\" name=\""+ name +"\" target=\""+ target +"\" method=\""+ method +"\" action=\""+ action +"\" onsubmit=\"return parent.data.clientp.buy(this)\"><input type=hidden name=\"totalselections\" value=\"\">"
	} else {
		return "<form style=\"margin:0px\" name=\""+ name +"\" target=\""+ target +"\" method=\""+ method +"\" action=\""+ action +"\">";
	}

}
//
// Output the Body/Table to the Browser
function prelimClientOutputBody(pobjArray,s1,s2) {

	dDoc.writeln("<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#ffffff\" border=\"0\">");
	dDoc.writeln("	<tr>");
	dDoc.writeln("		<td>");
	dDoc.writeln("			<table bgcolor=\"#ffffff\" width=\"500\" align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
	dDoc.writeln("				<tr>");
	dDoc.writeln("					<td bgcolor=\"#efefef\">");
	dDoc.writeln("						<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" bgcolor=\"#ffffff\" width=\"500\">");
	dDoc.writeln("							<tr>");
	dDoc.writeln("								<td nowrap=\"1\" valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\">&#160;<span class=\"smblueb\">Select Record</span>&#160;</td> ");
	dDoc.writeln("								<td nowrap=\"1\" valign=\"top\" width=\"17%\" bgcolor=\"#ddeeff\">&#160;<span class=\"smblueb\">Address</span>&#160;</td> ");
	dDoc.writeln("								<td nowrap=\"1\" valign=\"top\" width=\"17%\" bgcolor=\"#ddeeff\"><span class=\"smblueb\">&#160;Town&#160;</span>&#160;</td>");
	dDoc.writeln("								<td nowrap=\"1\" valign=\"top\" width=\"17%\" bgcolor=\"#ddeeff\">&#160;<span class=\"smblueb\">Property&#160;Type&#160;</span>&#160;</td>");
	dDoc.writeln("								<td nowrap=\"1\" align=\"center\" width=\"17%\" bgcolor=\"#ddeeff\"><table><tr><td><img src=\"img/radius_small.gif\"></td><td><span class=\"smblueb\">Proximity <br>Search</span></tr></table></td>");
	dDoc.writeln("							</tr>");
	dDoc.writeln("						</table>");
	dDoc.writeln("					</td>");
	dDoc.writeln("				</tr>");
	dDoc.writeln("			</table>");
	dDoc.writeln("		</td>");
	dDoc.writeln("	</tr>");
	dDoc.writeln("</table>");
	dDoc.writeln("<table width=\"500\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#ffffff\" border=\"0\">");

	for (var i = s1-1; i < s2; i++) {

		dDoc.writeln("	<tr>");
		dDoc.writeln("		<td>");
		dDoc.writeln("			<table bgcolor=\"#ffffff\" width=\"500\" align=\"left\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
		dDoc.writeln("				<tr>");
		dDoc.writeln("					<td bgcolor=\"#efefef\">");
		dDoc.writeln("						<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" bgcolor=\"#ffffff\" width=\"500\">");
		dDoc.writeln("							<tr>");
		
		dDoc.write("<td valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\">");
		dDoc.write("<img src=\"img/t.gif\" width=\"35\" height=\"1\"><input type=\"checkbox\" name=\"selection\" value=\""+pobjArray[i].propid+"\"");
		if (pobjArray[i].selection == true) {
			dDoc.write(" checked");
		}
		dDoc.write(" onClick=\"parent.data.clientp.toggle("+i+")\">");
		var va_flag = checkInactiveFlag(pobjArray[i].inactvfl,pobjArray[i].complevl);
		if (va_flag == gAVFlagVirtual) {
			dDoc.write("<font color=\"red\">*</font>");
		}
		if (va_flag == gAVFlagArchive) {
			dDoc.write("<font color=\"red\" size=-1><sup>A<b></b></sup></font>");
		}
		dDoc.writeln("</div></td>");
		
		dDoc.writeln("								<td valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\"><span class=\"smblueb\">&#160;"+ preaddress(pobjArray[i]) +"</span></td> ");
		dDoc.writeln("								<td valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\"><span class=\"smblueb\">" +pobjArray[i].townname +"</span></td>");
		var cuse = noNull(pobjArray[i].use," ");
		var duse = noNull(pobjArray[i].shortd," ");
		if (cuse + duse == "  ")
			dDoc.writeln("								<td valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\">&#160;<span class=\"smblueb\">&#160;</td>");
		else
			dDoc.writeln("								<td valign=\"top\" width=\"16%\" bgcolor=\"#ddeeff\">&#160;<span class=\"smblueb\">"+ cuse +": "+ duse +"</span>&#160;</td>");
		if (pobjArray[i].lat != 0 && pobjArray[i].lon != 0)
			dDoc.writeln("								<td align=\"center\" valign=\"top\" width=\"16%\">&#160;&#160;<span class=\"smblue\"><img src=\"img/checkmark1.gif\"/></span></td>");
		else
			dDoc.writeln("								<td align=\"center\" valign=\"top\" width=\"16%\">&#160;&#160;<span class=\"smblue\"></span></td>");
		dDoc.writeln("							</tr>");
		dDoc.writeln("						</table>");
		dDoc.writeln("					</td>");
		dDoc.writeln("				</tr>");
		dDoc.writeln("			</table>");
		dDoc.writeln("		</td>");
		dDoc.writeln("	</tr>");
		
	}

	dDoc.writeln("</table>");
	dDoc.writeln("<font color=\"red\">*</font><span class=\"medblack\"> indicates that this transaction record was not matched to a property record.</span><br>");
	dDoc.writeln("<font color=\"red\" size=-1><sup><b>A</b></sup></font><span class=\"medblack\"> indicates that this property record is archived. It is no longer active, and it no longer exists in the town assessor's tax rolls  . It probably has been replaced by one or more new property records (e.g.: a single 3-family house record could have been replaced by 3 individual condo unit records).</span>");

}

function preaddress(ary) {
	if ((ary.stnum != '0') && (ary.stnum != null) && (ary.stnum != "null")) {
		var stnum = noNull(ary.stnum," ");
	} else {
		var stnum = "";
	}
	var stnumext = noNull(ary.stnumext," ");
	var street = noNull(ary.street," ");
	if ((ary.unit != "") && (ary.unit != null) && (ary.unit != "null")) {
		var unit = ",Unit: "+noNull(ary.unit," ");
	} else {
		var unit = "";
	}
	return stnum+stnumext+" "+street+unit;
}

function prelimSort() {
	// Call the sort function with the comparsion function PrelimCompare
	// currSortElm contains the index to the sort element array...
	var dummy = this.pobjArray.sort(this.precomp);
	if (this.dir == true) {
		dummy = this.pobjArray.reverse();
	}
}

function prelimCompare(x,y) {
	var i = parent.data.clientp.currSortElm;
	var elm = parent.data.clientp.sortElmArray[i];
	
	var a = 0;
	var b = 0;
	switch(elm) {
		case "orgSort":
			a = parseInt(x.orgSort);
			b = parseInt(y.orgSort);
			break;
		case "price":
			a = parseInt(x.price);
			b = parseInt(y.price);
			if (isNaN(a)) a = 0;
			if (isNaN(b)) b = 0;
			break;
		case "date":
			// If it's a date comparsion then compare using date...
			var t1 = new Date(x.date);
			var t2 = new Date(y.date);
			a = t1.getTime();
			b = t2.getTime();
			if (isNaN(a)) a = 0;
			if (isNaN(b)) b = 0;
			break;
		case "use":
			a = x.use;
			b = y.use;
			break;
		default:
			a = parseInt(x.orgSort);
			b = parseInt(y.orgSort);
			break;
	}
	var ret = 0;
	if (a < b) {
		ret = -1;
	}
	if (a > b) {
		ret = 1;
	}
	if (a == b) {
		if (parseInt(x.orgSort) == parseInt(y.orgSort)) {
			ret = 0;
		}
		if (parseInt(x.orgSort) < parseInt(y.orgSort)) {
			ret = -1;
		}
		if (parseInt(x.orgSort) > parseInt(y.orgSort)) {
			ret = 1;
		}
	}
	return ret;
}
//
/////////////////////// Functions below is used to interact with the user form
//

// Function to received the sorting form from user and set the properties and perform the sorting
function prelimSetSort(sorttype, sortdirection) {	

	// added in for NS compatibility...
	var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
	parent.pwin = apopup;
	
	for (i = 0; i < this.sortElmArray.length; i++) {
		if (sorttype == this.sortElmArray[i])
			this.currSortElm = i;
	}
	
	this.dir = sortdirection == "ascending";
	
	// Perform the actual resorting rountine here...
	this.sort();	
	this.pagenum = 0;
	this.coutput();
}
// Function to received the Select All Button Click...
function prelimSelectAll() {

	// added in for NS compatibility...
	var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
	parent.pwin = apopup;

	for (var i=0;i<this.pobjArray.length;i++) {
		this.pobjArray[i].selection = true;
	}
	this.checkboxsetting = true;
	this.coutput();
}
// Function to received the Clear All Button Click...
function prelimClearAll() {

	// added in for NS compatibility...
	var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
	parent.pwin = apopup;

	for (var i=0;i<this.pobjArray.length;i++) {
		this.pobjArray[i].selection = false;
	}
	this.checkboxsetting = false;
	this.coutput();
}
// Function to move to the Next page...
function prelimMoveNext() {
	// added in for NS compatibility...
	var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
	parent.pwin = apopup;

	this.pagenum++;
	this.bof = false;
	this.coutput();
}
function prelimMovePrev() {
	// added in for NS compatibility...
	var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
	parent.pwin = apopup;

	this.pagenum--;
	this.eof = false;
	this.coutput();
}
function prelimWarnBof() {
	alert('Already at the start of the recordset.');
	return false;
}
function prelimWarnEof() {
	alert('Already at end of the recordset.');
	return false;
}
function prelimToggle(i) {
	var tmp = this.pobjArray[i].selection;
	if (tmp) {
		this.pobjArray[i].selection = false;
	} else {
		this.pobjArray[i].selection = true;
	}
}
function prelimSearchTip() {
	self.location.href = "/home/sor/searchtips.html";
	return true;
}
function prelimUserProfile() {
	self.location.href = "/UserProfile";
	return true;
}
function prelimBuy(form) {
	var j = 0;
	var  tmp = new Array();
	for (var i=0;i<this.pobjArray.length;i++) {
		if (this.pobjArray[i].selection == true) {
			tmp[j] = this.pobjArray[i].propid;
			j++;
		}
	}
	if (tmp.length == 0) {
		// None selected
		alert("You have not selected any record to be purchased.");
		return false;
	} else {
	
		if (this.p_base != "Y") {
			var apopup = window.open('wait.html','wait','height=400,width=600,resizable=1,scrollbars=1,status=1,toolbar=0,location=0,directories=0,menubar=0');
			parent.pwin = apopup;
		}
		form.totalselections.value = tmp.join(",");
		return true;
	}
}
//
function copyrightnotice() {
	return "<div class=\"copyright\"><img src=\"/home/img/wlogo.gif\" border=0> Copyright 2002 by The Warren Group, 280 Summer Street, Boston, MA 02210</div>";
}
//
function noNull(orgstr,repstr) {
	var tmp = "";
	if ((orgstr == null) || (orgstr == "null") || (orgstr == "") || (orgstr == " ") || (orgstr == " null")) {
		tmp = repstr;
	} else {
		tmp = orgstr;
	}
	// Added to get rid of just ':'
	if (tmp == ":") {
		tmp = " ";
	}
	// Added to get rid of the 'Unit:' at end of address...
	var tlen = tmp.length;
	if (tlen > 5) {
		if (tmp.substring(tlen-5,tlen) == "Unit:") {
			// Get rid of the space and the comma before Unit...
			tmp = tmp.substring(0,tlen-7);
		}
	}
	return tmp;
}
function noZero(orgstr,repstr) {
	if ((orgstr == null) || (orgstr == "null") ||  (orgstr == "") || (orgstr == "0")) {
		return repstr;
	} else {
		return orgstr;
	}
}
function noEqual(instr,repstr) {
	if ((instr == null) || (instr == "null") || (instr == "") || (instr == " ")) {
		instr = repstr;
	}
	var re = /\=/g;
	return instr.replace(re," ");
}
function pcSeparate(criteria) {
	var tmp = criteria.split("&");
	var tmp1 = new Array();
	var j = 0;
	for (var i=0;i<tmp.length;i++) {
		if ((tmp[i] != "") && (tmp[i] != "null") && (tmp[i] != null)) {
			tmp1[j] = tmp[i];
			j++;
		}
	}
	var temp = tmp1.join(", ");
	return temp;
}
function commaIn(val) {
	val = "" + val;
	var len = val.length;
	var i = 0;
	var tmp = "";
	if (len < 4) {
		tmp = val;
	} else {
		while (len > 0) {
			tmp =  val.substring(len-1,len) + "" + tmp;
			len--;
			i++;
			if ((i == 3) && (len > 0)) {
				tmp = "," + tmp;
			}
			if (i == 4) {
				i = 1;
			}
		}
	}
	return tmp;
}
function commaInF(sval) {
	var tval = "" + sval;
	var tary = tval.split(".");
	var val = tary[0];
	var len = val.length;
	var i = 0;
	var tmp = "";
	if (len < 4) {
		tmp = val;
	} else {
		while (len > 0) {
			tmp =  val.substring(len-1,len) + "" + tmp;
			len--;
			i++;
			if ((i == 3) && (len > 0)) {
				tmp = "," + tmp;
			}
			if (i == 4) {
				i = 1;
			}
		}
	}
	if (tary.length > 1) {
		tmp += "." + tary[1];
	}
	return tmp;
}
function formatMoney(num) {
	var retval = noNull(num," ");
	if (retval != " ") {
		retval = "$ "+retval;
	}
	return retval;
}
function formatLsunits(lsnum,str) {
	var retvar = lsnum;
	var tailvar = "acres";
	if (str.toLowerCase() == "s") {
		tailvar = "sq ft";
	}
	if (retvar == " ") {
		retvar = " ";
	} else {
		retvar = retvar + " " + tailvar;
	}
	return retvar;
}
function formatBP(book,page) {
	// If both are blank, then don't show the '/' in between, otherwise, add it...
	var retvar = "";
	if ((book == " ") && (page == " ")) {
		retvar = "&nbsp;";
	} else {
		retvar = book + " / " + page;
	}
	return retvar;
}
function checkInactiveFlag(fl,cfl) {
	// Changed the return so that it would return:
	//		"virtual" for virtual records
	//		"archive" for archived records
	//		"none" for no marking

	// Check to make sure that complevl flag is not invalid first
	if ((cfl != null) && (cfl != "") && (cfl != " ")) {
		// Now, if the inactvfl has to be valid as well
		if ((fl != null) && (fl != "") && (fl != " ")) {
			// Virtual is any M, T, or Z in inactvfl or inactvfl of A and complevl of S
			var rt = fl.toUpperCase();
			var ct = cfl.toUpperCase();
			if ((rt == "M") || (rt == "T") || (rt == "Z") || ((rt == "A") && (ct == "S"))) {
				// return true;
				return gAVFlagVirtual;
			} else {
				if ((ct == "P") && (rt == "A")) {
					return gAVFlagArchive;
				} else {
					// return false;
					return gAVFlagNone;
				}
			}
		} else {
			// return false;
			return gAVFlagNone;
		}
	} else {
		return gAVFlagNone;
	}
}
function formatUseCode(use,shortd) {
	if ((use.length > 0) && (shortd.length > 0)) {
		return use+":"+shortd;
	} else {
		return " ";
	}
}
