// JavaScript Document

//-- POSITIONNER LES ONGLETS DE LA RECHERCHE --//
	
		$(document).ready(  function()
		{
			//initialisation des onglets
			// pour que les critères soient sur fond bleu
			if($("#tab_1 a").hasClass("active")) {
				$("#tab_2 a").css({ color: "#fff", background: "#4172d0" });
				$("#tab_3 a").css({ color: "#fff", background: "#4172d0" });
			}	
			
			// les onglets de la page d'accueil
			// Lorsqu'un lien a.tab est cliqué
			$("a.tab").click(   function () 
			{
				// Mettre tous les onglets non actifs
				$(".active").removeClass("active");
				
				// Mettre l'onglet cliqué actif
				$(this).addClass("active");
				
				// Cacher les boîtes de contenu
				$(".content").hide();
					
				// Pour afficher la boîte de contenu associé, nous
				// avons modifié le titre du lien par le nom de
				// l'identifiant de la boite de contenu
				var contenu_aff = $(this).attr("title");
				//$("#" + contenu_aff).slideDown();
				$("#" + contenu_aff).fadeIn("slow");
				//$("#" + contenu_aff).show();
				
				if(contenu_aff != 'content_1') {
					$('.boutonDeux').show();
				}
				else {$('.boutonDeux').hide();}
				
				if($("#tab_1 a").hasClass("active")) {
					$("#tab_2 a").css({ color: "#fff", background: "#4172d0" });
					$("#tab_3 a").css({ color: "#fff", background: "#4172d0" });
				}
				else {
					$("#tab_2 a").css({ color: "", background: "" });
					$("#tab_3 a").css({ color: "", background: "" });	
				}
			});

			
			
			$("#Occultation").selectToUISlider({labels:3 });
			$("#Gradinage").selectToUISlider({labels:2 });
			$("#EquipeTech").selectToUISlider({labels:2 });
			

		}); 
		
		
//------ RAFRAICHIR LA PAGE ---//
function regenerate()
{
	window.location.reload()
}

//------POSITIONNER LES CALQUES---------//
function positionner(calque, posL, posH)
{
	if(navigator.appName.substring(0,3)=="Net")
	{
		var leftL=(window.innerWidth)/2;
		setTimeout("window.onresize=regenerate",400);

		var leftH=(window.innerHeight)/2;
		setTimeout("window.onresize=regenerate",400);
	}
	else
	{
		var leftL=(document.body.clientWidth)/2;
		setTimeout("window.onresize=regenerate",400);

		var leftH=(document.body.clientHeight)/2;
		setTimeout("window.onresize=regenerate",400);
	}

	var tabL=(760/2);

	var margeL = (leftL-tabL);
	if (margeL < 0)
	{
		margeL=0;
	}

	
	if (document.getElementById)
	{
		var layerObj=document.getElementById(calque);
		layerObj.style.left=margeL+posL+'px';
		layerObj.style.top=posH+'px';
		return;
	}
	else if (document.all)
	{
		var calc_ie = document.all[calque];
		calc_ie.left=margeL+posL;
		calc_ie.top=posH;
		eval (calc_ie);
	}
	else if (document.layers)
	{
		var calc_ns = document.layers[calque];
		calc_ns.left=(margeL+posL)-8;
		calc_ns.top=posH;
		eval (calc_ns);
	}
}



function posMenu()
{
	/*positionner('affcriteres',415,145);
	afficher('affcriteres');
	positionner('recherche',415,165);
	afficher('recherche');
	
	positionner('soumettre',615,365);
	positionner('criteresgeo',275,155);
	positionner('criterestech',275,155);*/
}
function posMenuSoutien()
{
	/*positionner('recherche',385,150);
	afficher('recherche');*/
}

function posMenuInt()
{
	/*positionner('affcriteres',445,60);
	afficher('affcriteres');
	positionner('recherche',445,80);
	afficher('recherche');
	
	positionner('soumettre',645,280);
	positionner('criteresgeo',305,70);
	positionner('criterestech',305,70);*/
}

function posFiches()
{
	/*positionner('imprimpage',208,440);
	afficher('imprimpage');*/
	//positionner('nouvellerecherche',560,525);
	//afficher('nouvellerecherche');
	//positionner('gene',198,150);
	afficher('gene');
	
	/*positionner('salle',198,150);
	positionner('scene',198,150);
	positionner('equip',198,150);*/
}

function posFichesUn()
{
	/*positionner('imprimpage',208,490);
	afficher('imprimpage');
	positionner('gene',198,190);
	positionner('salle',198,190);*/
	//positionner('nouvellerecherche',560,615);
	//afficher('nouvellerecherche');
}

function posFichesDeux()
{
	/*positionner('imprimpage',208,490);
	afficher('imprimpage');*/
	//positionner('nouvellerecherche',560,615);
	//afficher('nouvellerecherche');
	/*positionner('scene',198,190);
	positionner('equip',198,190);*/
}

//-- AFFICHER LES CALQUES --//
function afficher(calc)
{
	arg = afficher.arguments;
	nbArg = arg.length;

	for (l=0 ; l<nbArg ; l++) 
	{
		if (document.getElementById)
		{
			var layerObj=document.getElementById(arg[l]).style;
			layerObj.display='block';
		}

		else if (document.all)
		{
			var calc_ie = 'document.all'+ arg[l];
			calc_ie.style.display='block';
			eval (calc_ie);
		}

	}
}

//-- EFFACER LES CALQUES --//
function effacer()
{
	img = effacer.arguments;
	nbPar = img.length;

	for (l=0 ; l<nbPar ; l++) 
	{
		if (document.getElementById)
		{
			var layerObj=document.getElementById(img[l]).style;
			layerObj.display='none';
		}

		else if (document.all)
		{
			var calc_ie = 'document.all'+ img[l];
			calc_ie.style.display='none';
			eval (calc_ie);
		}
	}
}
