// JavaScript Document
$(function(){
	$('a.menu')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-176px 0)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "0 0"})
			}})
		})
		
		$('a.submenu1')
		.css( {backgroundPosition: "-176px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-352px 0)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-176px 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "-176px 0"})
			}})
		})
		
		$('a.submenu2')
		.css( {backgroundPosition: "-352px 0"} )
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-176px 0)"}, {duration:200})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-352px 0)"}, {duration:200, complete:function(){
				$(this).css({backgroundPosition: "-352px 0"})
			}})
		})
		
	
		$("a.desplegar").click(function(){
			$(this).next("ul.submenuul").slideToggle(200).siblings("ul.submenuult").slideUp(200);
		});
		
		$("a #slideshow, a .linkderecha").mouseover(function () {
		$(this).fadeTo(200, 0.33);}).mouseout(function () {
      		$(this).fadeTo(200, 1);
    	});
				$('.scroll').jScrollPane({scrollbarWidth:8, scrollbarMargin:15});


/*** 
    Simple jQuery Slideshow Script
    Released by Jon Raasch (jonraasch.com) under FreeBSD license: free to use or modify, not responsible for anything, etc.  Please link out to me if you like it :)
***/

function slideSwitch() {
    var $active = $('#slideshow img.active');

    if ( $active.length == 0 ) $active = $('#slideshow img:last');

    // use this to pull the divs in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow img:first');

    // uncomment below to pull the divs randomly
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 5000 );
});


		
/*("#usualfin").idTabs();*/

$(document).ready(function(){
	$("div.tabcontent").hide();
	$("div.tabcontent2").hide();
	
	$("dl#usualfin dt:first").addClass("active").show();
	$("div.tabcontent:first").show();
	$("div.tabcontent2:first").show();

	$("dl#usualfin dt").click(function(){
		$("dl#usualfin dt").removeClass("active");
		$(this).addClass("active");
		$("div.tabcontent").hide();
			
		$("div.tabcontent2").hide();

		var activeTab = $(this).find("a").attr("href");
		$(activeTab).fadeIn();
		
		var activeTab2 = $(this).find("a").attr("onClick");
		$(activeTab2).fadeIn();
		return false;
	});
	
});
});
