// JavaScript Document
	
var images = new Array();
var preload = new Array();

images[0] = 'Menu_Accueil_Over.jpg';
images[1] = 'Menu_Baptemes_Over.jpg';
images[2] = 'Menu_Stages_Over.jpg';
images[3] = 'Menu_Competitions_Over.jpg';
images[4] = 'Menu_Commission_Over.jpg';
images[5] = 'Menu_Forum_Over.jpg';
images[6] = 'Menu_Contact_Over.jpg';
images[7] = 'Menu_Liens_Over.jpg';
images[8] = 'Menu_Cadenas_Over.jpg';

for(i=0;i<images.length;i++){
	preload[i] = new Image();
	preload[i].src = '/images/template/' + images[i];
}

function detection_flash(){
	var UseFlash = false;
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) {
		var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
		if (plugin && parseInt(plugin.description.substring(plugin.description.indexOf(".")-1))>=3)
			UseFlash = true;
	}else if (navigator.appName && navigator.appName.indexOf("Microsoft")!= -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { 
		UseFlash = true;
	} 
	return UseFlash;
}

function delete_contenu(champ,valeur){
	if(document.getElementById(champ).value == valeur){
		document.getElementById(champ).value = '';
	}
}

function delete_contenu_password(champ,show){
	document.getElementById(champ).style.display = 'none';
	document.getElementById(show).style.display = 'block';
	document.getElementById(show).focus();
}

function func_div(champ,show){
	document.getElementById(champ).style.display = show;
}

function del_picture(id){
	var confirmation = confirm('Etes-vous certain de vouloir supprimer cette photo ?');
	if(confirmation){
		document.location.href = '/10-00-services/10-06-gestion-photos.php?del_picture='+id;
	}
}

function del_debat(id){
	var confirmation = confirm('Etes-vous certain de vouloir supprimer ce debat ?');
	if(confirmation){
		document.location.href = '/06-00-forum/06-01-forum.php?del_debat='+id;
	}
}

function del_message(id,iddeb){
	var confirmation = confirm('Etes-vous certain de vouloir supprimer ce message ?');
	if(confirmation){
		document.location.href = '/06-00-forum/06-01-forum.php?del_message='+id+'&debat='+iddeb;
	}
}


function change_picture(id){
	document.getElementById('preview').src = '../images/galerie/preview/'+id+'.jpg';	
}

function select_sous_cat(id){
	z = 0;
	document.forms['upload_photos'].elements['upload_sous_cat'].options.length = 0;
	for(i = 0; i < tab_cat.length; i++){
		if(tab_cat[i][0] == id){
			document.forms['upload_photos'].elements['upload_sous_cat'].options[z] = new Option(tab_cat[i][2],tab_cat[i][1]);
			z++;
		}
	}
}

function show_hide(show_div,hide_div){
	division_show = show_div.split('-');
	division_hide = hide_div.split('-');
	for(i = 0; i < division_show.length; i++){
		document.getElementById(division_show[i]).style.display = 'block';
	}
	for(i = 0; i < division_hide.length; i++){
		document.getElementById(division_hide[i]).style.display = 'none';
	}
}

function show_hide_all(division,indicateur){
	if(indicateur == true){
		for(i = 0; i < division; i++){
			document.getElementById('article_'+i).style.display = 'block';
			document.getElementById('image_'+i).style.display = 'none';
			document.getElementById('image_hide_'+i).style.display = 'block';
		}
		document.getElementById('bouton_all_plus').style.display = 'none';
		document.getElementById('bouton_all_moins').style.display = 'block';
	}else{
		for(i = 0; i < division; i++){
			document.getElementById('article_'+i).style.display = 'none';
			document.getElementById('image_'+i).style.display = 'block';
			document.getElementById('image_hide_'+i).style.display = 'none';
		}
		document.getElementById('bouton_all_plus').style.display = 'block';
		document.getElementById('bouton_all_moins').style.display = 'none';
	}
}

function archives(id,selection){
	switch(selection){
		case 'liens' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce lien ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-09-admin-liens.php?act=online&archives='+id;
		}
		break;
		case 'new_liens' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce lien ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-09-admin-liens.php?act=new&archives='+id;
		}
		break;
		case 'manuel' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cet article ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-08-admin-manuel-pilote.php?act=online&archives='+id;
		}
		break;
		case 'new_manuel' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cet article ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-08-admin-manuel-pilote.php?act=new&archives='+id;
		}
		break;
		case 'images' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cette image ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-10-admin-galerie.php?act=online&archives='+id;
		}
		break;
		case 'baptemes' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce baptême ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-05-admin-baptemes.php?act=online&archives='+id;
		}
		break;
		case 'contact' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce message ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-01-admin-accueil.php?archives='+id;
		}
		break;
		case 'new_images' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cette image ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-10-admin-galerie.php?act=new&archives='+id;
		}
		break;
		case 'new_competitions' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cette compétition ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-07-admin-competitions.php?act=new&archives='+id;
		}
		break;
		case 'competitions' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cette compétition ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-07-admin-competitions.php?act=online&archives='+id;
		}
		break;
		case 'new_stages' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce stage ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-06-admin-stages.php?act=new&archives='+id;
		}
		break;
		case 'stages' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce stage ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-06-admin-stages.php?act=online&archives='+id;
		}
		break;
		case 'nouvelles' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cette nouvelle ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-02-admin-news.php?act=online&archives='+id;
		}
		break;
		case 'cr' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver ce compte rendu ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-11-admin-comptes-rendus.php?act=online&archives='+id;
		}
		break;
		case 'objectifs' :
		var confirmation = confirm('Etes-vous certain de vouloir archiver cet objectif ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-12-admin-objectifs.php?act=online&archives='+id;
		}
		break;
		default:
			alert('Problème dans le switch');
		break;
	}
}

function desarchives(id,selection){
	switch(selection){
		case 'liens' :
		var confirmation = confirm('Etes-vous certain(e) de vouloir désarchiver ce lien ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-09-admin-liens.php?act=archives&desarchives='+id;
		}
		break;
		case 'images' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver cette image ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-10-admin-galerie.php?act=archives&desarchives='+id;
		}
		break;
		case 'competitions' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver cette competition ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-07-admin-competitions.php?act=archives&desarchives='+id;
		}
		break;
		case 'stages' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver ce stage ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-06-admin-stages.php?act=archives&desarchives='+id;
		}
		break;
		case 'nouvelles' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver cette nouvelle ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-02-admin-news.php?act=archives&desarchives='+id;
		}
		break;
		case 'manuel' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver cet article ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-08-admin-manuel-pilote.php?act=archives&desarchives='+id;
		}
		break;
		case 'cr' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver ce compte rendu ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-11-admin-comptes-rendus.php?act=archives&desarchives='+id;
		}
		break;
		case 'objectifs' :
		var confirmation = confirm('Etes-vous certain de vouloir désarchiver cet objectif ?');
		if(confirmation){
			document.location.href = '/14-00-admin/14-12-admin-objectifs.php?act=archives&desarchives='+id;
		}
		break;
		default:
			alert('Problème dans le switch');
		break;
	}
}

function select_cat(){
	var club = document.forms['modification'].elements['categorie'];
	if(club.options[club.selectedIndex].text != 'Sélection d\'une catégorie'){
		document.forms['modification'].elements['nom'].value = club.options[club.selectedIndex].text;
		document.forms['modification'].elements['id_hidden'].value = club.options[club.selectedIndex].value;
	}else{
		document.forms['modification'].elements['nom'].value = '';
	}
}

function del_categorie(){
	var id_cat = document.forms['modification'].elements['id_hidden'].value;
	var confirmation = confirm('Etes-vous certain(e) de vouloir supprimer cette catégorie ?');
	if(confirmation){
		document.location.href = '/14-00-admin/14-09-admin-liens.php?act=categories&del_categorie='+id_cat;
	}
}

function validation(id,selection){
	switch(selection){
		case 'liens' :
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider ce lien ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-09-admin-liens.php?act=new&desarchives='+id;
			}		
		break;
		case 'images':
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider cette image ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-10-admin-galerie.php?act=new&desarchives='+id;
			}	
		break;
		case 'manuel':
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider cet article ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-08-admin-manuel-pilote.php?act=new&desarchives='+id;
			}	
		break;
		case 'baptemes':
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider ce baptême ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-05-admin-baptemes.php?act=new&desarchives='+id;
			}	
		break;
		case 'competitions':
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider cette compétition ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-07-admin-competitions.php?act=new&desarchives='+id;
			}	
		break;
		case 'stages':
			var confirmation = confirm('Etes-vous certain(e) de vouloir valider ce stage ?');
			if(confirmation){
				document.location.href = '/14-00-admin/14-06-admin-stages.php?act=new&desarchives='+id;
			}	
		break;
		default:
			alert('Problème dans le switch Online');
		break;
	}
}

function rating(cat,id){
		document.location.href = '/08-00-liens/08-01-liens.php?categorie='+cat+'&rating='+id;
}

function checkvider(){
	var confirmation = confirm('Etes-vous certain(e) de vouloir vider la liste des actions ?');
	if(confirmation){
		document.location.href = '/14-00-admin/14-14-admin-statistiques.php?act=actions&vider=true';
	}
}

function show_photos(url){
	var top = (screen.height/2) - 240;
	var left = (screen.width/2) - 320;
	images = window.open(url,"Images","toolbar=no,width=640,height=480,left=" + left + ",top = " + top);
}

function del_mots(id){
	var confirmation = confirm('Etes-vous certain(e) de vouloir supprimer ce mot ?');
	if(confirmation){
		document.location.href = '/14-00-admin/14-13-admin-bibliotheque.php?act=dictionnaire&mot='+id;
	}
}

function del_files_papier(id){
	var confirmation = confirm('Etes-vous certain(e) de vouloir supprimer ce fichier ?');
	if(confirmation){
		document.location.href = '/14-00-admin/14-13-admin-bibliotheque.php?act=papiers&id_papier='+id;
	}
}

function del_files_numerique(id){
	var confirmation = confirm('Etes-vous certain(e) de vouloir supprimer ce fichier ?');
	if(confirmation){
		document.location.href = '/14-00-admin/14-13-admin-bibliotheque.php?act=numeriques&id_numerique='+id;
	}
}

function add_groupes(valeur,groupe){
	var val = document.forms['message'].elements['groupes'].value;
	var rec = document.forms['message'].elements['recepteur'].value;
	if(val.match('-' + valeur)){
		document.forms['message'].elements['groupes'].value = val.replace('-' + valeur,'');
		document.forms['message'].elements['recepteur'].value = rec.replace('[' + groupe + '],','');
	}else{
		document.forms['message'].elements['groupes'].value += '-' + valeur;
		document.forms['message'].elements['recepteur'].value += '[' + groupe + '],';
	}
	
}

function add_mail(valeur){
	var val = document.forms['message'].elements['recepteur'].value;
	if(val.match(valeur + ',')){
		document.forms['message'].elements['recepteur'].value = val.replace(valeur + ',','');
	}else{
		document.forms['message'].elements['recepteur'].value += valeur + ',';
	}
	
}
