function Profiltype (profil)
{

	if ( profil.value == 'Association' || profil.value == 'Entreprise' )
	{
		window.document.contact.ctc_profilnom.style.visibility = 'visible' ;
	}
	else
	{
		window.document.contact.ctc_profilnom.style.visibility = 'hidden' ;
	}

}



function CodePostal ()
{

	if ( document.getElementById('ctc_codepostal').value.length > 4 )
	{
		window.document.contact.ctc_ville.disabled = false ;
		Departement () ;
	}
	else
	{
		window.document.contact.ctc_ville.disabled = true ;
	}

}



function Departement ()
{

   	var code = window.document.contact.ctc_codepostal ;
   	var dpt = code.value.substr( 0 , 2 ) ;
   	
   	if ( dpt > 96 )
   	{
  	 	var dpt = code.value.substr( 0 , 3 ) ;
   	}
	
	window.document.contact.ctc_departement.value = departement[dpt] ;

	Ville (code.value) ;

}



function Ville (cp)
{

	window.document.contact.ctc_ville.options.length = 0 ;

	i = 1 ;

	for( x = 0 ; x < ville.length ; x++ )
	{

		if ( ville[x].substr(0,5) == cp )
		{
			opt = i==1?new Option(ville[x].substr(6),ville[x].substr(6),true,true):new Option(ville[x].substr(6),ville[x].substr(6),false,false) ;
			window.document.contact.ctc_ville.options[i] = opt ;
			i = i+1 ;
		}

	}

}



function Valider ()
{
	window.document.contact.ctc_departement.disabled = false ;
}
