﻿function TextBoxOnFocus(textbox, cssFocus)
{
    textbox.className = cssFocus;
}

function TextBoxOnBlurAux(textbox,event)
{ 
    vals = textbox.getAttribute("ZBL_Vals");
    cssError = textbox.getAttribute("ZBL_CssError");
    cssNormal = textbox.getAttribute("ZBL_Css");
    var strvals = vals.split(",");
    var isWithError = false;
    for (var i=0; i< strvals.length && !isWithError; i++)
    {
        var val = WebForm_GetElementById(strvals[i]);
        var focusTemp = val.focusOnError;
        val.focusOnError=null;
        ValidatorValidate(val, textbox.getAttribute("validationGroup"), event);
        val.focusOnError = focusTemp;
        isWithError = !val.isvalid;
        textbox.className = isWithError ? cssError : cssNormal;
    }
}

function TextBoxOnBlur(textbox,event)
{ 
    //TODO:Esto se hace as� para que le de tiempo a las mascaras (si existen) a limpiarse. Se podr�a hacer mejor.
    setTimeout(function(){TextBoxOnBlurAux(textbox,event);},100);
}