
var iconImgLocation="/images/global/fanfinder";var imgPrefix="ffmarker_";var imgSuffix=".png";function LocalFFResult(gResult,id){this.id=id;this.gResult=gResult;this.ffLocation=this.getFFLocation(gResult);this.locationPt=new GLatLng(parseFloat(this.ffLocation.latitude),parseFloat(this.ffLocation.longitude));this.mapResultDiv=this.getMapResultDiv(gResult.html);this.mapMarker=this.getMapMarker();this.distance=null;}
LocalFFResult.prototype.getFFLocation=function(gresult){var ffLocation=new FFLocation();ffLocation.id=this.id;ffLocation.latitude=gresult.lat;ffLocation.longitude=gresult.lng;ffLocation.address1=gresult.streetAddress;ffLocation.state=gresult.region;ffLocation.city=gresult.city;ffLocation.zip="";ffLocation.name=gresult.titleNoFormatting;ffLocation.url=gresult.url;return ffLocation;}
LocalFFResult.prototype.addTableRow=function(table){var friendButton=null;var blankimage=document.createElement('img');blankimage.src="/images/global/spacer.gif";blankimage.width="747";blankimage.height="1";blankimage.border="0";blankimage.alt="";var rowPos=table.rows.length;table.insertRow(rowPos);var row=table.rows[rowPos];if(this.id%2==0){row.className="rowcolor2";}
else{row.className="rowcolor1";}
var imgCol=document.createElement("td");var imgElt=document.createElement("img");imgElt.src=iconImgLocation+"/"+imgPrefix+this.id+imgSuffix;imgElt.alt="Marker Icon_"+this.id;imgCol.appendChild(imgElt);row.appendChild(imgCol);var nameCol=document.createElement("td");nameCol.appendChild(document.createTextNode(this.ffLocation.name));row.appendChild(nameCol);var streetAddressCol=document.createElement("td");streetAddressCol.appendChild(document.createTextNode(this.ffLocation.address1));row.appendChild(streetAddressCol);var dist=metersToMiles(this.locationPt.distanceFrom(myFFMap.currentSearchCenter));this.distance=dist;var distCol=document.createElement("td");distCol.appendChild(document.createTextNode(dist+" miles"));row.appendChild(distCol);var fanCountCol=document.createElement("td");fanCountCol.appendChild(document.createTextNode("            "));row.appendChild(fanCountCol);var friendCountCol=document.createElement("td");if(!friendButton){}
else{friendCountCol.appendChild(document.createTextNode(friendButton));}
row.appendChild(friendCountCol);var buttonRow=document.createElement("td");var buttonLink=buildAttendingButton(this.id);buttonRow.appendChild(buttonLink);var streetAddElt=document.createElement("input");streetAddElt.type="hidden";streetAddElt.id="locationAddress_"+this.id;streetAddElt.value=this.ffLocation.address1;buttonRow.appendChild(streetAddElt);var lngElt=document.createElement("input");lngElt.type="hidden";lngElt.id="locationLng_"+this.id;lngElt.value=this.ffLocation.longitude;buttonRow.appendChild(lngElt);var latElt=document.createElement("input");latElt.type="hidden";latElt.id="locationLat_"+this.id;latElt.value=this.ffLocation.latitude;buttonRow.appendChild(latElt);var locNameElt=document.createElement("input");locNameElt.id="locationName_"+this.id;locNameElt.value=this.ffLocation.name;locNameElt.type="hidden";buttonRow.appendChild(locNameElt);var locCityElt=document.createElement("input");locCityElt.id="locationCity_"+this.id;locCityElt.value=this.ffLocation.city;locCityElt.type="hidden";buttonRow.appendChild(locCityElt);var locStateElt=document.createElement("input");locStateElt.id="locationState_"+this.id;locStateElt.value=this.ffLocation.state;locStateElt.type="hidden";buttonRow.appendChild(locStateElt);var locZipElt=document.createElement("input");locZipElt.id="locationZip_"+this.id;locZipElt.value=this.ffLocation.zip;locZipElt.type="hidden";buttonRow.appendChild(locZipElt);var distInputElt=document.createElement("input");distInputElt.type="hidden";distInputElt.value=this.distance;distInputElt.id="dist_"+this.id;buttonRow.appendChild(distInputElt);var ddUrlInputElt=document.createElement("input");ddUrlInputElt.type="hidden";ddUrlInputElt.value=this.gResult.ddUrl;ddUrlInputElt.id="ddUrl_"+this.id;buttonRow.appendChild(ddUrlInputElt);row.appendChild(buttonRow);var rowPos2=table.rows.length;table.insertRow(rowPos2);var dividerRow=table.rows[rowPos2];dividerRow.className="rowDivider";var dividerRowTD=document.createElement('td');dividerRowTD.colSpan="7";dividerRowTD.appendChild(blankimage);dividerRow.appendChild(dividerRowTD);}
LocalFFResult.prototype.getMapMarker=function(){if(this.mapMarker){return this.mapMarker;}
var marker=new GMarker(new GLatLng(parseFloat(this.locationPt.lat()),parseFloat(this.locationPt.lng())),getFFIcon(this.id));GEvent.bind(marker,"mouseover",this,function(){this.mapMarker.openInfoWindow(this.mapResultDiv);});return marker;}
LocalFFResult.prototype.getFriends=function(fanList){var myFriendList=[];for(var i=0;i<fanList.length;i++){var fan=fanList[i];var friendList=fan.friendList;for(var j=0;j<friendList.length;j++){if(friendList[j]==myFFMap.fan.username){myFriendList.push(friendList[j]);}}}
return myFriendList;}
LocalFFResult.prototype.getMapResultDiv=function(gResultNode){gResultNode.style.width="175px";gResultNode.className="bodytext11";var goingHereButton=buildAttendingButton(this.id);gResultNode.appendChild(goingHereButton);return gResultNode;}
function addFanToLocationPrep(addressId,latId,lngId,distId,nameId,cityId,stateId,zipId,ddUrlId){var ffLocation=new FFLocation();ffLocation.address1=document.getElementById(addressId).value;ffLocation.latitude=document.getElementById(latId).value;ffLocation.longitude=document.getElementById(lngId).value;ffLocation.name=document.getElementById(nameId).value;ffLocation.city=document.getElementById(cityId).value;ffLocation.state=document.getElementById(stateId).value;ffLocation.zip=document.getElementById(zipId).value;var topicId=document.getElementById("team").value;var eventDate=document.getElementById("fullEventDate").value;var ddUrl=document.getElementById(ddUrlId).value;var distance=document.getElementById(distId).value;addFanToLocation(ffLocation,{id:topicId},eventDate,distance,ddUrl);}
function getFFIcon(itemNumber,imgUrl,shadowUrl){var ffIcon=new GIcon();if(!imgUrl){ffIcon.image=iconImgLocation+"/"+imgPrefix+itemNumber+imgSuffix;}
else{ffIcon.image=imgUrl;}
if(!shadowUrl){ffIcon.shadow=iconImgLocation+"/"+imgPrefix+'shadow'+imgSuffix;}
else{ffIcon.shadow=shadowUrl;}
ffIcon.iconAnchor=new GPoint(9.95,25);ffIcon.infoWindowAnchor=new GPoint(5,1);return ffIcon;}
function buildAttendingButton(id){var buttonLink=document.createElement("a");buttonLink.href="javascript:addFanToLocationPrep('locationAddress_"+id+"', 'locationLat_"+id+"', '"+"locationLng_"+id+"', 'dist_"+id+"', 'locationName_"+id+"', 'locationCity_"+id+"', '"+"locationState_"+id+"', 'locationZip_"+id+"', 'ddUrl_"+id+"');";var buttonImage=document.createElement("img");buttonImage.id="attendingNode";buttonImage.src="/images/fanfinder/btn-goinghere.gif";buttonImage.width="91";buttonImage.height="17";buttonImage.border="0";buttonImage.alt="I'm Going Here";buttonLink.appendChild(buttonImage);return buttonLink;}