var slideDelay=6000;var slideImageList=[];var slideFirstImage=[];var slideTimer=null;var slideGlobalId=0;var tmpUrl="http://www.popgom.fr";function preloadImages(imagesPath,imgList,parentNode){slideImageList[parentNode]=[];for(var i=0;i<imgList.length;i++){var img=new Image();if(typeof imagesPath!="undefined"&&imgList[i].indexOf(imagesPath)!=0){imgList[i]=imagesPath+imgList[i];}img.src=imgList[i];slideImageList[parentNode].push(img);}}function removeImages(parentNode){parentNode=EL(parentNode);while(parentNode.firstChild!=null){parentNode.removeChild(parentNode.firstChild);}}function renderImages(imagesPath,imgList,parentNode,noRandom){preloadImages(imagesPath,imgList,parentNode);if(noRandom){slideFirstImage[parentNode]=0;}else{slideFirstImage[parentNode]=Math.round(Math.random()*(imgList.length-1));}for(var i=0;i<imgList.length;i++){renderImage(imgList[i],parentNode,parentNode+"slideimage"+i,(slideFirstImage[parentNode]!=i));}}function renderImage(img,parentNode,id,hidden){parentNode=document.getElementById(parentNode);var d=document.createElement("div");d.id=id;d.style.position="absolute";var im=document.createElement("img");im.src=img;with(im.style){width=parentNode.style.width;height=parentNode.style.height;}d.appendChild(im);if(hidden){Valraiso.util.changeOpacity(d,0);}parentNode.appendChild(d);}function renderImagesWithUrl(imagesPath,imgList,imgUrls,parentNode,noRandom,urlTargets,altImages){preloadImages(imagesPath,imgList,parentNode);if(noRandom){slideFirstImage[parentNode]=0;}else{slideFirstImage[parentNode]=Math.round(Math.random()*(imgList.length-1));}for(var i=0;i<imgList.length;i++){renderImageWithUrl(imgList[i],imgUrls[i],parentNode,parentNode+"slideimage"+i,(slideFirstImage[parentNode]!=i),urlTargets[i],altImages[i]);}}function renderImageWithUrl(img,url,parentNode,id,hidden,urlTarget,altImage){parentNode=document.getElementById(parentNode);var d=document.createElement("div");d.id=id;d.style.zIndex="1";d.style.position="absolute";d.style.opacity="1";var a=document.createElement("a");a.href=url;a.style.color="white";if(urlTarget){if(navigator.appVersion.indexOf("MSIE 6")==-1&&navigator.appVersion.indexOf("MSIE 7")==-1){a.setAttribute("onclick","openNavigatorIframe('"+url+"','popgom','890','500', 'menubar=no,  status=no, scrollbars=yes, location=no');return false;");}else{a.target="_blank";}}var im=document.createElement("img");im.src=img;im.style.borderColor="transparent";im.alt=altImage;with(im.style){width=parentNode.style.width;height=parentNode.style.height;}a.appendChild(im);d.appendChild(a);if(hidden){Valraiso.util.changeOpacity(d,0);}parentNode.appendChild(d);}function slideImages(imgList,parentNode,delay,fromIdx,slideId){if(slideId<slideGlobalId){return;}if(imgList.length<2){return;}if(typeof parentNode=="string"){parentNode=document.getElementById(parentNode);}if(delay==null){delay=slideDelay;}if(fromIdx==null){fromIdx=slideFirstImage[parentNode.id];}var nextIdx=fromIdx+1;if(nextIdx>imgList.length-1){nextIdx=0;}if(slideImageList[parentNode.id]==null||!slideImageList[parentNode.id][nextIdx].complete){setTimeout(function(){slideImages(imgList,parentNode,delay,fromIdx,slideId);},200);return;}Valraiso.util.fading(parentNode.id+"slideimage"+fromIdx,100,0,1000);Valraiso.util.fading(parentNode.id+"slideimage"+nextIdx,0,100,1000);if(slideTimer!=null){clearTimeout(slideTimer);}slideTimer=setTimeout(function(){slideImages(imgList,parentNode,delay,nextIdx,slideId);},delay+1500);}function slideToPreviousImages(imgList,parentNode,delay,fromIdx,slideId){if(slideId<slideGlobalId){return;}if(imgList.length<2){return;}if(typeof parentNode=="string"){parentNode=document.getElementById(parentNode);}if(delay==null){delay=slideDelay;}if(fromIdx==null){fromIdx=slideFirstImage[parentNode.id];}var nextIdx=fromIdx-1;if(nextIdx<0){nextIdx=imgList.length-1;}if(slideImageList[parentNode.id]==null||!slideImageList[parentNode.id][nextIdx].complete){setTimeout(function(){slideImages(imgList,parentNode,delay,fromIdx,slideId);},200);return;}Valraiso.util.fading(parentNode.id+"slideimage"+fromIdx,100,0,1000);Valraiso.util.fading(parentNode.id+"slideimage"+nextIdx,0,100,1000);if(slideTimer!=null){clearTimeout(slideTimer);}slideTimer=setTimeout(function(){slideImages(imgList,parentNode,delay,nextIdx,slideId);},delay+1500);}function previousHighlight(imgList,delay){parentNode=document.getElementById("highlightCampaigns");var currentIndex=0;for(var i=0;i<imgList.length;i++){child=document.getElementById("highlightCampaignsslideimage"+i);if(child.style.opacity>=0.5){currentIndex=i;}}slideToPreviousImages(imgList,parentNode,delay,currentIndex,"highlightCampaignsslideimage"+currentIndex);}function nextHighlight(imgList,delay){parentNode=document.getElementById("highlightCampaigns");var currentIndex=0;for(var i=0;i<imgList.length;i++){child=document.getElementById("highlightCampaignsslideimage"+i);if(child.style.opacity>=0.5){currentIndex=i;}}slideImages(imgList,parentNode,delay,currentIndex,"highlightCampaignsslideimage"+currentIndex);}
