function path(id){return document.getElementById(id);}
function get_status(id){if(path(id).style.display=='block'){return true;}else{return false;}}
function showme(id){if(path(id)){path(id).style.display="block";}}
function hideme(id) {if(path(id)){path(id).style.display="none";}}
function show_hide(id){if(get_status(id)){hideme(id);}else{showme(id);}}
// function ttop(){path('liberte').scrollTop=0;}
// function ttop2(){path('drag1cont').scrollTop=0;}

var xhr_max=30;

/*ouvrir1*/var ouvrir_libresa=''; for(var i=0; i<=xhr_max; i++){ouvrir_libresa+='libre'+i+'="oui";';} eval(ouvrir_libresa); function ouvrir(page,cible,action){c_loading(); var ouvrir_fct=''; for(var i=0; i<=xhr_max; i++){ouvrir_fct+='if(libre'+i+'=="oui"){libre'+i+'="non";if(window.XMLHttpRequest)xhr_objecta'+i+'=new XMLHttpRequest;if(window.ActiveXObject)xhr_objecta'+i+'=new ActiveXObject("Microsoft.XMLHTTP");xhr_objecta'+i+'.open("GET", page+"&ms=" + new Date().getTime(), true);xhr_objecta'+i+'.setRequestHeader("Cache-Control","no-cache");xhr_objecta'+i+'.onreadystatechange=function(){if(xhr_objecta'+i+'.readyState==4 && path(cible)){path(cible).innerHTML=xhr_objecta'+i+'.responseText; c_finished(); libre'+i+'="oui"; eval(action);}else{c_loading;}}; xhr_objecta'+i+'.send(null);}else ';	}eval(ouvrir_fct+='{}');}
/*ouvrir2*/var ouvrir_libresb=''; for(var i=0; i<=xhr_max; i++){ouvrir_libresb+='libreb'+i+'="oui";';} eval(ouvrir_libresb);function ouvrir2(page,data,cible,method,action){var ouvrir_fctb=''; for(var i=0; i<=xhr_max; i++){ouvrir_fctb+='if(libreb'+i+'=="oui"){libreb'+i+'=="non";if(window.XMLHttpRequest)xhr_objectb'+i+'=new XMLHttpRequest;if(window.ActiveXObject)xhr_objectb'+i+'=new ActiveXObject("Microsoft.XMLHTTP");showme("loading");if(method=="GET"){xhr_objectb'+i+'.open("GET", page+"?"+data+"&ms=" + new Date().getTime(), true);xhr_objectb'+i+'.setRequestHeader("Cache-Control","no-cache");xhr_objectb'+i+'.onreadystatechange=function(){if(xhr_objectb'+i+'.readyState==4 && path(cible)){path(cible).innerHTML=xhr_objectb'+i+'.responseText;hideme("loading");libreb'+i+'="oui"; eval(action);}else{showme("loading");}};xhr_objectb'+i+'.send(null);}else{xhr_objectb'+i+'.open("POST", page, true);xhr_objectb'+i+'.setRequestHeader("Cache-Control","no-cache");xhr_objectb'+i+'.onreadystatechange=function(){if(xhr_objectb'+i+'.readyState==4  && path(cible)){path(cible).innerHTML=xhr_objectb'+i+'.responseText;hideme("loading");libreb'+i+'="oui"; eval(action);}else{showme("loading");}};xhr_objectb'+i+'.setRequestHeader("Content-type", "application/x-www-form-urlencoded");xhr_objectb'+i+'.send(data+"&ms=" + new Date().getTime());}}else ';} eval(ouvrir_fctb+='{}');}
/*ouvrir3*/var ouvrir_libresc=''; for(var i=0; i<=xhr_max; i++){ouvrir_libresc+='librec'+i+'="oui";';} eval(ouvrir_libresc);function ouvrir3(page,data,cible,method,action){var ouvrir_fctc=''; for(var i=0; i<=xhr_max; i++){ouvrir_fctc+='if(librec'+i+'=="oui"){librec'+i+'=="non";if(window.XMLHttpRequest)xhr_objectc'+i+'=new XMLHttpRequest;if(window.ActiveXObject)xhr_objectc'+i+'=new ActiveXObject("Microsoft.XMLHTTP");showme("loading");if(method=="GET"){xhr_objectc'+i+'.open("GET", page+"?"+data+"&ms=" + new Date().getTime(), true);xhr_objectc'+i+'.setRequestHeader("Cache-Control","no-cache");xhr_objectc'+i+'.onreadystatechange=function(){if(xhr_objectc'+i+'.readyState==4 && path(cible)){path(cible).value=xhr_objectc'+i+'.responseText;hideme("loading");librec'+i+'="oui"; eval(action);}else{showme("loading");}};xhr_objectc'+i+'.send(null);}else{xhr_objectc'+i+'.open("POST", page, true);xhr_objectc'+i+'.setRequestHeader("Cache-Control","no-cache");xhr_objectc'+i+'.onreadystatechange=function(){if(xhr_objectc'+i+'.readyState==4){path(cible).value=xhr_objectc'+i+'.responseText;hideme("loading");librec'+i+'="oui"; eval(action);}else{showme("loading");}};xhr_objectc'+i+'.setRequestHeader("Content-type", "application/x-www-form-urlencoded");xhr_objectc'+i+'.send(data+"&ms=" + new Date().getTime());}}else ';} eval(ouvrir_fctc+='{}');}


function c_loading(){
//showme("loading");
showme("load_rep");
showme("load_interv");
window.status="Chargement en cours ...";
}

//function hhh(){
//showme("cont_art");
//hideme("cont_art1");
//}


function c_finished(){
//hideme("loading");
hideme("load_rep");
hideme("load_interv");
window.status="";
}

//function Mclick(id,id2){
//	for(var i=0; i<combine3.length; i++){
//	hideme('d_'+combine3[i]);	
//	}
//	showme('d_'+id);
//	if(eval('n_'+id+'==0')){
//		ouvrir('pages/'+id+'.php?div=0', 'd_'+id+'_b', 'ttop();');
//		eval('n_'+id+'=1');
//	}
//	document.title=('GROUPE LIBERTE : '+id2);
//	ttop();
//	hideme('drag1');
//}
//
//
//function welcome(){
//Mclick('alaune', 'ACCUEIL!');
//}

// function recupD1_D2(div1){
// ttop();
// ttop2();
// var larg_wind = screen.width;
// var haut_wind = screen.height;
// var space_left = (larg_wind-800)/2;
// var posx_drag = space_left+125;
// var posy_drag = haut_wind-(3*177)-19;
// showme('drag1'); 
// path('drag1').style.top= posy_drag;
// path('drag1').style.left= posx_drag;
// var cont_amorc = path(div1).innerHTML; 
// path('drag1cont').innerHTML = cont_amorc; 
// }

function show_alb_manif(dossier){
var larg_wind = screen.width;
var haut_wind = screen.height;
var space_left = (larg_wind-800)/2;
var posx_drag = space_left+125;
var posy_drag = haut_wind-(3*177)-19;
showme('drag1'); 
path('drag1').style.top= posy_drag;
path('drag1').style.left= posx_drag;
ouvrir('album_manif.php?alb_manif='+dossier, 'drag1cont', '');
}


//function recupC1_C2(div1){
//showme("cont_art");
//hideme("cont_art1"); 
//var cont_amorc = path(div1).innerHTML; 
//path('cont_art').innerHTML = cont_amorc; 
//}
//


//function montr_react(id_art){
//ttop();
//ttop2();
//ouvrir('pages/show_react.php?idart='+id_art, 'drag1cont', ''); 
//var larg_wind = screen.width;
//var haut_wind = screen.height;
//var space_left = (larg_wind-800)/2;
//var posx_drag = space_left+125;
//var posy_drag = haut_wind-(3*177)-19;
//showme('drag1'); 
//path('drag1').style.top = posy_drag;
//path('drag1').style.left = posx_drag;
//showme('drag1');
//}

//function react(id_art){
//ttop();
//ttop2();
//ouvrir('pages/reagir.php?idart='+id_art, 'drag1cont', ''); 
//var larg_wind = screen.width;
//var haut_wind = screen.height;
//var space_left = (larg_wind-800)/2;
//var posx_drag = space_left+125;
//var posy_drag = haut_wind-(3*177)-19;
//showme('drag1'); 
//path('drag1').style.top = posy_drag;
//path('drag1').style.left = posx_drag;
//showme('drag1');
//}

//function montr_react_une(id_une){
//ttop();
//ttop2();
//ouvrir('pages/show_react_une.php?idune='+id_une, 'drag1cont', ''); 
//var larg_wind = screen.width;
//var haut_wind = screen.height;
//var space_left = (larg_wind-800)/2;
//var posx_drag = space_left+125;
//var posy_drag = haut_wind-(3*177)-19;
//showme('drag1'); 
//path('drag1').style.top = posy_drag;
//path('drag1').style.left = posx_drag;
//showme('drag1');
//}
//
//function react_une(id_art){
//ttop();
//ttop2();
//ouvrir('pages/reagir_une.php?idune='+id_art, 'drag1cont', ''); 
//var larg_wind = screen.width;
//var haut_wind = screen.height;
//var space_left = (larg_wind-800)/2;
//var posx_drag = space_left+125;
//var posy_drag = haut_wind-(3*177)-19;
//showme('drag1'); 
//path('drag1').style.top = posy_drag;
//path('drag1').style.left = posx_drag;
//showme('drag1');
//}

/* function redimImage2(inImg, inMW, inMH, alt, title) { var maxWidth = inMW;   var maxHeight = inMH;   var dW = 0;   var dH = 0;   var oImg = new Image();   oImg.src = inImg;   var h = dH = oImg.height;   var w = dW = oImg.width;   if ((h >= maxHeight) || (w >= maxWidth)) { if ((h >= maxHeight) && (w >= maxWidth)) { if (h > w) { dH = maxHeight; dW = parseInt((w * dH) / h, 10); } else { dW = maxWidth; dH = parseInt((h * dW) / w, 10); } } else if ((h > maxHeight) && (w < maxWidth)) { dH = maxHeight; dW = parseInt((w * dH) / h, 10); } else if ((h < maxHeight) && (w > maxWidth)) { dW = maxWidth; dH = parseInt((h * dW) / w, 10);} } imaj(inImg, alt, title); document.write('width="'+dW+'" height="'+dH+'" border="0"'+' />'); }
function imaj(inImg, alt, title){ document.write('<img src="'+inImg+'" alt="'+alt+'" title="'+title+'"'); };
*/
 
// function open_sup(val1, val2){
// var conf = confirm('Voulez-vous effectivement effectuer cette action?');
// if(conf==true){ouvrir('del_base.php?tab='+val1+'&id='+val2, 'bb', '');}
// }


function open_sup2(val1, val2){
var conf = confirm('Voulez-vous effectivement effectuer cette action?');
if(conf==true){ouvrir('del.php?id_artt='+val1+'&tablooo='+val2, 'bb', '');}
}


function sup_im(val1, val2){
var conf = confirm('Voulez-vous effectivement effectuer cette action?');
if(conf==true){ouvrir('sup_img.php?imname='+val1+'&folder='+val2, 'ee', '');}
}


// function open_sup3(v1, v2){
// var conf = confirm('Voulez-vous effectivement effectuer cette action?');
// if(conf==true){alert(v1);} else {alert(v2);}
// }


function mytime() {
var mdt = new Date();
var heures = mdt.getHours();
if(heures<10) heures="0"+heures;
var minutes = mdt.getMinutes();
if(minutes<10) minutes="0"+minutes;
var secondes = mdt.getSeconds();
if(secondes<10) secondes="0"+secondes;
var tmps = heures+":"+minutes+":"+secondes;
path("temps").innerHTML = tmps;
setTimeout("mytime()", 1000);
}

// function repl_char1(texte){
// texte = texte.replace(/\&eacute;/gi, "é");
// texte = texte.replace(/\&egrave;/gi, "è");
// texte = texte.replace(/\&ecirc;/gi, "ê");
// texte = texte.replace(/\&euml;/gi, "ë");
// texte = texte.replace(/\&icirc;/gi, "î");
// texte = texte.replace(/\&iuml;/gi, "ï");
// texte = texte.replace(/\&igrave;/gi, "ì");
// texte = texte.replace(/\&iacute;/gi, "í");
// texte = texte.replace(/\&agrave;/gi, "à");
// texte = texte.replace(/\&acirc;/gi, "â");
// texte = texte.replace(/\&auml;/gi, "ä");
// texte = texte.replace(/\&aelig;/gi, "æ");
// texte = texte.replace(/\&oelig;/gi, "œ");
// texte = texte.replace(/\&ccedil;/g, "ç");
// texte = texte.replace(/\&Ccedil;/g, "Ç");
// texte = texte.replace(/\&ocirc;/gi, "ô");
// texte = texte.replace(/\&ouml;/gi, "ö");
// texte = texte.replace(/\&ucirc;/gi, "û");
// texte = texte.replace(/\&uuml;/gi, "ü");
// texte = texte.replace(/\&uacute;/gi, "ú");
// texte = texte.replace(/\&ugrave;/gi, "ù");
// texte = texte.replace(/\&rsquo;/g, "'");
// texte = texte.replace(/\&#0039;/gi, "'");
// texte = texte.replace(/\&frac12;/gi, "½");
// texte = texte.replace(/\&frac14;/gi, "¼");
// texte = texte.replace(/\&frac34;/gi, "¾");
// texte = texte.replace(/\&Omega;/gi, "O");
// texte = texte.replace(/\&omega;/gi, "?");
// texte = texte.replace(/\&nbsp;/gi, " ");
// texte = texte.replace(/\&lt;/g, "<");
// texte = texte.replace(/\&gt;/g, ">");
// texte = texte.replace(/\&laquo;/g, "«");
// texte = texte.replace(/\&raquo;/g, "»");
// texte = texte.replace(/\&quot;/g, '"');
// texte = texte.replace(/\&euro;/g, "€");
// texte = texte.replace(/\&micro;/g, "µ");
// texte = texte.replace(/\&copy;/g, "©");
// texte = texte.replace(/\&reg;/g, "®");
// texte = texte.replace(/\&/g, "ET");
// texte = texte.replace(/\&amp;/g, "&");
// texte = texte.replace(/\&#0064;/g, "@");
// texte = texte.replace(/\&pound;/g, "£");
// texte = texte.replace(/\&yen;/g, "¥");
// texte = texte.replace(/\&ntilde;/gi, "ñ");
// texte = texte.replace(/\&eth;/g, "ð");
// texte = texte.replace(/\&oslash;/g, "ø");
// return texte;
// }

function valueof(id){return path(id).value;}

function add_text(content,cible)
{
	valeur=valueof(cible);
	valeur=(valeur=='Message')?'':valeur;
	path(cible).value=valeur+content;
	path(cible).focus();
}


function add_text_typ_art(content,cible)
{
	valeur=valueof(cible);
	valeur=(valeur=!'')?'':valeur;
	path(cible).value=valeur+content;
}

//function load_snd(val){
//var anim = 	'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="400" height="250" id="flashvars" align="middle">'
//			+'<param name="allowScriptAccess" value="sameDomain" />'
//			+'<param name="movie" value="newlect.swf?tm=<?echo time();?>" />'
//			+'<param name="FlashVars" value="str='+val+'" />'
//			+'<param name="quality" value="high" />'
//			+'<param name="bgcolor" value="#ffffff" />'
//			+'<embed name="lect3" swLiveConnect=true src="newlect.swf?tm=<?echo time();?>" FlashVars="str='+val+'" quality="high" bgcolor="#000000" width="400" height="250" name="lect3" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'
//			+'<\/object>';
//
//path("chant").innerHTML = anim;
//
//}
//


//function myjr(){
//var mdt2 = new Date();
//var trans_jr = new Array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
//var trans_mth = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");
//var jour = mdt2.getDay();
//var jour_real = trans_jr[jour];
//var dt = mdt2.getDate();
//var mois = mdt2.getMonth();
//var mois_real = trans_mth[mois];
//var annee = mdt2.getFullYear();
//var dates = jour_real+", le "+dt+" "+mois_real+" "+annee;
//path("dates").innerHTML = dates;
//}
//
//var trans_jr = new Array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
//var trans_mth = new Array("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre");


function ccf(id,couleur,textcol){
	path(id).style.background=couleur;
	path(id).style.color=textcol;
}

function ccf_edit(){
ccf("edito", "url('dec/tab2.jpg') repeat-x", "white");
ccf_initab("report");
ccf_initab("interviews");
}

function ccf_report(){
ccf("report", "url('dec/tab2.jpg') repeat-x", "white");
ccf_initab("edito");
ccf_initab("interviews");
}

function ccf_interviews(){
ccf("interviews", "url('dec/tab2.jpg') repeat-x", "white");
ccf_initab("edito");
ccf_initab("report");
}

function ccf_initab(id){
ccf(id, "url('dec/tab1.jpg') repeat-x", "black");
}



// function ccf12(){
// ccf("menulf1", "url('dec/imp1.jpg') no-repeat;");
// }

function montr_react(){
showme('reacttt2'); 
hideme('reacttt1'); 
}

function react(){
showme('reacttt1'); 
hideme('reacttt2'); 
}

function show_conf_react(){
showme('treat_reactt'); 
}


function test_email()
{
	var mail = valueof("email");
	var re=RegExp("^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$");
	if(!re.test(mail))
		{
			alert("c'est pas une adresse valide");
			return false;
		}
		else
		{
			alert("c'est une adresse valide");
			return true;
		}
} 
