YAHOO.namespace("example.container");
SS_initialX=-1;SS_initialY=-1;
SS_youAreHereChecked=false;
SS_sideNoteBehavior=1;
SS_SmallPanelOverrideFn=false;
SS_LargePanelOverrideFn=false;
SS_LargePanelX=0;
SS_LargePanelY=0;
SS_MatchGraphic="http://www.sidestreet.com/images/graphics/match2.gif";
SS_filterCat=-1;
SS_wasHighlighted=0;
var SS_largePanelRendered=false;
var SS_smallPanelRendered=false;

function SS_SetFilterIdentify(SS_cat)
{
   SetFilter(SS_cat);
   SS_initialbusid=SS_filterCat*-1;
}

function SS_SetFilter(SS_cat)
{
	SS_filterCat=9999;
	for (j=0;j<SS_numCategories;j++)
	{
	   if (SS_categoryName[j]!=SS_cat)
	      SS_categoryFilter[j]=0;
	   else
	      SS_filterCat=SS_categoryID[j];
	}

	for (j=0;j<SS_numHotspots;j++)
	{
  	   SS_busFilter[j]=0;
	}

	for (j=0;j<SS_numDirItems;j++)
	{
	   if (SS_dirCategory[j]!=SS_filterCat)
	      SS_dirFilter[j]=0;
	   else
	      SS_busFilter[SS_dirHotspotLink[j]]=1;
	} 
}

function SS_LoadThisPage() 
{
   // Instantiate a Panel from markup
   SS_SetInitialDataMultipleCats();
   SS_writeSideNoteData();
   SS_SyncInfo();

   SS_zoomFactor=1.3;
   SS_zoomLevelsX[0]=SS_gmdWidth;
   SS_zoomLevelsY[0]=SS_gmdHeight;
   for (j=1;j<=7;j++)
   {
      SS_zoomLevelsX[j]=SS_zoomLevelsX[j-1]*SS_zoomFactor;
      SS_zoomLevelsY[j]=SS_zoomLevelsY[j-1]*SS_zoomFactor;
   }

   SS_LoadPage();
}

function SS_DrawNavigation(SS_navigationame)
{
   SShtml="<table><tr><td><div id=\"SS_ZOOM_TXT\"><font color='#0000FF'>ZOOM:</font></div></td><td><map name='SS_FPMap0'><area onclick='SS_zoomOut();return false;'  shape='rect' coords='9, 28, 31, 51'>";
   SShtml=SShtml+"<area onclick='SS_zoom(0);return false;' shape='rect' coords='35, 30, 49, 52'>";
   SShtml=SShtml+"<area onclick='SS_zoom(1);return false;' shape='rect' coords='51, 28, 65, 51'>";
   SShtml=SShtml+"<area onclick='SS_zoom(2);return false;' shape='rect' coords='70, 30, 83, 52'>";
   SShtml=SShtml+"<area onclick='SS_zoom(3);return false;' shape='rect' coords='86, 28, 102, 52'>";
   SShtml=SShtml+"<area onclick='SS_zoom(4);return false;' shape='rect' coords='103, 29, 120, 52'>";
   SShtml=SShtml+"<area onclick='SS_zoom(5);return false;' shape='rect' coords='123, 28, 135, 51'>";
   SShtml=SShtml+"<area onclick='SS_zoomIn();return false;' shape='rect' coords='140, 28, 163, 50'></map>";
   SShtml=SShtml+"<img id='SS_zoomlevel' style=\"cursor:pointer\" src='http://www.sidestreet.com/images/graphics/zoom_01.gif' usemap='#SS_FPMap0' border='0'></td>";
   SShtml=SShtml+"<td><div id=\"SS_MOVE_TXT\"><font color='#0000FF'>MOVE:</font></div></td><td valign='Center'><map name='SS_FPMap1'>";
   SShtml=SShtml+"<area onMouseOut='SS_timeroff();return false;' onMouseOver='SS_moveLeft();return false;' shape='rect' coords='1, 28, 27, 50'>";
   SShtml=SShtml+"<area onMouseOut='SS_timeroff();return false;' onMouseOver='SS_moveUp();return false;' shape='rect' coords='29, 3, 52, 28'>";
   SShtml=SShtml+"<area onMouseOut='SS_timeroff();return false;' onMouseOver='SS_moveRight();return false;' shape='rect' coords='51, 28, 78, 51'>";
   SShtml=SShtml+"<area onMouseOut='SS_timeroff();return false;' onMouseOver='SS_moveDown();return false;' shape='rect' coords='27, 52, 52, 79'></map>";
   SShtml=SShtml+"<img id='SS_scrolling' style=\"cursor:pointer\" src='http://www.sidestreet.com/images/graphics/scrollingTool_Home.gif' usemap='#SS_FPMap1' border='0'></td></tr></table>";
   

   document.getElementById(SS_navigationame).innerHTML=SShtml;
}

function SS_DrawMap(SS_mapname,SS_small,SS_medium,SS_large)
{
   SS_sizeOfGMD=1;
   SS_html="";
   

   if (SS_small==0 && SS_medium==1 && SS_large==0)
   {
      SS_sizeOfGMD=2;
   }

   if (SS_small==0 && SS_medium==0 && SS_large==1)
   {
      SS_sizeOfGMD=3;
   }

   if (SS_small==1 && SS_medium==1 && SS_large==0)
   {
      SS_html=SS_html+"<a id=\"SS_small1\" href=\"resize\" onclick=\"SS_changeSize(1);return false;\">Small map</a>";
      SS_html=SS_html+"<div id=\"SS_small2\" style=\"color:#000000;display:none\">Small map</div>&nbsp;&nbsp;";
	  SS_html=SS_html+"<a id=\"SS_medium1\" href=\"resize\" onclick=\"SS_changeSize(2);return false;\">Large map</a>";
      SS_html=SS_html+"<div id=\"SS_medium2\" style=\"color:#000000;display:none\">Large map</div>&nbsp;&nbsp;";  
   }

   if (SS_small==1 && SS_medium==0 && SS_large==1)
   {
      SS_html=SS_html+"<a id=\"SS_small1\" href=\"resize\" onclick=\"SS_changeSize(1);return false;\">Small map</a>";
      SS_html=SS_html+"<div id=\"SS_small2\" style=\"color:#000000;display:none\">Small map</div>&nbsp;&nbsp;";
	  SS_html=SS_html+"<a id=\"SS_large1\" href=\"resize\" onclick=\"SS_changeSize(3);return false;\">Large map</a>";
      SS_html=SS_html+"<div id=\"SS_large2\" style=\"color:#000000;display:none\">Large map</div>&nbsp;&nbsp;";  
   }


   if (SS_small==0 && SS_medium==1 && SS_large==1)
   {
      SS_sizeOfGMD=2;
	  SS_html=SS_html+"<a id=\"SS_medium1\" href=\"resize\" onclick=\"SS_changeSize(2);return false;\">Small map</a>";
      SS_html=SS_html+"<div id=\"SS_medium2\" style=\"color:#000000;display:none\">Small map</div>&nbsp;&nbsp;";  
	  SS_html=SS_html+"<a id=\"SS_large1\" href=\"resize\" onclick=\"SS_changeSize(3);return false;\">Large map</a>";
      SS_html=SS_html+"<div id=\"SS_large2\" style=\"color:#000000;display:none\">Large map</div>&nbsp;&nbsp;";  
   }


   // allow for three different sizes
   if (SS_small==1 && SS_medium==1 && SS_large==1)
   {
      SS_html=SS_html+"<a id=\"SS_small1\" href=\"resize\" onclick=\"SS_changeSize(1);return false;\">Small</a>";
      SS_html=SS_html+"<div id=\"SS_small2\" style=\"color:#000000;display:none\">Small</div>&nbsp;&nbsp;";
	  SS_html=SS_html+"<a id=\"SS_medium1\" href=\"resize\" onclick=\"SS_changeSize(2);return false;\">Medium</a>";
      SS_html=SS_html+"<div id=\"SS_medium2\" style=\"color:#000000;display:none\">Medium</div>&nbsp;&nbsp;";  
	  SS_html=SS_html+"<a id=\"SS_large1\" href=\"resize\" onclick=\"SS_changeSize(3);return false;\">Large</a>";
      SS_html=SS_html+"<div id=\"SS_large2\" style=\"color:#000000;display:none\">Large</div>&nbsp;&nbsp;";  
   }

   SS_html=SS_html+SS_DrawMapNames();
   
   SS_html=SS_html+"<DIV ID='SS_spanid' width=350px height=400px style='border: 3px solid black;position:relative;overflow:hidden;width:350px;height;400px'>";
   SS_html=SS_html+"<IMG style='position:relative;display:none' id='SS_mall' border='0' src='http://www.sidestreet.com/images/graphics/pix_clear.gif' width=20px height=20px>";
   SS_html=SS_html+"</DIV>";
   SS_html=SS_html+"<img border='0' src='http://www.sidestreet.com/sabbatical/poweredby.gif' width='150px' height='18px'>";
   
   document.getElementById(SS_mapname).innerHTML=SS_html;
}

function SS_DrawPopup(SS_overlibsname)
{
   SS_html=SS_DrawOverlibs();
   
   SS_html=SS_html+"<iframe id='SS_selectblocker' style='position:absolute;display:none' frameBorder='0' scrolling='no' width=400px src=''></iframe><div style='position:absolute;display:none;width:400px' id='SS_largepanel' width=400px></div>";
   SS_html=SS_html+"<div style='position:absolute;display:none;width:200px' id='SS_smallpanel' width=200px></div>";
   
   document.getElementById(SS_overlibsname).innerHTML=SS_html;
}


function SS_DrawDirectory(SS_directoryname,SS_size)
{
   // Directory
   SS_html="";   
   SS_html=SS_html+"<form name=\"SS_form1\" id=\"SS_form1\" method=\"POST\" action=\"--WEBBOT-SELF--\">";
   SS_html=SS_html+"<p><strong><b>Directory</b></strong><br />";
   SS_html=SS_html+"<select size=\"1\" width=\""+SS_size+"\" STYLE=\"width:"+SS_size+"px\"  name=\"SS_Categories\" class=\"drop1\" onchange=\"SS_categoryClick(this.options[this.selectedIndex].value);\">";
   SS_html=SS_html+"</select></p><p><br>";
   SS_html=SS_html+"<select size=\"15\" width=\""+SS_size+"\" STYLE=\"width:"+SS_size+"px\" name=\"SS_BusinessList\" class=\"drop1\" onchange=\"SS_buscatClick(this.options[this.selectedIndex].value);\">";
   SS_html=SS_html+"</select></p>";
   SS_html=SS_html+"</form>";
   
   document.getElementById(SS_directoryname).innerHTML=SS_html;
}

function SS_ShowSmallPanel(SS_item)
{
   var SS_c=SS_getImageCoords (document.getElementById("SS_O"+SS_item));
   var SS_w = parseInt(document.getElementById("SS_O"+SS_item).style.width.replace('px',''));
   var SS_h = parseInt(document.getElementById("SS_O"+SS_item).style.height.replace('px',''));
   
   if (document.getElementById("SS_H"+SS_item).style.display=="block")
   {
      SS_wasHighlighted=1;
   }
   else
   {
      SS_wasHighlighted=0;
      document.getElementById("SS_H"+SS_item).src=SS_MatchGraphic;
      document.getElementById("SS_H"+SS_item).style.display="block";
   }

   if (SS_SmallPanelOverrideFn)
      SS_SmallPanelOverride(SS_name[SS_item],SS_hours[SS_item],SS_phone[SS_item],SS_moreInfo[SS_item],SS_c.x,SS_c.y,SS_w,SS_h);
   else
   {
/*      document.getElementById("SS_smallpanel").style.left=(SS_c.x+SS_w)+"px";
      document.getElementById("SS_smallpanel").style.top=(SS_c.y-20);

      SS_bodyStr="<table border='0' width='100%' id='SS_table1' cellspacing='0' cellpadding='0'><tr><td bgcolor='#005AE7' width='8px' height='8px' valign='top'><p style='margin-top: 0; margin-bottom: 0'>";
      SS_bodyStr+="<img border='0' src='http://www.sidestreet.com/images/graphics/xp-tl.gif' width='8px' height='18px'></td><td rowspan='2' bgcolor='#005AE7'>";
      SS_bodyStr+="<p style='margin-top: 0; margin-bottom: 0'>"+SS_name[SS_item]+"</p></td><td bgcolor='#005AE7' width='8px' height='8px' valign='top'><p style='margin-top: 0; margin-bottom: 0'>";
      SS_bodyStr+="<img border='0' src='http://www.sidestreet.com/images/graphics/xp-tr.gif' width='8px' height='18px'></td></tr>";
      SS_bodyStr+="<tr><td width='8px' bgcolor='#005AE7'>&nbsp;</td><td width='8px' bgcolor='#005AE7'>&nbsp;</td></tr></table>";
      SS_bodyStr+="<table bgcolor='#FFFFFF' border='1' width='100%' id='SS_table2' style='border-collapse: collapse'><tr><td>";
      if (SS_hours[SS_item]!="")
         SS_bodyStr+="<b>Info & Hours: </b>"+SS_hours[SS_item]+"<br>";
      if (SS_phone[SS_item]!="")
         SS_bodyStr+="<b>Phone: </b>"+SS_phone[SS_item]+"<br>";
      if (SS_moreInfo[SS_item]==1)
         SS_bodyStr+="</p><i>Click for more info</i>"; 
      SS_bodyStr+="</td></tr></table>"; 
      document.getElementById("SS_smallpanel").innerHTML=SS_bodyStr; 
      document.getElementById("SS_smallpanel").style.display="block"; 
      SS_ph = document.getElementById("SS_smallpanel").clientHeight;
      document.getElementById("SS_smallpanel").style.top=(SS_c.y-SS_ph)+"px";
      */
       
      if (!SS_smallPanelRendered)
      {
         SS_smallPanelRendered=true;
         SS_YUIsmallpanel = new YAHOO.widget.Panel("SS_panel2", { width:"200px",visible:false, constraintoviewport:true,close:false } );
      }

      document.getElementById("SS_smallpanel").style.display="block";
      document.getElementById("SS_smallpanel").style.left=((SS_c.x+SS_w)+"px");

      SS_YUIsmallpanel.setHeader("<div class='tl'></div><span>"+SS_name[SS_item]+"</span><div class='tr'></div>");

      SS_bodyStr="<p align=\"left\">"
      if (SS_hours[SS_item]!="")
      SS_bodyStr+="<b>Info & Hours: </b>"+SS_hours[SS_item]+"<br>";
      if (SS_phone[SS_item]!="")
         SS_bodyStr+="<BR><b>Phone: </b>"+SS_phone[SS_item]+"<br>";
      if (SS_moreInfo[SS_item]==1)
         SS_bodyStr+="</p><i>Click for more info</i>"; 
      SS_bodyStr+="</p>";
      SS_YUIsmallpanel.setBody(SS_bodyStr);

      SS_YUIsmallpanel.render(document.getElementById("SS_smallpanel"));
   
      SS_YUIsmallpanel.show();
      SS_ph = document.getElementById("SS_smallpanel").clientHeight;
      document.getElementById("SS_smallpanel").style.top=(SS_c.y-SS_ph)+"px";
   }

}

function SS_HideSmallPanel(SS_item)
{
   if (SS_wasHighlighted==0)
   {
      document.getElementById("SS_H"+SS_item).style.display="none";
   }

   if (SS_SmallPanelOverrideFn)
   {
      SS_HideSmallPanelOverride();
      return;
   }

   SS_YUIsmallpanel.hide();
   document.getElementById("SS_smallpanel").style.display="none";
}

function SS_openWin(page)
{
	window.open(page, 'SideStreet');
}


function SS_ctxClick(SS_item)
{
   document.getElementById("SS_smallpanel").style.display="none";
   SS_originalcoords = SS_getImageCoords(document.getElementById("SS_spanid"));
   if (SS_LargePanelOverrideFn)
   {
      if (SS_LargePanelX==0)
      {
         SS_LargePanelOverride(SS_name[SS_item],SS_gmdid[SS_item],SS_item,SS_originalcoords.x+175,SS_originalcoords.y+50);
      }
      else
      {
         SS_LargePanelOverride(SS_name[SS_item],SS_gmdid[SS_item],SS_item,SS_LargePanelX,SS_LargePanelY);
      }
      return;
   }

/*   if (SS_LargePanelX==0)
   {
      SS_originalcoords = SS_getImageCoords(document.getElementById("SS_spanid"));
      document.getElementById("SS_largepanel").style.left=(SS_originalcoords.x+175)+"px";
      document.getElementById("SS_largepanel").style.top=(SS_originalcoords.y+50)+"px";
      document.getElementById("SS_selectblocker").style.left=(SS_originalcoords.x+175)+"px";
      document.getElementById("SS_selectblocker").style.top=(SS_originalcoords.y+50)+"px";
      
   }
   else
   {
      document.getElementById("SS_largepanel").style.left=SS_LargePanelX+"px";
      document.getElementById("SS_largepanel").style.top=SS_LargePanelY+"px";
      document.getElementById("SS_selectblocker").style.left=SS_LargePanelX+"px";
      document.getElementById("SS_selectblocker").style.top=SS_LargePanelY+"px";
   }

   document.getElementById("SS_largepanel").style.display="block";
   document.getElementById("SS_selectblocker").style.display="block";

   SS_bodyStr="<table border='0' width='100%' id='SS_table1' cellspacing='0' cellpadding='0'><tr><td bgcolor='#005AE7' width='8px' height='8px' valign='top'><p style='margin-top: 0; margin-bottom: 0'>";
   SS_bodyStr+="<img border='0' src='http://www.sidestreet.com/images/graphics/xp-tl.gif' width='8px' height='18px'></td><td rowspan='2' bgcolor='#005AE7'>";
   SS_bodyStr+="<p style='margin-top: 0; margin-bottom: 0'><table border='0' width='100%'><tr><td>"+SS_name[SS_item]+"</td><td><img border='0' src='http://www.sidestreet.com/images/graphics/xp-close.gif' style='cursor:pointer' onclick='SS_CloseLargePanel();' style='cursor:pointer' width='21px' height='21px' align='right'></td></tr></table></p></td><td bgcolor='#005AE7' width='8px' height='8px' valign='top'><p style='margin-top: 0; margin-bottom: 0'>";
   SS_bodyStr+="<img border='0' src='http://www.sidestreet.com/images/graphics/xp-tr.gif' width='8px' height='18px'></td></tr>";
   SS_bodyStr+="<tr><td width='8px' bgcolor='#005AE7'>&nbsp;</td><td width='8px' bgcolor='#005AE7'>&nbsp;</td></tr></table>";
   SS_bodyStr+="<table  bgcolor='#FFFFFF' border='1' width='100%' id='SS_table2' style='border-collapse: collapse'><tr><td>";
   if (navigator.userAgent.indexOf("MSIE") != -1) 
      SS_bodyStr+="<iframe SCROLLING=no width=390px height=395px style='width:390px;height:395px'  id='SS_fcss' frameborder=0 src='http://www.sidestreet.com/custom/LargePanel.asp?gmd="+SS_gmdid[SS_item]+"&id="+SS_item+"'>Inline frames not supported.</iframe></td></tr></table>";
   else
      SS_bodyStr+="<iframe SCROLLING=no width=390px height=395px style='width:390px;height:395px'  id='SS_fcss' frameborder=0 src='http://www.sidestreet.com/custom/LargePanel2.asp?gmd="+SS_gmdid[SS_item]+"&id="+SS_item+"'>Inline frames not supported.</iframe></td></tr></table>";
   
   document.getElementById("SS_largepanel").innerHTML=SS_bodyStr;
   SS_ph=document.getElementById("SS_largepanel").clientHeight;
   document.getElementById("SS_selectblocker").style.height=SS_ph+"px"; */

   SS_x=0;
   SS_y=0;
   if (SS_LargePanelX==0)   
   {
     SS_x=SS_originalcoords.x+175;
     SS_y=SS_originalcoords.y+50;
   }
   else
   {
     SS_x=SS_LargePanelX;
     SS_y=SS_LargePanelY;
   }

   if (!SS_largePanelRendered)
   {
      SS_largePanelRendered=true;

      SS_panel1 = new YAHOO.widget.Panel("SS_panel1", { width:"420px", visible:false, constraintoviewport:true } );
      document.getElementById("SS_largepanel").style.display="block";
      document.getElementById("SS_largepanel").style.left=(SS_x+"px");
      document.getElementById("SS_largepanel").style.top=(SS_y+"px");
   }
   document.getElementById("SS_largepanel").display="block";

   SS_panel1.setHeader("<div class='tl'></div><span>"+SS_name[SS_item]+"</span><div class='tr'></div>");
   id = new Date().getTime();
   if (navigator.userAgent.indexOf("MSIE") != -1) 
      SS_panel1.setBody("<p align=left><iframe SCROLLING=no width=390 height=395 style=\"width:390px;height:395px\"  id='"+id+"' frameborder=0 src='http://www.sidestreet.com/custom/LargePanel.asp?gmd="+SS_gmdid[SS_item]+"&id="+SS_item+"'>Inline frames not supported.</iframe></p>");
   else
      SS_panel1.setBody("<p align=left><iframe SCROLLING=no width=390 height=395 style=\"width:390px;height:395px\"  id='"+id+"' frameborder=0 src='http://www.sidestreet.com/custom/LargePanel2.asp?gmd="+SS_gmdid[SS_item]+"&id="+SS_item+"'>Inline frames not supported.</iframe></p>");
   SS_panel1.render(document.getElementById("SS_largepanel"));
   SS_panel1.show(); 
}

function SS_CloseLargePanel()
{
   document.getElementById("SS_largepanel").style.display="none";
   document.getElementById("SS_selectblocker").style.display="none";
}

function SS_buildPanels(SS_gmdid_item,SS_item,SS_name_item,SS_hour_item,SS_phone_item,SS_moreInfo_item)
{
	SS_gmdid[SS_item]=SS_gmdid_item;
	SS_hours[SS_item]=SS_hour_item;
	SS_name[SS_item]=SS_name_item;
	SS_phone[SS_item]=SS_phone_item;
	SS_moreInfo[SS_item]=SS_moreInfo_item;
}

