var pageContext=null;
var name="";
var loc="";
var type="";
function initPage(){
pageContext=__getQueryContext();
if(CustomPageContextName){
name=CustomPageContextName;
}else{
name=(pageContext["N"]==null)?"":pageContext["N"];
}
loc=(pageContext["L"]==null)?"":pageContext["L"];
type=(pageContext["TYPE"]==null)?"p":pageContext["TYPE"];
headerSetSearchState(name,loc,null);
var _1="vcard";
if(type=="p"){
$("places").addClassName("current");
}else{
if(type=="e"){
$("events").addClassName("current");
_1="vevent";
}else{
if(type=="u"){
$("people").addClassName("current");
}else{
$("places").addClassName("current");
}
}
}
if(AddBiz){
newComment(AddBiz,"");
}
if(AddEventID){
addEvent(AddEventID);
}
if(window.initializeMap){
var a=$("olsrp").select(".mapimg");
var b=[];
if(a!=null&&a.length>0){
for(var i=0;i<a.length;i++){
b[i]=a[i].innerHTML;
a[i].innerHTML="";
a[i].hide();
}
}
var c=$("olsrp");
initializeMap(false);
map.clearOverlays();
__mapMicroformatsBind($(c),{"noAutoFitView":false,"microformatType":_1});
if(a!=null&&a.length>0){
for(var i=0;i<a.length;i++){
a[i].innerHTML=b[i];
a[i].show();
}
}
}
Lat49.initAds(204);
adHelper=new Lat49.AdHelper(204);
GEvent.addListener(map,"dragend",function(){
updateLat49();
});
updateLat49(true);
}
function RenderFilters(){
var sf=$("search-filters");
var _7=sf.select(".options a");
for(var i=0;i<_7.length;i++){
var _9=_7[i];
if(_9.hasClassName("submitButton")){
continue;
}
_9.onclick=function(){
if(!this.hasClassName("selected")){
var _a=this.up(".options");
var _b=_a.down(".selected");
if(_b){
_b.removeClassName("selected");
}
this.addClassName("selected");
if(_a.getAttribute("filterparam")=="type"){
ToggleStyles(this);
}
}
};
}
var _c=sf.select(".options");
for(var i=0;i<_c.length;i++){
var _d=_c[i];
var p=_d.getAttribute("filterparam");
if(!p){
continue;
}
var v=filterArray[p];
var aa=_d.select("a");
if(aa.length>1){
for(var j=0;j<aa.length;j++){
var a=aa[j];
if(a.getAttribute("filtervalue")==v){
a.addClassName("selected");
if(p=="type"){
ToggleStyles(a);
}
}
}
}else{
aa=_d.select("input");
var sv=v.split(",");
var _14=new Array();
for(var k=0;k<sv.length;k++){
var key=""+sv[k];
_14[key]=sv[k];
}
for(var j=0;j<aa.length;j++){
var a=aa[j];
a.onclick=function(){
this.up(".style").toggleClassName("selected-style");
};
a.disabled=true;
var key=""+a.getAttribute("filtervalue");
if(_14[key]){
a.checked=true;
a.up(".style").addClassName("selected-style");
}
}
if(sv.length>1){
expandFilters();
}
}
}
}
function expandFilters(_17){
var sf=$("search-filters");
var _19=sf.select("input");
if(sf.hasClassName("condensed-filter")){
for(var i=0;i<_19.length;i++){
_19[i].disabled=false;
}
sf.removeClassName("condensed-filter");
_17.innerHTML="collapse";
}else{
for(var i=0;i<_19.length;i++){
_19[i].disabled=true;
}
sf.addClassName("condensed-filter");
_17.innerHTML="expand";
}
}
function ToggleStyles(_1b){
var _1c=$("styles-filters");
if(_1b.getAttribute("filtervalue")=="p"){
if(_1c.hasClassName("inactive-filter")){
_1c.removeClassName("inactive-filter");
}
}else{
if(!_1c.hasClassName("inactive-filter")){
_1c.addClassName("inactive-filter");
}
}
}
var totalAdRefreshTime=0;
function updateLat49(_1d){
var ll=map.getCenter();
$("adcontainer").show();
var _1f=new Object();
_1f["adcontainer"]=Lat49.Ads.HALF_BANNER;
Lat49.updateMultiAdsByLatLon(_1f,ll.lat(),ll.lng(),15);
totalAdRefreshTime=totalAdRefreshTime+10000;
if(_1d&&totalAdRefreshTime<=120000){
setTimeout("updateLat49(true)",10000);
}
}
function showContent(s){
if(name!=""){
document.location.href=rootPath+s+"/"+loc+"/"+name;
}else{
document.location.href=rootPath+s+"/"+loc;
}
}
function newComment(id,_22){
if(headerCurrentUserProfileID!=null&&headerCurrentUserProfileID!=""){
var url=rootPath+"business/profile/newcomment.aspx?id="+id;
new Ajax.Request(url,{method:"get",onSuccess:addConfirm,onFailure:addConfirm});
}else{
var _24="Be a local expert";
var _25="Save and tag places, give and receive recommendations on the best places in town";
var _26="?CallingPage="+PageURL.replace(/&/g,"%!")+"%!addBiz="+id;
headerShowModalDialog(authRootDomain+"auth/signinPrompt.aspx"+_26+"&SignupHeadingMessage="+_24+"&MarketingMessage="+_25,295,430,false);
}
}
function removePlace(id){
headerShowErrorMessage("Removing from your places list...",false,"alert");
var url=rootPath+"business/profile/newcomment.aspx?id="+id+"&type=remove";
var _29=function(t){
headerShowErrorMessage("Selected item has been removed from your places list.",true,"Alert");
};
var _2b=new Ajax.Request(url,{method:"get",asynchronous:true,postBody:"",onSuccess:_29,onFailure:_29});
}
function addConfirm(){
headerShowErrorMessage("The selected place has been added to your places...",true,"Info");
}
function addEvent(id){
if(headerCurrentUserProfileID!=null&&headerCurrentUserProfileID!=""){
headerShowErrorMessage("Adding event to your calendar...",false,"alert");
var url=rootPath+"async/event.aspx/?id="+id+"&type=add";
var _2e=function(t){
_addEventSuccess(id);
};
var _30=new Ajax.Request(url,{method:"post",asynchronous:true,postBody:"",onSuccess:_2e,onFailure:_2e});
}else{
var _31="Join Center'd!";
var _32="In order to add events to your calendar, you need to have an account with us.";
var _33="?CallingPage="+PageURL.replace(/&/g,"%!")+"%!addEvent="+id;
headerShowModalDialog(authRootDomain+"auth/signinPrompt.aspx"+_33+"&SignupHeadingMessage="+_31+"&MarketingMessage="+_32,295,425,false);
}
}
function _addEventSuccess(id){
headerShowErrorMessage("The selected event has been added to your calendar...",true,"Info");
}
function openConnectPanel(id){
headerShowModalDialog(rootPath+"async/contact.aspx/?id="+id,150,550,true);
}
function openEmailPanel(id){
headerShowModalDialog(rootPath+"async/email.aspx/?toid="+id,305,550,true);
}
Event.observe(window,"load",initPage,false);

