/*
    BL.js
    Funcionalidad para el perfil Gestor business Line
    Jaime Seuma
*/



// ----------------------------------------------------------
// Promote to candidate

function BLFilterUser()
{
    document.forms[0].curPage.value = 0;
    submitForm();
}

function submitForm(){
    document.forms[0].submit();
}

function BLPrevPage()
{
    var curPage = parseInt("0"+document.forms[0].curPage.value,10);
    if(curPage>0){
        document.forms[0].curPage.value=(--curPage);
        submitForm();
    }    
}

function BLNextPage()
{
    var curPage = parseInt("0"+document.forms[0].curPage.value,10);
    document.forms[0].curPage.value=(++curPage);
    submitForm();
}


function PromoteUser2Candidato(userid)
{
    var theForm = document.forms[0];
    var theSel = eval("theForm.bl_"+userid);
    if(theSel.selectedIndex==0)
    {
        alert("Por favor, seleccione una Business Line para el candidato.");
        return;
    }
    theForm.user.value=userid;
    theForm.bline.value=theSel[theSel.selectedIndex].value;
    theForm.action = "BLPromocionUsuarios.PromoteUser2Candidate.ashx";
    theForm.submit();
}


// ----------------------------------------------------------
// Promote to premium

function ShowPruebaAcceso(id_pruebaAcceso)
{
    var theForm = document.forms[0];
    
    theForm.id_pruebaAcceso.value=id_pruebaAcceso;
    theForm.action = "BLEvaluacionCandidatos.ShowPruebaAcceso.ashx";
    theForm.submit();
}

function showReasonsBox(n)
{
    var theBox = document.getElementById("reasonBox");
    var visible=n==1?"visible":"hidden";

    theBox.style.visibility = visible;
    var theForm = document.forms[0];
    theForm.sReason.value="";
    
}

function ShowEvaluationForm(userid)
{
    var theForm = document.forms[0];
    theForm.user.value=userid;
    theForm.action = "BLEvaluacionCandidatos.ShowEvaluationForm.ashx";
    theForm.submit();
}


function PromoteUser2Premium()
{
    var theForm = document.forms[0];
    if(theForm.sReason.value.length>255){
        alert(tooLongMsg);
        return;
    }

    theForm.action = "BLEvaluacionCandidatos.PromoteUser2Premium.ashx";
    theForm.submit();
}

function BLLaunchST()
{
    var url = "/LaunchST.aspx?itinerario=0";
    window.open(url);
}
