﻿$(document).ready(function() {
    //Poner tamaño real de las imagenes para que en resoluciones mas chicas no se corten las imagenes
    $(".description").css({ width: "343px" });
    $(".nubes").css({ width: "1197px" });
    $(".nubesrojo").css({ width: "1404px" });
    $(".nubesamarillo").css({ width: "1106px" });
    $('#parallax').jparallax({ xtravel: '300px' }, { ytravel: '50px' }, { ytravel: '50px' });

    //zoom thumbnails del portafolio
    $("#portafolio .item .thumb").hover(function() {
        $(this).children('img').stop().animate({ width: '300px', height: '230px', left: '0', top: '0', opacity: '0.6' }, 100);
        $(this).children('a').fadeIn(200);
    }, function() {
        $(this).children('img').stop().animate({ width: '350px', height: '271px', left: '-10px', top: '-10px', opacity: '1' }, 100);
        $(this).children('a').fadeOut(200);
    });

    //Arrastre del menú principal
    $("#links a").hover(function() {
    $(this).stop().animate({ width: '381px' }, 400, 'easeOutBounce');
    }, function() {
        $(this).stop().animate({ width: '330px' }, 100);
    });

    //Click menu principal
    $("#links a").mousedown(function() {
        $(this).stop().animate({ width: '370px' }, 100);
    }, function() {
        $(this).stop().animate({ width: '315px' }, 100);
    });

    //Animación de los H1 al hover del ID de zona
    $("#portafolio").hover(function() {
        $("#rutaPortafolio").stop().animate({ width: '650px' }, 400, 'easeInOutExpo');
    }, function() {
        $("#rutaPortafolio").stop().animate({ width: '300px' }, 400, 'easeInOutExpo');
    });

    $("#servicios").hover(function() {
        $("#rutaServicios").stop().animate({ width: '674px' }, 400, 'easeInOutExpo');
    }, function() {
        $("#rutaServicios").stop().animate({ width: '324px' }, 400, 'easeInOutExpo');
    });

    $("#contacto").hover(function() {
        $("#rutaContacto").stop().animate({ width: '662px' }, 400, 'easeInOutExpo');
    }, function() {
        $("#rutaContacto").stop().animate({ width: '312px' }, 400, 'easeInOutExpo');
    });

    

    //Hover Servicios
    $(".servicios-top .tipoServicio p").hide();
    $(".servicios-top .tipoServicio").hover(function() {
        $(this).children('p').fadeIn();
        $(this).children('h3').stop().animate({ marginBottom: '150px' }, 300, 'easeOutBounce');
    }, function() {
        $(this).children('p').hide();
        $(this).children('h3').stop().animate({ marginBottom: '0' }, 200);
    });

    $(".servicios-bottom .tipoServicio p").hide();
    $(".servicios-bottom .tipoServicio").hover(function() {
        $(this).children('p').fadeIn();
        $(this).children('h3').stop().animate({ marginTop: '150px' }, 300, 'easeOutBounce');
    }, function() {
        $(this).children('p').hide();
        $(this).children('h3').stop().animate({ marginTop: '0' }, 200);
    });


    //Hover feedback
    $("#servicios .proyecto .cuestionario").hover(function() {
        $(this).children('.feedback').stop().animate({ top: '140px' }, 200);
    }, function() {
        $(this).children('.feedback').stop().animate({ top: '120px' }, 100);
    });

    //labels cuestionario feedback
    $(function() { $("label").inFieldLabels(); });

    //Slider Portafolio
    $("#slider-controls").jFlow({
        slides: "#slides",
        controller: ".slide-bullet", // must be class, use . sign
        selectedWrapper: "slide-bullet-selected",  // just pure text, no sign
        auto: false, 	//auto change slide, default true
        width: "960px",
        height: "610px",
        duration: 200
    });

    //Scroll a secciones de los links principales
    $("#links a, .creditos .navigation a").click(function() {
        var ruta = $(this).attr("href");
        $("html, body").animate({ scrollTop: $(ruta).offset().top }, 1100, 'easeInOutExpo');
        return false;
    });

    //Tooltips
    $('.networks a').tipsy({ fade: true, gravity: 's' });
    $('#slider-controls').tipsy({ fallback: "Navegación del portafolio", fade: true, gravity: 'w' });

    //Pretty Photo
    $("a[rel^='prettyPhoto']").prettyPhoto({
        show_title: false
    });

    
    //    //Esconder div proyecto
    //    $(".cuestionario").hide();

    //    //Hover cuentame el proyecto
    //    $(".irRegistro a").hover(function() {
    //        $(this).animate({ backgroundPosition: '0 0' }, 70);
    //    }, function() {
    //        $(this).animate({ backgroundPosition: '0 -40px' }, 150);
    //    });

    //    //Click cuentame el proyecto
    //    $("#mostrarCuestionarioIdea").click(function() {
    //        var ruta = $(this).attr("href");
    //        $("html, body").animate({ scrollTop: $(ruta).offset().top }, 1100, 'easeInOutExpo');
    //        $(".cuestionario").slideDown("2500", function() {
    //            $('#ctl00_txtNombre').focus();
    //        });
    //        return false;
    //    });

    //Recargar las funciones que se pierden al hacer postback
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_endRequest(function() {
        $(function() { $("label").inFieldLabels(); });
    });
    // fin recarga
});
