num = 1 + Math.round(Math.random()*2);

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
		scroll: 1,
        auto: 0,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
	jQuery('#mycarousel2').jcarousel({
		scroll: 1,
        auto: 0,
		start: num,
		size:2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
	
	jQuery('#myheadercarousel').jcarousel({
		scroll: 1,
        auto: 5,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});


function destaca(que)
{
	try{anterior.style.backgroundColor="";}catch(e){}
	anterior=que;
	try{anterior.style.backgroundColor="#F0F4F7";}catch(e){}
}
jQuery(function(){
	jQuery('ul.sf-menu').superfish();
	$('form fieldset:first').append('<input type="hidden" name="captcha2" value="85yd"');
});

$(document).ready(function() {

		// Tabs de servicio.
		var tabs = $('ul#tabs li a');
		var divs = $('#content-tabs div');
		var lis = $('ul#tabs li');
		divs.not(':first').fadeOut();
		tabs.click(function(e){
				e.preventDefault();	
				var rel = $(this).attr('rel');
				var id = '#'+$(this).attr('rel');
				divs.not(':hidden').fadeOut('fast',function(){
						$(id).fadeIn('slow');
				});
				// remove - add classes
				tabs.removeClass('selected');
				lis.removeClass('tab-active');
				tabs.each(function(i){
						if ($(this).attr('rel') == rel){
								$(this).addClass('selected');		
								$(this).parent('li').addClass('tab-active');		
						}
				});
		});

		// marcar en la navegación el servicio en el que estoy.
		var whoiam = $('h2:last').text();
		$('li.service').each(function(i){	
				if ($(this).children('a').text() == whoiam){
						$(this).children('a').addClass('active');	      
						$(this).children('a').removeClass('normal');
				}
		});
});

