
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function ValidaIndex()
{

    var bAtivo = true;
    
    if(bAtivo == true)
    {
        if ($B('txtCliente','Informe o Código do Cliente.') == false)
            return false;
        if ($B('txtApartamento','Informe o Apartamento.') == false)
		    return false;
        if ($B('txtBloco','Informe o Bloco.') == false)
		    return false;
        $('txtFuncControl').value = 'OK';			
		    __doPostBack('__Page','#LNPB#4'); 
	    return true;
    }
    else
    {
        alert('Desculpe-nos pelo transtorno. Estamos trabalhando para melhor atendê-lo. ');
        return false;
    }

}	
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function SoNumero(e)
{		
	var tecla = e.which? e.which : e.keyCode; 
	if ((tecla==44)||(tecla==8)||(tecla  >= 47 && tecla < 58)) 
		return true;
	else
		return false;	
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $(id)
{	var obj = document.getElementById(id);
	return obj;}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $F(id)
{	$(id).focus();}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $L(id)
{	var obj = $(id).length;
	return obj;}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $V(id)
{	var obj = $(id).value;
	return obj;}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $I(id)
{	var obj = parseInt($V(id));
	if (isNaN(obj)) obj= 0;
	return obj;}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $Fl(id)
{	var obj = parseFloat($V(id));
	if (isNaN(obj)) obj= 0;
	return obj;}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function $B(objId,Mesage,Tipo)
{
	if ($(objId).type == 'select-one')
	{
		if ($V(objId)=='0')
		{
			alert (Mesage);
			$F(objId);
			return false;
		}
	}
	else
	{
		if ($V(objId)=='')
		{
			alert (Mesage);
			$F(objId);
			return false;
		}
		else
		{
		    if (Tipo == 'N')
		    {
		        if (!IsNumeric(objId))
		            return false;
		    }
		}
	}
	return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function IsNumeric(idObj)
{
    
    var ValidChars = "0123456789";
    var Char;
    var sText = $V(idObj);
    
    for (i = 0; i < sText.length; i++) 
    { 
        Char = sText.charAt(i); 
        if (ValidChars.indexOf(Char) == -1) 
        {
            alert ('Apenas insira numeros no campo.');
		    $F(idObj);
            return  false;
        }
            
    }
    return true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

