function LogView(containerId, container, mapObject) {	this.mapObject = mapObject;	this.mapManagerEvent = null;	this.chkScope = null;	this.page = 1; 	this.totpages = 0; 	this.numresults = 0;	this.sql = '';	this.HilightColor = '#FFFF00';	this.BackgroundColor = 'transparent';	this.CellBackgroundColor = '#F0E8E8';	this.titleFont = 'Verdana, Arial, Helvetica, sans-serif';	this.titleFontColor = '#FFFFFF';	this.titleFontBold = 'normal';	this.titleFontSize = '8pt';	this.font = 'Verdana, Arial, Helvetica, sans-serif';	this.fontColor = '#FFFFFF';	this.fontBold = 'normal';	this.fontSize = '8pt';	this.SelectedIndex = -1;	this.onItemClick = null;	this.Box = document.createElement('DIV');	this.Box.style.position = 'relative';	this.Box.style.top = 0;	this.Box.style.left = 0;	this.Box.style.width = '99%';	this.Box.style.height = '100%';	this.Box.style.border = '1px inset silver';	this.Box.style.overflow = 'auto';	this.Box.style.fontSize = '9pt';	this.Box.style.backgroundColor = this.BackgroundColor;	this.Box.style.textAlign = 'left';	if (container == null) {		if (containerId != null) {			container = document.getElementById(containerId);		}	}	if (container == null) {		container = document.body;	}	container.appendChild(this.Box);	this.Table = document.createElement('TABLE');	this.TableBody = document.createElement("TBODY");	this.Table.appendChild(this.TableBody);	this.Box.appendChild(this.Table);	this.Table.border = 0;	this.Table.style.margin = 0;	this.Table.style.padding = 0;	this.Table.bgColor = this.BackgroundColor;	var oRow = document.createElement('TR');	var oCell = document.createElement('TD');	oCell.style.border = '0px';	oCell.style.backgroundColor = this.BackgroundColor;	oCell.innerHTML = '&nbsp;';	oCell.style.width = '16px';	oRow.appendChild(oCell);	this.cellTop = document.createElement('TD');	this.cellTop.style.border = '0px';	this.cellTop.style.textAlign = 'left';	this.cellTop.style.paddingBottom = '4px';	this.cellTop.style.backgroundColor = this.BackgroundColor;	oRow.appendChild(this.cellTop);	this.TableBody.appendChild(oRow);		this.allItems = new Array();}LogView.prototype.logitemClick = function(ev, obj) {	if (obj != null) {		var lview = obj.listview;		if (!lview) {			obj = obj.parentNode;			lview = obj.listview;		}		var sId = obj.id;		var iblogId = obj.blogId;		this.selectItem(iblogId);	}}LogView.prototype.changeTrackingMode = function(ev, obj) {	if (this.chkScope.checked) {		this.mapManagerEvent = GEvent.bind(this.mapObject.map, "moveend", this, this.loadObjectsViewport);		this.loadObjectsViewport();	} else {		GEvent.removeListener(this.mapManagerEvent);		this.loadObjects();	}}LogView.prototype.createLogListCallback = function(httpObj, owner) {	if (httpObj.readyState == 4) {		if (httpObj.status == 200) {			owner.processXML(GXml.parse(httpObj.responseText));		}	}}LogView.prototype.setMapTracking = function(bTrack) {	this.chkScope = document.createElement('INPUT');	this.chkScope.type = 'checkbox';	this.cellTop.appendChild(this.chkScope);	var oTxt = document.createElement('SPAN');	oTxt.innerHTML = '&nbsp; limita all\'area visualizzata';	this.cellTop.appendChild(oTxt);	GEvent.bindDom(this.chkScope, "click", this, this.changeTrackingMode);}LogView.prototype.loadObjects = function() {	var d = new Date();	sUrl = 'get_last_blogs.php?dummy=' + d.getTime();	this.mapObject.downloadUrl(sUrl, this.createLogListCallback, this);}LogView.prototype.loadObjectsViewport = function() {	var d = new Date();	sUrl = 'get_last_blogs.php?dummy=' + d.getTime() + '&' + this.mapObject.getViewport();	this.mapObject.downloadUrl(sUrl, this.createLogListCallback, this);	//GLog.write(sUrl);}LogView.prototype.SetVisible = function(bVisible) {	if (bVisible) {		this.Box.style.display = 'block';	} else {		this.Box.style.display = 'none';	}}LogView.prototype.SetHeight = function(iHeight) {	this.Box.style.height = iHeight; // + 'px';}LogView.prototype.SetWidth = function(iWidth) {	this.Box.style.width = iWidth; // + 'px';}LogView.prototype.GetDOMContainer = function() {	return this.Box;}LogView.prototype.SetBackgroundColor = function(bgcol) {	this.BackgroundColor = bgcol;	this.Box.style.backgroundColor = this.BackgroundColor;	this.Table.bgColor = this.BackgroundColor;}LogView.prototype.SetCellBackgroundColor = function(bgcol) {	this.CellBackgroundColor = bgcol;}LogView.prototype.SetHilightColor = function(hlcol) {	this.HilightColor = hlcol;}LogView.prototype.SetFont = function(sFont) {	this.font = sFont;	this.Table.style.fontFamily = sFont;}LogView.prototype.SetFontColor = function(sFontCol) {	this.fontColor = sFontCol;	this.Table.style.color = sFontCol;}LogView.prototype.SetFontBold = function(bBold) {	if (bBold) {		this.fontBold = 'bold';	} else {		this.fontBold = 'normal'; 	}	this.Table.style.fontWeight = this.fontBold;}LogView.prototype.SetFontSize = function(iFontSize) {	this.fontSize = iFontSize + 'pt';	this.Table.style.fontSize = this.fontSize;}LogView.prototype.SetTitleFont = function(sFont) {	this.titleFont = sFont;}LogView.prototype.SetTitleFontColor = function(sFontCol) {	this.titleFontColor = sFontCol;}LogView.prototype.SetTitleFontBold = function(bBold) {	if (bBold) {		this.titleFontBold = 'bold';	} else {		this.titleFontBold = 'normal';	}}LogView.prototype.SetTitleFontSize = function(iFontSize) {	this.titleFontSize = iFontSize + 'pt';}LogView.prototype.setBorder = function(sBorderStyle) {	this.Box.style.border = sBorderStyle;}LogView.prototype.addItem = function(vId, blogId, sNazione, sLabel, sSummary, oMapObject) {	var iId = parseInt(vId);	var newItem = new LogItem(this, iId, blogId, sNazione, sLabel, sSummary, oMapObject);	if (newItem != null) {		this.allItems[blogId] = newItem;		this.TableBody.appendChild(newItem.oRow);	}	return newItem;}LogView.prototype.selectItem = function(sId) {	var iId = parseInt(sId);	//alert(this.SelectedIndex + ' ' + iId);	if (this.SelectedIndex != iId) {		if (this.SelectedIndex > 0) {			this.allItems[this.SelectedIndex].Select(false);		}		this.SelectedIndex = iId;		this.allItems[iId].Select(true);		this.itemClick(sId);	}}LogView.prototype.itemClick = function(sId) {	if (this.onItemClick != null) {		var iId = parseInt(sId);		this.onItemClick(this.allItems[iId]);	}}LogView.prototype.removeItem = function(vId) {	var iId = parseInt(vId);	var oItem = this.allItems[iId];	this.TableBody.removeChild(oItem.oRow);	this.allItems[iId] = null;	if (this.SelectedIndex != -1) {		this.SelectedIndex = -1;	}}LogView.prototype.removeAll = function() {	for (var i = 0; i < this.allItems.length; i++) {		if (this.allItems[i]) {			this.removeItem(i);		}	}}LogView.prototype.processXML = function(xmlobj) {	this.removeAll();	var xdoc = xmlobj.documentElement;	this.numresults = xdoc.getAttribute("num");	this.page = parseInt(xdoc.getAttribute("pag")); 	this.totpages = parseInt(xdoc.getAttribute("totpages")); 	this.sql = GXml.value(xdoc.getElementsByTagName("RICERCA")[0]);	var polygons = xdoc.getElementsByTagName("POLYGON");	if (polygons.length > 0) {		var xpolygon = null;		var titolo = '';		var testo = '';		var nazione = '';		var polId = 0;		var catId = 0;		var punti = null;		var path = null;		var nvertici = 0;		var vertici = null;		for (var j = 0; j < polygons.length; j++) {			xpolygon = polygons[j];			nazione = GXml.value(xpolygon.getElementsByTagName("NAZIONE")[0]);			titolo = GXml.value(xpolygon.getElementsByTagName("TITOLO")[0]) + ' (<i>' + GXml.value(xpolygon.getElementsByTagName("DATA_INS")[0]) + '</i>)';			testo = GXml.value(xpolygon.getElementsByTagName("SOMMARIO")[0]) + '<br><br>';			if (titolo == '') {				titolo = 'Senza nome';			}			polId = parseInt(xpolygon.getAttribute("id"));			blogId = parseInt(xpolygon.getAttribute("id_entry"));			this.addItem(polId, blogId, nazione, titolo, testo, xpolygon);		}	}	return this.numresults;}function LogItem(oContainer, nId, blogId, sNazione, sLabel, sSummary, oMapObject) {	this.Selected = false;	this.cont = oContainer;	this.id = nId;	this.blogId = blogId;	this.label = sLabel;	this.oRow = document.createElement('TR');	this.oRow.style.backgroundColor = this.cont.CellBackgroundColor;	this.oRow.style.cursor = 'pointer';	this.oCell0 = document.createElement('TD');	this.oCell1 = document.createElement('TD');	this.oLabel = document.createElement('SPAN');	this.oText = document.createElement('SPAN');	this.oCell0.style.verticalAlign = 'top';	this.oCell0.style.color = this.cont.titleFontColor;	this.oCell0.style.fontFamily = this.cont.titleFont;	this.oCell0.style.fontSize = this.cont.titleFontSize;	this.oCell0.style.fontWeight = this.cont.titleFontBold;	this.oCell0.style.border = '0px';	//this.oCell0.style.borderBottom = '1px solid #000080';	this.oCell0.innerHTML = '<img src=\"img/list_item.gif\">';		this.oCell1.style.verticalAlign = 'top';	this.oCell1.style.border = '0px';	this.oCell1.style.borderBottom = '1px solid #000080';		this.oLabel.style.color = this.cont.titleFontColor;	this.oLabel.style.fontFamily = this.cont.titleFont;	this.oLabel.style.fontSize = this.cont.titleFontSize;	this.oLabel.style.fontWeight = this.cont.titleFontBold;	this.oLabel.innerHTML = sLabel;	this.oLabel.listview = this.cont;	this.oLabel.id = 'labl' + nId;	this.oLabel.blogId = blogId;	GEvent.bindDom(this.oLabel, "click", this.cont, this.cont.logitemClick);	this.oText.style.color = this.cont.fontColor;	this.oText.style.fontFamily = this.cont.font;	this.oText.style.fontSize = this.cont.fontSize;	this.oText.style.fontWeight = this.cont.fontBold;	this.oText.innerHTML = sSummary;	this.oText.listview = this.cont;	this.oText.id = 'text' + nId;	this.oText.blogId = blogId;	GEvent.bindDom(this.oText, "click", this.cont, this.cont.logitemClick);		this.oRow.appendChild(this.oCell0);	this.oRow.appendChild(this.oCell1);	this.oCell1.appendChild(this.oLabel);	this.oCell1.appendChild(document.createElement('BR'));	this.oCell1.appendChild(this.oText);	this.objXML = oMapObject;}LogItem.prototype.Select = function(isSelected) {	if (isSelected) {		this.oRow.cells[1].style.backgroundColor = this.cont.HilightColor;		this.Selected = true;	} else {		this.oRow.cells[1].style.backgroundColor = this.cont.CellBackgroundColor;		this.Selected = false;	}}
