function getObj(id) {
	// on cherche dans document.all

	try {
		if (eval("typeof(document.all[id])")!="undefined") {
			return document.all[id];
		}
	}
	catch(e) {
	}

	// sinon on cherche dans les formulaires
	for(var i=0; i<document.forms.length; i++) {
		try {
			if (eval("typeof(document.forms[i]."+id+")")!="undefined")
				return eval("document.forms[i]."+id);
		}
		catch(e) {
		}
	}

	// sinon on cherche dans les frames
	for(var i=0; i<document.frames.length; i++) {
		try {
			if (eval("typeof(document.frames[i]."+id+")")!="undefined")
				return eval("document.frames[i]."+id);
		}
		catch(e) {
		}
	}

	// sinon on cherche dans les images
	for(var i=0; i<document.images.length; i++) {
		try {
			if (eval("typeof(document.images[i]."+id+")")!="undefined")
				return eval("document.images[i]."+id);
		}
		catch(e) {
		}
	}

	// pas trouvé !!
	return null;
}

function getClientDim(parent, x, y)
{
	for (var lx=x,ly=y;parent!=null;
		lx+=parent.offsetLeft,ly+=parent.offsetTop,parent=parent.offsetParent);
		
	return {x:lx,y:ly};
}

function getDim(el){
	var _w = el.width;
	var _h = el.height;
	
	for (var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	
	return {x:lx,y:ly,w:_w,h:_h}
}

/* --------------------------------------------------
	Renvoie la valeur d'un radio, ou null si aucun bouton radio n'est sélectionné
*/
function getRadioValue(radioButtonOrGroup) {
  var value = null;
  if (radioButtonOrGroup.length) { // group
    for (var b = 0; b < radioButtonOrGroup.length; b++)
      if (radioButtonOrGroup[b].checked)
        value = radioButtonOrGroup[b].value;
  }
  else if (radioButtonOrGroup.checked)
    value = radioButtonOrGroup.value;
  return value;
}

/* --------------------------------------------------
	Active le bouton radio de valeur donnée
*/
function setRadioValue(radioButtonOrGroup, value) {
  if (radioButtonOrGroup.length) { // group
    for (var b = 0; b < radioButtonOrGroup.length; b++)
      radioButtonOrGroup[b].checked = (radioButtonOrGroup[b].value == value)
  }
  else
    radioButtonOrGroup.checked = (radioButtonOrGroup.value == value);
}
