var objRequete;
if(navigator.appName.search("Microsoft")>-1){
	objRequete= new ActiveXObject("Msxml2.XMLHTTP");
}else{
	objRequete= new  XMLHttpRequest();
}

// Fonction de "http://www.pbdr.com/vbtips/asp/JavaNumberValid.htm"
function is_numeric( strString ){
// check for valid numeric strings
    var strValidChars = "0123456789.-";
    var strChar;
    var blnResult = true;
    if (strString.length == 0) return false;
    // test strString consists of valid characters listed above
    for (i = 0; i < strString.length && blnResult == true; i++){
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1){
			blnResult = false;
		}
    }
    return blnResult;
}
//Fonction d'impression de zone.
function imprime_zone(titre, obj) {
	// Définie la zone à imprimer
	var zi = document.getElementById(obj).innerHTML;
	
	// Ouvre une nouvelle fenetre
	var f = window.open("", "ZoneImpr", "height=500, width=600,toolbar=0, menubar=0, scrollbars=1, resizable=1,status=0, location=0, left=10, top=10");
	
	// Définit le Style de la page
	f.document.body.style.color = '#000000';
	f.document.body.style.backgroundColor = '#FFFFFF';
	f.document.body.style.padding = "10px";
	
	// Ajoute les Données
	f.document.title = titre;
	f.document.body.innerHTML += " " + zi + " ";
	
	// Imprime et ferme la fenetre
	f.window.print();
	f.window.close();
	return true;
}
//rendre un element visible
function OuvrireCalque(nomcalque){
	document.getElementById(nomcalque).style.visibility="visible";
	document.getElementById(nomcalque).style.display="block";
}

//rendre un element invisible
function FermerCalque(nomcalque){
	document.getElementById(nomcalque).style.visibility="hidden";
	document.getElementById(nomcalque).style.display="none";
}
function DateInt(){
    var now = new Date();
    var h = now.getHours();
    var m = now.getMinutes();
    var s = now.getSeconds();
    return ( h *60*60 ) + ( m*60 ) + s;
}
   
function sleep( intTime ){
    if( !is_numeric( intTime ) ){
		return; // Arret de l'éxecution
    }
    intTime = ( intTime / 1000 );
    var Exp = DateInt() + intTime; // TimeOut
    while( Exp > DateInt() );
}

function formTextNomVide(nomform){
	var form = document.forms[nomform];
	for(var i=0;i<form.length;i++){
		if(form.elements[i].value==""&&form.elements[i].type=="text"){
			alert("aucun champs ne doit etre vide.");
			return false;
		}
	}
	return true;
}
function var_dump(obj) {
   if(typeof obj == "object") {
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}
