/* init */

var nowdate = new Date;
var now = nowdate.getTime();

function usersinitrefresh() {
	var http = gethttp();
	http.onreadystatechange = function() { usershookrefresh(http); };
	http.open('GET', 'http://www.hypodea.com/fluffs/ajax.xml', true);
	http.send(null);
}

function usershookrefresh(http) {
	if(http.readyState == 4) {
		if(http.status == 200) {
			var xmldoc = http.responseXML;
			var x = xmldoc.getElementsByTagName('user');
			alert('Here we go. yoyo ' + x.length);
			for(i = 0; i < x.length; i++) {
				// alert(x[i].getElementsByTagName('i')[0].childNodes[0].nodeValue)
				alert(x[i].attributes['i'].value);
			}
		}
	}

}


function gethttp() {
	var xmlhttp;

        if (window.XMLHttpRequest) { // Mozilla, Safari,...
            xmlhttp = new XMLHttpRequest();
            if (xmlhttp.overrideMimeType) {
                xmlhttp.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!xmlhttp) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }

	return xmlhttp;
}
