function isDefined(obj) { return (typeof(obj) != "undefined"); } function JSRequest() { var ivIsSupported = true; var ivUA = null; this.openURL = openURL; this.openXMLURL = openXMLURL; this.openPOSTURL = openPOSTURL; this.initialize = initialize; this.isActive = isActive; function initialize() { } function _init() { if (!ivIsSupported || ivUA != null) return; with (document) { try { if (window.XMLHttpRequest) ivUA = new XMLHttpRequest(); else ivUA = new ActiveXObject("Microsoft.XMLHTTP"); ivIsSupported = isDefined(ivUA.readyState); } catch (ex) { ivIsSupported = false; } } } function isActive() { if (ivIsSupported && ivUA == null) _init(); return ivIsSupported && ivUA != null; } function openURL(url) { if (ivIsSupported && ivUA == null) _init(); if (!ivIsSupported || ivUA == null) return null; var absUrl = 'http://www.faredanza.it/' + url; myRand = parseInt(Math.random() * 99999999); ivUA.open("GET", absUrl + "&myRand=" + myRand, false); ivUA.send(null); return ivUA.responseText; } function openXMLURL(url) { if (ivIsSupported && ivUA == null) _init(); if (!ivIsSupported || ivUA == null) return null; var absUrl = 'http://www.faredanza.it/' + url; myRand = parseInt(Math.random() * 99999999); ivUA.open("GET", absUrl + "&myRand=" + myRand, false); ivUA.send(null); return ivUA.responseXML; } function openPOSTURL(url,params) { if (ivIsSupported && ivUA == null) _init(); if (!ivIsSupported || ivUA == null) return null; var absUrl = 'http://www.faredanza.it/' + url; ivUA.open("POST", absUrl, false); ivUA.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); ivUA.setRequestHeader("Content-length", params.length); ivUA.setRequestHeader("Connection", "close"); ivUA.send(params); return ivUA.responseText; } } function loadXMLFile(xml) { if (window.ActiveXObject) { var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; xmlDoc.load('http://www.faredanza.it/' + xml); return xmlDoc.documentElement; } else if (document.implementation && document.implementation.createDocument) { var xmlDoc = document.implementation.createDocument("","",null); xmlDoc.async = false; xmlDoc.load('http://www.faredanza.it/' + xml); return xmlDoc; } }