// FONCTIONS DE CHECK
function isNum(elem) {
	var str = elem.value;
	var re = /^[-]?\d*\.?\d*$/;
	str = str.toString();
	if (!str.match(re))
		return false;
	else
		return true;
	}
	
function verifMail(elem)
	{
	adresse = elem.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		return true;
	else
		return false;
	}

// EFFETS
function showextra() {
	start = 1;
	stop = 0;	
	mainFX.custom(start,stop);
	setTimeout('document.getElementById("extra4").style.display = "block"',450);
	}
function maskextra() {
	start = 0;
	stop = 1;
	document.getElementById("extra4").style.display = "none";
	mainFX.custom(start,stop);
	}

// CHARGEMENT DES PAGES
function loadpart() {
	new ajax ( 'usr/adael.php', {
		update: $('mainbody')
		});
	}

function loadweb() {
	new ajax ( 'usr/webmaster.php', {
		update: $('extra4'),
		onComplete: Function = showextra
		});
	}

function loadeval() {
	new ajax( 'share/auto-eval/acces.php', {
		update: $('extra4'),
		onComplete: Function = showextra
		});
	}

function loadcontent(url,args) {
	new ajax (url, {
		postBody: args, 
		update: $('maincontent')
		});
	}
	
function loadelmt(url,cat,elmt,section) {
	list = document.getElementById(section).getElementsByTagName('a');
	for( var i = 0 ; i < list.length ; i++ )
		list[i].style.color = '#000';
	elmt.style.color = '#3384de';
	new ajax (url, {
		postBody: 'cat=' + cat, 
		update: $('mainbody') 
		});
	}
	
function loadnews(base,id) {
	new ajax ('share/website/usr/shownews.php', {
		postBody: 'base=' + base + '&id=' + id,
		update: $('extra4'),
		onComplete: Function = showextra
		});
	}
	
function loadcal(base,id,mailagent,title) {
	new ajax ('share/website/usr/showcal.php', {
		postBody: 'base=' + base + '&id=' + id + '&mailagent=' + mailagent + '&even=' + title,
		update: $('extra4'),
		onComplete: Function = showextra
		});
	}
	
function sendsub() {
	sendit = true;
	for( var i = 0 ; i < 5 ; i++ )
		document.getElementsByTagName('label')[i].style.color = '#888';
	fm = document.forms['sub'];
	if( fm.nom.value == '' ) { 
		document.getElementById('nom').style.color = 'red';
		sendit = false;
		}
	if( fm.prenom.value == '' ) { 
		document.getElementById('prenom').style.color = 'red';
		sendit = false;
		}
	if( fm.coor.value == '' ) { 
		document.getElementById('coor').style.color = 'red';
		sendit = false;
		}
	str = fm.tel.value;
	if( (fm.tel.value == '') || (!isNum(fm.tel)) || (str.length != 10) ) { 
		document.getElementById('tel').style.color = 'red';
		sendit = false;
		}
	if( (fm.mail.value == '') || (!verifMail(fm.mail)) ) { 
		document.getElementById('mail').style.color = 'red';
		sendit = false;
		}
	if( sendit ) {
		post = '';
		for( var i = 0 ; i < fm.length ; i++ ) {
			post += fm.elements[i].name + '=' + fm.elements[i].value + '&';
			}
		new ajax ('share/website/usr/subscribe.php', {
			postBody: post,
			update: $('subscribe')
			});
		}
	}

