var count_police=5;
function change_police(count_police){
	array_titre_article=new Array();
	array_radio_contenu=new Array();

	array_titre_article[3]="12";
	array_titre_article[4]="14";
	array_titre_article[5]="15";
	array_titre_article[6]="16";
	array_titre_article[7]="17";
	array_titre_article[8]="18";
	array_titre_article[9]="19";
	array_titre_article[10]="20";

	array_radio_contenu[3]="9";
	array_radio_contenu[4]="11";
	array_radio_contenu[5]="12";
	array_radio_contenu[6]="13";
	array_radio_contenu[7]="14";
	array_radio_contenu[8]="15";
	array_radio_contenu[9]="16";
	array_radio_contenu[10]="18";

	if (count_police>2 && count_police<11){
			if ( document.getElementById('titre_article') ) document.getElementById('titre_article').style.fontSize=array_titre_article[count_police]+"px";
			if ( document.getElementById('radio_contenu') ) document.getElementById('radio_contenu').style.fontSize=array_radio_contenu[count_police]+"px";
	}
	if (count_police==11) count_police=10;
	if (count_police==2) count_police=3;
	
	var url="squelettes/php_to_xml/changepolice.php?count="+count_police;
	prepare_requete();
	http_request.open('GET', url, true);
	http_request.send(null);
	return count_police;
}

function affiche_sous_menu(j){
	for (var i=1; i<=nbre; i++){
		if (document.getElementById('home_radio_MEA_'+i) && i!=j) {window.document.getElementById('home_radio_MEA_'+i).style.display='none';}
	}
	if (document.getElementById('home_radio_MEA_'+j)) {window.document.getElementById('home_radio_MEA_'+j).style.display='block';}

}

function defile_titre(j, count, stop){
	if (document.getElementById('home_radio_liste_item_'+j) && (count==0 ||  document.getElementById('home_radio_liste_item_'+j).offsetWidth+window.document.getElementById('home_radio_liste_item_'+j).offsetLeft>195) ) {
		document.getElementById('home_radio_liste_item_'+j).style.marginLeft=count+'px';
	}
	
	if (stop==0 && document.getElementById('home_radio_liste_item_'+j).offsetWidth+window.document.getElementById('home_radio_liste_item_'+j).offsetLeft>200 && count<5){
		count=count-5;
		delai_cache=setTimeout("defile_titre("+j+", "+count+", 0)", 55);
	}else if (stop==0){
		count=0
		delai_cache=setTimeout("defile_titre("+j+", "+count+", 1)", 1000);
	}
}


var delai;
function affiche_envoyer_ami(){
	document.getElementById('envoyer_ami_validation').style.display="none";
	document.getElementById('envoyer_ami_formulaire').style.display="block";
	document.getElementById('envoyer_ami').style.display="block";
}

function cache_envoyer_ami(){
	document.getElementById('envoyer_ami').style.display="none";
	document.getElementById('envoyer_ami_validation').style.display="none";
	document.getElementById('envoyer_ami_formulaire').style.display="block";
}

var http_request = false;
var url="";

function prepare_requete() {

    http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('application/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
            http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!http_request) {
        alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
}

function envoyer_ami(){
	document.getElementById('envoyer_ami_formulaire').style.display="none";
	document.getElementById('envoyer_ami_validation').style.display="block";
	
	url="squelettes/php_to_xml/envoyer_ami.php";

	parameters="";
	
	valeur=document.getElementById('mail_ami').value;	
	parameters+="&mail_ami="+encodeURI(valeur);

	valeur=document.getElementById('votre_nom').value;	
	parameters+="&&votre_nom="+encodeURI(valeur);

	valeur=document.getElementById('message_ami').value;	
	while (valeur.search("\r\n")>-1){
		valeur=valeur.replace("\r\n","<br />");
	}
	parameters+="&&message_ami="+encodeURI(valeur);
	

	valeur=" "+window.location;
	while (valeur.search("&")>-1){

		valeur=valeur.replace("&","eamp;");
	}
	while (valeur.search("&amp;")>-1){

		valeur=valeur.replace("&amp","eamp;");
	}

	parameters+="&&location="+encodeURI(valeur);
	prepare_requete();

	http_request.onreadystatechange = function() {
		if (http_request.readyState == 4) {
			if (http_request.status == 200) {
				delai=setTimeout(cache_envoyer_ami, 1500);
			}
		}
	};
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}

	 	
function getMovieName(movieName) {
 if (navigator.appName.indexOf("Microsoft") != -1) {
	 	return window[movieName];
} else {
 		return document[movieName];
	}
}

function changedemp3(str) {
	getMovieName("audio_plan").lecture(str);
}

function afficher_lister(id){
	for (i=0;i<array_listes.length;i++){
		if (array_listes[i]==id){
			document.getElementById('contenu_liste_'+array_listes[i]).className='radio_contenu_liste';
			document.getElementById('titre_liste_'+array_listes[i]).style.display='none';
			document.getElementById('titre_liste_over_'+array_listes[i]).style.display='block';
		}else{
			document.getElementById('contenu_liste_'+array_listes[i]).className='radio_contenu_liste_cache';
			document.getElementById('titre_liste_'+array_listes[i]).style.display='block';
			document.getElementById('titre_liste_over_'+array_listes[i]).style.display='none';
		}
	}
}

function afficher_lister_debut(){

	for (i=0;i<array_listes.length;i++){
		if (document.getElementById('divtitre_liste_'+array_listes[i]).style.display!='none'){
			if (document.getElementById('intertitre_liste_'+array_listes[i]) ) document.getElementById('intertitre_liste_'+array_listes[i]).style.display='none';
			afficher_lister(array_listes[i]);
			break;
		}
	}
}
