// JavaScript Document

$(function() {
	
	
$("ul.links").show();
$("img#img1").show();

$('a#1').addClass('active');

var cual=1;
var cualImgId="img#img"+cual;
var cualAId="img#img"+cual;

transi = function(){
    $("img#img5").fadeIn("slow", function(){
        
        $(cualImgId).hide();

        if(cual == 4){
            cual=1;
        }else{
            cual++;
        }
        cualAId="a#"+cual;
        cualImgId="img#img"+cual;

        $('a.inks').removeClass('active');
        $(cualAId).addClass('active');

        console.log($('a.active').attr('rel'));

        $(cualImgId).show();
        $("img#img5").fadeOut("slow");

    });
}

ahora = function(){
	play = setInterval(function(){
		transi();
                console.log("ahora");
	}, 5000);
};


ultimo = function(){
    cual = $('a.active').attr('rel');

    $("img#img5").fadeIn("slow", function(){
        
        cualImgId="img#img"+cual;
        cualAId="a#"+cual;

        $('img.cadaImg').hide();

        $(cualImgId).show();
        $("img#img5").fadeOut("slow");

    });
}

ahora();


$('a.inks').click(function(){
    $('a.inks').removeClass('active');

    $(this).addClass('active');
    console.log($('a.active').attr('rel'));
    clearInterval(play); //para la funciÃ³n de rotar


    ultimo();
    return false;

});	
	
	
	
	
	
	//drop down menus
	
	$(".father").hover(
		function(){
			$(this).children('.child').show();
		},function(){
			$(this).children('.child').hide();
		});
	
	
	
	
	
	//tabs home

        $("a#recentTab").addClass("tabSelec");
	
	$("a#recentTab").click(function() {
		
		$(this).addClass("tabSelec");
		$("a#assetTab").removeClass("tabSelec");
		$("a#microTab").removeClass("tabSelec");
		$("a#popTab").removeClass("tabSelec");

		$("#recent").show();
		$("#asset").hide();
		$("#micro").hide();
		$("#pop").hide();
			
	});
	
	$("a#assetTab").click(function() {
		$(this).addClass("tabSelec");
		$("a#recentTab").removeClass("tabSelec");
		$("a#microTab").removeClass("tabSelec");
		$("a#popTab").removeClass("tabSelec");
					
		$("#recent").hide();
		$("#asset").show();
		$("#micro").hide();
		$("#pop").hide();
			
	});
	
	$("a#microTab").click(function() {
		$(this).addClass("tabSelec");
		$("a#assetTab").removeClass("tabSelec");
		$("a#recentTab").removeClass("tabSelec");
		$("a#popTab").removeClass("tabSelec");
					
		$("#recent").hide();
		$("#asset").hide();
		$("#micro").show();
		$("#pop").hide();
	});
	
	$("a#popTab").click(function() {
		$(this).addClass("tabSelec");
		$("a#recentTab").removeClass("tabSelec");
		$("a#assetTab").removeClass("tabSelec");
		$("a#microTab").removeClass("tabSelec");
					
		$("#recent").hide();
		$("#asset").hide();
		$("#micro").hide();
		$("#pop").show();
			
	});		
	
}); //termina jQ
