/*

///////////////////////////////////////////////////////////////////////////////////
#	WEBKEY LIBRARY (using Jquery lib)			#
#	Version 0.2														#
#	By WEBKEY-ENGINE										#
#	http://www.webkey-services.com					#
///////////////////////////////////////////////////////////////////////////////////

©2009-2010 - WebKey Productions & Developpement
All rights reserved


*/

$(function(){  $("#slideshow").ready(function(){  var classIMG = $(".slideimg"); var classIMG_h1 = $("#slideshow h1"); var classIMG_span = $("#slideshow span"); var classIMG_ul = $("#btts"); var focusBtt_color = "#3F3F3F"; var IMGsrc = "script/slide-images/"; var timeout = 15; var fade = 1000; var IMGSize = classIMG.size(); var currentIMG = 1; var intervalStop = false;  function getHTMLBoutons() {  var HTMLBoutons; for (i=0; i<IMGSize; i++) {  if (HTMLBoutons == undefined) {  HTMLBoutons = "<li>" + (i+1) + "</li>";  }  else {  HTMLBoutons = HTMLBoutons + "<li>" + (i+1) + "</li>";  }  }  return HTMLBoutons;  }  function checkIfTextExist(textOfh1,textOfspan) {  if ((textOfh1 == undefined) && (textOfspan == undefined)) {  $("#slide_text").fadeOut();  }  else {  $("#slide_text").fadeIn();  }  }  function btts_focusOn(number) {  for (y=0; y<IMGSize; y++) {  if (y == number) { $("#btts li").eq(y).css("background-color",focusBtt_color); $("#btts li").eq(y).css("color","#FFF"); }  else { $("#btts li").eq(y).css("background-color","#FFF"); $("#btts li").eq(y).css("color","#000"); } }  }  classIMG_ul.html(getHTMLBoutons());  $("#btts li").each(function(i) {  $(this).mouseover(function(){  if (i == 0) { classIMG.eq(1).hide(); } $("#debug").html("/* DEBUG */<br /><strong>Ancien :</strong> " + (currentIMG+1) + "<br /><strong>Nouveau : </strong>" + (i+1));  classIMG.eq(currentIMG).hide(); currentIMG = i;  var textOfh1 = classIMG.eq(i).attr("title"); var textOfspan = classIMG.eq(i).attr("alt");   classIMG.eq(i).show(); classIMG.eq(i).css("opacity",100);  checkIfTextExist(textOfh1,textOfspan);  if (textOfh1 == undefined) { textOfh1 = " "; } if (textOfspan == undefined) { textOfspan = " "; }    classIMG_h1.html(textOfh1); classIMG_span.html(textOfspan);  intervalStop = true; btts_focusOn(currentIMG);   });  });   function hide_and_show(hidevar,showvar) {  hidevar.animate({ opacity:0 },fade,function(){ hidevar.hide(); });  showvar.css({ opacity:0 });  showvar.show(function(){ showvar.animate({ opacity:100 },fade);  });   }  function hide_and_show_text(source,newvalue) {  if (newvalue == undefined) {	newvalue = " ";	}  source.animate({ opacity:0 },"fast",function(){ source.html(newvalue); });  source.css({ opacity:0 });    source.show(function(){ source.animate({ opacity:99 },"fast");  });  }   classIMG.eq(0).show(); hide_and_show_text(classIMG_h1,classIMG.eq(0).attr("title")); hide_and_show_text(classIMG_span,classIMG.eq(0).attr("alt")); checkIfTextExist(classIMG.eq(0).attr("title"),classIMG.eq(0).attr("alt")); btts_focusOn(0);    setInterval(function(){  if (!intervalStop) {  if  (IMGSize > currentIMG)  {  if (currentIMG > 0) {  var textOfh1 = classIMG.eq(currentIMG).attr("title"); var textOfspan = classIMG.eq(currentIMG).attr("alt"); checkIfTextExist(textOfh1,textOfspan); hide_and_show(classIMG.eq(currentIMG-1),classIMG.eq(currentIMG)); hide_and_show_text(classIMG_h1,textOfh1); hide_and_show_text(classIMG_span,textOfspan); btts_focusOn(currentIMG);  }  else {  var textOfh1 = classIMG.eq(0).attr("title"); var textOfspan = classIMG.eq(0).attr("alt"); checkIfTextExist(textOfh1,textOfspan); hide_and_show(classIMG.eq(currentIMG),classIMG.eq(0)); hide_and_show_text(classIMG_h1,textOfh1); hide_and_show_text(classIMG_span,textOfspan); btts_focusOn(0);  }  currentIMG++; } else  {  var textOfh1 = classIMG.eq(0).attr("title"); var textOfspan = classIMG.eq(0).attr("alt"); checkIfTextExist(textOfh1,textOfspan); hide_and_show(classIMG.eq(currentIMG-1),classIMG.eq(0)); hide_and_show_text(classIMG_h1,textOfh1); hide_and_show_text(classIMG_span,textOfspan); currentIMG=1; btts_focusOn(0);  }  }  },timeout*1000);        });  });