var id;
var divupdate;
var inputid;

function actus_defilement(action, categorie)
{	
	switch(categorie)
	{
		case "actus_enfance":
			id = $('actus_enfance_id').value;
			divupdate = 'actus_enfance_index';
			inputid = 'actus_enfance_id';
			break;
			
		case "actus_culture":
			id = $('actus_culture_id').value;
			divupdate = 'actus_culture_index';
			inputid = 'actus_culture_id';
		break;
			
		case "actus_association":
			id = $('actus_association_id').value;
			divupdate = 'actus_association_index';
			inputid = 'actus_association_id';
		break;
		
		case "breves":
			id = $('breves_id').value;
			divupdate = 'breves_index';
			inputid = 'breves_id';
		break;
		
		case "A_la_une":
			id = $('A_la_une_id').value;
			divupdate = 'A_la_une';
			inputid = 'A_la_une_id';
		break;
	}
	
	if(id && divupdate && inputid)
	{	
		new Ajax.Request(
							 'http://www.pays-de-barr.fr/ajax/getactus.php',
							 {
								method:'post',
								parameters:'id_actu='+id+'&div='+divupdate+'&input='+inputid+'&action='+action,
								onComplete:actus_defilementOK
							 }
						);	 
	}					 	
}

function actus_defilementOK(reponse)
{
	new Effect.toggle(
					  divupdate,
					  'Appear',
						  {
						  afterFinish:function () 
												{
													$(divupdate).innerHTML = reponse.responseText;
													new Effect.toggle(divupdate,'Appear',{duration:0.25});
												},
						  duration:0.25
						  }
					);	
}

function recherche()
{
	search=$('input_rechercher').value;	
	document.location.href = 'http://www.pays-de-barr.fr/search.php?recherche='+search;

}

function recherche_commune()
{
	search=$('input_rechercher').value;
	commune=$('commune').value;
	
	//alert(commune);
	document.location.href = 'http://www.pays-de-barr.fr/'+commune+'/search.php?recherche='+search;

}

function versSiteCommune()
{
	//alert($('plan_commune_select').value);
	
	if($('plan_commune_select').value != '0')
	{
		//document.location.href = 'http://www.pays-de-barr.fr/'+$('plan_commune_select').value;
		window.open('http://www.pays-de-barr.fr/'+$('plan_commune_select').value,"","menubar=yes, status=yes, toolbar=yes, scrollbars=yes,");
	}
}