﻿
var current = 0;
var intervalo;
var intervalo2;
var entro = false;
var totalframes = 3;
var myPopup;


function cierra() {
    window.location.reload();
    //myPopup.close();
}

function cierra2() {
    //myPopup.close();
}


function llena_registro(first_name, last_name, link, gender, email, picture) {
    alert(first_name);
    myPopup.close();
}

function scroll(numero) {
    jwplayer("container1").stop();
    jwplayer("container2").stop();
    jwplayer("container3").stop();
    jwplayer("container4").stop();
    //clearInterval(intervalo);
    var numOriginal = numero;
    if (current != numero) {
        if (current > numero) {
            while (current != numero) {
                $("#slidesContainer").animate({ "left": "+=" + anchoItem + "px" }, "slow");
                numero++;
            }
        } else {
            while (current != numero) {
                $("#slidesContainer").animate({ "left": "-=" + anchoItem + "px" }, "slow");
                numero--;
            }
        }
    }
    current = numOriginal;
    //intervalo2 = setInterval("moverB()", 5000);    
}

var UsernameValidationResult;
var UsernameValidatorLastCheckValue;




function moverB() {
    clearInterval(intervalo);
    clearInterval(intervalo2);  
    //intervalo = setInterval("moverA()", 5000);
    //intervalo2 = setInterval("moverB()", 5000);
}

function moverC(numero) {
    if (numero == 0) {
        if (current != 0 && current != 2) {
            jwplayer("container1").stop();
            jwplayer("container2").stop();
            jwplayer("container3").stop();
            jwplayer("container4").stop();
            clearInterval(intervalo);
            moverA();
        }
    } else {
        if (current != 1 && current != 3) {
            jwplayer("container1").stop();
            jwplayer("container2").stop();
            jwplayer("container3").stop();
            jwplayer("container4").stop();
            clearInterval(intervalo);
            moverA();
        }
    }
    

}

function moverA() {
    if (current != totalframes) {
        scroll(current + 1);
    }else {
        $("#slidesContainer").css('left', 0 - anchoItem);
        current = 1;
        scroll(current + 1);
    }
}



function valida_correo(source, clientside_arguments) {
    var service = new wepikService.wepikService();
    service.valida_correo(clientside_arguments.Value,
        function onSuccessmuestra_imagenes(resultado) {
            if (resultado == "valid") {
                clientside_arguments.IsValid = true;
                UsernameValidationResult = true;
                source.isvalid = true;
            } else {
                clientside_arguments.IsValid = false;
                UsernameValidationResult = false;
                source.isvalid = false;
            }

            UsernameValidatorLastCheckValue = clientside_arguments.Value;

            ValidatorUpdateDisplay(source);
            ValidatorUpdateIsValid();
        }

    , onFailed, null);

}


var NicknameValidationResult;
var NicknameValidatorLastCheckValue;


function valida_nick(source, clientside_arguments) {
    var service = new wepikService.wepikService();
    service.valida_nick(clientside_arguments.Value,
        function onSuccessmuestra_imagenes(resultado) {
            if (resultado == "valid") {
                clientside_arguments.IsValid = true;
                NicknameValidationResult = true;
                source.isvalid = true;
            } else {
                clientside_arguments.IsValid = false;
                NicknameValidationResult = false;
                source.isvalid = false;
            }

            NicknameValidatorLastCheckValue = clientside_arguments.Value;

            ValidatorUpdateDisplay(source);
            ValidatorUpdateIsValid();
        }

    , null, null);

}


function llena_universidades() {

    var service = new wepikService.wepikService();
    service.Universidades(
    function onSuccessmuestra_imagenes(resultado) {
        document.getElementById('ScrollTemporal').innerHTML = resultado;
    }

    , null, null);

    
}


function onFailed() {
    //alert("Error al establecer comunicación con el servidor.");
}




