var Mod = new Array() ;

Mod[1] = new Array("Brot-Plamboz","La Chaux-de-Fonds","La Chaux-du-Milieu","La Sagne","Le Cerneux-Péquignot","Le Locle","Les Brenets"
                  , "Les Planchettes","Les Ponts-de-Martel") ; // Neuchatel

Mod[2] = new Array("Alle","Asuel","Bassecourt","Beurnevésin","Boécourt","Boncourt","Bonfol","Bourrignon","Bressaucourt","Buix","Bure"
                  ,"Charmoille","Châtillon","Chevenez","Coeuve","Corban","Cornol","Courchapoix","Courchavon","Courfaivre","Courgenay"
                  ,"Courrendlin","Courroux","Courtedoux","Courtemaîche","Courtételle","Damphreux","Damvant","Delémont","Develier"
                  ,"Epauvillers","Epiquerez","Fahy","Fontenais","Fregiécourt","Glovelier","Goumois","Grandfontaine","La Chaux-des-Breuleux"
                  ,"LaJoux","Le Bémont","Le Noirmont","Le Peuchapatte","Les Bois","Les Breuleux","Les Enfers","Les Genevez"
                  ,"Les Pommerats","Lugnez","Mervelier","Mettembert","Miécourt","Montenol","Montfaucon","Montfavergier","Montignez"
                  ,"Montmelon","Montsevelier","Movelier","Muriaux","Ocourt","Pleigne","Pleujouse","Porrentruy","Rebeuvelier","Réclère"
                  ,"Roche d'Or","Rocourt","Rossemaison","Saignelégier","Saint-Brais","Saint-Ursanne","Saulcy","Seleute","Soubey"
                  ,"Soulce","Soyhières","Undervelier","Vellerat","Vendlincourt","Vermes","Vicques") ; // Jura
                  
Mod[3] = new Array("Belprahon","Bévillard","Champoz","Châtelat","Corcelles","Corgémont","Cormoret","Cortébert","Court","Courtelary"
                  ,"Crémines","Eschert","Grandval","La Ferrière","La Heutte","La Scheulte","Loveresse","Malleray","Monible","Mont-Tramelan"
                  ,"Moutier","Orvin","Perrefitte","Péry","Plagne","Pontenet","Rebévelier","Reconvilier","Renan","Roches","Romont"
                  ,"Saicourt","Saint-Imier","Salues","Sonceboz-Sombeval","Sonvilier","Sornetan","Sorvilier","Souboz","Tavannes"
                  ,"Tramelan","Vauffelin","Villeret") ; // Berne


Mod[4] = new Array("15691","15686","15693","15688","15692","15694","15689"
                  ,"15687","15695") ; // Id Neuch

Mod[5] = new Array("15841","15842","15793","15843","15794","15844","15845","15795","15846","15847","15848"
                  ,"15849","15796","15850","15851","15797","15852","15798","15853","15799","15854"
                  ,"15800","15801","15855","15856","15803","15857","15858","15804","15805"
                  ,"15827","15828","15859","15860","15861","15807","15830","15862","15825"
                  ,"15831","15822","15835","15836","15823","15824","15826","15829"
                  ,"15837","15863","15808","15809","15864","15865","15832","15833","15866"
                  ,"15867","15810","15811","15834","15868","15812","15869","15871","15813","15872"
                  ,"15873","15874","15814","15838","15839","15875","15815","15876","15840"
                  ,"15816","15817","15818","15821","15877","15819","15820") ; // Id Jura
                  
Mod[6] = new Array("15878","15879","15880","15881","15882","14688","14699","14704","15885","14705"
                  ,"15886","15887","15888","14706","14707","15912","15889","15890","15891","14708"
                  ,"15894","14709","15904","14710","14713","15907","15919","15908","14716","15909","14719"
                  ,"15910","14722","15911","14725","14728","15915","15916","15917","15918"
                  ,"14730","14732","14735") ; // Id Berne

function SelectCommune()
{

        
        
	var NewOpt ;
	var Select = document.getElementById("drpCanton").value ;

	ClearMod() ;
	NewOpt = new Option("- commune -",-1);
	document.getElementById("drpCommune").options[0]=NewOpt ;
	NewOpt = new Option("",0);

	document.getElementById("drpCommune").options[1]=NewOpt ;
	document.getElementById ("hLienPdf").style.display = "none" ;

	if ( Select > 0 )
	{

		for ( i=0;i<Mod[Select].length;i++ )
		{
			NewOpt = new Option( Mod[Select][i] , i ) ;
			document.getElementById("drpCommune").options[document.getElementById("drpCommune").length] = NewOpt ;
		}

		document.getElementById("drpCommune").style.display = "block" ;

	}
	else
	{
		document.getElementById("drpCommune").style.display = "none" ;
	}

}

function ClearMod()
{

	while ( document.getElementById("drpCommune").options.length > 0 )
	{

		document.getElementById("drpCommune").options[document.getElementById("drpCommune").options.length-1] = null ;

	}

}

function SelectPdf()
{

	if ( document.getElementById("drpCommune").value != "-1" )
	{
                
                iIndice =  parseInt(document.getElementById ("drpCanton").value) ;
                iIndice = iIndice + 3 ;
                
		document.getElementById ("hLienPdf").href = "https://www.mpsecure.ch/abfallinfo/Gemeinden/show.aspx?sprache=2&id=" + Mod[iIndice][document.getElementById("drpCommune").value] ;
		document.getElementById ("hLienPdf").target = "_blank" ;
		document.getElementById ("hLienPdf").style.display = "inline" ;
	}
	else
	{
		document.getElementById ("hLienPdf").style.display = "none" ;
	}

}