/********		TEST		************/
function test(param){
// alert(param);
}
function preload2(){
var imgs2 = new Array( "img/logo/graphisme/v2/infoBulle.png",
						"img/v3/png/livreur.png",
						"img/v3/png/rdoOff2.png",
						"img/v3/png/rdoOn.png",
						"img/v3/png/logoFR.png",
						"img/v3/png/btnGamme.png",
						"img/v3/png/btnAussi.png",
						"img/v3/png/btnPDF.png",
						"img/logo/graphisme/v2/txtNouveaute.png",
						"img/logo/graphisme/v2/txDuMois.png",
						"img/logo/graphisme/v2/txtActu.png",
						"salon/atlantica/logoAtlantica2.jpg",
						"img/logo/graphisme/v2/duMois/photo/1.jpg",
						"img/logo/graphisme/v2/btnConnexion.png",
						"salon/atlantica/Visuel.jpg",
						"salon/atlantica/plan.jpg",
						"salon/piscine/plan.jpg",
						"salon/sett/plan.jpg",
						"salon/sett/VisuelSett.jpg",
						"salon/atlantica/plan.jpg",
						"salon/atlantica/Visuel.jpg",
						"salon/lienSalon/atlanticaOver.png",
						"salon/lienSalon/sett.png",
						"salon/lienSalon/piscine.png",
						"salon/piscine/piscineSett.jpg",
						"img/v3/gif/btnCaracteristique.gif",
						"img/v3/gif/btnGamme.gif",
						"img/v3/gif/btnAussi.gif",
						"img/v3/gif/btnPDF.gif",
						"img/v3/png/garantieFond1.png",
						"img/v3/png/garantieFond3.png",
						"img/v3/png/garantieFond2.png",
						"img/v3/png/societeTxt1.png",
						"img/v3/png/societeImg1.png",
						"img/v3/png/societeTxt2.png",
						"img/v3/png/societeImg2.png",
						"img/v3/png/societeTxt3.png",
						"img/v3/png/societeImg3.png",
						"img/coloris/composite_cloisons_cl/echantillon/Blanc.jpg",
						"img/coloris/composite_cloisons_cl/echantillon/Bleu.jpg",
						"img/coloris/composite_cloisons_cl/echantillon/Gris Souris (gris fonce).jpg",
						"img/coloris/composite_cloisons_cl/echantillon/Marron Europeen (marron fonce).jpg",
						"img/coloris/composite_cloisons_cl/echantillon/Naturel (marron clair).jpg",
						"img/coloris/composite_cloisons_cl/echantillon/Vert de Gris.jpg");  // On repere les images contenu dans la page
		var totalImage2 = imgs2.length // taille du tableau imgs
		for( var nbrImg2=0 ; nbrImg2 < totalImage2 ; nbrImg2++ )
		{
			
			var tmp2 = imgs2[ nbrImg2 ];
			(imgs2[ nbrImg2 ] = new Image()).src = tmp2;
		}
}
function focus(param)
{
if(param)
document.getElementById(param).focus();
}
function popUp(page,nom,option){
var screenH = ((screen.availHeight)/2)-150;
var screenW = ((screen.width)/2)-300;
var top = ",top = "+screenH+"px";
var left = ",left = "+screenW+"px";
	window.open(page,nom,option+top+left)
	// alert('window');
}
function resoEcran(page,nom,option){
var screenH = ((screen.availHeight)/2)-150;
var screenW = ((screen.width)/2)-300;
var EcranH = screen.height;
var EcranW = screen.width;
var top = ",top = "+screenH+"px";
var left = ",left = "+screenW+"px";
if(EcranW<1280){
		document.getElementById('darkBox').className="dark";
		document.getElementById('lightBox').className="light2";
		document.getElementById('lightBox').style.visibility='visible';
		document.getElementById('darkBox').style.visibility='visible';
		document.getElementById('darkBox').style.height=screen.availHeight+"px";
		document.getElementById('lightBox').innerHTML='<div style="text-align:center; line-height:25px; font-weight:bold;"><div style="top:320px;" id="fermer" onclick="retourDetail()"></div>Si vous voyez ce message,<br />celà signifie que votre résolution d\'écran est inférieur pour sa largeur à 1280px.<br />Qualité et résolution d\'écran étant en constante évolution,<br />ce site à été développé pour une résolution d\'écran minimale de 1280/1024px.<br />Les résolutions inférieures entraineront des difficultées d\'affichage et de fonctionnement du site.<br /><br /><a href="http://windows.microsoft.com/fr-FR/windows-vista/Change-screen-resolution">Changer la résolution de mon écran</a></div>';
}
}
function closePopUp(page){
	window.close(page);
}
function setCook2(nom,valeur,jours) {
	var expDate = new Date()
	expDate.setTime(expDate.getTime() + (jours * 24 * 3600 * 1000))
	document.cookie = nom + "=" + escape(valeur)+ ";expires=" + expDate.toGMTString()
}
function delCook(nom){ 
	setCook2(nom,"",-1) ;
}

function deconnexion(cook,sess,action){	
	// location.href="http://www.vtec.fr/vtecV3/inc/deconnexion.php?dec="+document.URL+"&cok="+cook+"&sess="+sess+"&act="+action;
	location.href="http://www.vtec.fr/inc/deconnexion.php?dec="+document.URL+"&cok="+cook+"&sess="+sess+"&act="+action;
}

/*****	ASCENCEUR	********/
var count=0;
var defilBas;
function lanceurBas(id)
{
	defilBas=setInterval("descendre('"+id+"')",100) ;
}
function descendre(id)
{
	var pos=document.getElementById('contenuBloc2').offsetTop;
	var posCurseur=document.getElementById('curseur').offsetTop;
count-=10;
	if(pos<0)
	{
		document.getElementById(id).style.top=-count+"px";
		document.getElementById('curseur').style.top=count+"px";
	}
}

function stopDescendre()
{
clearInterval(defilBas);
}

/*******************/
var defilHaut;

function lanceurHaut(id)
{
	defilHaut=setInterval("monter('"+id+"')",100) ;
}

function monter(id)
{
var pos=document.getElementById('contenuBloc2').offsetTop;
var posCurseur=document.getElementById('curseur').offsetTop;
count+=10;

	if(pos>-324)
	{	
		count=posCurseur;
		document.getElementById(id).style.top=-count+"px";
		document.getElementById('curseur').style.top=count+"px";
	}
	if(posCurseur>310)
	{
		document.getElementById(id).style.top=-1950+"px";
	}
}

function stopMonter()
{
clearInterval(defilHaut);
}

/****	DEPLACEMENT  CURSEUR ********/
var dragged=null;
function elementDrag(event,id)
{
	dragged=document.getElementById(id);
}

function drag_mousemove(event,id)
{
count=150;
	if(dragged )
	{
		var Y=event.clientY;
		if(Y>=150 && Y<=480)
		{
			dragged.style.position="relative";
			dragged.style.top=Y-150+"px";
			document.getElementById('contenuBloc2').style.top=-Y*+4+"px";
		}
		if(Y<150)
		{
			document.getElementById('contenuBloc2').style.top=0+"px";
		}
		if(Y>480)
		{
			document.getElementById('contenuBloc2').style.top=-1950+"px";
		}
	}
}

function stopDrag()
{
	dragged=null;
}

/****	GESTION MENUS ********/
function menu(id)
{
}

function sousMenuActif(id,image)
{
	document.getElementById('bDerou').className="bDerou";
}

function menu2(id)
{
}

function lienActif(id,param,color,imgMenu,idMenu)
{

	if(param=="lienCatPdf")
	{
		document.getElementById(id).className=id+"On";
		// alert(document.getElementById(id).className);
	}	
	if(param=="lien")
	{
		document.getElementById(id).style.color="#000080";
	}	
	if(param=="mg")
	{
		document.getElementById('lienGauche'+id).style.color="#8e9fbd";
	}		
	if(param=="mdV3")
	{
		document.getElementById(id).style.color="#000080"
	}
	if(param=="mhOff")
	{
		document.getElementById(id).className="menuHaut";
	}
	if(param=="chemin")
	{
		document.getElementById('lien'+id).className="listeLiensG2";
	}
		if(param=="dt")
	{
		document.getElementById('lien'+id).className="dernierTitre2";
	}

}

function btnRadio(id,param,colorLien,imgMenu,idMenu)
{
// alert(idMenu);
	for(var i=1; i<=colorLien; i++){
		 document.getElementById('nomColor').value='';
		 document.getElementById('radio'+i).className='radioOff';
	}
		 document.getElementById('nomColor').value=idMenu;
		 document.getElementById(param).className='radioOn';
}

function lienActif2(id,param,colorLien,imgMenu,idMenu)
{

	if(id=="listePdt")
	{	
		document.getElementById(param).style.backgroundColor=colorLien;	
	}
		if(id=="radioColor")
	{	
	// alert(id);
	// alert(param);
	// alert(colorLien);
	// alert(imgMenu);
	// alert(idMenu);
	// alert(navigator.appVersion);
	// alert(document.getElementById(param).offsetLeft);
		document.getElementById('modalite').style.visibility="hidden";
		document.getElementById(param).className=colorLien;
		document.getElementById('imgColor').style.display='block';
		document.getElementById('imgColor').style.position='relative';
		
		var nav=navigator.appVersion;
		var navErsion7="MSIE 7";
		var navErsion8="MSIE 8";
		// alert('img/coloris/'+imgMenu+'/echantillon/'+idMenu+'.jpg');
		if((nav.indexOf(navErsion7))>0){
			document.getElementById('imgColor').innerHTML='<img src="img/coloris/'+imgMenu+'/echantillon/'+idMenu+'.jpg" />';
			// document.getElementById('imgColor').style.top=100+'px';
			// document.getElementById('imgColor').style.left=150+'px';
		}else if((nav.indexOf(navErsion8))>0){
			document.getElementById('imgColor').innerHTML='<img style="position:relative; top:-43px;" src="img/coloris/'+imgMenu+'/echantillon/'+idMenu+'.jpg" />';
			// document.getElementById('imgColor').innerHTML='<img src="img/coloris/'+imgMenu+'/echantillon/'+idMenu+'.jpg" />';
			// document.getElementById('imgColor').style.top=(document.getElementById(param).offsetTop)-100+'px';
			// document.getElementById('imgColor').style.left=(document.getElementById(param).offsetLeft)-250+'px';
		}else{
			document.getElementById('imgColor').innerHTML='<img src="img/coloris/'+imgMenu+'/echantillon/'+idMenu+'.jpg" />';
		}
			document.getElementById('imgColor').style.top=(document.getElementById(param).offsetTop)-100+'px';
			document.getElementById('imgColor').style.left=(document.getElementById(param).offsetLeft)-250+'px';
	}	
	if(id=="vignDtl")
	{	
		document.getElementById(param).className=colorLien;
	}
	if(id=="menuAjax")
	{	
		document.getElementById(param).style.backgroundImage="url(img/v3/gif/"+colorLien+".gif)";
	}
	if(param=="mg")
	{
		document.getElementById('lien'+id).className="lienActif2";
		document.getElementById('lienHrf'+id).style.textDecoration="none";
		document.getElementById('lienHrf'+id).style.color=colorLien;
		document.getElementById('der'+id).className="mDerouV";
		document.getElementById('bDerou').className="bDerou";
	}	
	if(param=="m1Der")
	{
		document.getElementById('m1Href'+id).style.textDecoration="underline";
	}		
	if(param=="modal")
	{
		document.getElementById('modalite').style.visibility="visible";
	}	
		if(param=="salon")
	{
		document.getElementById(id).style.visibility="visible";
	}
	if(param=="md")
	{
		document.getElementById('lien'+id).className="titreMenuD2";
	}
	if(param=="chemin")
	{
		document.getElementById('lien'+id).className="listeLiensG2";
	}
		if(param=="dt")
	{
		document.getElementById('lien'+id).className="dernierTitre2";
	}		
	if(param=="nav")
	{
		document.getElementById('txtChemin').className="txtCheminOn";
		document.getElementById('moteur').style.zIndex='1';
		// document.getElementById('modeRech').style.visibility='hidden';
	}	
	if(param=="produitRouge" || param=="listeRouge")
	{
		document.getElementById('element_'+id).className=param;
	}
	if(param=="produitBleu" || param=="listeBleu")
	{
		document.getElementById(idMenu+id).className=param;
		document.getElementById(colorLien+id).style.color="#ffffff";
	}
	if(param=="photoDRouge" || param=="promoDRouge")
	{
		document.getElementById(idMenu).className=param;
	}

}

function lien(id,param,colorLien,idMenu)
{
	if(id=="listePdt")
	{	
		document.getElementById(param).style.backgroundColor=colorLien;	
	}
	if(id=="radioColor")
	{	

		document.getElementById('imgColor').style.display='none';
		if(document.getElementById('nomColor').value=="" || document.getElementById('nomColor').value!=idMenu+'-/-'+param){
			document.getElementById('radio'+param).className=colorLien;		
		}
	}	
	if(id=="vignDtl")
	{	
		document.getElementById(param).className=colorLien;
	}
	if(id=="menuAjax")
	{	
		document.getElementById(param).style.backgroundImage="url(img/v3/png/"+colorLien+".png)";
	}
	if(param=="lien")
	{
		document.getElementById(id).style.color="#8b4513";
	}
	if(param=="mg")
	{	
		document.getElementById('lienGauche'+id).style.color="#000080";
		// document.getElementById('lien'+id).className="lien";
		// document.getElementById('lienGauche'+id).style.color=colorLien;
		// document.getElementById('der'+id).className="mDerou";
		// document.getElementById('bDerou').className="bDerouHid";
	}
	if(param=="lienCatPdf")
	{
		document.getElementById(id).className=id;
	}	
	if(param=="mdV3")
	{
		document.getElementById(id).style.color="#8B4513"
	}
	if(param=="mhOff")
	{
		document.getElementById(id).className="menuHautOff";
	}
	if(param=="m1Der")
	{
		document.getElementById('m1Href'+id).style.textDecoration="none";
	}
	if(param=="modal")
	{
		document.getElementById('modalite').style.visibility="hidden";
	}	
	if(param=="salon")
	{
		document.getElementById(id).style.visibility="hidden";
	}
	if(param=="md")
	{
		document.getElementById('lien'+id).className="titreMenuD";
	}
		if(param=="chemin")
	{
		document.getElementById('lien'+id).className="listeLiensG";
	}
		if(param=="_2")
	{
		document.getElementById(id).className="titreSFamille2";
		document.getElementById(param).className="titreSFamille2";
	}		
	
	if(param=="dt")
	{
		document.getElementById('lien'+id).className="dernierTitre";
	}
	if(param=="nav")
	{
		document.getElementById('txtChemin').className="txtCheminOff";
		document.getElementById('moteur').style.zIndex='3';
		// document.getElementById('modeRech').style.visibility='visible';
	}
	if(param=="produitRouge" || param=="produitBleu" )
	{
		document.getElementById(idMenu+id).className="produit";
		document.getElementById(colorLien+id).style.color="#000000";
	}	
	if(param=="listeRouge"  || param=="listeBleu")
	{
		document.getElementById(idMenu+id).className="elementSFamille";
		document.getElementById(colorLien+id).style.color="#000000";
	}
	if(param=="photoD"  || param=="promoD")
	{
		document.getElementById(idMenu).className=param;
	}
}

function allumer(id)
{
	document.getElementById('element'+id).className="allumer";
}

function eteindre(id)
{
	document.getElementById('element'+id).className="elementSFamille";
}

function allumerd(id)
{
	document.getElementById('element'+id).className="allumerD";
}

function eteindred(id)
{
	document.getElementById('element'+id).className="elementSFamilleD";
}
/***	ALPHA  MARQUES	*****/
function alphaOn(id)
{
	document.getElementById('m'+id).className="lienMarqueOn";
}

function alphaOff(id)
{
	document.getElementById('m'+id).className="lienMarqueOff";
}

/**** MOTEUR ***/
function textMoteur(champ)
{
	champ.style.color="#000";
	champ.style.border="1px solid #7e96bc";
	champ.value="";
}

/*** REDIRECTION DES PAGES D'ACCUEILS PAR THEME ***/
function redir(id,event,param)
{
	var key = window.event ? event.keyCode : event.which;
	if (key == 13 || key == 1 || key == 0) 
	{
		if(id == "recherche-" || id=="Entrez votre recherche" || id=="recherche-Rechercher")
		{
			document.getElementById('champmoteur').value="Entrez votre recherche";
		}else{
		
		id=id.replace(/ /g, "-"); 
		id = id.replace(/ê/, 'e');
		id = id.replace(/ë/, 'e');
		id = id.replace(/é/,'e');
		id = id.replace(/è/, 'e');
		// On remplace les variantes de "u"
		id = id.replace(/ù/, 'u');
		id = id.replace(/û/, 'u');
		id = id.replace(/ü/, 'u');
		// On remplace les variantes de "a"
		id = id.replace(/ä/, 'a');
		id = id.replace(/à/, 'a');
		id = id.replace(/â/, 'a');
		// On remplace les variantes de "o"
		id = id.replace(/ô/, 'o');
		// On remplace les variantes de "i"
		id = id.replace(/ï/, 'i');
		 // On remplace les variantes de "c"
		id = id.replace(/ç/, 'c');
			location.href="http://www.vtec.fr/"+id;
			// location.href="http://www.vtec.fr/vtecV3/"+id;

		}
	}
	if(event=="uploadMaj")
	{
		location.href="http://www.vtec.fr/inc/uploadMaj.php";   
		// location.href="http://www.vtec.fr/vtecV3/inc/uploadMaj.php";   
	}
	if(event=="telePdf")
	{ 
		location.href="http://www.vtec.fr/"+id;   
	}
	if(event=="div")
	{ 
		location.href="http://www.vtec.fr/"+id;   
		// location.href="http://www.vtec.fr/vtecV3/"+id;   
	}	
	if(event=="divImg")
	{
		location.href="http://www.vtec.fr/"+id;  
	}	
	if(event=="inscriPro")
	{
		location.href="http://www.vtec.fr/"+id;  
		// location.href="http://www.vtec.fr/vtecV3/"+id;  
	}	
	if(event=="inscriPart")
	{
		// location.href="http://www.vtec.fr/vtecV3/"+id;  
		location.href="http://www.vtec.fr/"+id;  
	}	
	if(event=="monPanier")
	{
		location.href="http://www.vtec.fr/"+id;  
	}	
	if(event=="monCompte")
	{
		location.href="http://www.vtec.fr/"+id;  
	}	
	if(event=="identification")
	{
		event="Mon-compte-Vtec";	
		location.href="http://www.vtec.fr/"+event; 			
	}
	if(event=="url")
	{  
		location.href="http://www.vtec.fr/"+id;  
		// location.href="http://www.vtec.fr/vtecV3/"+id;  
	}	
	if(event=="confirmer")
	{
		location.href="http://www.vtec.fr/"+id;  
	}
}


/** AJOUT PANIER ***/	
function confirmMdp()
{
document.getElementById('confirmMdp').innerHTML='<div class="structu">Mot de passe : <form id="formPanier"><input type="text" name="passConfirm" id="passConfirm" /></form></div><div class="structu"><input onclick="ajaxPanier(\'confirmer\',\'00\',document.getElementById(\'passConfirm\').value,document.getElementById(\'choixCompte\').value);" type="image" name="confirmer" id="confirmer" src="img/logo/confirmer.png"></div>';
}
function ajouter(page,id)
{

	var scrollTop=document.body.scrollTop || document.documentElement.scrollTop;
	var hGlobal=document.getElementById('global').offsetHeight;
	var lEcran=screen.width;
	var posZoom=(lEcran-500)/2;
	document.getElementById('darkBox').className="dark";
	if(page=="pdf")
	{
		document.getElementById('lightBox').className="light2";
		document.getElementById('lightBox').style.visibility='visible';
		document.getElementById('darkBox').style.visibility='visible';
		document.getElementById('lightBox').style.top=scrollTop+150+"px";
		document.getElementById('darkBox').style.height=hGlobal+440+"px";
	}	
	if(page=="panier")
	{
		document.getElementById('lightBox').className="light2";
		document.getElementById('lightBox').style.visibility='visible';
		document.getElementById('darkBox').style.visibility='visible';
		document.getElementById('lightBox').style.top=scrollTop+300+"px";
		document.getElementById('darkBox').style.height=hGlobal+340+"px";
	}	
	if(page=="duMois")
	{
		// document.getElementById('flash').innerHTML='';
		// document.getElementById('flashGeotoile').innerHTML='';
			document.getElementById('detailBox2').className="detailBox2";
			document.getElementById('detailBox2').style.top=scrollTop+100+"px";
			document.getElementById('detailBox2').style.left=posZoom+"px";
			document.getElementById('darkBox').style.height=hGlobal+20+"px";
			document.getElementById('detailBox2').style.visibility='visible';
			document.getElementById('darkBox').style.visibility='visible';
		duMois(id,scrollTop,hGlobal,lEcran,posZoom);
	}	
	if(page=="detail" )
	{
			var image = new Image();
		image.onerror = function()
		{
			alert("Erreur lors du chargement de l'image");
		}
		image.onabort = function()
		{
			alert("Chargement interrompu");
		}
		// une fois l'image chargée :
		image.onload = function()
		{
			img = document.getElementById("imageZoom");
		// on affiche l'image
			img.src = image.src;
			var screenW = ((document.body.clientWidth)/2)-250;
			document.getElementById('detailBox').className="detailBox2";
			document.getElementById('detailBox').style.top=scrollTop+100+"px";
			// document.getElementById('detailBox').style.left=posZoom+"px";
			document.getElementById("detailBox").style.marginLeft  =screenW+"px";
			document.getElementById('darkBox').style.height=hGlobal+20+"px";
			document.getElementById('detailBox').style.visibility='visible';
			document.getElementById('darkBox').style.visibility='visible';
		}
			image.src = id;
	}

}
 function duMois(nbr)
{
	if(nbr=="stop"){
	clearTimeout(timer);
	document.getElementById('detailBox2').style.visibility='hidden';
	document.getElementById('darkBox').style.visibility='hidden';
	// document.getElementById('lightBox2').style.visibility='hidden';
	}else{
		 if(nbrImg > nbr) nbrImg = 1;
					var image = new Image();
			image.onerror = function()
			{
				alert("Erreur lors du chargement de l'image");
			}
			image.onabort = function()
			{
				alert("Chargement interrompu");
			}
			// une fois l'image chargée :
			image.onload = function()
			{
				img = document.getElementById("imageZoom2");
			// on affiche l'image
				img.src = image.src;
			}
				image.src =  "img/logo/graphisme/v2/duMois/photo/"+nbrImg+".jpg";


		 nbrImg ++;
	//	 alert(nbrImg);
		timer=setTimeout("duMois('"+nbr+"')",2000);
	}
 }
function retourDetail(param,url)
{
if(param=="divVacances"){
document.getElementById(param).style.visibility='hidden';
}else{
document.getElementById('detailBox').style.visibility='hidden';
document.getElementById('darkBox').style.visibility='hidden';
document.getElementById('lightBox').style.visibility='hidden';
}
if(param=="verifMailPanier"){
// var nbrCarac=url.length;
// var derVirg=url.lastIndexOf(',',nbrCarac);
// var idPdt=url.substring(derVirg+1,nbrCarac);
// ajaxPanier('ajouter',url);
location.href=url;
}
// var flash = {
			// movie:"flash/FlashVtec06.swf", width:"640px", height:"130px", majorversion:"9", build:"0", minorversion:"8", bgcolor:"#fff"
			// };
			// UFO.create(flash, "flash");	
// var flashGeotoile = {
			// movie:"flash/geotoile2.swf", width:"241px", height:"200px", majorversion:"9", build:"0", minorversion:"8", bgcolor:"#fff"
			// };
			// UFO.create(flashGeotoile, "flashGeotoile");
// clearTimeout(timer);
}
/** TIMER COMMANDE PANIER **/
	 var count=0;
function positionnement()
{
}


function stop()
{
	clearInterval(pos);
}


function livraisonCache()
{
	 document.getElementById('tarifLivr').className="tarifCache";
}

var affiche;
function lancerAficher()
{
document.getElementById('blocConnexion2').className="afficherBloc";
stopMail();
}

function afficher(id)
{
	if(id=='tarifLivr')
	{
		 document.getElementById('tarifLivr').className="tarifVu";
	}
	if(id=='creationAd')
	{
		 document.getElementById('creationAd').className="fieldAd";
	}	
if(id=='modifierAd')
	{
		 document.getElementById('modifierAd').className="fieldAd";
	}
		if(id=='nvoCompte')
	{
		var verif=/^[a-zA-Z0-9âêûôéèàùëäç._-]+@[a-zA-z0-9âêûôéèàùëäç]{2,}[.][a-zA-Z]{2,3}$/
		var mail=document.formConnexion.emailC2.value;
		if(verif.exec(mail)!=null)
		{
			affiche=setInterval("lancerAficher()",500) ;
		}
	}
}


function cacherForm(id)
{
if(id=='creationAd')
		
	{
	 document.getElementById(id).style.height=15+"px";
		document.getElementById(id).style.overflow="hidden";
		document.getElementById(id).style.cursor="pointer";
	}	
	if(id=='modifierAd')
	{
	 document.getElementById(id).style.height=15+"px";
		document.getElementById(id).style.overflow="hidden";
		document.getElementById(id).style.cursor="pointer";
	}
}

function stopMail()
{
clearInterval(affiche);
}

/** FOCUS ONLOAD **/
function curseur()
{
	document.formConnexion.emailC2.focus();
}

/** ZOOM PHOTO **/
function openWindow(id,idImg)
{
var src=document.images['photoDetail'].src;
var longu=src.length;
var slsh=src.lastIndexOf('/',longu);
var ext=src.substr(slsh+1,longu);
var point=src.lastIndexOf('.',longu)
var extFichier=src.substr(point,longu);
var idImage=src.substring(slsh+1,point);
var image=idImg+idImage+extFichier;
var win=window.open(id+'?add='+image,'','directories =no,location =no,menubar =no,resizable =no,scrollbars =no,status =no,toolbar =no,width=600,height=400');
win.moveTo((screen.width)/2-300,(screen.height)/2-200); 
}

/***********/
/**  AJAX **/
/***********/
function getXhr(){
  var xhr = null; 
  if(window.XMLHttpRequest) // Firefox et autres
    xhr = new XMLHttpRequest(); 
  else if(window.ActiveXObject){ // Internet Explorer 
    try {
    xhr = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
    xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }else { // XMLHttpRequest non supporté par le navigateur 
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
    xhr = false; 
  } 
  return xhr;
}
/** PANIER	**/
function ajaxPanier(param,id,passe,login,frais)
{
// alert("param : "+param);
// alert("id : "+id);
// alert("passe : "+passe);
// alert("login : "+login);
// alert("frais : "+frais);
if(param=='verifMailPanier' || param=='verifMailNLTR' || param=='verifMailPromoWeb' || param=='promoWeb' ||param=='ajouter' || param=='confirmer' || param=='ajoutColoris' || param=='pdf'|| param=='verifMail'|| param=='centrePdf' || param=='saloninvit' || param=='verifMailSalon')
{
// alert(param);
var traitement='inc/ajout_panier.php';
}
if(param=='detail' || param=='detail2' || param=='detail3')
{
var traitement='inc/detailAjax.php';
}
if(param=='enrPArt')
{
var traitement='inc/traitInscription.php';
}
if(param=='enrPro')
{
var traitement='inc/traitInscriptionPro.php';
}
if(param=='enrPdf')
{
var traitement='inc/traitInscriptionPdf.php';
}
if(param=='continuer' || param=='panier' || param=='calculer')
{
var traitement='inc/panier.php';
}
if(param=='commander' || param=='livraison')
{
var traitement='inc/livraison.php';
}
if(param=='paiement' || param=='confirPaiement')
{
var traitement='inc/paiement.php';
}
if(param=='confirmation' || param=="confirCommande")
{
var traitement='inc/confirmer.php';
}
if(param=='adrsFactu' )
{
var traitement='inc/adrsFactu.php';
}
if( param=='moncompte' || param=='moncompte2')
{
var traitement='inc/traitCompte.php';
}
if( param=='mdpPerdu' )
{
var traitement='inc/moncompte.php';
}
var xhr = getXhr();
xhr.onreadystatechange = function()
{
	if(xhr.readyState == 4 && xhr.status == 200)
	{		
		// alert(xhr.readyState);
		// alert(xhr.status);
	document.getElementById('lightBox2').style.display='none';
		if(param=='mdpPerdu')
		{
		document.getElementById(id).innerHTML=passe;
		document.getElementById('infoChercheMdp').innerHTML=login;
		}	
		if(param=='moncompte')
		{
			if(id=='compteSup')
			{
			// location.href="http://www.vtec.fr/vtecV3/";    
			location.href="http://www.vtec.fr/";    
			}else if(id=='autoOui' || id=='autoNon'){
			
			// location.href="http://www.vtec.fr/vtecV3/Mon-compte";
			location.href="http://www.vtec.fr/Mon-compte"; 
			}else{
			document.getElementById('blok'+passe).innerHTML=xhr.responseText;
			}
		}
		if(param=='moncompte2')
		{
		document.getElementById('blok'+id).innerHTML=xhr.responseText;
		}			
		if(param=='ajouter' || param=='ajoutColoris')
		{
		lienImg=passe;
		ajouter('panier',id);
		// alert(xhr.responseText);
		document.getElementById('lightBox').innerHTML=xhr.responseText;
		document.getElementById('hidPanier').value=lienImg;
		}
		
		if(param=='verifMailNLTR' || param=='verifMailPromoWeb' || param=='promoWeb'|| param=='pdf'|| param=='verifMail' || param=='verifMailPanier'|| param=='centrePdf' || param=='saloninvit' || param=='verifMailSalon')
		{
		ajouter('pdf',id);
		document.getElementById('lightBox').innerHTML=xhr.responseText;
		}	
		
		if(param=='confirmer')
		{
		lienImg=passe;
		if(xhr.responseText.length!=0){
			ajouter('panier',id);
			document.getElementById('lightBox').innerHTML=xhr.responseText;
			document.getElementById('hidPanier').value=lienImg;
			document.getElementById('hidUrl').value=frais;
		}else{
			// location.href="http://www.vtec.fr/vtecV3/inc/deconnexion.php?dec="+frais+"&act=connexion&adrs="+login+"&adrsp="+passe;
			location.href="http://www.vtec.fr/inc/deconnexion.php?dec="+frais+"&act=connexion&adrs="+login+"&adrsp="+passe;
		}
		}		
		if(param=='panier')
		{   
			location.href="http://www.vtec.fr/"+param;    
			// location.href="http://www.vtec.fr/vtecV3/"+param;    
		}		
		if(param=='calculer')
		{
		var longXhr=(xhr.responseText).length;
		var derOccu=(xhr.responseText).lastIndexOf(">");
			 var blok=(xhr.responseText).substring(0, derOccu+1)
			 var panier=(xhr.responseText).substring(derOccu+1, longXhr);
			document.getElementById('blok').innerHTML=blok;
			 document.getElementById('panier').innerHTML=panier; 	//A REACTIVER POUR AFFICHAGE NOMBRE PDTS DS PANIER

		}		
			
		if(param=='continuer')
		{
		esspace=" ";
		tiret="-";
		slash="/";
		virg=",";
		while(passe.indexOf(esspace)>-1){passe=passe.replace(esspace,tiret)}
		while(passe.indexOf(slash)>-1){passe=passe.replace(slash,virg)}
			// location.href="http://www.vtec.fr/vtecDrop2/"+passe;  
			location.href="http://www.vtec.fr/"+passe;  
			// location.href="http://www.drop-arcadian.com/VTEC/"+passe;
		}		
		if(param=='enrPArt' || param=='enrPro' || param=='enrPdf')
		{
		 document.getElementById('formPanier').innerHTML=xhr.responseText;
		}	

		if(param=='commander')
		{
			// location.href="http://www.vtec.fr/vtecV3/"+param;  
			location.href="http://www.vtec.fr/"+param;  
		}
		if(param=='livraison')
		{
		 document.getElementById('blok').innerHTML=xhr.responseText;
		}		
		if(param=='confirPaiement')
		{
		 document.getElementById('blok').innerHTML=xhr.responseText;
		}		
		if(param=='paiement')
		{
		 location.href="http://www.vtec.fr/"+param;  
		 // location.href="http://www.vtec.fr/vtecV3/"+param;  
		}		
		if(param=='confirmation')
		{ 
		 location.href="http://www.vtec.fr/"+param;  
		 // location.href="http://www.vtec.fr/vtecV3/"+param;  
		}
		
		if(param=='confirCommande')
		{
			
		 document.getElementById('detailPanier').innerHTML=xhr.responseText;
			if(id=='finconfirm')
			{
				document.getElementById('terrasse').innerHTML=xhr.responseText;
			}
		}		
		if(param=='adrsFactu')
		{
		 document.getElementById('messModif').innerHTML=xhr.responseText;
		}
		if(param=='detail')	{
		// alert('id : '+id);
			if(id='confAjouPanier'){
				if(passe.length>0 && passe!='colorisVide'&& passe!='confAjouPanier' ){
					for (x=0; x<2; x++) {
						if (x == 0) {

							ajaxPanier('detail2','confAjouPanier','confAjouPanier'+'!:!'+login,passe,frais);			
						}else{
							break;
						}
					}
				}
				if(passe.length==0){
					ajaxPanier('detail2','txtChoixColor','txtChoixColor');
				}
			}			
		}

		if(param=='detail2'){
							// alert('param : '+param);
		// alert('id : '+id);
		// alert('passe : '+passe);
		// alert('login : '+login);
		// alert('frais : '+frais);
				if(id=='confAjouPanier'){
				var tabXhrPan=xhr.responseText.split('!:!');
				var tabXhrConfirm=tabXhrPan[4].split(':-:');
				// for(m=0; m<tabXhrPan.length; m++){
					// alert(tabXhrPan[m]);
				// }
					document.getElementById('confAjouPanier').innerHTML=tabXhrConfirm[1];
					document.getElementById('txtChoixColor').innerHTML='';
					ajaxPanier(tabXhrPan[0],tabXhrPan[1],tabXhrPan[2],tabXhrPan[3]+'!:!:'+tabXhrConfirm[0],tabXhrConfirm[1]);
				}
			if(id=='txtChoixColor'){
// alert('param : '+param);
// alert('id : '+id);
// alert('passe : '+passe);
// alert('login : '+login);
// alert('frais : '+frais);
// alert('xhr : '+xhr.responseText);
				document.getElementById('txtChoixColor').innerHTML=xhr.responseText;
				document.getElementById('confAjouPanier').innerHTML='';
			}		
			if(id=='prixTTDetail'){
			var tabXhrPan=xhr.responseText.split(':::');
// alert('param : '+param);
// alert('id : '+id);
// alert('passe : '+passe);
// alert('login : '+login);
// alert('frais : '+frais);
// alert('xhr : '+xhr.responseText);
// alert(tabXhrPan[0]);
// alert(tabXhrPan[1]);
				document.getElementById('prixTTDetail').innerHTML=tabXhrPan[0];
				document.getElementById('putQtt').value=tabXhrPan[1];
				document.getElementById('txtChoixColor').innerHTML='';
				document.getElementById('confAjouPanier').innerHTML='';
			}
		}
		if(param=='detail3'){
					// alert('param : '+param);
		// alert('id : '+id);
		// alert('passe : '+passe);
		// alert('login : '+login);
		// alert('frais : '+frais);
		// alert('xhr.responseText : '+xhr.responseText);
			if(id='detailAjax'){
				document.getElementById('detailAjax').innerHTML=xhr.responseText;
			}
		}		

	}else if (xhr.readyState < 4){
	var ahEcran=screen.availHeight;
	var hEcran=screen.height;
	var alEcran=screen.availWidth ;
	var lEcran=screen.width ;
	var scrollTop=document.body.scrollTop || document.documentElement.scrollTop;
	document.getElementById('lightBox2').className="light";
	document.getElementById('lightBox2').style.display='block';
	document.getElementById('lightBox2').style.top=scrollTop+400+"px";
	document.getElementById('lightBox2').innerHTML='<img src="img/logo/tempo/tempo1.gif" />';
	}
};
xhr.open("POST",traitement,true);
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xhr.send('param='+param+'&id='+id+'&passe='+passe+'&log='+login+'&frais='+frais);
}

/** LISTE DEROULANTE	FORMULIARE **/	
function ajax(param,id)
{
// alert(param);
// alert(id);
var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
        document.getElementById(id).innerHTML=xhr.responseText;
      }else{
//document.getElementById('blok').innerHTML='<img src="img/logo/tempo/tempo1.gif" />';
	}
    };
	xhr.open("POST","ajax.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('identifiant='+param+'&table='+id);
}

/** FORMULIARE **/	
function ajaxForm(thisForm)
{

var longForm=thisForm.length;
var champInput='';
var champFile='';
var champTextarea='';
var champRadio='';
var nomChampInput='';
var nomChampTextarea='';
var nomChampFile='';

for(var i=0; i<longForm; i++)
{
		if(thisForm.elements[i].value=="")
		{
			champInput+="vide"+"||";
		}else{
			champInput+=thisForm.elements[i].value+"||";
		}
		nomChampInput+=thisForm.elements[i].name+"||";
}
var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
		if(xhr.readyState == 4 && xhr.status == 200)
		{
	document.getElementById('lightBox2').style.display='none';
    var tab = xhr.responseText.split("--");
    var compteur=tab[0].split("|-|");//array recupere le nombre d'élément de responseText
    var imgIcone=tab[1].split("|-|");//array recupere le nombre d'élément image icone
    var vide=tab[2].split("|-|");//array recupere le nombre d'élément verif ----->  utilisé pour les test
	document.getElementById('espace').innerHTML=tab[4];
    var nbrimgIcone=imgIcone.length;
    var nbrCompteur=(compteur.length)-2;

		  for(var c=1; c<nbrCompteur; c++)
		  {
			  document.getElementById('icone'+c).innerHTML="<img src='img/logo/"+imgIcone[c-1]+"' alt='' />";
		  }
      }else{
		var ahEcran=screen.availHeight;
		var hEcran=screen.height;
		var alEcran=screen.availWidth ;
		var lEcran=screen.width ;
		var scrollTop=document.body.scrollTop || document.documentElement.scrollTop;
		document.getElementById('lightBox2').className="light";
		document.getElementById('lightBox2').style.display='block';
		document.getElementById('lightBox2').style.top=scrollTop+300+"px";
		document.getElementById('lightBox2').innerHTML='<img src="img/logo/tempo/tempo1.gif" />';  
		}
    };
	xhr.open("POST","inc/traitForm.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('champInput='+champInput+'&champTextarea='+champTextarea+'&champFile='+champFile+'&nomChampInput='+nomChampInput+'&nomChampTextarea='+nomChampTextarea+'&=nomChampFile'+nomChampFile);

}
/******************	PHOTOTEQUE ****************/
var opac;
var opacit=0;
function fototekOn(id)
{
	document.getElementById('photoD').style.opacity =opacit;
	document.getElementById('photoD').style.MozOpacity =opacit;
	document.getElementById('photoD').style.KhtmlOpacity =opacit;
	document.getElementById('photoD').style.filter = 'alpha(opacity='+opacit+')';
	opac=setInterval("timer()",100);
	var img=new Image;
	img=id;
	document.images['photoDetail'].src=img;
}

function zoom(id,numIm)
{
	document.images['photoDetail'].src=id;
	document.getElementById('numIm').value=numIm;
}
function timer()
{
	var opaDiv=document.getElementById('photoD').style.opacity;
	opacit+=0.1;
	if(opaDiv<1)
	{
		// alert(opac);	
		document.getElementById('photoD').style.opacity =opacit;
        document.getElementById('photoD').style.MozOpacity =opacit;
        document.getElementById('photoD').style.KhtmlOpacity =opacit;
        document.getElementById('photoD').style.filter = 'alpha(opacity='+opacit+')';
	}
	if(opaDiv==1)
	{
		stopOpac();
	}
	
}
function fototekOff()
{
	var img=new Image;
	img="img/table/TableRec300-172.jpg";
	document.images['photoDetail'].src=img;
	var hautDiv = document.getElementById('photoD').offsetHeight;
	var W=document.images['photoDetail'].width;
	var H=document.images['photoDetail'].height;
	var posX=(hautDiv-H)/2;
	document.getElementById('photoImg').style.width=W+"px";
	document.getElementById('photoImg').style.height=H+"px";
	document.getElementById('photoImg').style.marginLeft="auto";
	document.getElementById('photoImg').style.marginRight="auto";
	document.getElementById('photoImg').style.marginTop=posX+"px"
}

function tofDetail()
{
	var hautDiv = document.getElementById('photoD').offsetHeight;
	var W=document.images['photoDetail'].width;
	var H=document.images['photoDetail'].height;
	var posX=(hautDiv-H)/2;
	document.getElementById('photoImg').style.width=W+"px";
	document.getElementById('photoImg').style.height=H+"px";
	document.getElementById('photoImg').style.marginLeft="auto";
	document.getElementById('photoImg').style.marginRight="auto";
	document.getElementById('photoImg').style.marginTop=posX+"px"
}

function stopOpac()
{
	clearInterval(opac);
	opacit=0;
}

/*****	IMGACCUEIL	****/
function imgAccueilOver(id)
{
document.getElementById("ligne"+id).className="ligneAccueilOn";
document.getElementById("imgAccueil"+id).style.cursor="pointer";
}
function imgAccueilOut(id)
{
document.getElementById("ligne"+id).className="ligneAccueilOff";
}

function radio(valueRadio,byId) {
	document.getElementById(byId).value=valueRadio;
}

/*		BACKOFFICE		*/
function ajaxTitreOver(id,param)
{
	if(id=="salon"){
		document.getElementById(id+param).style.backgroundImage="url(salon/lienSalon/"+param+"Over.png )";
	}else{
		document.getElementById(id).style.color="#f00";
	}
}

function ajaxTitreOut(id,param)
{
	if(id=="salon"){
		document.getElementById(id+param).style.backgroundImage="url(salon/lienSalon/"+param+".png )";
	}else{
		document.getElementById(id).style.color="#464343";
	}
}
function ajaxFormMaj(id,block,param,idCom,prm)
{
// if( id == 'validerFacture'){
// alert('id : '+id);
// alert('block : '+block);
// alert('param : '+param);
// alert('idCom : '+idCom);
// alert('prm : '+prm);
// }
if(id=='atlantica' || id=='sett' || id=='piscine')
{
	var traitement='inc/actualiteTrait.php';
}else{
	var traitement='inc/ajaxFormMaj.php';
}
var xhr = getXhr();
	xhr.onreadystatechange = function()
	{
	if(xhr.readyState == 4 && xhr.status == 200)
	{
	if(id=='redir')
	{
	document.location.href ='http://www.vtec.fr/?add=28237vtec';
	// document.location.href ='http://www.vtec.fr/vtecV3/?add=28237vtec';
	}
	// alert(xhr.responseText);
		 document.getElementById('lightBox2').style.display='none';
		document.getElementById(block).innerHTML=xhr.responseText;

    }else{
		var ahEcran=screen.availHeight;
		var hEcran=screen.height;
		var alEcran=screen.availWidth ;
		var lEcran=screen.width ;
		var scrollTop=document.body.scrollTop || document.documentElement.scrollTop;
		document.getElementById('lightBox2').className="light";
		document.getElementById('lightBox2').style.display='block';
		document.getElementById('lightBox2').style.top=scrollTop+300+"px";
		document.getElementById('lightBox2').innerHTML='<img src="img/logo/tempo/tempo1.gif" />';
	}
    };
	xhr.open("POST",traitement,true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('id='+id+'&block='+block+'&param='+param+'&idCom='+idCom+'&prm='+prm);
	// }
}
