self.defaultStatus = "Pegasys Logistique";

// Ne plus afficher le message d'alerte de java
function NoError()
	{
	return true;
	}
window.onerror=NoError;
//

// Script permettant de rendre compatible votre navigateur avec la fonction getElementById. //
if(!document.getElementById)
	{
 	 if(document.all)
	 	{
    		document.getElementById=function()
				{
					if(typeof document.all[arguments[0]]!="undefined")
						{return document.all[arguments[0]]}else{return null}
    			}
  		}
	  else if(document.layers)
		{
    		document.getElementById=function()
				{
					if(typeof document[arguments[0]]!="undefined")
						{return document[arguments[0]]}else{return null}
    			}
  		}
	}
// Script permettant de rendre compatible votre navigateur avec la fonction getElementById. //

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
function fenetreCentre(url,largeur,hauteur,options) 
	{
		var haut=(screen.height-hauteur)/2;
		var Gauche=(screen.width-largeur)/2;
		window.open(url,"","top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
	}
//

// actif sur toutes les pages
function bloqueTouche()
    {
	     if (event.ctrlKey){ //Touche Ctrl enfoncée
		     event.keyCode=0;return false;}
		  
	     if (event.keyCode == 13){ //touche entrée enfoncée
             event.keyCode=0;return false;}
		  
         if (event.keyCode == 122){ //touche F11 enfoncée
             event.keyCode=0;return false;}
	
   	     if (event.keyCode == 116){ //touche F5 enfoncée
             event.keyCode=0;return false;}
	}
    document.onkeydown =bloqueTouche;
//

// utilisation sur mise en page et login
function best_nav()
	{
		var navigateur = navigator.appName;
		if (navigateur!='Microsoft Internet Explorer')
			{
			window.location='http://www.pegasys-logistique.com/incompatible.php';
			alert('Pour que Pegasys Logistique fonctionne normalement, veuillez utiliser Microsoft Internet Explorer');
			}
}
//

//
function lockCol(tblID)
	{
		var table = document.getElementById(tblID);
		var button = document.getElementById('toggle');
		var cTR = table.getElementsByTagName('TR');  //collection of rows
	
		if (table.rows[0].cells[0].className == '') 
			{
				for (i = 0; i < cTR.length; i++)
					{
					var tr = cTR.item(i);
					tr.cells[0].className = 'locked'
					}
			}
		else 
			{
				for (i = 0; i < cTR.length; i++)
					{
					var tr = cTR.item(i);
					tr.cells[0].className = ''
					}
			}
} 
//

//
function retour_accueil(nom_accueil)
	{
		window.location=nom_accueil;
	}
//

//
function soumettre(formulaire, cible, nomdepage)
	{
	document.forms[formulaire].action=nomdepage ;
	document.forms[formulaire].target=cible ;
	document.forms[formulaire].submit();
	}
//

//
function ClassChange(Ctl,Class) 
	{
		Ctl.className = Class;
	}
//

//
function position(e,nom_div)
	{
		// coordonnées du curseur
			
				var PosSourisHoriz = 0;
				var PosSourisVerti = 0;
			
			x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
			y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
			
				PosSourisHoriz = x;
				PosSourisVerti = y;
			
		
		// Positionnement du panneau
		
			cnt = document.getElementById(nom_div);
		
			cnt.style.left = PosSourisHoriz - 151;      // Position horizontale
			cnt.style.top = PosSourisVerti - 0;      // position verticale	
	}
//

//
function renverseStrDate(sIn) 
	{ //1ere procedure renverse date
		 var sOut = "";
		 // : 01346789
		 //-->67893401
		 sOut = sIn.charAt(6) + sIn.charAt(7) + sIn.charAt(8)+ sIn.charAt(9) + "/" + sIn.charAt(3)+ sIn.charAt(4) + "/" + sIn.charAt(0)+ sIn.charAt(1)
		 
		 // alert("sIn=["+sIn+"], sOut=["+sOut+"]");
		 
		 return(sOut);
	}
//

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// changement auto de case
function autotab(box, longueur, texte) 
	{ 
		if (texte.length > longueur-1) { 
			document.getElementById(box).focus(); 
		} 
	} 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// utilisation dans accueil
function date_null()   // suivi stock
	{
	  var date_null=true;
	  if (document.suivi_stock_general.date_debut_suivi_stock.value.length != 0 && document.suivi_stock_general.date_fin_suivi_stock.value.length == 0)
		  {
					alert("Veuillez saisir une date de fin !");
					date_null=false;
		  }
	  if (document.suivi_stock_general.date_debut_suivi_stock.value.length == 0 && document.suivi_stock_general.date_fin_suivi_stock.value.length != 0)
		  {
					alert("Veuillez saisir une date de début !");
					date_null=false;
		  }
		  
	  return date_null;
	}



function radio_et_champ_null()    //suivi installation/livraison
	{
  var radio_et_champ_null=true;
  if (document.suivi_installation_livraison.n_commande_a_afficher.value.length == 0 && document.getElementById('detail').checked == true)
	  {
		  if (document.suivi_installation_livraison.date_debut_suivi_installation.value.length != 0 && document.suivi_installation_livraison.date_fin_suivi_installation.value.length == 0)
			  {
				  		alert("Veuillez saisir un numero d'affaire !");
						alert("Veuillez saisir une date de fin !");
						radio_et_champ_null=false;
			  }
		  else if (document.suivi_installation_livraison.date_debut_suivi_installation.value.length == 0 && document.suivi_installation_livraison.date_fin_suivi_installation.value.length != 0)
			  {
				  		alert("Veuillez saisir un numero d'affaire !");
						alert("Veuillez saisir une date de début !");
						radio_et_champ_null=false;
			  }
		  else
		  	  {
						alert("Veuillez saisir un numero d'affaire !");
						radio_et_champ_null=false;
			  }
	  }
  else
  	  {
		  if (document.suivi_installation_livraison.date_debut_suivi_installation.value.length != 0 && document.suivi_installation_livraison.date_fin_suivi_installation.value.length == 0)
			  {
						alert("Veuillez saisir une date de fin !");
						radio_et_champ_null=false;
			  }
		  else if (document.suivi_installation_livraison.date_debut_suivi_installation.value.length == 0 && document.suivi_installation_livraison.date_fin_suivi_installation.value.length != 0)
			  {
						alert("Veuillez saisir une date de début !");
						radio_et_champ_null=false;
			  }
	  }
  return radio_et_champ_null;
} 
//

// utilisation dans historique
function date_null_h()   // suivi stock historique
	{
	  var date_null=true;
	  if (document.historique_suivi_stock_general.date_debut_suivi_stock_historique.value.length != 0 && document.historique_suivi_stock_general.date_fin_suivi_stock_historique.value.length == 0)
		  {
					alert("Veuillez saisir une date de fin !");
					date_null=false;
		  }
	  if (document.historique_suivi_stock_general.date_debut_suivi_stock_historique.value.length == 0 && document.historique_suivi_stock_general.date_fin_suivi_stock_historique.value.length != 0)
		  {
					alert("Veuillez saisir une date de début !");
					date_null=false;
		  }
		  
	  return date_null;
	}



function radio_et_champ_null_h()    //suivi installation/livraison
	{
	  var radio_et_champ_null_h=true;
	  if (document.historique_suivi_installation_livraison.n_commande_a_afficher.value.length == 0 && document.getElementById('detail').checked == true)
		  {
			  if (document.historique_suivi_installation_livraison.date_debut_historique_suivi_installation.value.length != 0 && document.historique_suivi_installation_livraison.date_fin_historique_suivi_installation.value.length == 0)
				  {
					  		alert("Veuillez saisir un numero d'affaire !");
							alert("Veuillez saisir une date de fin !");
							radio_et_champ_null_h=false;
				  }
			  else if (document.historique_suivi_installation_livraison.date_debut_historique_suivi_installation.value.length == 0 && document.historique_suivi_installation_livraison.date_fin_historique_suivi_installation.value.length != 0)
				  {
							alert("Veuillez saisir un numero d'affaire !");
							alert("Veuillez saisir une date de début !");
							radio_et_champ_null_h=false;
				  }
			  else
			  	  {
							alert("Veuillez saisir un numero d'affaire !");
							radio_et_champ_null_h=false;
				  }
		  }
	  else
		  {
			  if (document.historique_suivi_installation_livraison.date_debut_historique_suivi_installation.value.length != 0 && document.historique_suivi_installation_livraison.date_fin_historique_suivi_installation.value.length == 0)
				  {
							alert("Veuillez saisir une date de fin !");
							radio_et_champ_null_h=false;
				  }
			  else if (document.historique_suivi_installation_livraison.date_debut_historique_suivi_installation.value.length == 0 && document.historique_suivi_installation_livraison.date_fin_historique_suivi_installation.value.length != 0)
				  {
							alert("Veuillez saisir une date de début !");
							radio_et_champ_null_h=false;
				  }
		  }
	  return radio_et_champ_null_h;
	} 
//


// utilisation pour tout les tableau
function radio_null(nom_radio) 
	{
		var nombreRadios = document.getElementsByName(nom_radio).length;
		var coche = false;
		var radio=true;
		
		for (i=0; i < nombreRadios; i++)
			{
			if (document.getElementById("radio"+i).checked == true)
				{
				coche = true;
				}
			}
		
		if (coche == false)
			{
			alert("Veuillez cocher une case !");
			radio=false;
			}
		else
			{
			radio=true;
			}
	return radio;
	} 
//

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
