function del( Obj ) {
	var label = ( Obj.title ) ? Obj.title : 'Etes vous sûr de vouloir supprimer cet élément ?';
	return confirm( label );	
}

function popup( href, name, h, l ) {
	var hauteur = Math.round( ( screen.availHeight - h ) / 2 );
	var largeur = Math.round( ( screen.availWidth - l ) / 2 );
	var popup = window.open( href, name, 'toolbar=0,location=0,directories=0,status=0, scrollbars=1,resizable=1,menubar=0,top='+hauteur+',left='+largeur+',width='+l+',height='+h);
	popup.focus();
	return false;	
}
function selectCountryRegion (idState, labelState ) {
	var uri = document.location.href.split('/');
	var urlGet = '';
	switch(uri[(uri.length-1)]){
		case 'Investisseurs-associes':
			urlGet='getIAinfo.php'
			break;
		case 'Professionnels-associes':
			urlGet='getPAinfo.php'
			break;
		case 'Reseaux-de-BA-Locaux':
		default : 
			urlGet='getBAinfo.php'
			break;
	}
	
	var jsonRequest = new Request({
 		url:urlGet, 
		method: 'get',
		onComplete: function(content){
			$('cibleFlash').innerHTML=content;
		}
	}).get({idstat:idState});	
}
function showDetailsBA(id){
	new insidePopup({
		width:460,
		url:'getBAdetails.php',
		closer:{text:'X'},
		gets:{'idcomp':id},
		duration:5
	});
}
function showDetailsIA(id){
	new insidePopup({
		width:460,
		url:'getIAdetails.php',
		closer:{text:'X'},
		gets:{'idcomp':id},
		duration:5
	});
}
function showDetailsPA(id){
	new insidePopup({
		width:460,
		url:'getPAdetails.php',
		closer:{text:'X'},
		gets:{'idcomp':id},
		duration:5
	});
}

function initMenu(){
	if ($('menuhori'))
	new mooMenu($('menuhori'));
}
var arrayVer = [];
function initMenuVertAndHor(){
	initMenu();
	if ($('menuvert')){
		new rAccordion('menuvert', 'togglevert', 'elementvert', {
			alwaysHide: true,
			onActive: function(toggle){
				toggle.addClass('active');
			},
			elToOpen: todis,
			onBackground: function(toggle){
				toggle.removeClass('active');
			}
		});
	}
}

function initKeywordsHidden(){
	new keywordsHidden('q','login','password');	
}
function sliderInit(){
	if(slideBox = $('slidebox')){
		new mooSlider(slideBox, slideBox.getElements('span'), {'waitDuration': 3000, 'direction': 'horizontal'});
	}
}

function limChar(id,nMax){
	var ttext = $(id).value;
	var cLeft = nMax-ttext.length;
	if (cLeft<0)
		cLeft = 0;
	if ($('nchar'))
		$('nchar').innerHTML = cLeft+'/'+nMax+' restants';
	$(id).value=ttext.substr(0,250);		
}

function initLimitValue(){
	new limitValues ($$('.limited'));
}

function initCibleFlash(){
	if ($('cibleFlash'))
		selectCountryRegion ('68', 'Ile de France' );
}

function initSlideShow() { 
	var data = [
 	'bandeau01.jpg',
 	'bandeau02.jpg',
 ];
 var myShow = new Slideshow('my_slideshow', data, { duration:1000, hu: 'images/bandeau/' });
}


function fInit(){
	initMenuVertAndHor();
	initKeywordsHidden();
	sliderInit();
	initLimitValue();
	glossary();
	initCibleFlash();
	initSlideShow()
}

window.addEvent('domready', fInit);
/*
function popupOrder( Obj ) {
	return popup( Obj.href, 'order', 600, 580 );
}
*/