//onfocus="document.location = 'javascript:post();'"

//***********************************************************************************************//
function PulaCampo(controle, tammax) {
    VerifiqueTAB = true;
    if (controle.value.length == tammax && VerifiqueTAB) {
        var i = 0, j = 0, indice = -1;
        for (i = 0; i < document.forms.length; i++) {
            for (j = 0; j < document.forms[i].elements.length; j++) {
                if (document.forms[i].elements[j].name == controle.name) {
                    indice = i;
                    break;
                }
            }
            if (indice != -1)
                break;
        }
        for (i = 0; i <= document.forms[indice].elements.length; i++) {
            if (document.forms[indice].elements[i].name == controle.name) {
                while (document.forms[indice].elements[(i + 1)].type == "hidden" && i < document.forms[indice].elements.length) {
                    i++;
                }
                document.forms[indice].elements[(i + 1)].focus();
                VerifiqueTAB = false;
                break;
            }
        }
    }
}
//***********************************************************************************************//
//--=> Função para setar o foco.
function SetFocusTabIndexOne()
{
	var Control = document.forms[0];
	Control = SearchFirstTabIndex(Control);
	try{
		if(Control != null && Control.tabIndex == 1)
			Control.focus();
	}
	catch(E)
	{}
}

//***********************************************************************************************//
function SearchFirstTabIndex(Control)
{
	if(Control.tabIndex == 1)
		return Control;
		
	if(Control.childNodes != null)
		for(var i = 0; i < Control.childNodes.length; i++)
		{
			var ChildControl = Control.childNodes[i];
			if((ChildControl.tagName != null) &&
				((ChildControl.tagName.toUpperCase()!= 'INPUT') &&
				(ChildControl.tagName.toUpperCase() != 'SELECT') &&
				(ChildControl.tagName.toUpperCase() != 'TEXTAREA')))
			{
				//Verificando se pode ser um de seus controles filhos
				ChildControl = SearchFirstTabIndex(ChildControl);
			}
			if(ChildControl != null && ChildControl.tabIndex == 1)
				return ChildControl;			
		}
	return null; 
}
//***********************************************************************************************//
/* Finalidade: limpa o campo no foco e repõe mensagem se o texto não for digitado */
//***********************************************************************************************//
function limpar(objeto, msg) {
    if (objeto.value == msg) objeto.value = '';
}

function mostrar(objeto, msg) {
    if (objeto.value == '') objeto.value = msg;
}

//***********************************************************************************************//
function enviar()
{
	document.submit();
}

//***********************************************************************************************//
function OpenWindow(theURL,winName,features) 
{ 
	//OpenWindow('url.aspx','recomende','status=yes,scrollbars=yes,width=430,height=430,top=0,left=0')
	window.open(theURL,winName,features);
}

//***********************************************************************************************//
function xxx(st)
{
	alert(st);
}

