// JavaScript Document

function opacity(id, opacStart, opacEnd, millisec) 
{ 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else{ 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
}

function pausecomp(millis) 
{
	var date = new Date();
	var curDate = null;
	
	do { curDate = new Date(); } 
	while(curDate-date < millis);
} 

function changeOpac(opacity, id) 
{ 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function donull(){
}

function imageChange(div)
{	
	//Do not Edit below
	randMax = imagesA.length-1;
	randN ++;
	if(randN > randMax)
	{
		randN = randN - randMax;
	}
	document.getElementById(div).style.backgroundImage = "url("+imagesA[randN]+")";
	setTimeout("fadeIn('"+div+"');", 1);
}

function fadeOut(Instant, Div)
{
	/*if(Instant != true)
	{
		opacity(Div, 100, 0, 750);
	}
	else
	{
		opacity(Div, 100, 0, 1);
	}*/
	setTimeout ("imageChange('"+Div+"');", 5000);
}

function fadeIn(Div)
{
	//opacity(Div, 0, 100, 750);
	setTimeout("fadeOut(true, '"+Div+"');", 5000);
} 

function montrer(id) {
window.document.getElementById(id).style.display="block";
window.document.getElementById(elm).style.visibility ='visible';
}

function cacher(id) {
window.document.getElementById(id).style.display="none";
window.document.getElementById(elm).style.visibility ='hidden';
}


function see(id, num)
{
	for(i=1;i<=num;i++)
	{
		document.getElementById(i).style.display = 'none';
	}

	document.getElementById(id).style.display = 'block';
}

function verifFormContact(monForm)
{
	var ok = true;
	if(window.document.monForm.nom.value == ''){

         alert('Il faut obligatoirement renseigner le champs NOM');

         window.document.monForm.nom.focus();
		 ok = false;

    }

    if(window.document.monForm.pnom.value == '') {

         alert('Il faut obligatoirement renseigner le champs PRENOM');

         window.document.monForm.pnom.focus();
		 ok = false;

    }
	

	 if(window.document.monForm.mail.value == '') {

         alert('Il faut obligatoirement renseigner le champs EMAIL');

         window.document.monForm.mail.focus();
		 ok = false;

    }
	if(window.document.monForm.mail.value.indexOf('@') == -1)
	{

		alert("Votre email n'est pas valable !");

		window.document.monForm.mail.focus();
		ok = false;

	}
	
	if (ok != false)
	{
		window.document.monForm.submit();
	}

}

function see_img(div1,num)
{
	for(i=0;i<num;i++)
	{
		Pdiv = document.getElementById( 'img_' + i );
		Pdiv.className = ( Pdiv.className.match('cachediv')) ? Pdiv.className.replace("","") : Pdiv.className+' '+'cachediv';
	}
	
	var divID = div1;
	Pdiv = document.getElementById( divID );
	Pdiv.className = Pdiv.className.replace(/cachediv/,"");
}

function see_prod(div1,num)
{
	for(i=0;i<99;i++)
	{
		if(document.getElementById( 'prod_' + i ))
		{
			Pdiv = document.getElementById( 'prod_' + i );
			Pdiv.className = ( Pdiv.className.match('cachediv')) ? Pdiv.className.replace("","") : Pdiv.className+' '+'cachediv';
		}
	}
	
	if(div1 != '')
	{
		var divID = div1;
		Pdiv = document.getElementById( divID );
		Pdiv.className = Pdiv.className.replace(/cachediv/,"");
	}
}

function see_indic(id)
{
	for(i=0;i<99;i++)
	{
		if(document.getElementById( 'indic_open_' + i ))
		{
			Pdiv = document.getElementById( 'indic_open_' + i );
			Pdiv.className = ( Pdiv.className.match('cachediv')) ? Pdiv.className.replace("","") : Pdiv.className+' '+'cachediv';
		}
	}
	
	if(id != '')
	{
		var divID = 'indic_open_' + id ;
		Pdiv = document.getElementById( divID );
		Pdiv.className = Pdiv.className.replace(/cachediv/,"");
	}
	
}

function pagi_theme(div1,num)
{
	for(i=0;i<9;i++)
	{
		if(document.getElementById( i + '_pagthem' ))
		{
			Pdiv = document.getElementById( i + '_pagthem' );
			Pdiv.className = ( Pdiv.className.match('cachediv')) ? Pdiv.className.replace("","") : Pdiv.className+' '+'cachediv';
		}
	}
	
	for(i=0;i<9;i++)
	{
		if(document.getElementById( i + '_pag' ))
		{
			Pdiv = document.getElementById( i + '_pag' );
			Pdiv.className = 'pagination_sup_2';
		}
	}
	
	if(div1 != '')
	{
		var divID = div1;
		Pdiv = document.getElementById( divID );
		Pdiv.className = Pdiv.className.replace(/cachediv/,"");
	}
	
	if(num != '')
	{
		Pdiv = document.getElementById( num + '_pag' );
		Pdiv.className = 'pagination_sup';
	}
}

function pagi_prod(div1,num)
{
	for(i=0;i<9;i++)
	{
		if(document.getElementById( i + '_pagprod' ))
		{
			Pdiv = document.getElementById( i + '_pagprod' );
			Pdiv.className = ( Pdiv.className.match('cachediv')) ? Pdiv.className.replace("","") : Pdiv.className+' '+'cachediv';
		}
	}
	
	for(i=0;i<9;i++)
	{
		if(document.getElementById( i + '_pag' ))
		{
			Pdiv = document.getElementById( i + '_pag' );
			Pdiv.className = 'pagination_sup_2';
		}
	}
	
	if(div1 != '')
	{
		var divID = div1;
		Pdiv = document.getElementById( divID );
		Pdiv.className = Pdiv.className.replace(/cachediv/,"");
	}
	
	if(num != '')
	{
		Pdiv = document.getElementById( num + '_pag' );
		Pdiv.className = 'pagination_sup';
	}
}


