$(document).ready(function() {
    $('#barra-superior li, #social-pie li').hover(function(){
        $(this).find('span').stop(true, true).fadeIn("slow");
    }, function(){
        $(this).find('span').stop(true, true).fadeOut("slow");
    });
    $('#menu li').hover(function(){
		if(checkIEVersion())
			$(this).find('ul').stop(true, true).show();
		else
			$(this).find('ul').stop(true, true).fadeIn("slow");

    }, function(){
        $(this).find('ul').stop(true, true).hide();
    });
    $(".botones-secciones-5 li a img").hover(function(){
        $(".botones-secciones-5 li a img").stop(true, true).animate({
            opacity: 1
          }, 300);
        $(".botones-secciones-5 li a img").not(this).stop(true, true).animate({
            opacity: 0.3
          },300);
        });
    $(".botones-secciones-5 li a img").mouseleave(function(){
        $(".botones-secciones-5 li a img").stop(true, true).animate({
            opacity: 1
          },300);
    });
	
	$('.pack_repuestos li').hover(function(){
        $(this).find('span').stop(true, true).fadeIn("fast");
    }, function(){
        $(this).find('span').stop(true, true).fadeOut("fast");
    });

	$("#flash-pie").html("<ul><li><ul id=\"primer-nivel\"><li><a href=\"http://www.dercocenter.cl\" target=\"_blank\" onmouseover=\"footerSegundoNivel('c-vehiculos');\"><img src='img/footer/iconos/derco/derco-center.jpg' border='0' alt='derco-center' /></a></li><li><a href=\"http://www.suzuki.cl/motos/\" target=\"_blank\"><img src='img/footer/iconos/derco/derco-motos.jpg' border='0' alt='derco-motos' /></a></li><li><a href=\"http://www.dercomaq.cl\" target=\"_blank\" onmouseover=\"javascript:footerSegundoNivel('c-maq');\"><img src='img/footer/iconos/derco/derco-maq.jpg' border='0'  alt='derco-maq'/></a></li><li><a href=\"http://www.dercoparts.cl\" target=\"_blank\" onmouseover=\"javascript:footerSegundoNivel('c-parts');\"><img src='img/footer/iconos/derco/derco-parts.jpg' border='0' alt='derco-parts' /></a></li><li><a href=\"http://www.autoplanet.cl\" target=\"_blank\" onmouseover=\"javascript:footerSegundoNivel('c-autoplanet');\"><img src='img/footer/iconos/derco/autoplanet.jpg' border='0' alt='autoplanet' /></a></li></ul></li><li><ul id=\"segundo-nivel\" class=\"sn-c-vehiculos\"><li><a href=\"http://www.dercocenter.cl/nuevos.html\" target=\"_blank\" onmouseover=\"javascript:footerTercerNivel('c-vehiculos');\"><img src='img/footer/iconos/vehiculos.jpg' border='0' alt='vehiculos' /></a></li><li><a href=\"http://www.dercocenter.cl/repuestos.html\" target=\"_blank\" ><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.dercocenter.cl/accesorios.html\" target=\"_blank\"><img src='img/footer/iconos/accesorios.jpg' border='0' alt='accesorios' /></a></li><li><a href=\"http://www.dercocenter.cl/garantia.html\" target=\"_blank\"><img src='img/footer/iconos/serv-tecnico.jpg' border='0' alt='serv-tecnico' /></a></li><li><a href=\"http://www.dercocenter.cl/financiamiento.html\" target=\"_blank\"><img src='img/footer/iconos/financiamiento.jpg' border='0' alt='financiamiento' /></a></li><li><a href=\"http://www.dercocenter.cl/seguros.html\" target=\"_blank\"><img src='img/footer/iconos/seguros.jpg' border='0' alt='seguros' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-maq\"><li><a href=\"http://www.dercomaq.cl/agricola/\" target=\"_blank\"><img src='img/footer/iconos/agricola.jpg' border='0' alt='agricola' /></a></li><li><a href=\"http://www.dercomaq.cl/construccion/\" target=\"_blank\"><img src='img/footer/iconos/construccion.jpg' border='0' alt='construccion' /></a></li><li><a href=\"http://www.dercomaq.cl/industrial/\" target=\"_blank\"><img src='img/footer/iconos/industrial.jpg' border='0' alt='industrial' /></a></li><li><a href=\"http://www.dercomaq.cl/forestal/\" target=\"_blank\"><img src='img/footer/iconos/forestal.jpg' border='0' alt='forestal' /></a></li><li><a href=\"http://www.camionesjac.cl/\" target=\"_blank\"><img src='img/footer/iconos/camiones.jpg' border='0' alt='camiones' /></a></li><li><a href=\"http://www.dercomaq.cl/mineria/\" target=\"_blank\"><img src='img/footer/iconos/mineria.jpg' border='0' alt='mineria' /></a></li><li><a href=\"http://www.dercomaq.cl/ferreteria/\" target=\"_blank\"><img src='img/footer/iconos/agroferreteria.jpg' border='0' alt='agroferreteria' /></a></li><li><a href=\"http://www.dercomaq.cl/arriendos/\" target=\"_blank\"><img src='img/footer/iconos/rental.jpg' border='0' alt='rental' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-parts\"><li><a href=\"http://www.dercoparts.cl/repuestos/\" target=\"_blank\"><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.dercoparts.cl/neumaticos/\" target=\"_blank\"><img src='img/footer/iconos/neumaticos.jpg' border='0' alt='neumaticos' /></a></li><li><a href=\"http://www.dercoparts.cl/baterias/\" target=\"_blank\"><img src='img/footer/iconos/baterias.jpg' border='0' alt='baterias' /></a></li><li><a href=\"http://www.dercoparts.cl/lubricantes/\" target=\"_blank\"><img src='img/footer/iconos/lubricantes.jpg' border='0' alt='lubricantes' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-autoplanet\"><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/neumaticos.jpg' border='0' alt='neumaticos' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/baterias.jpg' border='0' alt='baterias' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/lubricantes.jpg' border='0' alt='lubricantes' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/car-care.jpg' border='0' alt='car-care' /></a></li></ul></li><li><ul id=\"tercer-nivel\" class=\"tn-c-vehiculos\"><li><a href=\"http://www.suzuki.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/suzuki.jpg' border='0' alt='suzuki' /></a></li><li><a href=\"http://www.mazda.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/mazda.jpg' border='0' alt='mazda' /></a></li><li><a href=\"http://www.renault.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/renault.jpg' border='0' alt='renault' /></a></li><li><a href=\"http://www.renaultsamsung.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/samsung.jpg' border='0' alt='samsung' /></a></li><li><a href=\"http://www.greatwallmotors.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/great-wall.jpg' border='0' alt='great-wall' /></a></li><li><a href=\"http://www.autosjac.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/jac.jpg' border='0' alt='jac' /></a></li><li><a href=\"http://www.geelymotors.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/geely.jpg' border='0' alt='geely' /></a></li><li><a href=\"http://www.changan.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/changan.jpg' border='0' alt='changan' /></a></li></ul></li></ul>");
	//document.write("<ul><li><ul id=\"primer-nivel\"><li><a href=\"javascript:void(0)\" onmouseover=\"footerSegundoNivel('c-vehiculos');\"><img src='img/footer/iconos/derco/derco-center.jpg' border='0' alt='derco-center' /></a></li><li><a href=\"http://www.suzuki.cl/motos/\" target=\"_blank\"><img src='img/footer/iconos/derco/derco-motos.jpg' border='0' alt='derco-motos' /></a></li><li><a href=\"javascript:void(0)\" onmouseover=\"javascript:footerSegundoNivel('c-maq');\"><img src='img/footer/iconos/derco/derco-maq.jpg' border='0'  alt='derco-maq'/></a></li><li><a href=\"javascript:void(0)\" onmouseover=\"javascript:footerSegundoNivel('c-parts');\"><img src='img/footer/iconos/derco/derco-parts.jpg' border='0' alt='derco-parts' /></a></li><li><a href=\"javascript:void(0)\" onmouseover=\"javascript:footerSegundoNivel('c-autoplanet');\"><img src='img/footer/iconos/derco/autoplanet.jpg' border='0' alt='autoplanet' /></a></li></ul></li><li><ul id=\"segundo-nivel\" class=\"sn-c-vehiculos\"><li><a href=\"javascript:void(0)\" onmouseover=\"javascript:footerTercerNivel('c-vehiculos');\"><img src='img/footer/iconos/vehiculos.jpg' border='0' alt='vehiculos' /></a></li><li><a href=\"http://www.dercocenter.cl/repuestos.html\" target=\"_blank\" ><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.dercocenter.cl/accesorios.html\" target=\"_blank\"><img src='img/footer/iconos/accesorios.jpg' border='0' alt='accesorios' /></a></li><li><a href=\"http://www.dercocenter.cl/garantia.html\" target=\"_blank\"><img src='img/footer/iconos/serv-tecnico.jpg' border='0' alt='serv-tecnico' /></a></li><li><a href=\"http://www.dercocenter.cl/financiamiento.html\" target=\"_blank\"><img src='img/footer/iconos/financiamiento.jpg' border='0' alt='financiamiento' /></a></li><li><a href=\"http://www.dercocenter.cl/seguros.html\" target=\"_blank\"><img src='img/footer/iconos/seguros.jpg' border='0' alt='seguros' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-maq\"><li><a href=\"http://www.dercomaq.cl/agricola/\" target=\"_blank\"><img src='img/footer/iconos/agricola.jpg' border='0' alt='agricola' /></a></li><li><a href=\"http://www.dercomaq.cl/construccion/\" target=\"_blank\"><img src='img/footer/iconos/construccion.jpg' border='0' alt='construccion' /></a></li><li><a href=\"http://www.dercomaq.cl/industrial/\" target=\"_blank\"><img src='img/footer/iconos/industrial.jpg' border='0' alt='industrial' /></a></li><li><a href=\"http://www.dercomaq.cl/forestal/\" target=\"_blank\"><img src='img/footer/iconos/forestal.jpg' border='0' alt='forestal' /></a></li><li><a href=\"http://www.camionesjac.cl/\" target=\"_blank\"><img src='img/footer/iconos/camiones.jpg' border='0' alt='camiones' /></a></li><li><a href=\"http://www.dercomaq.cl/mineria/\" target=\"_blank\"><img src='img/footer/iconos/mineria.jpg' border='0' alt='mineria' /></a></li><li><a href=\"http://www.dercomaq.cl/ferreteria/\" target=\"_blank\"><img src='img/footer/iconos/agroferreteria.jpg' border='0' alt='agroferreteria' /></a></li><li><a href=\"http://www.dercomaq.cl/arriendos/\" target=\"_blank\"><img src='img/footer/iconos/rental.jpg' border='0' alt='rental' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-parts\"><li><a href=\"http://www.dercoparts.cl/repuestos/\" target=\"_blank\"><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.dercoparts.cl/neumaticos/\" target=\"_blank\"><img src='img/footer/iconos/neumaticos.jpg' border='0' alt='neumaticos' /></a></li><li><a href=\"http://www.dercoparts.cl/baterias/\" target=\"_blank\"><img src='img/footer/iconos/baterias.jpg' border='0' alt='baterias' /></a></li><li><a href=\"http://www.dercoparts.cl/lubricantes/\" target=\"_blank\"><img src='img/footer/iconos/lubricantes.jpg' border='0' alt='lubricantes' /></a></li></ul><ul id=\"segundo-nivel\" class=\"sn-c-autoplanet\"><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/repuestos.jpg' border='0' alt='repuestos' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/neumaticos.jpg' border='0' alt='neumaticos' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/baterias.jpg' border='0' alt='baterias' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/lubricantes.jpg' border='0' alt='lubricantes' /></a></li><li><a href=\"http://www.autoplanet.cl/\" target=\"_blank\"><img src='img/footer/iconos/car-care.jpg' border='0' alt='car-care' /></a></li></ul></li><li><ul id=\"tercer-nivel\" class=\"tn-c-vehiculos\"><li><a href=\"http://www.suzuki.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/suzuki.jpg' border='0' alt='suzuki' /></a></li><li><a href=\"http://www.mazda.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/mazda.jpg' border='0' alt='mazda' /></a></li><li><a href=\"http://www.renault.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/renault.jpg' border='0' alt='renault' /></a></li><li><a href=\"http://www.renaultsamsung.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/samsung.jpg' border='0' alt='samsung' /></a></li><li><a href=\"http://www.greatwallmotors.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/great-wall.jpg' border='0' alt='great-wall' /></a></li><li><a href=\"http://www.autosjac.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/jac.jpg' border='0' alt='jac' /></a></li><li><a href=\"http://www.geelymotors.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/geely.jpg' border='0' alt='geely' /></a></li><li><a href=\"http://www.changan.cl\" target=\"_blank\"><img src='img/footer/iconos/marcas_autos/changan.jpg' border='0' alt='changan' /></a></li></ul></li></ul>");
	
	var alertTimerId;
	$("#flash-pie").mouseout(function() {
		clearTimeout(alertTimerId);
		alertTimerId= setTimeout('ocultaIconosFooter()', 2000);
	});


});

function ocultaIconosFooter()
{
	$(".sn-c-vehiculos").stop().hide(0);
	$(".sn-c-maq").stop().hide(0);
	$(".sn-c-parts").stop().hide(0);
	$("#tercer-nivel.tn-c-vehiculos").stop().hide(0);
	$(".sn-c-autoplanet").stop().hide(0);
}


$(window).load(function() {
    $('#slider-bienvenida').nivoSlider({
        effect:'fade',
        slices:3,
        animSpeed:700, 
        pauseTime:3000,
        startSlide:0, 
        directionNav:false, 
        directionNavHide:true, 
        controlNav:false, 
        keyboardNav:false,
        pauseOnHover:true, 
        manualAdvance:false

    });
});

function getInternetExplorerVersion()
// Returns the version of Windows Internet Explorer or a -1
// (indicating the use of another browser).
{
   var rv = -1; // Return value assumes failure.
   if (navigator.appName == 'Microsoft Internet Explorer')
   {
      var ua = navigator.userAgent;
      var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
      if (re.exec(ua) != null)
         rv = parseFloat( RegExp.$1 );
   }
   return rv;
}
function checkIEVersion()
{
   var ver = getInternetExplorerVersion();
   if ( ver> -1 )
   {
      if ( ver>= 8.0 )
         return true;
      else if ( ver == 7.0 )
    	  return true;
      else if ( ver == 6.0 )
    	  return true;
      else
    	  return true;
    }else{
	   return false;
	}
}


function footerSegundoNivel(cat)
{
	if(checkIEVersion())
	{
		$(".sn-c-vehiculos").stop().hide();
		$(".sn-c-maq").stop().hide();
		$(".sn-c-parts").stop().hide();
		$(".sn-c-vehiculos").stop().hide();
		$(".sn-c-autoplanet").stop().hide();
		$(".tn-c-vehiculos").stop().hide();
		
		$(".sn-" + cat).show();
	}else{
		$(".sn-c-vehiculos").stop().hide(0);
		$(".sn-c-maq").stop().hide(0);
		$(".sn-c-parts").stop().hide(0);
		$("#tercer-nivel.tn-c-vehiculos").stop().hide(0);
		$(".sn-c-autoplanet").stop().hide(0, function(){
			$(".sn-" + cat).stop().show(0);
		});
	}
}

function footerTercerNivel(cat)
{
	if(checkIEVersion())
	{
		$(".tn-c-vehiculos").stop().hide();
		$(".tn-" + cat).stop().show();
	}else{
		$("#tercer-nivel.tn-c-vehiculos").stop().hide(0, function(){
			$("#tercer-nivel.tn-" + cat).stop().show(0);
		});
	}
}


//ACORDION

$(document).ready(function(){
		$(".acordeon dd:not(:first)").hide();
		
	});


var acc1= true;
var acc2= false;
var acc3= false;
var acc4= false;
var acc5= false;
var acc6= false;
var acc7= false;
var acc8= false;
var acc9= false;
var acc10= false;	
	function acordion(num)
	{
	
		if(num == 1)
		{				
			if(acc1){
				$("#masmenos_1").css({backgroundPosition: "0 0"});
				$("#opcion1").slideUp("fast");
				acc1= false;
			}else{
				$("#masmenos_1").css({backgroundPosition: "0 -13px"});
				$("#opcion1").slideDown("fast");
				acc1= true;
			}
		}else if(num == 2){
			if(acc2){
				$("#masmenos_2").css({backgroundPosition: "0 0"});
				$("#opcion2").slideUp("fast");
				acc2= false;
			}else{
				$("#masmenos_2").css({backgroundPosition: "0 -13px"});
				$("#opcion2").slideDown("fast");
				acc2= true;
			}
		}else if(num == 3){
			if(acc3){
				$("#masmenos_3").css({backgroundPosition: "0 0"});
				$("#opcion3").slideUp("fast");
				acc3= false;
			}else{
				$("#masmenos_3").css({backgroundPosition: "0 -13px"});
				$("#opcion3").slideDown("fast");
				acc3= true;
			}
		}else if(num == 4){
			if(acc4){
				$("#masmenos_4").css({backgroundPosition: "0 0"});
				$("#opcion4").slideUp("fast");
				acc4= false;
			}else{
				$("#masmenos_4").css({backgroundPosition: "0 -13px"});
				$("#opcion4").slideDown("fast");
				acc4= true;
			}
		}else if(num == 5){
			if(acc5){
				$("#masmenos_5").css({backgroundPosition: "0 0"});
				$("#opcion5").slideUp("fast");
				acc5= false;
			}else{
				$("#masmenos_5").css({backgroundPosition: "0 -13px"});
				$("#opcion5").slideDown("fast");
				acc5= true;
			}
		}else if(num == 6){
			if(acc6){
				$("#masmenos_6").css({backgroundPosition: "0 0"});
				$("#opcion6").slideUp("fast");
				acc6= false;
			}else{
				$("#masmenos_6").css({backgroundPosition: "0 -13px"});
				$("#opcion6").slideDown("fast");
				acc6= true;
			}
		}else if(num == 7){
			if(acc7){
				$("#masmenos_7").css({backgroundPosition: "0 0"});
				$("#opcion7").slideUp("fast");
				acc7= false;
			}else{
				$("#masmenos_7").css({backgroundPosition: "0 -13px"});
				$("#opcion7").slideDown("fast");
				acc7= true;
			}
		}else if(num == 8){
			if(acc8){
				$("#masmenos_8").css({backgroundPosition: "0 0"});
				$("#opcion8").slideUp("fast");
				acc8= false;
			}else{
				$("#masmenos_8").css({backgroundPosition: "0 -13px"});
				$("#opcion8").slideDown("fast");
				acc8= true;
			}
		}else if(num == 9){
			if(acc9){
				$("#masmenos_9").css({backgroundPosition: "0 0"});
				$("#opcion9").slideUp("fast");
				acc9= false;
			}else{
				$("#masmenos_9").css({backgroundPosition: "0 -13px"});
				$("#opcion9").slideDown("fast");
				acc9= true;
			}
		}
}

function trackEvent(cat,act,lbl) {
	try {
	_gaq.push(['_trackEvent', cat,act,lbl]);
	} catch(err) {}
}
