Focused = 0;

// ------------------------------------------------------------------------------------------------------------------------------

function ClassInputToggleAttributesDisplay(Id, Type)
{
  if(Type == 1)
  {
    $('#' + Id).css('display', 'inline');
  }
  if(Type == 0)
  {
    $('#' + Id).css('display', 'none');
  }
}

// ------------------------------------------------------------------------------------------------------------------------------

function SetMaxLength(InputId, MaxLength, Event)
{
	if(document.getElementById(InputId).value.length >= MaxLength)
	{
    Allowed = new Array("8", "9", "16", "17", "18", "20", "27", "33", "34", "35", "36", "37", "38", "39", "40", "46", "92", "93");
    AllowedKeyEvent = 0;

    if(Allowed.join(" ").search(Event.keyCode) == -1)
    {
      return false;
    }
	}
}

// ------------------------------------------------------------------------------------------------------------------------------

function InputOnFocus(InputId, DefValue, Blur, CssHover)
{
  if(document.getElementById(InputId).value == DefValue)
  {
    if(Blur == 1)
    {
      document.getElementById(InputId).value = '';
    }
  }

	if(CssHover != '%CssHover%')
	{
	  document.getElementById(InputId).className = CssHover;
  }

  Focused = InputId;
  // ClassInputToggleAttributesDisplay(InputId + 'InputAttributesDisplayDiv', 1);
}

// ------------------------------------------------------------------------------------------------------------------------------

function InputOnBlur(InputId, DefValue, Blur, CssDef)
{
  if(document.getElementById(InputId).value == '')
  {
    if(Blur == 1)
    {
      document.getElementById(InputId).value = DefValue;
    }
  }

	if(CssDef != '%CssDef%')
	{
	  document.getElementById(InputId).className = CssDef;
  }
  
  Focused = 0;
  // ClassInputToggleAttributesDisplay(InputId + 'InputAttributesDisplayDiv', 0);
}

// ------------------------------------------------------------------------------------------------------------------------------

function InputOnMouseOver(InputId, CssHover)
{
  document.getElementById(InputId).className = CssHover;
}

// ------------------------------------------------------------------------------------------------------------------------------

function InputOnMouseOut(InputId, CssDef)
{
  if(Focused != InputId)
  {
    document.getElementById(InputId).className = CssDef;
  }
}

// ------------------------------------------------------------------------------------------------------------------------------
