﻿function RichWidgets_Input_SetFocus_init(widgetId)
{
  osjs(function($){
    var widget = document.getElementById(widgetId);
    if (widget == null)
    {
        var errorElement = document.createElement("p");
        errorElement.innerText = "Uso inválido do RichWidgets\\SetFocusInput: Por favor especifique o runtime Id de um widget Input ou Input Password.";
        errorElement.style.color = "red";
        document.body.appendChild(errorElement);
        return;
    }
    if (widget.tagName != "INPUT" && widget.tagName != "TEXTAREA")
    {
        var errorElement = document.createElement("p");
        errorElement.innerText = "Uso inválido do RichWidgets\\SetFocusInput: Somente widgets de Input e Input Password são suportadas.";
        errorElement.style.color = "red";
        document.body.appendChild(errorElement);
        return;
    }
    widget.focus();
    widget = null;
  });
}
