﻿/*********************************************************
 DÉFINITION
	Complément de l'objet VBScript ListeGIP

 PROPRIÉTÉS

	
 MÉTHODES	

*********************************************************/
function ListeGIP(){
	var ogSelf = this;
	
	this.NomEntite = "";
	
	this.SetOutils = function(){
		if(Elem("ExpMPI")){
			Elem("ExpMPI").value=0;
		}
		Elem("frmListe" + ogSelf.NomEntite).submit();
	}
	
	this.SetFiltreCheckBox = function(npID){
		if (!Elem(ogSelf.NomEntite + "Filtre" + npID).checked)
			Elem(ogSelf.NomEntite + "FiltreCheck" + npID).value = 1;	
	}
		
	this.Trier = function(spNom){
		if(Elem("ExpMPI")){
			Elem("ExpMPI").value=0;
		}
		Elem(ogSelf.NomEntite + "Tri").value = spNom;
		Elem("frmListe" + ogSelf.NomEntite).submit();
	}
	
	this.TrierGroupe = function(){
		if(Elem("ExpMPI")){
			Elem("ExpMPI").value=0;
		}
		Elem(ogSelf.NomEntite + "TriGroupe").value = 1;
		Elem("frmListe" + ogSelf.NomEntite).submit();
	}
	
	this.GestExport = function(spEntite){
		
		if (Elem(spEntite + 'Telecharger').style.display == 'block'){
			if (Elem('ExpMPI').value != Elem('Export_MPI').value){
				Elem(spEntite + 'Telecharger').style.display = 'none';
				Elem(spEntite + 'Export').style.display = 'block';
			}
		}
		if(parseInt(Elem('ExpMPI')) != 0){
			if (Elem('ExpMPI').value == Elem('Export_MPI').value){
				Elem(spEntite + 'Telecharger').style.display = 'block';
				Elem(spEntite + 'Export').style.display = 'none';
			}
		}
	}

	
	this.Effacer = function(spFiltres,spEntite){
		var alFiltres;
		
		if(Elem("ExpMPI")){
			Elem("ExpMPI").value=0;
		}
		if(spEntite == undefined){
			spEntite = '';	
		}
		if (spFiltres != ""){
			alFiltres = spFiltres.split(";"); 
			for (var i=0; i < alFiltres.length; i++){
				if(Elem(spEntite + "Filtre" + alFiltres[i])){
					
					if(Elem(spEntite + "Filtre" + alFiltres[i]).type == "select-one"){
						Elem(spEntite + "Filtre" + alFiltres[i]).selectedIndex = 0;
					}
					if(Elem(spEntite + "Filtre" + alFiltres[i]).type == "checkbox"){
						Elem(spEntite + "Filtre" + alFiltres[i]).value = -1;
					}

				}
			}
		}
	
		if(Elem(ogSelf.NomEntite + 'FiltreLettre')){
			Elem(ogSelf.NomEntite + 'FiltreLettre').value='';
		}
		if(Elem(ogSelf.NomEntite + 'FiltreLettreRenit')){
			Elem(ogSelf.NomEntite + 'FiltreLettreRenit').value='1';
		}
		if(Elem('LstEtatGlobules')){
			Elem('LstEtatGlobules').value = -1;		
		}
		
		Elem(ogSelf.NomEntite + 'Recherche').value = "";
		Elem("frmListe" + ogSelf.NomEntite).submit();
	}
	
	this.ChangePage = function(spPage, npID){
		var slLien = spPage;
				
		if(npID != 0){
			slLien = slLien + "?ID=" + npID;	
		}
				
		location.href = slLien;	
	}
}

