// JavaScript Document

// sidebar events
//function myclick(m){ GEvent.trigger(marker[i], "click");}
function glo(m){ marker[m].setImage("../icon/town-glo.gif"); }
function dim(m){ marker[m].setImage("../icon/town-dim.gif");}
function attractionGlo(m,type){ marker[m].setImage("../icon/"+type+"-glo.gif"); }
function attractionDim(m,type){ marker[m].setImage("../icon/"+type+".gif"); }


function glotowns() {
  if (!document.getElementsByTagName) return false;
  var spans = document.getElementsByTagName("a");
  for (var i=0; i < spans.length; i++) {
    if (spans[i].className.match("town")) {
      spans[i].onmouseover = function() {glo(this.id);}
      spans[i].onmouseout = function() {dim(this.id);      }
			spans[i].onclick = function() {
				//document.location = 'http://www.wheretostay.co.za/accommodation/'+ this.id;
				// open the window
			}
    } //end of if not compatible browser
  } //end of loop
} //end of function

function highlight() { //for special cats (/accommodation/)
  if (!document.getElementsByTagName) return false;
  var spans = document.getElementsByTagName("tr");
  for (var i=0; i < spans.length; i++) {
    if (spans[i].className.match("link")) {
      spans[i].onmouseover = function() {
        this.style.backgroundColor = '#FFCC66';
      }
      spans[i].onmouseout = function() {
        this.style.backgroundColor = '#FFFFFF';
      }
			spans[i].onclick = function() {
				document.location = 'http://www.wheretostay.co.za/accommodation/'+ this.id;
			}
    } //end of if
  } //end of loop
} //end of function

  function estLink() {
    if (!document.getElementsByTagName) return false;
    var spans = document.getElementsByTagName("span");
    for (var i=0; i < spans.length; i++) {
      if (spans[i].className.match("link")) {
        spans[i].onmouseover = function() {
          this.style.backgroundColor = '#ffeeee';
        }
        spans[i].onmouseout = function() {
          this.style.backgroundColor = '#eeffff';
        }
				spans[i].onclick = function() {
					document.location = 'http://www.wheretostay.co.za/'+ this.id;
				}
      } //end of if
    } //end of loop
  } //end of function

