var idInput;


function modele8Pop(content,lien){
	if(lien=='')
		onclick="popClose('');";
	else
		onclick="popClose('"+lien+"');";
	
	if(document.getElementById('popup')){
		$elt=document.getElementById('popup');
		$elt2=document.getElementById('popup2');
	}
	else{
		$elt=document.getElementById('johnny').
		$elt2=document.getElementById('jo');
	}
	
	cacheSelect('hidden');
	
	document.location.href='#';
	$elt.style.width=document.body.scrollWidth+50+'px';
	$elt.style.height=document.body.scrollHeight+60+'px';
	$elt.style.backgroundColor='#f6f6b0';
	$elt2.style.width=document.body.scrollWidth+14+'px';
	$elt2.style.height=window.screen.height-250+'px';
	//document.getElementById('popup2').style.backgroundColor='white';
	$elt2.innerHTML='<div class="popTotal"><div class="popContent">'+content+'</div><p><input style="color:red;" type="button" value="X" onclick="'+onclick+'"/></p><div>';
}


	
	
	
	

function modele8PopSansLien(content){
	if(document.getElementById('popup')){
		$elt=document.getElementById('popup');
		$elt2=document.getElementById('popup2');
	}
	else{
		$elt=document.getElementById('johnny').
		$elt2=document.getElementById('jo');
	}
	
	cacheSelect('hidden');
	
	document.location.href='#';
	$elt.style.width=document.body.scrollWidth+50+'px';
	$elt.style.height=document.body.scrollHeight+60+'px';
	$elt.style.backgroundColor='#e7e0cf';
	$elt2.style.width=document.body.scrollWidth+14+'px';
	$elt2.style.height=window.screen.height-250+'px';
	//document.getElementById('popup2').style.backgroundColor='white';
	$elt2.innerHTML='<div class="popTotal">'+content+'</div>';
}


	
	
	
	

function popClose(lien){ 
	if(document.getElementById('popup')){
		$elt=document.getElementById('popup');
		$elt2=document.getElementById('popup2');
	}
	else{
		$elt=document.getElementById('johnny').
		$elt2=document.getElementById('jo');
	}
	
	$elt.style.width='0px';
	$elt.style.height='0px';
	$elt.innerHTML='';
	$elt2.style.width='0px';
	$elt2.style.height='0px';
	$elt2.innerHTML='';
	
	if(lien!='')
		document.location.href=lien;
		
	cacheSelect('visible');
}


	
	
	
	

function ajaxRechCat(id,tempType,typeReq){
	tempType=( tempType ? tempType : '');
	typeReq=( typeReq ? typeReq : '');
	if(window.XMLHttpRequest)
	{ // Firefox 
		   xhrConn = new XMLHttpRequest(); 
	}
	else if(window.ActiveXObject)
	{ // Internet Explorer 
				try{
	                xhrConn = new ActiveXObject("Msxml2.XMLHTTP");
	            } catch (e) {
	                xhrConn = new ActiveXObject("Microsoft.XMLHTTP");
	            }
	}
		 
	if(!xhrConn)
	{ // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhrConn = false; 
	}

	xhrConn.onreadystatechange  = function()
	{
		try{
			 if(xhrConn.readyState  == 4)
			 {
				  if(xhrConn.status  == 200){
					modele8Pop(xhrConn.responseText,'');
					window.document.body.style.cursor='default';
					
					}
			}
		}
		catch(e){
		}
	}/*
	xhr.open(method,url, true); 
	xhr.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	xhr.send(null);*/	
	
	complet="idCatParent="+id+"&tempType="+tempType+"&typeReq="+typeReq;
	
	xhrConn.open("POST", "../phpAjax/navigateur.php", true);
	xhrConn.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	 
	xhrConn.send(complet); 	
}


	
	
	
	

function choixCat(id,nom){
	popClose('');
	window.document.getElementById('idLienCat'+idInput).value=id;
	window.document.getElementById('lienExt'+idInput).value=nom;
	disable('lienExt'+idInput);
}


	
	
	
	

function disable(id){
	window.document.getElementById(id).disabled = true;
}


	
	
	
	

function enable(id){
	window.document.getElementById(id).disabled = false;
}


	
	
	
	

function checkLienCat(type,identifiant,tempType,reqType){
	tempType=( tempType ? tempType : '');
	reqType=( reqType ? reqType : '');
	window.document.body.style.cursor='wait';
	idInput=identifiant;
	if(type=='add'){
		ajaxRechCat('1',tempType,reqType);
	}
	else{
		choixCat('','');
		enable('lienExt'+idInput);
		window.document.getElementById('lienExt'+idInput).focus();
		window.document.body.style.cursor='default';
	}
}


	
	
	
	

function ajaxTitreForm(id,titre){
	if(window.XMLHttpRequest)
	{ // Firefox 
		   xhrConn = new XMLHttpRequest(); 
	}
	else if(window.ActiveXObject)
	{ // Internet Explorer 
				try{
	                xhrConn = new ActiveXObject("Msxml2.XMLHTTP");
	            } catch (e) {
	                xhrConn = new ActiveXObject("Microsoft.XMLHTTP");
	            }
	}
		 
	if(!xhrConn)
	{ // XMLHttpRequest non supporté par le navigateur 
	   alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	   xhrConn = false; 
	}

	xhrConn.onreadystatechange  = function()
	{
		try{
			 if(xhrConn.readyState  == 4)
			 {
				  if(xhrConn.status  == 200)
					modele8Pop(xhrConn.responseText,'');
			}
		}
		catch(e){
		}
	}/*
	xhr.open(method,url, true); 
	xhr.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT");
	xhr.send(null);*/	
	
	complet="idForm="+id+"&titre="+titre;
	
	xhrConn.open("POST", "../phpAjax/titreForm.php", true);
	xhrConn.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 	 
	xhrConn.send(complet); 	
}


	
	
	
	

function cacheSelect(type){
	var elDiv = document.getElementsByTagName("*");
	
	for (var i=0; i<elDiv.length; i++) {
		if(elDiv[i].tagName=='SELECT'){
				elDiv[i].style.visibility=type;
		}
	}
}

