// Copyright 2000 Adobe Systems Incorporated. All rights reserved. Permission
// to use, modify, distribute, and publicly display this file is hereby
// granted. This file is provided "AS-IS" with absolutely no warranties of any
// kind. Portions (C) Netscape Communications 1999.

// If you modify this file, please share your changes with Adobe and other SVG
// developers at http://www.adobe.com/svg/.

// Version 3/23/00

function choice(form){

	  /*On supprimme les ?l?ments d?j? pr?sents dans la liste des sous-th?mes*/
	  var  chstheme = form.sThemeCp;
	  while(chstheme.length!=1){
	  		chstheme.removeChild(chstheme.options[1]);
	  }
		i= form.themeCp.selectedIndex;
		theme = form.themeCp.options[i].text;
		nb = form.concatThemeCp.options.length;
	
			for(i=0;i<nb;i++){
				tmp = form.concatThemeCp.options[i].text;
				j = tmp.indexOf("(",1);
				l = tmp.length;
				k = tmp.lastIndexOf(")",l);
			
				if(j != -1){
					ch = tmp.substring(j+1,k);
				
					if(j < k){
						if(ch == theme){
							st = tmp.substring(0,j);						
							if(st != ""){
								label = new Option(st,st,false,false);
								form.sThemeCp.options[form.sThemeCp.length] = label;	
							}
						}
						
						if(theme == 'choix...'){
							st = tmp.substring(0,j);						
							if(st != ""){
								label = new Option(st,st,false,false);
								form.sThemeCp.options[form.sThemeCp.length] = label;	
							}
						}
						
					}
				}	
			}
}


function load(form){

 form.cantonId.selectedIndex = 0;
 form.communeId.selectedIndex = 0;

}

function genCommune(form){



				i = form.cantonId.selectedIndex;
				canton = form.cantonId.options[i].text;
				cant = form.cantonId.options[i].value;

				var chcommune = form.communeId;
				while(chcommune.length!=1){
					chcommune.removeChild(chcommune.options[1]);
				}
				
				nb = form.comId.options.length;
				
				for(j=0;j<nb;j++){
						tmp = form.comId.options[j].text;
						k = tmp.indexOf(",",0);
						l = tmp.indexOf(";",0);
						numCant = tmp.substring(0,k);
						commune = tmp.substring(k+1,l);
						numCom = tmp.substring(l+1,tmp.length);
						if(numCant == cant){
							label = new Option(commune,numCom,false,false);
							form.communeId.options[form.communeId.length] = label;	
						}
				}
}






