/* ASPItalia.com BlackAthena Javascript Library codename 'squizzy' Copyright 2006 ASPItalia.com - All rights reserved */ var ASPItalia = new Object(); //namespace ASPItalia.TabLayers = function(Layers, firstPanel) { this.lastPanelId = firstPanel; this.layers = Layers; this.ShowPanel = function (id) { for (var i = 0; i< this.layers.length; i++) { if (this.layers[i][0] == id) { this.show(id); this.layers[i][2] = 1; if (this.layers[i][1] != null) this.LoadPanel(id, this.layers[i][1] + '&dt=' + new Date().getDate()); } else { this.hide(this.layers[i][0]); this.layers[i][2] = 1; } } this.lastPanelId = id; } this.RestorePanel = function () { this.ShowPanel(this.lastPanelId); } this.show = function (id) { document.getElementById(id).style.display = 'block'; document.getElementById(id + '_button').className = id + '_button_active'; } this.hide = function (id) { document.getElementById(id).style.display = 'none'; document.getElementById(id + '_button').className = ''; } this.LoadPanel = function (id, url) { try { this.SendRequest(id, url); } catch (er) { this.OnError(id, er); } } this.SendRequest = function (id, url) { var request; var data = null; // IE if (navigator.userAgent.indexOf('MSIE') > 0) { request = new ActiveXObject("Microsoft.XMLHTTP"); // Avvio operazione asincrona request.Open("GET", url + "&dt=" + new Date(), true); } else { request = new XMLHttpRequest(); request.open('GET', url, true, null, null); } request.onreadystatechange = function() { if (request.readyState == 4) { try { document.getElementById(id).innerHTML = request.responseText; /*document.getElementById(id).focus();*/ } catch (er) { OnError(id, er); } } } request.send(data); } this.OnError = function (id, er) { document.getElementById(id).innerHTML = er.message; } }