/* CHARGEMENT DU L'EDITEUR DE TEXTE WYSIWYG
function loadtinyMCE(action){
	if(action=="contact"){
			tinyMCE.init({
			language : "fr",
			mode : "textareas",
			theme : "advanced", 
			plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", 
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect,undo,redo", 
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,link,unlink,anchor,|,insertdate,inserttime,|,forecolor,backcolor", 
			theme_advanced_buttons3 : "charmap,emotions,iespell,media,|,print,|,fullscreen", 
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
		});
	}else{
		tinyMCE.init({
			language : "fr",
			mode : "textareas",
			theme : "advanced", 
			plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", 
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect", 
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", 
			theme_advanced_buttons3 : "tablecontrols,|,hr,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,|,print,|,fullscreen", 
			theme_advanced_toolbar_location : "top", 
			theme_advanced_toolbar_align : "left",
		});	
	}
}

loadtinyMCE("normal");
*/



/************ PARTIE HEADER ***************************/
function changeBanniereOn(position){
	document.getElementById('header').style.backgroundPosition='50% '+position;
}
function changeBanniereOut(){
	document.getElementById('header').style.backgroundPosition='50% 0';
}

/************ FOOTER ***************************/
function w3c (type) {
 page = document.location.href;
 if (type == "css") {
  url = "http://jigsaw.w3.org/css-validator/validator?profile=css2&warning=2&uri=";
 } else {
  url = "http://validator.w3.org/check?verbose=1&uri=";
 }
 window.open(url+page,'_blank');
}

/*** VERIFICATION DU NAVIGATEUR*
function cssie(chaine){
	var name = navigator.appName;
	//var version = navigator.appVersion;
	//			if (((name == 'Netscape') && (parseInt(version.substring(0,1),10) >= 3)) || ((name == 'Microsoft Internet Explorer') && (parseInt(version.substring(0,1),10) >= 4)) ) 
	if (name == 'Microsoft Internet Explorer'){
		//document.write('<link href="styles/'+chaine+'_ie.php" rel="stylesheet" type="text/css" />');
		document.write('<link href="styles/'+chaine+'.php" rel="stylesheet" type="text/css" />');
	}else{
		document.write('<link href="styles/'+chaine+'.php" rel="stylesheet" type="text/css" />');
	}
}
*/


/************ PARTIE CONTACT ***************************/
function affiche_contact(html){
	if (document.getElementById('contact') != null){
		if(document.getElementById('contact').innerHTML==""){
			document.getElementById("contact").innerHTML=html;
			/*
			// modif du cadre
			document.getElementById("cadre_contact").style.height="416px";			
			document.getElementById("gauche_contact").style.height="366px";
			document.getElementById("droite_contact").style.height="366px";
			document.getElementById("cadre_contenu_contact").style.height="366px";
			*/
		}else{
			html=document.getElementById("contact").innerHTML;
			document.getElementById("contact").innerHTML="";
			/*
			// modif du cadre
			document.getElementById("cadre_contact").style.height="51px";
			document.getElementById("gauche_contact").style.height="1px";
			document.getElementById("droite_contact").style.height="1px";
			document.getElementById("cadre_contenu_contact").style.height="1px";
			*/
		}
	}
	//loadtinyMCE("contact");
	return html;	
}
function verifFormContact(formulaire){

	var testm = false ;

	for (var j=1 ; j<(formulaire.mail.value.length) ; j++) {
		if (formulaire.mail.value.charAt(j)=='@') {
			if (j<(formulaire.mail.value.length-4)){
				for (var k=j ; k<(formulaire.mail.value.length-2) ; k++) {
					if (formulaire.mail.value.charAt(k)=='.') testm = true;
				}
			}
		}
	}

	var a="0";

	if (formulaire.nom.value.length == 0) {alert('Vous n\'avez pas rempli le Nom.'); a="1"; formulaire.nom.focus();}
	else if (formulaire.mail.value.length == 0) {alert('Vous n\'avez pas rempli le mail.'); a="1"; formulaire.mail.focus();}
	else if ((testm==false) && (formulaire.mail.value.length != 0)) {alert('Votre adresse e-mail est incorrecte.'); a="1"; formulaire.mail.focus();}
	else if (formulaire.sujet.value.length == 0) {alert('Vous n\'avez pas rempli le Sujet.'); a="1"; formulaire.sujet.focus();}
	else if (formulaire.message.value.length == 0) {alert('Vous n\'avez pas rempli le Message.'); a="1"; formulaire.message.focus();}
	
	if (a == 0) {formulaire.submit();}

	return testm ;

}



/************ PARTIE CV   ===>> AJAX biensûr ***************************/
function affiche_partie_cv(partie){
	var xhr=null;
	if (window.XMLHttpRequest) { // Mozilla, Safari,...
		xhr = new XMLHttpRequest();
		if (xhr.overrideMimeType) {
			xhr.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				xhr = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	
    //on définit l'appel de la fonction au retour serveur
    xhr.onreadystatechange = function() { 
		ecriture_partie_cv(xhr); 
	};
        
    //on appelle le fichier reponse.txt
    //xhr.open("GET", "http://localhost/john/includes/cv/cv.php?partie="+partie, true);
    xhr.open("GET", "http://"+document.domain+"/includes/cv/cv.php?partie="+partie, true);
    xhr.send(null);
}
function ecriture_partie_cv(xhr){
	if (xhr.readyState==4){
		
		var hauteur=null;
    	
		var docXML= xhr.responseXML;
    	var items = docXML.getElementsByTagName("a");
		var hauteur=null;
		//hauteur=items.item(0).firstChild.data;
		document.getElementById('contenu_cv').innerHTML=xhr.responseText;
			
	}
}



/* Modification de la taille d'un texteArea*/
function modiftailletextarea(id){
	var element=document.getElementById(id);
	element.rows=element.value.split("\n").length;
}

