/**
 * Objet Lieu : permet de stocker les données concernant un lieu
 */
function Lieu(){
	this.id;
	this.type;
	this.nom;
	this.code;
	this.pays;
	
	this.getId=function(){
		return this.id;
	}
	
	this.getType=function(){
		return this.type;
	}
	
	this.getNom=function(){
		return this.nom;
	}
	
	this.getCode=function(){
		return this.code;
	}
	
	this.getPays=function(){
		return this.pays;
	}
	
	this.getIataMEH=function(){
		return "v:"+this.id+"|c:"+this.code+"|t:"+this.nom;
	}
	
//	this.getOnClick=function(){
//		var iataMEH = "v:"+this.id+"|c:"+this.code+"|t:"+this.nom;
//		setLieuIataMEH(this.nom,iataMEH);
//	}
}

/**
 * Objet Lieux : permet de stocker une liste de proposition de lieux
 */
function Lieux(){
	this.listeLieux = new Array(); //liste des lieux proposés 

    this.DOMToObjet=function(document){		
		if(document != undefined){
			var i=0;
			while(document.getElementsByTagName("nomLieu")[i] != undefined && document.getElementsByTagName("nomLieu")[i].firstChild != undefined){
				var lieu=new Lieu();
				lieu.id = document.getElementsByTagName("idLieu")[i].firstChild.nodeValue;
				lieu.type = document.getElementsByTagName("typeLieu")[i].firstChild.nodeValue;
				lieu.nom = document.getElementsByTagName("nomLieu")[i].firstChild.nodeValue;
				lieu.code = document.getElementsByTagName("codeLieu")[i].firstChild.nodeValue;
				lieu.pays = document.getElementsByTagName("pays")[i].firstChild.nodeValue;
				this.listeLieux[i]=lieu;
				i++;
			}
		} else{
			throw new Error("impossible de creer un objet Lieu à partir de l'objet passé en paramètre");
		}
    }
}
