// javascript file

// Correctif de l'affichage des images PNG dans IE5.5 et IE6 (transparent pour les autres navigateurs).
// V1.1 par Brice de Villeneuve, http://www.boursica.com/
// Licence : freeware, librement utilisable du moment que vous laissez ces commentaires dans votre source.
// Mettre ce script dans le head et dans les balises IMG ajouter simplement : onload='setpng(this)'
// Si l'image n'est pas visible (display:none par exemple), appeler la fonction juste après l'affichage de l'image
// dans un javascript avec, par exemple, un setpng(document.getElementById('idDeMonImage');

function setpng(img) { 

	if (document.all && (IEver=parseFloat(navigator.appVersion.split("MSIE")[1])) && (IEver>=5.5) && (IEver<7) && document.body.filters && img)
	{
		imgName=img.src.toUpperCase();
		
		if (imgName.substring(imgName.length-3,imgName.length)=="PNG") img.outerHTML="<span "+(img.id?"id='"+img.id+"' ":"")+(img.className?"class='"+img.className+"' ":"")+(img.title?"title=\""+img.title+"\" ":"")+"style=\"width:"+img.width+"px;height:"+img.height+"px;"+(img.align=="left"?"float:left;":(img.align=="right"?"float:right;":""))+(img.parentElement.href?"cursor:hand;":"")+"display:inline-block;"+img.style.cssText+";"+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"',sizingMethod='scale');\"></span>";
		
	}
	
}

// Fonction page Intro

function ShowLinksLgs() {
	
	document.getElementById("links_lgs").style.display = "block";
}

// Fonctions sur le sous-menu

function Show_ss_menu_produits() {
	
	var ss_menu_produits = document.getElementById("ss_menu_produits");
	
	if (typeof timer_produits != "undefined")
	{
		clearInterval(timer_produits);
	}
	
	ss_menu_produits.style.display = "block";
}

function Hide_ss_menu_produits() {
	
	timer_produits = setInterval(function() {document.getElementById("ss_menu_produits").style.display = "none"; clearInterval(timer_produits);},300);
}

function Yes_ss_menu_produits() {
	
	var ss_menu_produits = document.getElementById("ss_menu_produits");
	
	if (typeof timer_produits != "undefined")
	{
		clearInterval(timer_produits);
	}
	
	ss_menu_produits.style.display = "block";
}

function No_ss_menu_produits() {
	
	timer_produits = setInterval(function() {document.getElementById("ss_menu_produits").style.display = "none"; clearInterval(timer_produits);},300);
}

function Show_ss_menu_societe() {
	
	var ss_menu_societe = document.getElementById("ss_menu_societe");
	
	if (typeof timer_societe != "undefined")
	{
		clearInterval(timer_societe);
	}
	
	ss_menu_societe.style.display = "block";
}

function Hide_ss_menu_societe() {
	
	timer_societe = setInterval(function() {document.getElementById("ss_menu_societe").style.display = "none"; clearInterval(timer_societe);},300);
}

function Yes_ss_menu_societe() {
	
	var ss_menu_societe = document.getElementById("ss_menu_societe");
	
	if (typeof timer_societe != "undefined")
	{
		clearInterval(timer_societe);
	}
	
	ss_menu_societe.style.display = "block";
}

function No_ss_menu_societe() {
	
	timer_societe = setInterval(function() {document.getElementById("ss_menu_societe").style.display = "none"; clearInterval(timer_societe);},300);
}

// Fonctions defilement bande miniatures

function Init() {

	
	/* On fixe le nombre de miniatures	*/
	
	nbr = document.getElementById("nbr_minis").value;
	nbr = Number(nbr);
	
	/*alert(nbr);*/
	
	if (nbr > 5)
	{
		/* Pour test IE 6 */
	
		var strChUserAgent = navigator.userAgent;
		var intSplitStart = strChUserAgent.indexOf("(",0);
		var intSplitEnd = strChUserAgent.indexOf(")",0);
		var strChStart = strChUserAgent.substring(0,intSplitStart);
		var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);
		var strChEnd = strChUserAgent.substring(strChEnd);
	
		
		if (strChMid.indexOf("MSIE 6") != -1)	// SI NAVIGATEUR IE 6
		{
			nbr = (nbr - 5) * (108 + 16);	// pour l'arrete du defilement (le nombre de photo - 5 car 5 sont affichées en permanence */
		}
		else	// SI NAVIGATEUR PAS IE 6
		{
			nbr = (nbr - 5) * (108 + 20);
		}
	}
	
	if (nbr < 5)
	{
		nbr = 5;	// pour que la taille de la bande prenne en compte les image avec la croix (none.jpg) qu'on ajoute pour completer la ligne
	}
	
	nbr2 = nbr * (108 + 20);	// la longueur de la bande = nombre de miniatures * (108 la largeur + 20 les marges)
	
	document.getElementById("bande_minis").style.width = nbr2+"px";
	
	/* On cale la bande à gauche */
	
	bande = document.getElementById("bande_minis");

	document.getElementById("bande_minis").style.left = "0px";
	
	margin = 0;
	
	time1 = false;
	time2 = false;
	
	margin_asc = 0;
}

function Left() {

	timer1 = window.setInterval("Left2()",45);
	time1 = true;
	
}

function Left2() {
	
	if (margin >= 0)
	{
		if (time2 == true)
		{
			clearInterval(timer2);
			time2 = false;
		}
	}
	else
	{
		margin = margin + 10;
		bande.style.left = margin + "px";
	}
}

function Stop_left() {

	if (time1 == true)
	{
		clearInterval(timer1);
		time1 = false;
	}
}

function Right() {
	
	timer2 = window.setInterval("Right2()",45);
	time2 = true;
}

function Right2() {
	
	if (margin <= -nbr)
	{
		if (time1 == true)
		{
			clearInterval(timer1);
			time1 = false;
		}
	}
	else
	{
		margin = margin - 10;
		bande.style.left = margin + "px";
	}
}

function Stop_right() {
	
	if (time2 == true)
	{
		clearInterval(timer2);
		time2 = false;
	}
}

/* ascenseurs sur la page fours à induction */

function Haut() {
	
	zone_txt = document.getElementById("zone_asc_texte");
	
	timerA = window.setInterval("Haut2()",50);
	
}

function Haut2() {
	
	margin_asc = margin_asc + 10;
	
	zone_txt.style.top = margin_asc + "px";
	
	if (margin_asc >= 0)
	{
		clearInterval(timerA);
		
		margin_asc = 0;
		zone_txt.style.top = margin_asc + "px";
	}
}

function Stop_haut() {

	clearInterval(timerA);
}

function Bas() {
	
	zone_txt = document.getElementById("zone_asc_texte");
	
	timerB = window.setInterval("Bas2()",50);
}

function Bas2() {
	
	margin_asc = margin_asc - 10;
	
	zone_txt.style.top = margin_asc + "px";
	
	if (margin_asc <= -770)
	{
		clearInterval(timerB);
		
		margin_asc = -770;
		zone_txt.style.top = margin_asc + "px";
	}
}

function Stop_bas() {
	
	clearInterval(timerB);
}

function GoAncre() {
	
	zone_txt = document.getElementById("zone_asc_texte");
	margin_asc = -360;
	
	zone_txt.style.top = margin_asc + "px";
}

function Time() {

	cpt_tps = window.setInterval("Time2()",2000);
}

function Time2() {
	
	clearInterval(cpt_tps);
	
	window.location.href = "http://www.technofour.be/fours_industriels.php";
}