
var InfoBoxManager=new InfoBoxManagerClass();function InfoBoxManagerClass()
{this.StoreDescription=StoreDescription;this.GetDescription=ResolveDescription;this.GetName=ResolveName;this.GetAddress=ResolveAddress;this.GetImage=ResolveImage;this.GetActionArea=ResolveActionArea;this.GetDirections=ResolveDirections;this.IsFormattedKey=IsFormattedKey;this.GenerateKey=GenerateKey;this.ClearDescriptions=ClearDescriptions;var LocationMap=new Array();var ListingMap=new Array();var POIMap=new Array();var PersonalMap=new Array();var FindOnMapPins=new Array();var separator='||';function IsFormattedKey(key){var fields=key.split(separator);var poiPattern=new RegExp("^POI","i");if((fields.length==2&&(fields[0]=='Listing'||fields[0]=='Location'||fields[0]=='Personal'||fields[0]=='fom'))||poiPattern.test(fields[0])){return true;}
return false;}
function GenerateKey(type,index)
{return type+separator+index;}
function StoreDescription(type,index,description)
{if(type!='Listing'&&type!='Location'&&type!='POI'&&type!='Personal'&&type!='fom')
{return'';}
var poiPattern=new RegExp("POI","i");if(type=='Listing')
{ListingMap[parseInt(index)]=description;}
else if(type=='Location')
{LocationMap[parseInt(index)]=description;}
else if(poiPattern.test(type))
{POIMap[parseInt(index)]=description;}
else if(type=='Personal')
{PersonalMap[parseInt(index)]=description;}
else if(type=='fom'){FindOnMapPins[parseInt(index)]=description;}
return type+separator+index;}
function ResolveDescription(key)
{if(!IsFormattedKey(key))
{return'';}
var fields=key.split('||');var type=fields[0];var index=parseInt(fields[1]);var poiPattern=new RegExp("POI","i");switch(type){case'Listing':return ListingMap[index];case'Location':return LocationMap[index];case'Personal':return PersonalMap[index];case'fom':return FindOnMapPins[index];default:if(poiPattern.test(type)){if(fields.length==2)
return POIManager.GenerateDescription(index,type.match(/POI(\d+)/i)[1]);else if(fields.length>2)
return clusterManager.GenerateDescription(key);}
return'';}}
function ResolveName(key)
{if(!IsFormattedKey(key))
{return'';}
var fields=key.split('||');var type=fields[0];var index=parseInt(fields[1]);var poiName=POIManager.GenerateName(index,type.match(/POI(\d+)/i)[1]);return poiName;}
function ResolveAddress(key)
{if(!IsFormattedKey(key))
{return'';}
var fields=key.split('||');var type=fields[0];var index=parseInt(fields[1]);return POIManager.GenerateAddress(index,type.match(/POI(\d+)/i)[1]);}
function ResolveImage(key)
{if(!IsFormattedKey(key))
{return'';}
var fields=key.split('||');var type=fields[0];var index=parseInt(fields[1]);return POIManager.GenerateImage(index,type.match(/POI(\d+)/i)[1]);}
function ResolveActionArea(key){var actionDiv='<div id=\"AP_ACTION_'+key+'\" class="popupActionArea" style="top:10px;">'
+'<div id=\"AP_EMPTY_'+key+'\" style="height:130px; width:100px;"></div>'
+'<div id=\"AP_TO_'+key+'\" style="height:130px;display:none;">'
+'<div class="popupHeader"><strong>'+resourceDD+':</strong></div><br/>'
+resourceToHere+':<br/>'
+'<input type="text" id="p_toAddress'+key+'" style="width:158px;" onkeydown="ExecuteFindFromInput(\'p_imgTo'+(key)+'\', event);"/><br/>'
+'<div><img id="p_imgTo'+key+'" src="'+images+'GetDD.gif" class="popupLink" style="left:100px; float: right;" onclick="POIManager.GDDForPOIPopup(\'TO\', \''+(key)+'\');" /></div>'
+'</div>'
+'<div id=\"AP_FROM_'+key+'\" style="height:130px;display:none;">'
+'<div class="popupHeader"><strong>'+resourceDD+': </strong></div><br/>'
+resourceFromHere+':<br/>'
+'<input type="text" id="p_fromAddress'+key+'" style="width:158px;" onkeydown="ExecuteFindFromInput(\'p_imgFrom'+(key)+'\', event);"/><br/>'
+'<div><img id="p_imgFrom'+(key)+'" src="'+images+'GetDD.gif" class="popupLink" style="left:100px; float: right;" onclick="POIManager.GDDForPOIPopup(\'FROM\', \''+(key)+'\');"/></div>'
+'</div>'
+'<div id=\"AP_NEAR_'+key+'\" style="height:130px;display:none;"></div>'
+'<div id=\"AP_MAP_'+key+'\" style="height:130px;display:none;"></div>'
+'</div>';return actionDiv;}
function ResolveDirections(key)
{if(!IsFormattedKey(key))
{return'';}
var fields=key.split('||');var type=fields[0];var index=parseInt(fields[1]);var descriptionArray=new Array();descriptionArray.push('<img src="images/drivingicon.gif" align="left" style="margin-right:3px;margin-left:3px"></img>');descriptionArray.push(resourceDD.toUpperCase()+'<div></div><span class="popupLink popupDrivingFunctionTo" onclick="YPSearchManager.ShowActionDiv(\'AP_\', \''+(key)+'\', \'FROM\');"><img src="images/tohereicon.gif"><span>'+resourceToHere.toUpperCase()+'</span></img></span> | <span class="popupLink popupDrivingFunctionFrom" onclick="YPSearchManager.ShowActionDiv(\'AP_\', \''+(key)+'\', \'TO\');"><img src="images/fromhereicon.gif"><span>'+resourceFromHere.toUpperCase()+'</span></img></span>');return('<table><td>'+descriptionArray.join('</td><td>')+'</td></table>');}
function ClearDescriptions(type)
{if(type=='Listing'){ListingMap.length=0;}
else if(type=='Location'){LocationMap.length=0;}
else if(type=='POI'){POIMap.length=0;}
else if(type='Personal'){PersonalMap.length=0;}
else if(type='Personal'){FindOnMapPins.length=0;}}}