function valide_form1(nom_form){
	var myForm = document.getElementById(nom_form);
	if (myForm.identifiant.value != '' && myForm.pass.value != ''){
		myForm.submit();
	}
}

function changeEtat(valeur){
	with (document.formarticle) {
		artetat.value = valeur;
		destination.value = "fermer";
		submit();
	}
}

function changeEtatVoir(valeur){
	with (document.formarticle) {
		artetat.value = valeur;
		destination.value = "voir";
		submit();
	}
}
function changeEtatContinue(valeur){
	with (document.formarticle) {
		artetat.value = valeur;
		destination.value = "continuer";
		submit();
	}
}
function togglememo(champ,champcible){
	var obj = document.getElementById(champ);
	var objcible = document.getElementById(champcible);
	objcible.className =  (obj.checked)?"visible":"invisible";
}
function toggletype (e) {
	document.getElementById("trdossier").className = (this.value=="DS")?"visible":"invisible";
	document.getElementById("trexpert").className = (this.value=="TR")?"visible":"invisible";
}
function article (id,r,search) {
	popup ("article.php?id="+id+"&r="+r+"&search="+search,"article"+id,"800","600","yes");
}
function articleAdmin(id,r) {
	popup ("article.php?id="+id+"&r="+r,"article"+id,"800","600","yes");
}
function popSupprime(id) {
	popup ("popSupprime.php?id="+id,"popcheck","320","150","yes");
}
function popReprends(id) {
	popup ("popReprends.php?id="+id,"popcheck","320","150","yes");
}
function aboSupprime(id) {
	popup ("abo_supprime.php?id="+id,"popcheck","320","150","yes");
}
function beuSupprime(id) {
	popup ("user_supprime.php?id="+id,"popcheck","320","150","yes");
}
function chargeArticle(id,rub) {
	article (id,rub);
	chargeIndex(rub);
}

function chargeIndex(rub){
	switch(rub){
		case "e":
		case "j":
			param = "?r="+rub;
			break;
		case "DS":
		case "DC":
		case "TR":
			param = "?c="+rub;
			break;
		default:
			param = "?t="+rub;
	}
	window.location.href = 'index.php'+param;
}

function titreEurope (obj){
	var myForm = obj.form;
	if (! obj.checked){
		myForm.arttitreeurope.value = "";
		myForm.arttitreeurope.className = "champ invisible";
	} else {
		myForm.arttitreeurope.className = "champ visible";
	}
}

function titreJuridique (obj){
	var myForm = obj.form;
	if (! obj.checked){
		myForm.arttitrejuridique.value = "";
		myForm.arttitrejuridique.className = "champ invisible";
	} else {
		myForm.arttitrejuridique.className = "champ visible";
	}
}

function archiver(id){
	self.location.href = 'article.php?archive=oui&id='+id;
}

function adminFiles(e){
	var myTd = document.getElementById("tddocuments");
	var myID = document.getElementById("artid");
	if (this.checked){
		myTd.innerHTML = "<iframe frameborder='0' width='100%' height='300px' src='managerdocument.php?id="+myID.value+"'></iframe>";
	} else {
		myTd.innerHTML = "&nbsp;";
	}
}
function adminImages(e){
	var myTd = document.getElementById("tdvisuels");
	var myID = document.getElementById("artid");
	if (this.checked){
		myTd.innerHTML = "<iframe frameborder='0' width='100%' height='300px' src='managerimage.php?id="+myID.value+"'></iframe>";
	} else {
		myTd.innerHTML = "&nbsp;";
	}
}
function adminLiens(e){
	var myTd = document.getElementById("tdliens");
	var myID = document.getElementById("artid");
	if (this.checked){
		myTd.innerHTML = "<iframe frameborder='0' width='100%' height='300px' src='managerlien.php?id="+myID.value+"'></iframe>";
	} else {
		myTd.innerHTML = "&nbsp;";
	}
}
function deuxCar(car){
	if (car.toString().length == 1){car = "0"+car;}
	return (car);
}

function handleSelect(type,args,obj) {
	var maintenant = new Date();
	var heures = maintenant.getHours();
	var Min = maintenant.getMinutes();
	var sortie_heure  = ((heures < 10) ? "0" + heures : heures);
	var sortie_minutes  = ((Min < 10) ? "0" + Min : Min);
	var heure = sortie_heure + ":" + sortie_minutes ;
	var dates = args[0];
	var date = dates[0];
	var year = date[0], month = deuxCar(date[1]), day = deuxCar(date[2]);
	switch (obj) {
		case (YAHOO.example.calendar.cal1):
			var txtDate1 = document.getElementById("artdatepublication");
			txtDate1.value = year + "-" + month + "-" + day + " " + heure;
			YAHOO.example.calendar.cal1.hide();
			break;
		case (YAHOO.example.calendar.cal2):
			var txtDate2 = document.getElementById("artdatearchivage");
			txtDate2.value = year + "-" + month + "-" + day  + " " + heure;
			YAHOO.example.calendar.cal2.hide();
			break;
		case (YAHOO.example.calendar.date1):
			var txtDate1 = document.getElementById("abodatedebutabonnement");
			txtDate1.value = year + "-" + month + "-" + day;
			year = year + 1;
			document.getElementById("abodatefinabonnement").value = year + "-" + month + "-" + day;
			YAHOO.example.calendar.date1.hide();
			break;
		case (YAHOO.example.calendar.date2):
			var txtDate2 = document.getElementById("abodatefinabonnement");
			txtDate2.value = year + "-" + month + "-" + day;
			YAHOO.example.calendar.date2.hide();
			break;
	}
}