function addEvent(elm,evType,fn,useCapture)
{if(elm.addEventListener)
{elm.addEventListener(evType,fn,useCapture);return true;}
else if(elm.attachEvent)
{var r=elm.attachEvent('on'+evType,fn);return r;}
else
{elm['on'+evType]=fn;}}
var settingpub={imagesPath:'images/',imagesPrefix:'pub'};var settinggraph={imagesPath:'images/',imagesPrefix:'graphisme'};var settingbrand={imagesPath:'images/',imagesPrefix:'branding'};var settingweb={imagesPath:'images/',imagesPrefix:'web'};var settingflor={imagesPath:'images/',imagesPrefix:'florilege'};var imgpub,imggraph;$(document).ready(function(){var e=$('a.pub');e.data('config',settingpub);e=document.getElementById('pub');if($(e).hasClass('menuactive')==false){addEvent(e,'mouseover',over,true);addEvent(e,'mouseout',out,true);}
e=$('a.graph');e.data('config',settinggraph);e=document.getElementById('graph');if($(e).hasClass('menuactive')==false){addEvent(e,'mouseover',over,false);addEvent(e,'mouseout',out,false);}
e=$('a.brand');e.data('config',settingbrand);e=document.getElementById('brand');if($(e).hasClass('menuactive')==false){addEvent(e,'mouseover',over,false);addEvent(e,'mouseout',out,false);}
e=$('a.web');e.data('config',settingweb);e=document.getElementById('web');if($(e).hasClass('menuactive')==false){addEvent(e,'mouseover',over,false);addEvent(e,'mouseout',out,false);}
e=$('a.flor');e.data('config',settingflor);e=document.getElementById('flor');if($(e).hasClass('menuactive')==false){addEvent(e,'mouseover',over,false);addEvent(e,'mouseout',out,false);}});function out(event){var elem=event.target||event.srcElement;config=$(elem).data('config');if(typeof config=='undefined'){elem=$(elem).parents('a').get(0);}
config=$(elem).data('config');var bck=$(elem).children('.clappet-background').get(0);myimage=$(bck).find('img').get(0);img=$(myimage);elem=img;doOut(elem,config);}
function switchsrc(elem,sr){elem.attr('src',sr);}
function over(event){var elem=event.target||event.srcElement;config=$(elem).data('config');if(typeof config=='undefined'){elem=$(elem).parents('a').get(0);}
config=$(elem).data('config');var bck=$(elem).children('.clappet-background').get(0);myimage=$(bck).find('img').get(0);img=$(myimage);elem=img;doOver(elem,config);}
function doOver(elem,config){for(i=1;i<8;i++){$.get(config.imagesPath+config.imagesPrefix+i+'.jpg');}
setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'2.jpg');},200);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'3.jpg');},250);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'4.jpg');},400);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'5.jpg');},450);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'6.jpg');},600);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'7.jpg');},650);}
function doOut(elem,config){setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'6.jpg');},200);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'5.jpg');},250);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'4.jpg');},400);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'3.jpg');},450);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'2.jpg');},600);setTimeout(function(){switchsrc(elem,config.imagesPath+config.imagesPrefix+'1.jpg');},650);}
(function($){$.fn.extend({clapet:function(options){var defaults={imagesPath:'images/',imagesPrefix:'cpl-back',sound:'glass.wav'};var setting=$.extend(defaults,options);$(this).each(function(index,elem){var html=$('<div class="clappet-background"></div>');$(this).append(html);var bck=$(this).children('.clappet-background').get(0);var img=$('<img />');if($(this).hasClass('menuactive')){$(img).attr('src',setting.imagesPath+setting.imagesPrefix+'7.jpg').css({height:'99px',width:'99px'});}
else{$(img).attr('src',setting.imagesPath+setting.imagesPrefix+'1.jpg').css({height:'99px',width:'99px'});}
$(bck).append(img);});}})})(jQuery);
