/* ------------------------------------------------------------------------------ */
/* Copyright Sentido Virtual - http://www.sentidovirtual.com.br ----------------- */
/* contato@sentidovirtual.com.br ------------------------------------------------ */
/* ------------------------------------------------------------------------------ */



window.defaultStatus="INDAB Indústria Metalúrgica - www.indab.com.br"



/* ------------------------------------------------------------------------------ */
/* Abre janela PopUp ------------------------------------------------------------ */
/* ------------------------------------------------------------------------------ */
function OpenUp(resenha, w, h)
{
	remote = window.open(resenha,'comentario','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,menubar=no,width='+ w + ',height='+ h + '')
}



/* ------------------------------------------------------------------------------ */
/* abrir link de popup na janela atual  ----------------------------------------- */
/* ------------------------------------------------------------------------------ */
function go(pag)
{
	top.opener.top.location.href=pag;
	window.self.close();
}



/* ------------------------------------------------------------------------------ */
/* Verifica campo vazio em formulário ------------------------------------------- */
/* ------------------------------------------------------------------------------ */
function isFieldBlank(theField)
{
	inStr = theField.value;
	inLen = inStr.length;
	for(var i = 0; i < inLen; i++)
	{
		var ch = inStr.substring(i, i+1)
		if (ch != " ")
		return false;   
	}
	theField.Value = "";
	return true;
}



/* ------------------------------------------------------------------------------ */
/* Verifica caracter inválido em formulário ------------------------------------- */
/* ------------------------------------------------------------------------------ */
function Verifica()
{
	var caract = new RegExp(/^[a-z 0-9 ç ã á ê é í ó ü ú]+$/i); 
	var caract = caract.test(String.fromCharCode(event.keyCode));

	if(!caract){
		//alert("Caracter inválido.\n" +String.fromCharCode(event.keyCode));
		event.keyCode=0;
		return;
	}
}



/* ------------------------------------------------------------------------------ */
/* validação para qtd de caracters no campo  ------------------------------------ */
/* ------------------------------------------------------------------------------ */
function minLen(txtField, minVal)
{
	strExp = txtField.value;
	l = strExp.length;
	if (l < minVal)
		return(true);
	else
		return(false);
}



/* ------------------------------------------------------------------------------ */
/* função utilizada em formulário para aceitar somente entrada de números ------- */
/* ------------------------------------------------------------------------------ */
function soNumero(event)
{
	iKey = KeyStroke( event );
	if (!( ( iKey>47 && iKey<58 ) || iKey == 13 || iKey == 0 || iKey == 8 ) )
	{
		return false;
	}
	return true;
}

function KeyStroke( event )
{
	ikey = 0;
	if( event.which == undefined )
	{
		ikey = window.event.keyCode;
	}
	else
	{
		ikey = event.which;
	}
	return ikey;
}



/* ------------------------------------------------------------------------------ */
/* função utilizada para 'saltar' os campos quando o maxlength é atingido ------- */
/* ------------------------------------------------------------------------------ */
function DFchangeField(o,e) {
	if(window.event)key=window.event.keyCode;
	else if(e)key=e.which;
	else return true;
	if (key==9||key==2||key==16) return false;
	// Vai
	if(o.value.length==o.maxLength){
  		for(var i=0;i<o.form.length;i++){
			if(o.form[i]==o && o.form[i+1]){
	    		if (!o.form[i+1].disabled && o.form[i+1].type != "hidden" && o.form[i+1].style.display != "none") {
					o.form[i+1].focus();
					return true;
				}else{
					return false;
				}
	    	}
		}
	}
	// Volta
	if(o.value.length == 0 && key == 8){
  		for(var i=0;i<o.form.length;i++){
    		if(o.form[i]==o && o.form[i-1]){
				if (!o.form[i-1].disabled && o.form[i-1].type != "hidden" && o.form[i+1].style.display != "none") {
					setTimeout("document." + o.form.name + "[" + (i-1) +"].focus()",10);
    				o.form[i-1].value = o.form[i-1].value;
    				return;
    			}else{
					return;
				}
			}
		}
	}
}



/* ------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------ */