jQuery(function(){
var iconLegales = jQuery("#iconosLegales").detach();
var logoVigilado= jQuery("#viglogo").detach();
jQuery("#footerContainer").prepend(iconLegales);
jQuery(".icon-rot").prepend(logoVigilado);
var auto=null;
jQuery.fn.corfislider=function(intervalo){
//jQuery( "[data-control='adelante']" ).off("click");
var slider=jQuery(this);
var i=parseInt(slider.children("div").length)-1;
var estado=false;
function autoPlay(){
jQuery("#autoBoton").trigger("click");
}
auto=setInterval(autoPlay, intervalo);
jQuery(jQuery(this).children()).each(function(index){
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-src")+"')");
/*if(parseFloat(screen.width)<=768 && parseFloat(screen.width)>=400){
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-tablet-src")+"')");
}else if(parseFloat(screen.width)<400){
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-movil-src")+"')");
}else{
jQuery(this).css("background-image","url('"+jQuery(this).attr("data-src")+"')");
}*/
});
jQuery("[data-control], #autoBoton").on("click", function(event){
clearInterval(auto);
if(jQuery(this).attr("data-control")=="adelante"){
var miControl=jQuery(this);
miControl.attr("data-control", "void");
if(estado){
slider.children("div").fadeIn("slow");
estado=false;
miControl.attr("data-control", "adelante");
}else{
slider.children("div").eq(i).fadeOut("slow", function() {
miControl.attr("data-control", "adelante");
if(i<=1){
i=parseInt(slider.children("div").length)-1;
estado=true;
}else{
i--;
}//Fin if interno
});
}//Fin If medio
}else if(jQuery(this).attr("dataP-control")=="atras"){//Else de If principal
var miControl=jQuery(this);
miControl.attr("data-control", "void");
if(parseInt(slider.children("div:visible").length)==parseInt(slider.children("div").length)){
slider.children("div").hide();
slider.children("div").eq(0).fadeIn("slow", function(){
});
i=1;
miControl.attr("data-control", "atras");
}else{
slider.children("div").eq(parseInt(slider.children("div:visible").length)).fadeIn("slow", function(){
miControl.attr("data-control", "atras");
});
i=(parseInt(slider.children("div:visible").length)==parseInt(slider.children("div").length))?parseInt(slider.children("div").length)-1:parseInt(slider.children("div:visible").length);
}
}//Fin IF principal
auto=setInterval(autoPlay, intervalo);
event.stopImmediatePropagation();
});
}
jQuery("#corfislider").corfislider(6000);
jQuery(".id-Z7_609I03O0JOCSC0A6NTJHTV38E3").hide();
var resizeId;
jQuery(window).on("resize", function() {
clearTimeout(resizeId);
clearTimeout(auto);
resizeId = setTimeout(doneResizing, 500);
});
function doneResizing(){
jQuery("#corfislider").corfislider(6000);
}
});