function HotelsControl() { } // display single hotel in the hotels control HotelsControl.prototype.displayHotelInfo = function(hotelMarker, selected) { // insert a new row that contains only on cell in the table var table = document.getElementById("hotelsTable"); var row = table.insertRow(table.rows.length); var cell = row.insertCell(0); cell.setAttribute("nowrap", "true"); var a = document.createElement("a"); GEvent.bindDom(row, "click", hotelMarker, hotelMarker.openInfoWindowNoLoad); GEvent.bindDom(a, "mouseover", this, function() {document.body.style.cursor = 'pointer';}); GEvent.bindDom(a, "mouseout", this, function() {document.body.style.cursor = 'default';}); a.setAttribute("title", hotelMarker.name.toUpperCase()); if (selected == true) { a.style.fontWeight = "bold"; a.appendChild(document.createTextNode(this.limit(hotelMarker.name.toUpperCase(), 20))); } else { a.appendChild(document.createTextNode(this.limit(hotelMarker.name.toUpperCase(), 28))); } cell.appendChild(a); } HotelsControl.prototype.limit = function(string, limit) { if (string.length > limit) { return string.substring(0, limit) + '...'; } else { return string; } } HotelsControl.prototype.reset = function() { var rowsLength = document.getElementById("hotelsTable").rows.length; for (var i = 0; i < rowsLength; i++) { // always delete first row in the loop as this.hotelsTable is going to change // after deletion document.getElementById("hotelsTable").deleteRow(0); } }