<!-- Begin
/*----------------------------------------------------------------------------------------
|
|	Available Properties Processor Script by Josh Miller @ web@elmiradowntown.com
|	written for the the Elmira Downtown Development @ http://www.elmiradowntown.com
|	and the City of Elmira @ http://www.ci.elmira.ny.us
|		DO NOT USE THIS SCRIPT WITHOUT PERMISSION
-------------------------------------------------------------------------------------------*/ 

function startDirectory(){
	var a=document.location.toString();
	b=a.length;							
	c=a.lastIndexOf("html");				
	c=c+4;	
	var z=a.substring(c,b);
	if( z==""){
		noSort()								//DEFAULT DISPLAY: NO SORTING
	}
	else{
		state=z.substring(1,3);
	
		if (state=="st"){						// SORT BY PROPERTY, STREET, SQ FOOTAGE, OR SALESTYPE					
			sort=z.substring(4,z.length);
			sortBy(sort);
		}
		else if (state=="sc"){					// SEARCH FOR PROPERTY NAME, BUILDING USE, OR OTHER INFORMATION					
			query=z.substring(4,z.length);
			query=unescape(query);					//unescape the string to eliminate the %20 for spaces
			SearchForQuery(query);
		}
		else if (state=="id"){					// VIEW INDIVIDUAL RECORDS 					
			id=z.substring(4,z.length);
			Viewrecord(id);
		}
		else{
			noSort()
		}
	}
}	//end Start Function

function noSort(){
	PrintHeader();
	document.write("<tr><td valign='top' class='proplistheader'><a href='properties.html?st=1' title='Click here to sort by property name'>Property - Click for more info</a></td><td valign='top' class='proplistheader'>&nbsp;&nbsp;&nbsp;<a href='properties.html?st=2' title='Click here to sort by street'>Street</a></td><td valign='top' align='right' class='proplistheader'><a href='properties.html?st=3' title='Click here to sort by square footage'>SqFt</a>&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign='top' class='proplistheader'><a href='properties.html?st=4' title='Click here to sort by sales type'>Rent/Sale</a></td></tr>")
	document.write("<tr><td bgcolor='#990000' colspan='4'><img src='pics/dot.gif' width='200' height='1'></td></tr>")
	for(id=0;id<prop.length;id++){
			document.write("<tr><td valign='top'><a href='properties.html?id="+id+"' title='"+prop[id][pname]+": "+prop[id][other]+"' class='proplink'>"+prop[id][pname]+"</a></td><td valign='top' class='smalltext'>"+prop[id][stree]+"</td><td valign='top' align='right' class='smalltext'>"+insertCommas(prop[id][squft])+"&nbsp;&nbsp;</td><td valign='top' align='center' class='smalltext'>"+salesType(prop[id][sales])+"</td></tr>")
	} 
}		//end function noSort

function sortBy(sort){
	store=new Array();
	for (i=0; i<prop.length;i++){
		store[i]=i;
	}
	if (sort==1){
		store.sort(propertySort)
	}
	else if (sort==2){
		store.sort(streetSort)
	}
	else if (sort==3){
		store.sort(sqfootageSort)
	}
	else if (sort==4){
		store.sort(salesSort)
	}
	else{
		store.sort(propertySort)
	}
	printList(store)
}		//end function sortBy

function SearchForQuery(q){
	original=q;
	query=original.toLowerCase();								//convert the search string to lowercase
	storeName=new Array();											//create an array to store the index of Location Names that match search criteria
	storeUse=new Array();											//create an array to store the index of Building Uses that match search criteria
	storeOther=new Array();											//create an array to store the index of Other Information that matches search criteria
	counterName=0;													//set a counter for the storeName array
	counterUse=0;												//set a counter for the storeUse array
	counterOther=0;												//set a counter for the storeOther array
	for (i=0; i<prop.length; i++){								//for each property
		temp1=prop[i][pname].toLowerCase();							//set temp1 to the Property Name
		temp2=prop[i][pruse].toLowerCase();							//set temp2 to the Property Use
		temp3=prop[i][other].toLowerCase();							//set temp3 to the Other Information
		flagName=		temp1.indexOf(query);						//set the flag to the index of the query in the temp variable, if not found, then -1
		flagUse=		temp2.indexOf(query);						//set the flag to the index of the query in the temp variable, if not found, then -1
		flagOther=	temp3.indexOf(query);							//set the flag to the index of the query in the temp variable, if not found, then -1
		if(flagName>-1){											//if the flag is greater than -1
			storeName[counterName]=i;									//then search term exists in the Property Name and store the property		
			counterName++;
		}
		if(flagUse>-1){											//if the flag is greater than -1
			storeUse[counterUse]=i;								//then search term exists in the Building Uses Field and store the property		
			counterUse++;
		}
		if(flagOther>-1){										//if the flag is greater than -1
			storeOther[counterOther]=i;							//then search term exists in the Other Information Field and store the property		
			counterOther++;
		}
	}
	storeName.sort(propertySort);
	storeUse.sort(propertySort);
	storeOther.sort(propertySort);
	printSearchResults(storeName,1)
	printSearchResults(storeUse,2)
	printSearchResults(storeOther,3)
}		//end function searchForQuery

function Viewrecord(id){
	document.write("<tr><td><img src='pics/dot.gif' width='20' height='2'></td><td><img src='pics/dot.gif' width='121' height='2'></td><td><img src='pics/dot.gif' width='20' height='2'></td><td><img src='pics/dot.gif' width='110' height='2'></td><td><img src='pics/dot.gif' width='20' height='2'></td><td><img src='pics/dot.gif' width='132' height='2'></td></tr>")
	if(prop[id][pict3]!=""){
		document.write("<tr><td valign='top' align='center' colspan='6'><img src='proppics/"+prop[id][pict1]+"'></td></tr>");
		document.write("<tr><td valign='top' colspan='6'><img src='pics/dot.gif' width='250' height='4'></td></tr>")
		document.write("<tr><td valign='middle' align='center' colspan='6' class='smalltext'><a href='javascript: blowup(\"proppics/"+prop[id][pict2]+"\",\"300\",\"200\");' title='Click here for larger picture'><img height='50' width='75' border='0' src='proppics/"+prop[id][pict2]+"'></a>&nbsp;&nbsp;Click to enlarge picture&nbsp;&nbsp;<a href='javascript: blowup(\"proppics/"+prop[id][pict3]+"\",\"300\",\"200\");' title='Click here for larger picture'><img height='50' width='75' border='0' src='proppics/"+prop[id][pict3]+"'></a><br><br></td></tr>");
	}
	else if(prop[id][pict2]!=""){
		document.write("<tr><td valign='top' align='center' colspan='6'><img src='proppics/"+prop[id][pict1]+"'></td></tr>");
		document.write("<tr><td valign='top' colspan='6'><img src='pics/dot.gif' width='250' height='4'></td></tr>")
		document.write("<tr><td valign='middle' align='center' colspan='2' class='smalltext'><a href='javascript: blowup(\"proppics/"+prop[id][pict2]+"\",\"300\",\"200\");' title='Click here for larger picture'><img height='50' width='75' border='0' src='proppics/"+prop[id][pict2]+"'></a></td><td colspan='4'>Click to enlarge picture</td></tr>");
	}
	else if(prop[id][pict1]!=""){
		document.write("<tr><td valign='top' align='center' colspan='6'><img src='proppics/"+prop[id][pict1]+"'><br><br></td></tr>");
	}
	else{
	}
	document.write("<tr><td valign='top' colspan='6'><img src='pics/dot.gif' width='250' height='8'></td></tr>")
	document.write("<tr><td valign='top' class='title'colspan='6'>"+prop[id][pname]+"</td></tr>");
	document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='2'></td></tr>")
	document.write("<tr><td valign='top'  class='propheader' colspan='4'>Property Address:</td><td align='right' bgcolor='#990000' colspan='2' class='proptabs'>PROPERTY INFORMATION&nbsp;&nbsp;</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top' colspan='4'>"+prop[id][adres]+"</td><td align='center' colspan='2' class='proptype'>"+prop[id][sales]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='6'>Location Description:</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][locat]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Square Footage:</td><td valign='top'  class='propheader' colspan='2'>Frontage:</td><td valign='top' colspan='2' class='propheader'>Depth:</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top'>"+insertCommas(prop[id][squft])+"</td><td>&nbsp;</td><td valign='top'>"+prop[id][front]+"</td><td>&nbsp;</td><td valign='top'>"+prop[id][depth]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Assessed Value:</td><td valign='top'  class='propheader' colspan='3'>Taxes:</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top'>"+prop[id][pvalu]+"</td><td>&nbsp;</td><td valign='top' colspan='2'>"+prop[id][taxes]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Construction:</td><td valign='top'  class='propheader' colspan='3'>Construction Date:</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top'>"+prop[id][pcons]+"</td><td>&nbsp;</td><td valign='top' colspan='2'>"+prop[id][cdate]+"</td></tr>");
	document.write("<tr><td valign='top' bgcolor='#990000'colspan='6'><img src='pics/dot.gif' width='250' height='2'></td></tr>")
	document.write("<tr><td valign='top'  class='propheader' colspan='4'>Current/Possible Building Use:</td><td align='right' bgcolor='#990000' colspan='2' class='proptabs'>PROPERTY AMENITIES&nbsp;&nbsp;</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top' colspan='6'>"+prop[id][pruse]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Heating System:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][heati]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Air Conditioning:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][acpre]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Onsite Parking:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][onpar]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Available Parking:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][parki]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Restrooms/Location:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][restr]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>ADA Compliance:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][adaco]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Truck Dock:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][dockp]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Sprinklers:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][sprnk]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Elevator:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][eleva]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='2'>Roof Construction:</td><td valign='top' colspan='4' class='smalltext'>"+prop[id][roofc]+"</td></tr>");
	document.write("<tr><td valign='top'  class='propheader' colspan='6'>Other Information:</td></tr>");
	document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][other]+"</td></tr>");

	if(prop[id][realt]!=""){
		document.write("<tr><td valign='top' bgcolor='#990000'colspan='6'><img src='pics/dot.gif' width='250' height='2'></td></tr>")
		document.write("<tr><td valign='top'  class='propheader' colspan='4'>Realtor:</td><td align='right' bgcolor='#990000' colspan='2' class='proptabs'>REALTOR INFORMATION&nbsp;&nbsp;</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][realt]+"</td></tr>");
		document.write("<tr><td valign='top'  class='propheader' colspan='6'>Realtor Phone:</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][relph]+"</td></tr>");
		document.write("<tr><td valign='top'  class='propheader' colspan='6'>Agent Name:</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][agent]+"</td></tr>");
	}

	if(prop[id][owner]!=""){
		document.write("<tr><td valign='top' bgcolor='#990000'colspan='6'><img src='pics/dot.gif' width='250' height='2'></td></tr>")
		document.write("<tr><td valign='top'  class='propheader' colspan='4'>Owner:</td><td align='right' bgcolor='#990000' colspan='2' class='proptabs'>OWNER INFORMATION&nbsp;&nbsp;</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][owner]+"</td></tr>");
		document.write("<tr><td valign='top'  class='propheader' colspan='6'>Owner Address:</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][oaddr]+"</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][owcsz]+"</td></tr>");
		document.write("<tr><td valign='top'  class='propheader' colspan='6'>Owner Phone:</td></tr>");
		document.write("<tr><td>&nbsp;</td><td valign='top' colspan='5'>"+prop[id][ownph]+"</td></tr>");
	}
	footer(id)
	printDisclaimer(); 	
}

function printList(store){
	PrintHeader();
	document.write("<tr><td valign='top' class='proplistheader'><a href='properties.html?st=1' title='Click here to sort by property name'>Property - Click for more info</a></td><td valign='top' class='proplistheader'>&nbsp;&nbsp;&nbsp;<a href='properties.html?st=2' title='Click here to sort by street'>Street</a></td><td valign='top' align='right' class='proplistheader'><a href='properties.html?st=3' title='Click here to sort by square footage'>SqFt</a>&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign='top' class='proplistheader'><a href='properties.html?st=4' title='Click here to sort by sales type'>Rent/Sale</a></td></tr>")
	document.write("<tr><td bgcolor='#990000' colspan='4'><img src='pics/dot.gif' width='200' height='1'></td></tr>")
	for(id=0;id<store.length;id++){
			document.write("<tr><td valign='top'><a href='properties.html?id="+store[id]+"' title='"+prop[store[id]][pname]+": "+prop[store[id]][other]+"' class='proplink'>"+prop[store[id]][pname]+"</a></td><td valign='top' class='smalltext'>"+prop[store[id]][stree]+"</td><td valign='top' align='right' class='smalltext'>"+insertCommas(prop[store[id]][squft])+"&nbsp;&nbsp;</td><td valign='top' align='center' class='smalltext'>"+salesType(prop[store[id]][sales])+"</td></tr>")
	}
}

function printSearchResults(store,search){
		if (search==1){
			Search="Property Names"
		}
		else if (search==2){
			Search="Building Use"
		}
		else{
			Search="Other Information"
		}		
		if(store.length==1){
			Result="match"
		}
		else
			Result="matches"
		document.write("<tr><td colspan='4'><br><span class='dirmatches'>Your search returned "+store.length+" "+Result+" in "+Search+":</span></td></tr>");
	if (store.length!=0){
		document.write("<tr><td valign='top' class='proplistheader'>Property - Click for more info</td><td valign='top' class='proplistheader'>&nbsp;&nbsp;&nbsp;Street</td><td valign='top' align='right' class='proplistheader'>SqFt&nbsp;&nbsp;&nbsp;&nbsp;</td><td valign='top' class='proplistheader'>Rent/Sale</td></tr>")
		document.write("<tr><td bgcolor='#990000' colspan='4'><img src='pics/dot.gif' width='200' height='1'></td></tr>")
	}
	for(i=0;i<store.length;i++){
			document.write("<tr><td valign='top'><a href='properties.html?id="+store[i]+"' title='"+prop[store[i]][pname]+": "+prop[store[i]][other]+"' class='proplink'>"+prop[store[i]][pname]+"</a></td><td valign='top' class='smalltext'>"+prop[store[i]][stree]+"</td><td valign='top' align='right' class='smalltext'>"+prop[store[i]][squft]+"&nbsp;&nbsp;</td><td valign='top' align='center' class='smalltext'>"+salesType(prop[store[i]][sales])+"</td></tr>")
	}
}

function propertySort(A,B){
	//pre: 	A and B are arrays with an index of 0
	//post:	returns 1 if A is bigger than B
	//		returns -1 if A is smaller than B
	//		returns 0 if A is the same as B
	a=prop[A][0]
	b=prop[B][0]
	a=a.toLowerCase();									//set a and b to lowercase for comparison
	b=b.toLowerCase();
	result=new Array()									//store the result of the letter by letter comparison
	for (i=0; i<a.length; i++){							//for each character in the string
		if(a.charCodeAt(i)>b.charCodeAt(i)){			//if the unicode value of a is greater than b
			result[i]=1									//then store 1 in the result array
		}	//end if								
		else if (a.charCodeAt(i)<b.charCodeAt(i)){		//if the unicode value of a is less than b
			result[i]=-1								//then store -1 in the result array
		}	//end else if
		else if (a.charCodeAt(i)==b.charCodeAt(i)){		//if the unicode value of a is the same as b
			result[i]=0									//then store 0 in the result array
		}	//end else if
	}//end for loop
	g=0													//set g to 0 for a counter variable
	flag=0												//set the flag to 0 - assume they are the same word until proven otherwise
	while (flag==0 && g<result.length-1){				//while the flag proves they are still the same, and the result array has values
		test=result[g]									//assign test the value to be tested from the result array
		if(test==-1){									//if the result array is storing -1 then		
			flag=1										//change the flag
			Result=-1									//and store -1 to return to the function
		}	//end if				
		else if (test==1){								//if the result array is storing +1 then
			flag=1										//change the flag
			Result=1									//and store 1 to return to the function
		}	//end if else
		else if (test==0){								//if the result array is storing 0
			flag=0										//do not change the flag- the words may still be the same- check the rest of the result array
		}	//end if else								
		g++
	}	//end while
	if(flag==0){															//if the flag is still 0, the words are similar or the same: eg: Josh and Joshua
		if (a.length-b.length < 0){											//if the length of b is longer, then 
			Result=-1														//store -1 to return to the function
		}	//end if
		else if (b.length-a.length < 0){									//if the length of a is longer
			Result=1														//store 1 to return to the function
		}	//end else if													
		else if (a.length-b.length == 0){									//if the lengths are the same, it is the same word: eg: Josh and Josh
			Result=0														//store 0 to return to the function
		}	//end else if
	}
	return Result;															//return the stored Result to the function
}

function streetSort(A,B){
	//pre: 	A and B are arrays with an index of 0
	//post:	returns 1 if A is bigger than B
	//		returns -1 if A is smaller than B
	//		returns 0 if A is the same as B
	a=prop[A][2]
	b=prop[B][2]
	a=a.toLowerCase();									//set a and b to lowercase for comparison
	b=b.toLowerCase();
	result=new Array()									//store the result of the letter by letter comparison
	for (i=0; i<a.length; i++){							//for each character in the string
		if(a.charCodeAt(i)>b.charCodeAt(i)){			//if the unicode value of a is greater than b
			result[i]=1									//then store 1 in the result array
		}	//end if								
		else if (a.charCodeAt(i)<b.charCodeAt(i)){		//if the unicode value of a is less than b
			result[i]=-1								//then store -1 in the result array
		}	//end else if
		else if (a.charCodeAt(i)==b.charCodeAt(i)){		//if the unicode value of a is the same as b
			result[i]=0									//then store 0 in the result array
		}	//end else if
	}//end for loop
	g=0													//set g to 0 for a counter variable
	flag=0												//set the flag to 0 - assume they are the same word until proven otherwise
	while (flag==0 && g<result.length-1){				//while the flag proves they are still the same, and the result array has values
		test=result[g]									//assign test the value to be tested from the result array
		if(test==-1){									//if the result array is storing -1 then		
			flag=1										//change the flag
			Result=-1									//and store -1 to return to the function
		}	//end if				
		else if (test==1){								//if the result array is storing +1 then
			flag=1										//change the flag
			Result=1									//and store 1 to return to the function
		}	//end if else
		else if (test==0){								//if the result array is storing 0
			flag=0										//do not change the flag- the words may still be the same- check the rest of the result array
		}	//end if else								
		g++
	}	//end while
	if(flag==0){															//if the flag is still 0, the words are similar or the same: eg: Josh and Joshua
		if (a.length-b.length < 0){											//if the length of b is longer, then 
			Result=-1														//store -1 to return to the function
		}	//end if
		else if (b.length-a.length < 0){									//if the length of a is longer
			Result=1														//store 1 to return to the function
		}	//end else if													
		else if (a.length-b.length == 0){									//if the lengths are the same, it is the same word: eg: Josh and Josh
			Result=0														//store 0 to return to the function
		}	//end else if
	}
	return Result;															//return the stored Result to the function
}

function sqfootageSort(A,B){
	//pre: 	A and B are arrays with an index of 0
	//post:	returns 1 if A is bigger than B
	//		returns -1 if A is smaller than B
	//		returns 0 if A is the same as B
	a=prop[A][4]
	b=prop[B][4]
	a=parseInt(a);
	b=parseInt(b);
		if(a>b){										//if the value of a is greater than b
			result=1									//then store 1 in the result
		}	//end if								
		else if (a<b){									//if the value of a is less than b
			result=-1								//then store -1 in the result
		}	//end else if
		else if (a==b){									//if the value of a is equal to b
			result=0									//then store 0 in the result
		}	//end else if
	return result;										//return the stored result to the function
}

function salesSort(A,B){
	//pre: 	A and B are arrays with an index of 0
	//post:	returns 1 if A is bigger than B
	//		returns -1 if A is smaller than B
	//		returns 0 if A is the same as B
	a=prop[A][9]
	b=prop[B][9]
	a=a.toLowerCase();									//set a and b to lowercase for comparison
	b=b.toLowerCase();
	result=new Array()									//store the result of the letter by letter comparison
	for (i=0; i<a.length; i++){							//for each character in the string
		if(a.charCodeAt(i)>b.charCodeAt(i)){			//if the unicode value of a is greater than b
			result[i]=1									//then store 1 in the result array
		}	//end if								
		else if (a.charCodeAt(i)<b.charCodeAt(i)){		//if the unicode value of a is less than b
			result[i]=-1								//then store -1 in the result array
		}	//end else if
		else if (a.charCodeAt(i)==b.charCodeAt(i)){		//if the unicode value of a is the same as b
			result[i]=0									//then store 0 in the result array
		}	//end else if
	}//end for loop
	g=0													//set g to 0 for a counter variable
	flag=0												//set the flag to 0 - assume they are the same word until proven otherwise
	while (flag==0 && g<result.length-1){				//while the flag proves they are still the same, and the result array has values
		test=result[g]									//assign test the value to be tested from the result array
		if(test==-1){									//if the result array is storing -1 then		
			flag=1										//change the flag
			Result=-1									//and store -1 to return to the function
		}	//end if				
		else if (test==1){								//if the result array is storing +1 then
			flag=1										//change the flag
			Result=1									//and store 1 to return to the function
		}	//end if else
		else if (test==0){								//if the result array is storing 0
			flag=0										//do not change the flag- the words may still be the same- check the rest of the result array
		}	//end if else								
		g++
	}	//end while
	if(flag==0){															//if the flag is still 0, the words are similar or the same: eg: Josh and Joshua
		if (a.length-b.length < 0){											//if the length of b is longer, then 
			Result=-1														//store -1 to return to the function
		}	//end if
		else if (b.length-a.length < 0){									//if the length of a is longer
			Result=1														//store 1 to return to the function
		}	//end else if													
		else if (a.length-b.length == 0){									//if the lengths are the same, it is the same word: eg: Josh and Josh
			Result=0														//store 0 to return to the function
		}	//end else if
	}
	return Result;															//return the stored Result to the function
}
				
function queryHandler(){
	a=this.document.all.query.value;
	a=escape(a);
	b="property.html?sc="
	document.location=b+a;
}

function salesType(str){
	if(str=="For Rent"){
		return "R"
	}
	else if(str=="For Sale"){
		return "S"
	}
	else if(str=="For Rent or Sale"){
		return "R/S"
	}
	else{
		return ""
	}
}	//end salesType()


function footer(id){
	if (id==0){
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
		document.write("<tr><td valign='top' colspan='6'><table width='424' border='0'><tr><td align='left' width='125' class='smalltext'>&nbsp;</td><td align='center' width='174' class='smalltext'>&nbsp;<a href='properties.html'>Property Listing</a>&nbsp;</td><td align='right' width='125' class='smalltext'>&nbsp;<a href='properties.html?id="+(parseInt(id)+1)+"'>Next Property</a>&nbsp;</td></tr></table></td></tr>")
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
	}
	else if(id==prop.length-1){
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
		document.write("<tr><td valign='top' colspan='6'><table width='424' border='0'><tr><td align='left' width='125' class='smalltext'>&nbsp;<a href='properties.html?id="+(parseInt(id)-1)+"'>Previous Property</a>&nbsp;</td><td align='center' width='174' class='smalltext'>&nbsp;<a href='properties.html'>Property Listing</a>&nbsp;</td><td align='right' width='125' class='smalltext'>&nbsp;</td></tr></table></td></tr>")
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
	}
	else{
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
		document.write("<tr><td valign='top' colspan='6'><table width='424' border='0'><tr><td align='left' width='125' class='smalltext'>&nbsp;<a href='properties.html?id="+(parseInt(id)-1)+"'>Previous Property</a>&nbsp;</td><td align='center' width='174' class='smalltext'>&nbsp;<a href='properties.html'>Property Listing</a>&nbsp;</td><td align='right' width='125' class='smalltext'>&nbsp;<a href='properties.html?id="+(parseInt(id)+1)+"'>Next Property</a>&nbsp;</td></tr></table></td></tr>")
		document.write("<tr><td valign='top' bgcolor='#990000' colspan='6'><img src='pics/dot.gif' width='250' height='1'></td></tr>")
	}
}	//end footer()

function printDisclaimer(){
	document.write("<tr><td colspan='6' class='smalltext'><br><br>The information contained in this summary has been obtained from reliable sources (property owners and owner-appointed agents) and every effort has been made to assure its accuracy. However, its absolute accuracy is not warranted or implied. This summary is intended for information purposes only.</td></tr> ")
}

function PrintHeader(){
	document.write("</table><table><tr><td colspan='6'>Use this page to access information about properties available for sale or lease in the downtown district. Information is supplied by building owners and their agents; you may contact them directly or EDD for additional information. Click the headings below to sort by property name, location, size, or salestype. Use this page’s search engine if you have a specific requirement, including building use, size, or amenities.<br><br></td></tr></table><table>")
}



//-->









