var datos=new Array([0,"fororeptilia.jpg","http://www.reptilia.net","Reptilia"],[1,"foropeqmamiferos.jpg","http://www.pequenosmamiferos.com","Pequeños mamíferos"],[2,"foroterribilis.jpg","http://www.terribilis.net","Terribilis"],[3,"foro_habistat.jpg","http://www.habistat.es","HabiStat"],[4,"fororeptiline.jpg","http://www.reptiline.com","Reptiline"],[5,"foro_onlycork.jpg","http://bit.ly/dCBxK7","Only Cork"],[6,"foroalcotan.jpg","http://www.alcotanvalencia.com","Alcotán Valencia"],[7,"foroexpoterraria.jpg","http://www.expoterraria.es","Expoterraria"],[8,"madriguera.jpg","http://www.la-madriguera.com ","La Madriguera"],[9,"foro_tecnofauna.jpg","http://www.tecno-fauna.com","Tecno Fauna"],[10,"foromonanimal.jpg","http://www.monanimal.net","Mon Animal"],[11,"procages.jpg","http://www.pro-cages.com","Pro Cages"],[12,"katanga.jpg","http://www.katangaexotica.com","Katanga Exótica"],[13,"grilleria.jpg","http://www.lagrilleria.com","La Grilleria"],[14,"boxincubation.jpg","http://boxincubation.pogonavitticeps.es","Box Incubation"],[15,"tarantulas.jpg","http://www.entomoneitor.com","Tarántulas en red"],[16,"elbicho.jpg","http://www.elbichovalencia.com","El Bicho"],[17,"hobbyzoo_pinto.jpg","http://www.hobbyzoopinto.es","Hobby Zoo Pinto"]);var cache=new Array();var aleatorio,banner1,banner2,banner3,banner4,banner5,banner6;function iniciarBanners(){banner1=document.getElementById('banner_1');banner2=document.getElementById('banner_2');banner3=document.getElementById('banner_3');banner4=document.getElementById('banner_4');banner5=document.getElementById('banner_5');banner6=document.getElementById('banner_6');aleatorio=randomEntries(datos,6,false);cacheaImagenes(aleatorio);setInterval('cambiaImagen()',4000)};function cambiaImagen(){banner1.src=cache[aleatorio[0][0]].src;banner2.src=cache[aleatorio[1][0]].src;banner3.src=cache[aleatorio[2][0]].src;banner4.src=cache[aleatorio[3][0]].src;banner5.src=cache[aleatorio[4][0]].src;banner6.src=cache[aleatorio[5][0]].src;banner1.title=aleatorio[0][3];banner2.title=aleatorio[1][3];banner3.title=aleatorio[2][3];banner4.title=aleatorio[3][3];banner5.title=aleatorio[4][3];banner6.title=aleatorio[5][3];banner1.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[0][2];banner2.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[1][2];banner3.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[2][2];banner4.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[3][2];banner5.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[4][2];banner6.parentNode.href='http://www.faunaexotica.net/redirigir.php?e='+aleatorio[5][2];aleatorio=randomEntries(datos,6,false);cacheaImagenes(aleatorio)};function cacheaImagenes(datos){if(!cache[datos[0][0]]){cache[datos[0][0]]=new Image(300,55);cache[datos[0][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[0][1]}if(!cache[datos[1][0]]){cache[datos[1][0]]=new Image(300,55);cache[datos[1][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[1][1]}if(!cache[datos[2][0]]){cache[datos[2][0]]=new Image(300,55);cache[datos[2][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[2][1]}if(!cache[datos[3][0]]){cache[datos[3][0]]=new Image(300,55);cache[datos[3][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[3][1]}if(!cache[datos[4][0]]){cache[datos[4][0]]=new Image(300,55);cache[datos[4][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[4][1]}if(!cache[datos[5][0]]){cache[datos[5][0]]=new Image(300,55);cache[datos[5][0]].src='http://www.faunaexotica.net/patrocinadores/'+datos[5][1]}};function randomEntries(array,number){var len=array.length;var entries=[];var count=0;var rand;var lastIndex=-1;var mems=[];var isFull=(number%len==0);while(count<number){rand=Math.floor(Math.random()*len);if(count==0)firstIndex=rand;else if(isFull&&count==number-2&&!mems[firstIndex])rand=firstIndex;else{var toggle=((rand+count)%3==0);while(mems[rand]||rand==lastIndex||(!isFull&&count==number-1&&rand==firstIndex))if(toggle){if(--rand<0)rand=len-1}else if(++rand>len-1)rand=0}entries[count++]=array[rand];mems[rand]=true;lastIndex=rand;if(count%len==len-1&&count!=number){for(var i=0;i<len;i++)if(mems[i])mems[i]=false;else{entries[count++]=array[i];lastIndex=i}}}return entries};window.onload=iniciarBanners;
