
<!-- Begin

 var pansize = .50;

//var isChrome = (navigator.userAgent.indexOf("Chrome")!=-1);

function refreshMetas() {
  if (document.all) return;
  var a = document.getElementsByTagName('META');
  if (a.length==1) {
    a = a[0];
    var re = /.*URL=(.*)/;
    if (a.httpEquiv=='Refresh') {
      document.location = (String(a.content).replace(re, "$1"));
    }
  }
}

//setTimeout("refreshMetas()", 3000); // ff doesn't work with meta refresh using htmlarea.
// if we're still on page after while, reload.

function pan(direction, width, height) {    
  var x, y;

  //if (document.getElementById('newdot').style.display=="none") {
  // document.mapserv.isplacement.value='no';
  //}

  if(direction == 'n') {
    x = (width-1)/2.0;
    y = 0 - height*pansize + height/2.0;
  } else if(direction == 'nw') {
    x = 0 - width*pansize + width/2.0;
    y = 0 - height*pansize + height/2.0;
  } else if(direction == 'ne') {
    x = (width-1) + width*pansize - width/2.0;
    y = 0 - height*pansize + height/2.0;
  } else if(direction == 's') {
    x = (width-1)/2.0;
    y = (height-1) + height*pansize - height/2.0;
  } else if(direction == 'sw') {
    x = 0 - width*pansize + width/2.0;
    y = (height-1) + height*pansize - height/2.0;
  } else if(direction == 'se') {
    x = (width-1) + width*pansize - width/2.0;
    y = (height-1) + height*pansize - height/2.0;
  } else if(direction == 'e') {
    x = (width-1) + width*pansize - width/2.0;
    y = (height-1)/2.0;
  } else if(direction == 'w') {
    x = 0 - width*pansize + width/2.0;
    y = (height-1)/2.0;
  }

  //document.mapserv.zoomdir[1].checked = true; // force pan
  document.mapserv.zsize.value = 0;
  document.mapserv.imgxy.value = x + " " + y;
  addDotFormVals();
  document.mapserv.submit();
}


function zoomBox(width, height, minx, miny, maxx, maxy) {    
  var x, y;
  x = (width-1)/2.0;
  y = (height-1)/2.0;
  
  //if (document.getElementById('newdot').style.display=="none") {
  //  document.mapserv.isplacement.value='no';
  // }

  // Now force a pan at center
  //document.mapserv.zoomdir[1].checked = true;
  document.mapserv.imgxy.value = x + " " + y;
  document.mapserv.zsize.value = 0;
  // to the correct mapsize.
  document.mapserv.imgext.value = minx + " " + miny + " " + maxx + " " + maxy;
  addDotFormVals();
  document.mapserv.submit();
}

function showAlaska(width, height) {
  if (document.getElementById('newdot') &&
      document.getElementById('newdot').style.display=="block") {
    zoomBox(width, height, 
	    // anch 750 -149.89451615759,61.196490883103,-149.81286156627,61.256424190193);
	    // 695
	    -149.88840870745872,61.196455628215965,-149.81274211950125,61.251993826120035);

  }
  else {
    zoomBox(width, height, 
	    // 750 -179.54457317073124, 30.62157986900831, -120.0174165199388, 74.31366504008167);
	    // 695
	    -176.32239815890082,35.676725566381435,-121.16056632921917,76.16472449157857);

  }
}
function showHawaii(width, height) {    

  if (document.getElementById('newdot') &&
      document.getElementById('newdot').style.display=="block") {
    zoomBox(width, height, 
	    // Hl 750 -157.89131973667,21.298864388064,-157.80966385192,21.358715620835);
	    // Kihei 695
	    //-156.76001016616,20.571456636781,-156.07900204864,21.070614480679);
	    -156.49016546283,20.747303746495,-156.41449789422,20.80276572915);


    //Honolulu 695 imgext=-157.8852115905137+21.298829620716702+-157.8095450025563+21.354290884564293

  }
  else {
    zoomBox(width, height,
	    // 750 -160.57159249772918, 18.043936709161056, -153.9574658329308, 22.891886563566946);
	    // 696
	    -160.07688120115068,18.041084973952227,-153.94779049176935,22.533518505701775);
  }

}

var scaleArray = [25000000,8333333,2777777,925926,308641,
		  102880,34293,11431,3810,1270,423] ;
var minScales = [12500000,4166666,1388888,462963,154320,
		 //		 51440,17147,5715,1905,635];
		 51440,17147,5715,1905,1005];

function getCurrScale(s) {
  var i = 9;

  while (i >= 0) {
    if (s<minScales[i]) {
      return scaleArray[i+1];
    }
    i--;
  }
  return scaleArray[0]; // i==-1, so i+1==0
}


function setPrePan() {
  if (document.mapserv.zoomdir[0].checked==true) {
    document.mapserv.prepanzdir.value = 1;
  }
  if (document.mapserv.zoomdir[1].checked==true) {
    document.mapserv.prepanzdir.value = 0;
  }
  if (document.mapserv.zoomdir[2].checked==true) {
    document.mapserv.prepanzdir.value = -1;
  }
}

// given element id of iframe, replace its url
// should wrap in js 1.1 tags for replace.
function replaceIframeUrlById(id, URL) {
  var IFrameObj = document.getElementById(id);

  if (0 && document.all) {
    // not needed when add iframe name=""
    document.getElementById(id).src = URL;
    return;
  }

  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument; 
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    // oh well. back button does not work.
  }
  if (IFrameDoc) {
    IFrameDoc.location.replace(URL);
  }
  else {
    //  document.getElementById('myiframe').src = "/show_dotid.php?d=" + bizl_dotid[i] + "&i=" + i + s;
    document.getElementById(id).src = URL;
  }
}


function switchBusiness(i) {

  document.getElementById('myh2a').firstChild.nodeValue=bizl_name[i];
  document.getElementById('myh2a').href = "http://biz.mtrot.com/biz/" + bizl_url[i];
  document.getElementById('myh2a').target = "_website";
  document.getElementById('myh2a2').href = "http://biz.mtrot.com/biz/" + bizl_url[i];
  document.getElementById('myh2a2').target = "_website";
  replaceIframeUrlById('myiframe', "http://biz.mtrot.com/biz/" + bizl_url[i]);
}

// params should start with &
function switchDotInfo(i, i_multi, path, listitem, params) {
  var s = '';
  var pathfull = path + "_full";

  if (path=='show_dotid') { pathfull = 'browse_dot'; }

  if (listitem!=-1) { 
    s = (s + '&litem=' + listitem);
  }
  if (i_multi!=-1) { 
    s = (s + '&i_multi=' + i_multi);
  }
  s = s + params;

  // title myh2a is changed by top.x in show_dotid.
  document.getElementById('myh2a').firstChild.nodeValue='User Posting';
  document.getElementById('myh2a').href =   "/" + pathfull + ".php?d=" + bizl_dotid[i] + "&i=" + i + s;
  document.getElementById('myh2a').target = "_dot";
  document.getElementById('myh2a2').href =   "/" + pathfull + ".php?d=" + bizl_dotid[i] + "&i=" + i + s;
  document.getElementById('myh2a2').target = "_dot";

  replaceIframeUrlById('myiframe', "/" + path + ".php?d=" + bizl_dotid[i] + "&i=" + i + s);
}

// a is internal anchor
function switchListInfo(i, a) {
  var l;
  if (a!='') {
    l = '&litem=' + a;
    a = '#list' + a;
  }
  else {
    l = '';
  }

  document.getElementById('myh2a').firstChild.nodeValue='User List';
  document.getElementById('myh2a').href =   "/show_list_full.php?id=" + i + l + a;
  document.getElementById('myh2a').target = "_dot";
  document.getElementById('myh2a2').href =   "/show_list_full.php?id=" + i + l + a;
  document.getElementById('myh2a2').target = "_dot";

  replaceIframeUrlById('myiframe', "/show_list.php?id=" + i + l + a);
}


function showSmallBusiness(i) {

  if (bizl_url[i]==null || bizl_name[i]==null) return;

  showInfoDisplay();

  // change the biz that's displayed
  switchBusiness(i);
}

function showDotInfoId(id) {
  var i = get_array_index(bizl_dotid, id);
  if (i>-1) {
    return showDotInfo(i, -1);
  }
}

function showDotInfo(i, listitem) {

  if (bizl_dotid[i]==null) return;

  multidot=(i % 2 != 0); // for testing
  multidot=bizl_valid[i]==2;

  if (multidot) {
    if (1) {
      // show a multi-line info display

      // find first dot as representative.
      // show_multidot will do the rest.
      A = get_multidot_indexes(new Array(), i);

      var k, multi_gids = '';
      for (k=0; k<A.length; k++) {
	if (k>0) {multi_gids += 'x';}
	multi_gids += String(bizl_dotid[A[k]]);
      }
      //alert(multi_gids);


      j = A[0];

      showInfoDisplay();


      // change the dot that's displayed
      switchDotInfo(j, i, 'show_multidot', listitem, '&rank=' + min_dot_rank + '&count=' + A.length + '&multigids=' + multi_gids);
    }
    else {
      // just zoom into map

      document.mapserv.zoom.value *= 3;
      //document.mapserv.showonlypopup.value = 1;
      show_popup(0,-1,-1,-1);
    }
  }
  else {
    showInfoDisplay();

    // change the dot that's displayed
    switchDotInfo(i, -1, 'show_dotid', listitem, '');
  }
}

function showListInfo(i, a) {

  showInfoDisplay();

  // change the dot that's displayed
  switchListInfo(i, a);
}

function get_multidot_list(A, i) {
  //document.write("multidot " + i);
  //alert("multidot " + i);
  if (bizl_valid[i]==2 || bizl_valid[i]==3) {
    //alert("rec ");
    get_multidot_list(A,bizl_dottext[i]);
    get_multidot_list(A,bizl_dotid[i]);
  }
  else {
    //document.write(i);
    //document.write(bizl_dotname[i]);

    //alert(bizl_dotname[i]);

    A.push(bizl_dotname[i]);
  }

  return A;
}

// search array for value
function get_array_index(A, val) {
  var i;
  for(i=0; i<A.length; i++) {
    if (A[i]==val) {
      return i;
    }
  }
  return -1;
}

// 2=clustered dot on map, 3=unused bad clustered dot
function get_multidot_root(i) {
  var p;
  while(bizl_valid[i]!=2) {
    p = get_array_index(bizl_dottext, i);
    if (p>-1) {
      i=p;
    } else {
      p = get_array_index(bizl_dotid, i);
      if (p>-1) {
	i=p;
      } else {
	return -1;
      }
    }
  }
  return p;
}

function get_multidot_indexes(A, i) {
  //document.write("multidot " + i);
  //alert("multidot " + i);
  if (bizl_valid[i]==2 || bizl_valid[i]==3) {
    //alert("rec ");
    get_multidot_indexes(A,bizl_dottext[i]);
    get_multidot_indexes(A,bizl_dotid[i]);
  }
  else {
    //document.write(i);
    //document.write(bizl_dotname[i]);

    //alert(bizl_dotname[i]);
    //alert("pushing " + i);

    A.push(i);
  }

  return A;
}


function dump_array(a) {
  var i;

  alert('len=' + a.length);
  for(i=0; i<a.length; i++) {
    alert("p(" + i + ")= " + a[i].url);
    dump_props(a[i]);
  }
  alert('done');
}


function dump_props(obj, objName) {
  var result = "";
  for (var i in obj) {
    result += objName + "." + i + " = " + obj[i] + "<BR>";
    alert(objName + "." + i + " = " + obj[i] );
      
  }
  result += "<HR>";
  return(result);
}
function dumpCallStack()
{
  var stack = new Array();

  //search up the call stack
  for (var frame=dumpCallStack.caller;
       frame!=null; frame=frame.caller)
    {
      var body = frame + "";
      var fname = body.substring(9,body.indexOf('('));
      var trace = fname + "(";
      // dump the arguments (won't display much for objects)
      // those are the breaks... note, doesn't put quotes around strings.
      // but if you need that too... it's not hard to add.
      for (var a=0; a<frame.arguments.length;a++)
	trace += ((a>0)?',':'') + frame.arguments[a];
      stack[stack.length] = trace + ")";
    }

  // reverse it (so we list caller before callee...)
  var stackDownwards = new Array();
  for (var i=stack.length-1;i>=0;i--)
    stackDownwards[stackDownwards.length]=stack[i];

  // dump the call stack
  alert(stackDownwards.join("\n"));
}

function isSmallBizDisplayed() {
  return document.getElementById('myiframe').style.display=="block";
}

var mouseout_allowed = 1;
function hide_popup() {
  //dumpCallStack();
  if (mouseout_allowed) {
    last_popup_i = -1;
    if (document.getElementById('popup')) {
      document.getElementById('popup').style.visibility="hidden";
    }
  }
}
function force_hide_popup() {
  mouseout_allowed = 1;
  hide_popup();
}
function switchPopupSize(mapname) {

  var save_last_popup_i = last_popup_i;
  hide_popup();

  if (save_last_popup_i != -1) {
    document.getElementById('popup').style.visibility="visible";

    var mymap = document.getElementById(mapname);
    // call popup again with new map
    if (last_clip==2) {
      save_last_popup_i = parseInt(save_last_popup_i) + maxSlides + maxNotes;
    }
    var s = (String(mymap.areas[save_last_popup_i].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
    if (last_clip==2) {
      s = s.match(/show_popup.*,/) + "2);";
    }
    //alert(s);
    eval(s);
    //    show_popup('0', -3, 6, 2);
    //(mymap.areas[save_last_popup_i].onmouseover)();
  }
}

function showInfoDisplay() {

  mouseout_allowed = -1; // disallow hiding until after 2 popups, 1 for us, 1 for user.
  document.getElementById('popup').style.visibility="visible";
  //  document.getElementById('bigdiv').style.width="490px"; 

  // small side zoom removed.
  //document.getElementById('side').style.display="none";
  zoomerSwitch(0);
  document.getElementById('alaska').style.left='142px'; 
  // map large
  if (document.getElementById('img2')) {
    document.getElementById('img').style.width="232px"; 
    document.getElementById('img').style.height="340px";
    document.getElementById('img2').style.width="232px"; 
    document.getElementById('img2').style.height="340px";
  }
  else {
    document.getElementById('img').style.width="464px"; 
    document.getElementById('img').style.height="340px";
  }
  document.getElementById('transmap').style.width="464px"; 
  document.getElementById('transmap').style.height="340px";
  document.getElementById('transmap').useMap = "#sample3";

  switchPopupSize("sample3");

  // iframe+hdr displayed
  document.getElementById('myiframe').style.display = "block";
  document.getElementById('myh2').style.display="block";
  document.getElementById('myh2close').style.display="block";
  document.getElementById('myh2closeb').style.visibility="visible";
  if (document.getElementById('titlediv')) {
    document.getElementById('titlediv').style.display="none";
    document.getElementById('side').style.marginTop="0";
  }

  // iframe+hdr visible
  document.getElementById('myiframe').style.visibility="visible";
  document.getElementById('myh2').style.visibility="visible";
  document.getElementById('myh2close').style.visibility="visible";
}


function hideBusiness() {

  switchPopupSize("sample2");

  // iframe+hdr invisible, not displayed
  document.getElementById('myiframe').style.visibility="hidden";
  document.getElementById('myiframe').style.display = "none";
  document.getElementById('myh2').style.visibility="hidden";
  document.getElementById('myh2').style.display="none";
  document.getElementById('myh2close').style.visibility="hidden";
  document.getElementById('myh2close').style.display="none";
  document.getElementById('myh2closeb').style.visibility="hidden";
  if (document.getElementById('titlediv')) {
    document.getElementById('titlediv').style.display="block";
    document.getElementById('side').style.marginTop="16px";
  }

  if(document.getElementById('side').style.display=="none") {
    document.getElementById('side').style.display="block";
  }
  zoomerSwitch(1); // large

  document.getElementById('alaska').style.left='263px'; // 290 - (750-696)/2

  // hide any slideshow elements
  document.getElementById('slidecontrol').style.display="none";
  document.getElementById('slideplay').style.background = "white";

  // map large
  //  document.getElementById('bigdiv').style.width="737px"; //750+42

  if (document.getElementById('img2')) {
    document.getElementById('img').style.width="348px";
    document.getElementById('img').style.height="510px";
    document.getElementById('img2').style.width="348px";
    document.getElementById('img2').style.height="510px";
  }
  else {
    document.getElementById('img').style.width="696px";
    document.getElementById('img').style.height="510px";
  }
  document.getElementById('transmap').style.width="696px";
  document.getElementById('transmap').style.height="510px";
  document.getElementById('transmap').useMap = "#sample2";

  // legend visible
  //document.getElementById('mylegend').style.visibility="visible";

}

function hideBusinessClose() {
  hideBusiness();
  setTimeout(function(){ force_hide_popup(); }, 2000);
}

var timerID = 0;
var currSlide = 0;
var slideTime = 6500;

function changeSlide(delta, keepborder) {
  if(timerID) {
    clearTimeout(timerID);
  }
  if (keepborder==null) {
    document.getElementById('slideplay').style.background = "white";
  }
  currSlide += delta;
  if (currSlide >= maxSlides) {
    currSlide = 0;
  }
  if (currSlide < 0) {
    currSlide = maxSlides - 1;
  }
  //alert("new pic" + currSlide);
  switchBusiness(currSlide);
}

function UpdateTimer() {
  if(timerID) {
    clearTimeout(timerID);
  }
  // do nothing and stop setting timers if we've been closed
  if (document.getElementById('myiframe').style.visibility=="hidden") {
    //alert("hidden");
    timerID = 0;
    return;
  }
  changeSlide(1, 1);
  timerID = setTimeout("UpdateTimer()", slideTime);
}

function showSlideshow() {

  if (maxSlides==0) {
    alert('There are no matching businesses on this map level.\nPlease zoom in further or change your search.');
    return;
  }


  showSmallBusiness(currSlide);
  document.getElementById('slidecontrol').style.display="block";
  clearTimeout(timerID);
  timerID  = setTimeout("UpdateTimer()", slideTime);
  document.getElementById('slideplay').style.background = "#ffdd00";
}

function mtrotBookmark() {
  if (document.all) {
    window.external.AddFavorite(document.location,'Mtrot');
  }
  else {
    alert("Press Ctrl+D to bookmark this page");
  }
}


var notemap;
function nullF() {
}

function helpDot() {
  document.location='/help_dot.php?from=' + escape(document.location);
}

function noNote() {
  helpDot();
  //alert('You must zoom to level 7 or greater to place a note.');
}

function newNote() {

  if (document.getElementById('newdot').style.display=="block") {
    return;
  }

  document.getElementById('searchdiv').style.display="none";
  document.getElementById('newnote').style.display="block";
  notemap = document.getElementById('transmap').useMap;
  document.getElementById('transmap').useMap = "#notedisable";
}

function placeNote() {
  document.getElementById('newnote').style.display="block";
  document.getElementById('noteblink').style.display="block";
  document.getElementById('transmap').useMap = "#noteplace";
}

function closeNote() {
  document.getElementById('searchdiv').style.display="block";
  document.getElementById('newnote').style.display="none";
  document.getElementById('noteblink').style.display="none";
  document.getElementById('transmap').useMap = notemap;
}

// dot funcs
function noDot() {
  helpDot();
  //alert('You must zoom in to level 7 or greater to publish a dot.');
}

function check_find() {
  if (document.search.address.value=='' &&
      document.search.cszip.value=='' &&
      document.search.lstDropDown_First.value=='') {
    alert('Please enter an address or city.');
    return false;
  }
  return true;
}


function newDot() {
  if (document.getElementById('newdot').style.display=="block") {
    closeDot();
    return;
  }
  newDotNoCheck();
}
function newDotNoCheck() {

  if (!document.forms.dotform) {
    helpDot();
    return;
  }

  //alert(document.forms.dotform.dotknown[0].value);
  //alert(document.forms.dotform.dotknown[1].value);
  document.forms.dotform.dotknown[0].checked = true;
  dotAddr();

  document.getElementById('popup').style.visibility="hidden";

  document.getElementById('content').style.height="1300px";

  document.getElementById('searchdiv').style.display="none";
  document.getElementById('newdot').style.display="block";
  notemap = document.getElementById('transmap').useMap;
  document.getElementById('transmap').useMap = "#notedisable";

  if (document.getElementById('enhance').style.display=='none' &&
      (document.forms.dotform.eurl.value!='' ||
       document.forms.dotform.ephone.value!='')) {
    toggleEnhance();
  }
}

function placeDot() {
  document.getElementById('newdot').style.display="block";
  document.getElementById('dotblinkmsg').style.display="block";
  document.getElementById('transmap').useMap = "#dotplace";
}

var hoursDefault = 'e.g, Mon-We, 9a-5p, sat 11a-2p,4-6'; // see mtz
function checkHoursDefault() {
  var userhours = document.getElementById('userhours');
  //alert("checking" + userhours.value);
  if (userhours.value==hoursDefault) {
    userhours.value = '';
    userhours.style.color="#333333";
  }
}
function resetHoursDefault() {
  var userhours = document.getElementById('userhours');
  if (userhours.value.match(/^[\s]*$/m)) {
    userhours.value=hoursDefault;
    userhours.style.color="#777777";
  }
}

function closeDot() {
  document.getElementById('searchdiv').style.display="block";
  document.getElementById('newdot').style.display="none";
  document.getElementById('dotblinkmsg').style.display="none";
  document.getElementById('transmap').useMap = notemap;
  document.mapserv.isplacement.value='no';
  document.getElementById('content').style.height="650px";
  resetHoursDefault();
}

function changeDot() {
  //alert('Click on the map where you want the dot to appear.');
  //document.getElementById('changedottext').firstChild.nodeValue='Click on the map where you want the dot to appear.';
  document.getElementById('changedottext').firstChild.nodeValue='Click the new location on the map';
  notemap = document.getElementById('transmap').useMap;
  document.getElementById('transmap').useMap = "#adjustmap";
}

function changeDotComplete() {
  document.getElementById('changedottext').firstChild.nodeValue='CLICK HERE to move dot';
  document.getElementById('transmap').useMap = notemap;
}

function signupGoto(url) {
  if (document.forms.signup.action!='' &&
      document.forms.signup.action.indexOf('payment_form')==-1) {
    document.forms.signup.signup_goto.value=url;
    document.forms.signup.submit();
  }
  else {
    document.location=url;
  }
}

// setting of default dropdown values
function get_option_selected(list) {
  var gotone = false;
  for(i=0; i<list.options.length; i++) {
    if (list.options[i].selected) {
      return(list.options[i].text);
    }
  }
  return '';
}


// setting of default dropdown values
function get_option_default(list, selected) {
  var gotone = false;
  if (selected=='') return;
  for(i=0; i<list.options.length; i++) {
    if (list.options[i].text==selected || list.options[i].value==selected) {
      list.options[i].selected = true;
      gotone = true;
    } else {
      list.options[i].selected = false;
    }
  }
  if (!gotone) {
    list.options[0].selected = true;
  }
}

var savedPrint;
function fixBeforePrint() {
  // custom IE fn to fix remaining print issues
  if (document.all&&document.getElementById) {

    var kids = document.getElementById('burstp').childNodes;
    for (j=kids.length-1; j >= 0; j--) {
      document.getElementById('burstp').removeChild(kids[j]);
    }

    savedPrint = document.getElementById('side').style.display;
    document.getElementById('side').style.display="none";
  }
}
function fixAfterPrint() {
  // custom IE fn to fix remaining print issues
  if (document.all&&document.getElementById) {
    document.getElementById('side').style.display = savedPrint;
  }
}

function showHiliteId(id) {
  var i, s;
  var mymap = document.getElementById('sample3');
  var A, index;

  for(i=0; i<bizl_dotid.length; i++) {
    if (bizl_dotid[i]==id && bizl_valid[i]<2) { // 0 or 1 ok.
      
      if (bizl_valid[i]==0) {
	index = get_multidot_root(i);
      } else {
	index = i;
      }

      s = (String(mymap.areas[maxSlides + maxNotes + index].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      s = s.match(/show_popup.*,/) + "2);";
      eval(s);
      return;
    }
  }
}
function showPopupId(id, map) {
  var i, s;
  var mymap = document.getElementById(map);
  var A, index;

  for(i=0; i<bizl_dotid.length; i++) {
    if (bizl_dotid[i]==id && bizl_valid[i]<2) { // 0 or 1 ok.
      
      if (bizl_valid[i]==0) {
	index = get_multidot_root(i);
      } else {
	index = i;
      }

      s = (String(mymap.areas[maxSlides + maxNotes + index].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      s = s.match(/show_popup.*,/) + "2);";
      eval(s);
      return;
    }
  }
}

function showHilite(s, listid, listanchor) {
  var i, s;
  var mymap = document.getElementById('sample2');

  for(i=0; i<bizl_name.length; i++) {
    if (bizl_name[i]==s) {
      s = (String(mymap.areas[i].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      eval(s);

      showSmallBusiness(i);
      return;
    }
  }
  for(i=0; i<bizl_dotname.length; i++) {
    if (bizl_dotname[i]==s) {
      s = (String(mymap.areas[maxSlides + maxNotes + i].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      s = s.match(/show_popup.*,/) + "2);";
      eval(s);

      // just change these two lines to alter list click behavior.
      showDotInfo(i, listanchor);
      //showListInfo(listid, listanchor);

      return;
    }
  }
}

function showHiliteFromInfo(s) {
  var i, s;
  var mymap = top.document.getElementById('sample2');

  for(i=0; i<top.bizl_name.length; i++) {
    if (top.bizl_name[i]==s) {
      s = (String(mymap.areas[i].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      eval(s);
      return;
    }
  }

  for(i=0; i<top.bizl_dotname.length; i++) {
    if (top.bizl_dotname[i]==s) {
      s = (String(mymap.areas[top.maxSlides + top.maxNotes + i].onmouseover).match(/show_popup\(.*?,.*?,.*?,.*?\)/)) + ";";
      s = s.match(/show_popup.*,/) + "2);";

      re = /(.*)show_popup(.*)/;
      s = s.replace(re, "$1top.show_popup$2");

      eval(s);
      return;
    }
  }
}

/* see http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html */
/*
 * cssjs
 * written by Christian Heilmann (http://icant.co.uk)
 * eases the dynamic application of CSS classes via DOM
 * parameters: action a, object o and class names c1 and c2 (c2 optional)
 * actions: swap exchanges c1 and c2 in object o
 *			add adds class c1 to object o
 *			remove removes class c1 from object o
 *			check tests if class c1 is applied to object o
 * example:	cssjs('swap',document.getElementById('foo'),'bar','baz');
 */
function cssjs(a,o,c1,c2)
{
	switch (a){
		case 'swap':
			o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
		break;
		case 'add':
			if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
		break;
		case 'remove':
			var rep=o.className.match(' '+c1)?' '+c1:c1;
			o.className=o.className.replace(rep,'');
		break;
		case 'check':
			return new RegExp('\\b'+c1+'\\b').test(o.className)
		break;
	}
}

/*
  Written by Jonathan Snook, http://www.snook.ca/jonathan
  Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
  var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
  var arrReturnElements = new Array();
  strClassName = strClassName.replace(/\-/g, "\\-");
  var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
  var oElement;
  for(var i=0; i<arrElements.length; i++){
    oElement = arrElements[i];      
    if(oRegExp.test(oElement.className)){
      arrReturnElements.push(oElement);
    }   
  }
  return (arrReturnElements)
    }

function zoomerSwitch(makeBig) {
  var A, i;
  A = getElementsByClassName(document.getElementById("zoomer"), "em", "zmt");
  for(i=0; i<A.length; i++) {
    A[i].style.display = makeBig ? "inline" : "none";
  }
  A = getElementsByClassName(document.getElementById("zoomer"), "a", ".*");
  for(i=0; i<A.length; i++) {
    A[i].style.width = makeBig ? "74px" : "14px";
  }

  // large sidebar, no info.
  if (makeBig) {
    document.getElementById('zoomer').style.margin="5px 4px 5px 16px";
    document.getElementById('side').style.width="120px";

    if (IE) document.getElementById('side').style.height="571px"; // see css
    else  document.getElementById('side').style.height="561px"; // see css

    document.getElementById('sideInner').style.display="block";
  }
  else {
    // small sidebar with window
    document.getElementById('zoomer').style.margin="2px";
    document.getElementById('side').style.width="33px";

    if (IE) document.getElementById('side').style.height="414px";
    else document.getElementById('side').style.height="408px";

    document.getElementById('sideInner').style.display="none";
  }
  document.getElementById('side').style.display="block";
  
  ///var mysheet=document.styleSheets[0];
    ////var myrules=mysheet.cssRules? mysheet.cssRules: mysheet.rules;
    ///myrules[28].style.display=="block"; //#side rule.

  document.getElementById('side').style.visibility="visible";
}

function showThis(id) {

  if (document.getElementById(id) &&
      document.getElementById(id).style.display=="none") {
    document.getElementById(id).style.display="block";
  }
}
function hideThis(id) {
  if (document.getElementById(id) &&
      document.getElementById(id).style.display=="block") {
    document.getElementById(id).style.display="none";
  }
}


// Allow menus to drop down by setting class.
function unlockFFMenu() {
  navRoot = document.getElementById("nav2");
  navRoot.className+=" enablehover";
}

var startListInit = false;
function startList(mainpage) {
  navRoot = document.getElementById("nav2");
  for (i=0; i<navRoot.childNodes.length; i++) {
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI" && node.className!="adddot") {
      // IE check
      if (document.all&&document.getElementById) {
	node.onclick=function() {
          if (!startListInit) {
	    // see also errLogin
            startListInit = true;
            realStartList(mainpage);
            this.className+=" over";
            return false;
          }
        }
      } else {
	// add an unlocker function for firefox when clicked first.
	node.onclick=function() {
	  if (!startListInit) {
	    startListInit = true;
	    unlockFFMenu();
	    return false;
	  }
	}
      }
    }
  }
}

function realStartList(mainpage) {
  // IE check
  if (document.all&&document.getElementById) {
    //document.styleSheets(0).rules(0).style.backgroundColor = 'red';
    navRoot = document.getElementById("nav2");
    for (i=0; i<navRoot.childNodes.length; i++) {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI") {
	if (! navigator.vendor) {
	  node.onmouseover=function() {
	    this.className+=" over";
	  }
	  node.onmouseout=function() {
	    this.className=this.className.replace(" over", "");
	  }
	}
      }
    }
  }
}

var IE = document.all?true:false;
if (!IE) {
  document.captureEvents(Event.MOUSEMOVE)
  document.onmousemove = getMouseXY;
}
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  }
  else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX;
    tempY = e.pageY;
  }  
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}  
  return true;
}


var qdrop_on = '0';
function qdrop(s) {
  if (qdrop_on=='0') {
    qdrop_on = '1';
    force_hide_popup();
    document.getElementById(s).style.visibility="visible";
    setTimeout(function(){ 
		 document.getElementById('wrapper').onmousemove= isMenuDoneQD; }, 2000);
  }
  else {
    qdrop_on = '0';
    document.getElementById(s).style.visibility="hidden";
  }
}

function getX(e) {
  var x=0;
  while(e) {
    x += e.offsetLeft;
    e = e.offsetParent;
  }
  return x;
}
function getY(e) {
  var y=0;
  while(e) {
    y += e.offsetTop;
    e = e.offsetParent;
  }
  return y;
}

function simpleOnload() {
  startList(0);
}

function isMenuDone(id, xBuf, yBuf) {
  if (IE && event) {
    tempX = event.clientX + document.body.scrollLeft;
    tempY = event.clientY + document.body.scrollTop;
  }
  return (tempX + xBuf) < getX(document.getElementById(id)) || (tempY + yBuf) < getY(document.getElementById(id)) || (tempX - xBuf) > (getX(document.getElementById(id))+document.getElementById(id).offsetWidth) || (tempY - yBuf) > (getY(document.getElementById(id))+document.getElementById(id).offsetHeight);
}

function isMenuDoneQD() {
  if (isMenuDone('qdroplist', 10, 30)) {
    document.getElementById('wrapper').onmousemove = null;
    qdrop('qdroplist');
  }
}


// End --->
