	// ultimos trabajos

$(window).load(function() {
	$('#trabajos').nivoSlider({
		controlNav:false,
		directionNav:false,	
		pauseTime:3000
	});
});

// lightbox

$(function() {
	// Use this example, or...
	$('a.lightbox').lightBox(); // Select all links that contains lightbox in the attribute rel	
});

$(document).ready(function(){
	
	// Animacion inicial echa por SantiagoAV
		
	//  var ancho = $('#contenedor').css("width");
	//	var alto = $('#contenedor').height() - 60;
	//	$('#contenedor').css({width:(ancho = 0), height:(alto)});
	
	//var elementos = $('#cuerpo, #sidebar, #sidebar img,.destacado, .columnas li, #trabajos, .columnas li a, .columnas li span');
	//	$(elementos).css({'opacity' : '0'});
		$('#header').hide();
	//
	
   // $('#contenedor').animate({ "width": "+=955"}, 2500, 'easeOutCirc').queue(function() {
   // $(this).removeAttr("style");
		$('#header').animate({ "opacity": "1"}).slideDown(1500).fadeIn().queue(function() {
			//$(elementos).animate({ "opacity": "1"}, 700).queue(function() {
   //			$(elementos).removeAttr("style");
    //		});
		});	
	// });
	
	// Pestañas
	
	//When page loads...
	$(".contenido-pestana").hide(); //Hide all content
	$("ul.tabs li:first").addClass("current").show(); //Activate first tab
	$(".contenido-pestana:first").show(); //Show first tab content
	
	//On Click Event
	$("ul.tabs li").click(function() {
		$("ul.tabs li").removeClass("current"); //Remove any "active" class
		$(this).addClass("current"); //Add "active" class to selected tab
		$(".contenido-pestana").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	// Clases para IE
  	if ($.browser.msie) {
		// $("body").append('<div class="alerta"><p>Este sitio no puede verse correctamente en Internet Explorer 6 hasta nuevo aviso</p></div>');
     	$("a[onclick^='window']").addClass('vincExt');
		$("ul.columnas > li:first-child").addClass('first');
		$("ul.columnas > li:last-child").addClass('last');
		$("#mainNav li:last-child").addClass('last');			
		$(".contacto input[type='submit']").addClass('btnenviar');
		$(".contacto input:focus, .contacto textarea:focus").bind('focus focusout', function() {
		  $(this).toggleClass('focus');
		});		
	 };
	
		

	// menu 	
	
	$('#mainNav li:not(#actual) a').hover(function() {
            $(this).stop().animate({ top:10 }, 'fast');
			$(this).css({'color' : '#000'});
        }, function() {
            $(this).stop().animate({ top: 0 }, 'fast');
			$(this).css({'color' : '#821122'});
   	 });

	 // solicitar presupuesto
	
	 $(".contacto textarea").autoResize({minHeight:40, maxHeight:200});
		
	// tareas para facilitar el código q hice
	
	// en portfolio
        $(".image-title a").attr("target", "_blank"); 
        // $('.image-title a').click(function() { window.open(this.href); return false; });
	$(".image-title a").attr("rel", "nofollow"); 
	$(".navigation li a[href*=bigscreens]").addClass("thumb");
		

	
	// We only want these styles applied when javascript is enabled
	$('div.navigation').css({'width' : '175px', 'float' : 'left'});
	$('div.content').css('display', 'block');

	$(".each-gallery").each(function(i){
		// Initially set opacity on thumbs and add
		// additional styling for hover effect on thumbs
		var onMouseOutOpacity = 0.70;
		var miniatura = '#thumbs' + i + ' ul.thumbs li';
		$(miniatura).opacityrollover({
			mouseOutOpacity:   onMouseOutOpacity,
			mouseOverOpacity:  1.0,
			fadeSpeed:         'fast',
			exemptionSelector: '.selected'
		});
				
		// Initialize Advanced Galleriffic Gallery
		var gallery = $('#thumbs' + i ).galleriffic({
			delay:                     2500,
			numThumbs:                 4,
			preloadAhead:              10,
			enableTopPager:            true,
			enableBottomPager:         true,
			maxPagesToShow:            7,
			imageContainerSel:         '#slideshow' + i,
			controlsContainerSel:      '#controls' + i,
			captionContainerSel:       '#caption' + i,
			loadingContainerSel:       '#loading' + i,
			renderSSControls:          true,
			renderNavControls:         true,
			playLinkText:              'Ver como Presentaci&oacute;n',
			pauseLinkText:             'Pausar Presentaci&oacute;n',
			prevLinkText:              '&lsaquo; Trabajo Anterior ',
			nextLinkText:              'Siguiente Trabajo &rsaquo;',
			nextPageLinkText:          'Sig &rsaquo;',
			prevPageLinkText:          '&lsaquo; Ant',
			enableHistory:             false,
			autoStart:                 false,
			syncTransitions:           true,
			defaultTransitionDuration: 500,
			onSlideChange:             function(prevIndex, nextIndex) {
			// 'this' refers to the gallery, which is an extension of $('#thumbs')
			this.find('ul.thumbs').children()
				.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
				.eq(nextIndex).fadeTo('fast', 1.0);
			},
			// animaciones echas por santiagoAV
			onTransitionOut:          function(slide, caption, isSync, callback) {
				slide.animate({ left:550 }, 1000, 'easeInOutQuart',callback);
				caption.animate({ left:550 }, 1000, 'easeInOutQuart', callback);
			 },
      	    onTransitionIn:          function(slide, caption, isSync) {
				var duration = this.getDefaultTransitionDuration(isSync);
				slide.css("left","-550px");
				caption.css("left","-550px");
				slide.fadeTo(500, 1.0).animate({ "left": "+=550"}, 1000, 'easeOutCirc');
				caption.fadeTo(500, 1.0).animate({ "left": "+=550"}, 1000, 'easeOutCirc');;
			},
			// fin animaciones echas por santiagoAV
			onPageTransitionOut:       function(callback) {
				this.fadeTo('fast', 0.0, callback);
			},
			onPageTransitionIn:        function() {
				this.fadeTo('fast', 1.0)
			}
		});
	});
});


