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});	
}
var popinside = null;
function fInitInsidePop(){
	popinside = new insidePopup({
		mainDiv: 'maintop',
		width:460,
		duration:5
	});
}

function showDetailsBA(id){
	popinside.start({'idcomp':id},'getBAdetails.php');	
}
function showDetailsIA(id){
	popinside.start({'idcomp':id},'getIAdetails.php');	
}
function showDetailsPA(id){
	popinside.start({'idcomp':id},'getPAdetails.php');	
}

function initMenu(){
	if ($('menuhori'))
		new mooMenu($('menuhori'));
}
var arrayVer = [];
function initMenuVertAndHor(){
	if ($('menuvert')){
		new rAccordion('menuvert', 'togglevert', 'elementvert', {
			alwaysHide: true,
			onActive: function(toggle){
				toggle.addClass('active');
				
			},
			elToOpen: todis,
			onBackground: function(toggle){
				toggle.removeClass('active');
			}
		});
	}
}
function initMV(){
	initMenuVertAndHor();
	var rule = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
	if (rule.exec(navigator.userAgent) != null) 
		ieVersion = parseFloat( RegExp.$1 );
	if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1)
		setTimeout("initMenuVertAndHor()",1000);
}
function initKeywordsHidden(){
	new keywordsHidden('q','login','password');	
}
function sliderInit(){
	if(slideBox = $('slidebox')){
		new mooSlider(slideBox, slideBox.getElements('span'), {'waitDuration': 3000, 'direction': 'horizontal'});
		$('partners').setStyle('visibility','visible');
	}
}

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(){
	if($$('.limited'))
		new limitValues ($$('.limited'));
}

function initCibleFlash(){
	if ($('cibleFlash'))
		selectCountryRegion ('', '' );
}

function initSlideShow() { 
	if($('my_slideshow')){
		var data = [
	 		'bandeau01.jpg',
	 		'bandeau02.jpg'
	 	];
 		var myShow = new Slideshow('my_slideshow', data, { duration:1000, hu: 'images/bandeau/' });
	}
}
function laterSliderInit(){
	setTimeout("sliderInit();",500);
}
function fInit(){
	glossary();
	initMenu();
	initSlideShow();
	initMV();
	fInitInsidePop();
	initCibleFlash();
	initKeywordsHidden();
	initLimitValue();
	laterSliderInit();
}

window.addEvent('load', fInit);