/*

///////////////////////////////////////////////////////////////////////////////////
#	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 == "") && (textOfspan == "")) {  $("#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);        });  $("h2.question").each(function(i){  var question_current = $("h2.question").eq(i); var reponse_current = $("div.reponse").eq(i); var reponse_current_height = $("div.reponse").eq(i).height(); var question_current_marginB = $("h2.question").eq(i).css("margin-bottom"); var opacity_noFocus = 1;    $(question_current).click(function(){  if (reponse_current.css("display") == "none") {  reponse_current.css({ height:reponse_current_height, opacity:1 }); $("h2.question").css({ opacity: opacity_noFocus }); question_current.css({ "margin-bottom":0, opacity:1 }); reponse_current.show(function(){ reponse_current.fadeIn("slow"); });  }  else {   reponse_current.animate({ height:"0px", opacity:0 }, function(){ question_current.css({ "margin-bottom":question_current_marginB }); reponse_current.hide(); }); $("h2.question").css({ opacity: opacity_noFocus }); question_current.css({ opacity: 1 });   }   $("h2.question").css({ "filter": " " }); $("div.reponse").css({ "filter": " " });   });   });  $("#customInputPrice").ready(function() {  var formule; var total; var customPrice; var TEG;  $("#customInputPrice").keyup(function() {  customPrice = $(this).val(); if (isNaN(customPrice)) { $(this).val(""); } TEG = (customPrice*(TEGmin*(customPrice/PremierPack)/customPrice));  for (i=0; i<mensualites.length; i++) {  formule = (mensualites[i] != 1) ? ((((parseFloat(((customPrice*(PremierPack*TEG)))/customPrice)/100)*mensualites[i])+parseFloat(customPrice))/mensualites[i]) : customPrice; total = (formule*mensualites[i]);  $("#CustomMensualites_by" + mensualites[i]).html(number_format(formule,2,',','')); $("#customTotal_by" + mensualites[i]).html(number_format(total,2,',','')); $("#CustomInputs_by" + mensualites[i]).val(customPrice + "C" + mensualites[i]);  }  });  });  $("#packs").ready(function() {  var nextBTT = $("img.NextPack"); var prevBTT = $("img.PreviousPack"); var packWrap = $("div#pack_wrap"); var packBoxes = $("div.packBox"); var packBox_nb = packBoxes.length; var packBox_margins = 10; var packBox_width = packBoxes.css("width"); var packBox_size = parseFloat(packBox_width)+parseFloat(packBox_margins); var currentPX = 0; var currentPos = 1; var divisions = 2;  function checkBTTS() {  if (currentPos == 1) {  prevBTT.fadeOut("slow");  }  else {  prevBTT.fadeIn("slow");  }   if ((currentPos == (packBox_nb+1)-divisions) || (currentPos == (packBox_nb+divisions)-divisions)) {  nextBTT.fadeOut("slow");  }  else {  nextBTT.fadeIn("slow");  }  return true;   }  $("#pack_wrap").css("width",(packBox_size*packBox_nb)+"px"); $(".packBox h1").css("margin-top","-47px"); packBoxes.css("float","left"); currentPX += (packBox_size*(currentPos-1)); packBoxes.css("right", currentPX + "px"); checkBTTS();   $(nextBTT).click(function(){  if (currentPos < (packBox_nb*divisions)) {  currentPX += (packBox_size*divisions); currentPos = (currentPos + divisions); packBoxes.animate({  "right": currentPX + "px"  });  checkBTTS();  }  });  $(prevBTT).click(function(){  if (currentPos > (1*divisions)) {  currentPX -= (packBox_size*divisions); currentPos = (currentPos - divisions); packBoxes.animate({  "right": currentPX + "px"  });  checkBTTS();  }  });  $(".content h2").each(function(i){  var h2nb = ($(".content h2").length)/packBox_nb; var imgLink = $("img.check").eq(i); var TextSuite = $(".textSuite").eq(i);  if (imgLink.attr("alt") == "NON") {  $(".textSuite").eq(i).hide();  }   $(".content h2").eq(i).click(function(){  if (TextSuite.css("display") == "none") { TextSuite.slideDown("slow"); } else { TextSuite.slideUp("slow"); }  });  });  });  });
