//function sdbInfoWindow(recordIds) {function sdbInfoWindow(recordIds) {//this.stolenTitle = '<label for = "stolen">Stolen:&nbsp;$</label>';//this.damageTitle = '<label for = "damage">Damage:&nbsp;$</label>';// This is an array containing the record IDs // that will be displayed by this info window set when the window object is created	//this.recordIds = recordIds;sdbInfoWindow.prototype.createInfoContainerDiv = function() {var div = document.createElement("div");div.setAttribute("id", "infoWindow");return div;}sdbInfoWindow.prototype.createInfoWindowNav = function(binId, numRecords) {//logger.writeLog("createInfoWindowNav received binId " + binId + " which contains " + numRecords + " records");var infoNav = document.createElement("div");infoNav.setAttribute("id", "infoNav");infoNav.setAttribute("binId", binId);infoNav.setAttribute("currentIndex", 0);infoNav.setAttribute("numRecords", numRecords);// Create the navigation buttonsvar prevLink = document.createElement("a");//nextLink.setAttribute("href", "javascript:next(' + binId + ', ' + (numrecords-1)");try {//var alertString = "javascript:mySDBInfoWindow.previous(" + (numRecords-1) + ")";var alertString = "javascript:mySDBInfoWindow.previous()";prevLink.setAttribute("href", alertString);prevLink.className = "previous";}catch (e) {alert(e);}var leftNav = document.createElement("p");leftNav.innerHTML = "Previous";prevLink.appendChild(leftNav);try {var nextLink = document.createElement("a");var alertString = "javascript:mySDBInfoWindow.next()";nextLink.setAttribute("href", alertString);nextLink.className = "next";}catch (e) {alert(e);}var rightNav = document.createElement("p");rightNav.innerHTML = "Next";nextLink.appendChild(rightNav);// Create the status displayvar status = document.createElement("p");status.className = "status";status.innerHTML = "1 of " + numRecords;//status.innerHTML = "1 of " + size;infoNav.appendChild(prevLink);infoNav.appendChild(nextLink);infoNav.appendChild(status);return infoNav;}sdbInfoWindow.prototype.createContentDiv = function(recordId) {//logger.writeLog("createContentDiv received recordId " + recordId);var markerObj = markers[recordId];/*try {		var info = "";for (element in markerObj) {info += element + ": " + markerObj[element] + "\n";}alert(info);}catch (e) {alert("createContentDiv: " + e);}*/var div = new Array();var divNode = document.createElement("div");divNode.setAttribute("id", "infoContent");var descHTML = "<p>" + markerObj.description + "</p>";var typeHTML = "<table><tr><td class='title'><p class='title'>Type:</p></td><td><p>" + markerObj.TYPE+ "</p></td></tr>";	var locationHTML = "<tr><td class='title'><p class='title'>Name:</p></td><td><p>" + markerObj.NAME+ "</p></td></tr>";var streetHTML = "<tr><td class='title'><p class='title'>Address:</p></td><td><p>" + markerObj.ADDRESS + "</p></td></tr>";var cityHTML = "<tr><td class='title'><p class='title'>City:</p></td><td><p>" + markerObj.CITY + "</p></td></tr>";var stateHTML = "<tr><td class='title'><p class='title'>State:</p></td><td><p>" + markerObj.STATE + "</p></td></tr>";var zipHTML = "<tr><td class='title'><p class='title'>Postal Code:</p></td><td><p>" + markerObj.ZIP + "</p></td></tr></table>";divNode.innerHTML = descHTML +typeHTML+ locationHTML + streetHTML +cityHTML+stateHTML+zipHTML;        /*if (markerObj.stolen != 0) {var stolenPara = document.createElement("p");stolenPara.className = "left";stolenPara.innerHTML = this.stolenTitle + markerObj.stolen.toString();divNode.appendChild(stolenPara);}if (markerObj.damage != 0) {var damagePara = document.createElement("p");damagePara.className = "left";damagePara.innerHTML = this.damageTitle + markerObj.damage.toString();divNode.appendChild(damagePara);}        *//*for (element in markerObj) {logger.writeLog(element + ": " + markerObj[element]);}*/return divNode;}/*sdbInfoWindow.prototype.updateContentDiv = function(binId, index) {logger.writeLog("updateContentDiv" + recordId);var markerObj = markers[markerBinArray[index]];var contentDiv = document.createElement("div");contentDiv.setAttribute("infoIndex", index);var nameDiv = document.createElement("p");nameDiv.innerHTML = markerObj.name;var infoDiv = document.createElement("p");infoDiv.innerHTML = markerObj.info;contentDiv.appendChild(nameDiv);contentDiv.appendChild(infoDiv);return contentDiv;}*/sdbInfoWindow.prototype.createInfoWindowDiv = function(binId, recordIds) {//logger.writeLog("createInfoWindowDiv received " + recordIds.length + " records");var infoContainer = this.createInfoContainerDiv();if (recordIds.length > 1) {var infoNav = this.createInfoWindowNav(binId, recordIds.length);// This div is used to separate the navbar from the content - necessary when// floating div styles are used, as they are in the navbarvar clear = document.createElement("div");// Set the class name - this allows us to apply CSS style to the divclear.className = "clear";infoContainer.appendChild(infoNav);infoContainer.appendChild(clear);}// Create a content div with the first record from the set points that// will be displayed in this windowvar contentDiv = this.createContentDiv(recordIds[0]);infoContainer.appendChild(contentDiv);return infoContainer;}sdbInfoWindow.prototype.previous = function() {var infoNavDiv = document.getElementById("infoNav");var binId = infoNavDiv.getAttribute("binId");var currentIndex = parseInt(infoNavDiv.getAttribute("currentIndex"));var numRecords = infoNavDiv.getAttribute("numRecords");// No need to fetch a new record if there's only oneif (numRecords == 1) {return;}//logger.writeLog("previous received binId: " + binId + ", currentIndex: " + currentIndex + ", numRecords: " + numRecords);var myMarkerBin = markerBinArray[binId];var recordIds = myMarkerBin.recordIds;var infoWindow = document.getElementById("infoWindow");	infoWindow.removeChild(infoWindow.lastChild);if (currentIndex != 0) {infoNavDiv.setAttribute("currentIndex", (currentIndex-1));var newDiv = this.createContentDiv(recordIds[currentIndex-1]);infoWindow.appendChild(newDiv);infoNavDiv.lastChild.innerHTML = currentIndex + " of " + numRecords;}else {infoNavDiv.setAttribute("currentIndex", (numRecords-1));var newDiv = this.createContentDiv(recordIds[numRecords-1]);infoWindow.appendChild(newDiv);infoNavDiv.lastChild.innerHTML = numRecords + " of " + numRecords;}}sdbInfoWindow.prototype.next = function() {var infoNavDiv = document.getElementById("infoNav");var binId = infoNavDiv.getAttribute("binId");var currentIndex = parseInt(infoNavDiv.getAttribute("currentIndex"));var numRecords = infoNavDiv.getAttribute("numRecords");// No need to fetch a new record if there's only oneif (numRecords == 1) {return;}//logger.writeLog("next received binId: " + binId + ", currentIndex: " + currentIndex + ", numRecords: " + numRecords);var myMarkerBin = markerBinArray[binId];var recordIds = myMarkerBin.recordIds;var infoWindow = document.getElementById("infoWindow");	infoWindow.removeChild(infoWindow.lastChild);if (currentIndex != numRecords-1) {infoNavDiv.setAttribute("currentIndex", (currentIndex+1));var newDiv = this.createContentDiv(recordIds[currentIndex+1]);infoWindow.appendChild(newDiv);infoNavDiv.lastChild.innerHTML = (currentIndex + 2) + " of " + numRecords;}else {infoNavDiv.setAttribute("currentIndex", 0);var newDiv = this.createContentDiv(recordIds[0]);infoWindow.appendChild(newDiv);infoNavDiv.lastChild.innerHTML = "1 of " + numRecords;}}}