function filesize(file, id) {

    var xmlHttpObj = null;
    var size = null;
    var risposta = null;
   
    if (typeof XMLHttpRequest != "undefined") {
        xmlHttpObj = new XMLHttpRequest();
    }
    else {
        try {
            xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) {
                xmlHttpObj = null;
            }
        }
    }


    xmlHttpObj.open("HEAD", file, true);
         
    xmlHttpObj.onreadystatechange = function() {
        if (xmlHttpObj.readyState == 4) {
            switch(xmlHttpObj.status) {
            
                case 200: // Page found
                case 304: // Status Code on Opera when page reload
                     size = xmlHttpObj.getResponseHeader("Content-Length");
		     if (size<1001){
		     	risposta="&#160; ("+size+" byte)";
		     	document.getElementById(id).innerHTML = risposta;
			} 
			else
			{
			risposta="&#160; ("+Math.round(size / 1000)+" Kb)";
			document.getElementById(id).innerHTML = risposta;
			}
                     return;
                     break;
                     
                case 0: // Worong protocol
                    //alert("Can't load file using 'file://' protocol")
                    return;
                    break;
                    
                case 404: // Page not found
                    //alert("File not found: "+file);
                    return;
                    break;
                    
                default:
                    //alert("Unrecognized status code: ["+xmlHttpObj.status+"]")
                    return;
                    break;
            }
        }            
    }          
    xmlHttpObj.send(null); 
    delete xmlHttpObj;
    

}
