var AptColNames=new Array("","","","Unit","LT","Brms","Baths","Prkg","MLS#","Price","Maint.<br/>Fee","Int<br/>Area","Price<br/>per<br>IntSqFt","Total<br/>Area","Furn","Remarks");function Apartment(A){this.FullArray=A}Apartment.prototype.Unit=function(){return this.FullArray[3]};Apartment.prototype.LT=function(){return this.FullArray[4]};Apartment.prototype.Brms=function(){return this.FullArray[5]};Apartment.prototype.Baths=function(){return this.FullArray[6]};Apartment.prototype.Prkg=function(){return this.FullArray[7]};Apartment.prototype.MlsNumber=function(){return this.FullArray[8]};Apartment.prototype.Price=function(){return this.FullArray[9]};Apartment.prototype.MaintFee=function(){return this.FullArray[10]};Apartment.prototype.IntArea=function(){return this.FullArray[11]};Apartment.prototype.TotArea=function(){return this.FullArray[12]};Apartment.prototype.Furn=function(){return this.FullArray[13]};Apartment.prototype.Remarks=function(){return this.FullArray[14]};Apartment.prototype.TMK=function(){return this.FullArray[15]};Apartment.prototype.PricePerSqFoot=function(){var B="";var C=this.IntArea();var A=parseInt(this.Price());if(C!=0&&C!=""&&C!=undefined&&C!="NaN"){B=(A*1/C).toFixed(2)}return B};Apartment.prototype.ToTableRow=function(){var C='<A HREF="javascript:LoadMLSPictures('+this.MlsNumber()+', 8);">[X]</a>';var A='<A HREF="javascript:StartMls('+this.MlsNumber()+');">[S]</a>';var B="<A HREF=\"javascript:ShowTmkData('"+this.TMK()+"');\">[T]</a>";return"<tr><td>"+this.Unit()+"</td><td>"+this.LT()+"</td><td>"+this.Brms()+"</td><td>"+this.Baths()+"</td><td>"+this.Prkg()+"</td><td>"+this.MlsNumber()+C+"&nbsp;"+A+"&nbsp;"+B+"</td><td>"+formatCurrency(this.Price())+"</td><td>"+this.MaintFee()+"</td><td>"+this.IntArea()+"</td><td>$"+this.PricePerSqFoot()+"</td><td>"+this.TotArea()+"</td><td>"+this.Furn()+"</td><td>"+this.Remarks()+"</td></tr><tr><td colspan='13'><div id='mls_main"+this.MlsNumber()+"'><div id='tmk"+this.TMK()+"'></div><div id='mls"+this.MlsNumber()+"'></div><div id='mlsAptForm"+this.MlsNumber()+"'></div></div></td></tr>"};function ShowTmkData(C){var D=document.getElementById("tmk"+C);var A=D.innerHTML!="";if(A){D.innerHTML="";SetDisplay4Id("tmk"+C,false);return }SetDisplay4Id("tmk"+C,true);var B="<table>";B+=GetTmkRows(C);B+="</table>";D.innerHTML=B}var ApartmentSortIndex=9;var bAsc=1;function AptSortFunction(C,B){var A="";var D="";switch(ApartmentSortIndex){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:A=C.FullArray[ApartmentSortIndex];D=B.FullArray[ApartmentSortIndex];break;case 12:A=C.PricePerSqFoot();D=B.PricePerSqFoot();break;case 13:A=C.FullArray[12];D=B.FullArray[12];break;default:return 0}switch(ApartmentSortIndex){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:if(A>D){return bAsc}if(A<D){return -bAsc}return 0;case 9:case 10:case 11:case 12:case 13:return(A-D)*bAsc;default:return 0}}function ToTable(C,H){var E=mmc.MasterMarkerFromId(C);var I=E.ApartmentObjects;ApartmentSortIndex=H;bAsc=-bAsc;I.sort(AptSortFunction);var B="<table  border='1' cellspacing=0 cellpadding=1 width='100%' style='border:1px solid #CCC;border-collapse: collapse;'>";B+="<tr>";var G=AptColNames.length;for(var D=0;D<G;D++){if(AptColNames[D]==""){continue}B+="<th onclick='javascript:PopulateAptsDiv("+C+","+D+");' style='cursor:hand'>"+AptColNames[D]+(D==ApartmentSortIndex?(bAsc==1?"<br>(asc)":"<br>(desc)"):"")+"</th>"}B+="</tr>";var F=I.length;for(var D=0;D<F;D++){var A=I[D];B+=A.ToTableRow()}B+="</table>";return B}function PopulateAptsDiv(C,B){var A="Apts"+C;document.getElementById(A).innerHTML=GetAptsDiv(C,B)}function GetAptsDiv(C,B){var D="<h3>Listings for sale</h3>";D+="Press [X] to expand/collapse the images or submit a request. Press [S] to run the slideshow. Press [T] to view TMK data<br/>";D+="Click column headers to sort<br/>";D+="Note: MLS does not have images for some properties<br/>";D+="If you would like to see all available apartment pictures at once please click <a href='javascript:ShowAllImagesAtOnce("+C+")' alt='View all images at once'>[Show all images]</a><br/>";var A=ToTable(C,B);return D+A};