
function gotoAgencie()
{
		var url = $('selectAgence').options[$('selectAgence').selectedIndex].value;
		if(url != -1)
		{
			window.location.replace(url);
		}
}

function fDelete(){
	$$('.fDelete').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e);
			if( !confirm(el.title ? el.title : 'Etes vous sûr de vouloir supprimer cet élément ?')){
				e.stop();
			}
		});
	});
}
 

function fFlashMessage() {
	new mooFlashMessage($$('.flash'));
}
 

function setTypeAnnounce(type)
{

	if(type == 'achat')
	{
		if (  document.getElementById('idtypeannouncement') )
		{
			document.getElementById('idtypeannouncement').value='2';	
			$('bt_louer').setProperty('class','hover_on');
			$('bt_acheter').setProperty('class','');
			
			if( $('budgetloyer') )
			{
				$('budgetloyer').setText('Budget (€)');
			}
		}
		
	}else if(type == 'location')	
	{ 
		if  ( document.getElementById('idtypeannouncement') )
		{
			document.getElementById('idtypeannouncement').value='1';	
			$('bt_acheter').setProperty('class','hover_on');
			$('bt_louer').setProperty('class','');
			libelle = "Loyer";
			
			if( $('budgetloyer') )
			{
				$('budgetloyer').setText('Loyer (€)');
			}


		}
		
	}
	
}


function popupCenter( href, l, h) {
   var hauteur = Math.round( ( screen.availHeight - h ) / 2 );
   var largeur = Math.round( ( screen.availWidth - l ) / 2 );
   window.open( href, 'rsmPopup', 'toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=1,menubar=0,top='+hauteur+',left='+largeur+',width='+l+',height='+h);
   return false;   
   
}

function fInit(){
	fFlashMessage();
	fDelete();
}
window.addEvent('domready',fInit);