// JavaScript Document

function roundNumber(num, dec) {
  var result = String(Math.round(num*Math.pow(10,dec))/Math.pow(10,dec));
  if(result.indexOf('.')<0) {result+= '.';}
  while(result.length- result.indexOf('.')<=dec) {result+= '0';}
  return result;
}

function erase_if_default(oID){
	
	oCurrent_Object = document.getElementById(oID);
	
	iEN_Initial = oCurrent_Object.value.indexOf('earch');
	iFR_Initial = oCurrent_Object.value.indexOf('echerche');
	
	//alert(oID);
	
	if(iEN_Initial>0 || iFR_Initial>0){
		oCurrent_Object.value='';
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) selObj.selectedIndex=0;
}

function delete_check(delete_url) {
	if (confirm('Voulez-vous vraiment effacer cette entrée (irréversible) ?')) {
		window.location.href=delete_url;
	}
}

function clearSelection() {
    if(document.selection && document.selection.empty) {
        document.selection.empty();
    } else if(window.getSelection) {
        var sel = window.getSelection();
        sel.removeAllRanges();
    }
}

function Set_focus(vModule){
	var bFound = false;
	oForm = document.getElementById(vModule);
	if(oForm){
		for(i=0; i < oForm.length; i++)
		{
		  if (oForm[i].type == "text")
		  {
			if (oForm[i].disabled != true)
			{
				oForm[i].focus();
				var bFound = true;
			}
		  }
		  if (bFound == true)
			break;
		}
	}
}
