function reload(){ //reload della pagina corrente
var loc = window.location.href;
window.location.href = loc;
}


function getElementsByClassName(aClassName){
	var elements = ( document.all ) ? document.all : document.getElementsByTagName("*")
	var results = [];
	for (var i=0, j=elements.length; i<j; ++i){
		x = elements[i];
		if (x.className && (x.className == aClassName)){
			results[results.length] = x;
		}
	}
	return results;
}	

function defined(x) {
    // returns if x is defined
    return (typeof arguments[0] != "undefined");
}

function GetElementPosition ( el ){
	// Initializes the Coordinates object that will be returned by the function.
	var c = { X:0, Y:0 } ;
	
	// Loop throw the offset chain.
	while ( el )
	{
		c.X += el.offsetLeft ;
		c.Y += el.offsetTop ;
		
		el = el.offsetParent ;
	}
	
	// Return the Coordinates object
	return c ;
}

function getElementSize(elem) {
    // returns a Rectangle with the size of the element
    var width = 0;
    var height = 0;
    if (defined(elem.offsetWidth)) {
	width = elem.offsetWidth;
	height = elem.offsetHeight;
    } else if (defined(elem.width)) {
	width = elem.width;
	height = elem.height;
    } else if (defined(elem.clip.width)) {
		width = elem.clip.width;
		height = elem.clip.height;
    } else {
	alert("unable to get size of "+elem+" (id:"+elem.id+")");
    }
	var size = new Object();
	size.width = parseInt(width);
	size.height = parseInt(height);
	return size;
}

function getObj(id) {
	return document.getElementById (id);
}

	 
function getTags(id,tagName) {
	return getObj(id).getElementsByTagName(tagName);
}

	

