$(document).ready(function() {
zIndex = 1;
showImageAccueil();

if($("#image1"))
{
imageactive = 1;
chrono = setInterval('changePetiteImage();',4000);

}
var hauteurClient = $(window).height();
var hauteurContenu = $("#conteneur").height();

if(hauteurContenu < hauteurClient)
{
	
	$("#conteneur").css("height",hauteurClient+"px")
	$("#corp").css("height",hauteurClient-194+"px")
	
}

if($("#conteneur").height() < 800)
{
	$("#conteneur").css("height","800px")
	$("#corp").css("height","603px")	
}

$("#logoFiliale a").hover(
	function(){
	
		var titre = $(this).attr("alt");
		var posImg= $(this).children("img").position();
		var widthImg = $(this).children("img").width()/2;
		var posCentrer = posImg.left+widthImg;
					
		$(this).append('<div style="float:left;position:absolute;bottom:27px;z-index:10000;left:'+ posCentrer +'px;margin-left:-70px;padding-top:10px; background:url(http://www.v3wdev.com/titechno/images/layout/info-bulle.png) no-repeat;width:150px; height:43px; font-size:9px; line-height:10px;display:block; text-align:center;">' + titre + '</div>');
	
	},
	function()
	{
		$(this).children("div").fadeOut("fast");
	
	}
)
	$(window).resize(function(){
		
	var hauteurClient = $(window).height();
	var hauteurContenu = $("#conteneur").height();
	
	if(hauteurContenu < hauteurClient)
	{
		
		$("#conteneur").css("height",hauteurClient+"px")
		$("#corp").css("height",hauteurClient-194+"px")
		
	}
	
	if($("#conteneur").height() < 800)
	{
		$("#conteneur").css("height","800px")
		$("#corp").css("height","603px")	
	}
	
	
	})
	
	
	

});





function showImageAccueil()
{

	var logoClient=new Array(); 
	logoClient[0]="1";       
	logoClient[1]="2";
	logoClient[2]="3";
	logoClient[3]="4";
	logoClient[4]="5";
	logoClient[5]="6";
	logoClient[6]="7";
	logoClient[7]="8";
	
	
	var randomnumber1=Math.floor(Math.random()*logoClient.length)		
	
	if(randomnumber1 ==logoClient.length-1)
	{
		randomnumber2 = 0;
	}
	else
	{
	randomnumber2 = randomnumber1+1
	}
	
	$(".logo1").css("background","url(http://www.titechno.com/images/layout/logo-clients/"+ logoClient[randomnumber1] +".gif)")	
	$(".logo2").css("background","url(http://www.titechno.com/images/layout/logo-clients/"+ logoClient[randomnumber2] +".gif)")
	



}


function changePetiteImage(){
	
	if(imageactive + 1 == 6){
		next = 1;
	}else{
		next = imageactive+1;
	}
	
	$("#image"+imageactive).fadeOut("slow").css("z-index","40");
	$("#image"+next).fadeIn("slow").css("z-index","39").css("top","0");	

	imageactive = next;
}





