function doResize(intSize){
	/*var intwidth = 774;
	parent.document.all.fset.cols     = "*," + intSize + ",*";
	document.all.tabelaConteudo.width = intwidth;
	document.all.tabelaRodape.width   = intwidth;		
	document.all.tabelaMenu.width     = intwidth;
	return false;*/
}

function AjustaResolucao(){
	if(window.screen.availWidth <= 800){
		doResize(790);
	}
	else{
		doResize(775);
	}
}

function menuColorOver(menuObj){
	menuObj.style.color = "#4D4D4D";
}

function menuColorOut(menuObj){
	menuObj.style.color = "#000000";
}

function rodape(){
	var height, width;

	if (document.all)
	    height = document.body.offsetHeight, width = document.body.offsetWidth;
	else if (document.layers)
	    height = window.innerHeight, width = window.innerWidth;
	    
	document.all.tabelaConteudo.height = height - 210;    
}

function maxLenght(objCampo,tamanho,erroMsg){
	var campo = objCampo;

	if (campo.value.length >= tamanho){
		event.returnValue = false;
		alert(erroMsg + ' ' + tamanho);
		event.cancelBubble = true;
	}
	
	return 0;
}

function JustNumbers()
{
	if ('0123456789,.'.indexOf(String.fromCharCode(event.keyCode)) == -1)
		event.returnValue = false;
}

function JustDateChars()
{
	if ('0123456789/'.indexOf(String.fromCharCode(event.keyCode)) == -1)
		event.returnValue = false;
}

function y2k(number) { return (number < 1000) ? number + 1900 : number; }

function isDate (strDate, invalidMsg, obj) {

	var day   = strDate.substr(0,2);
	var month = strDate.substr(3,2);
	var year  = strDate.substr(6,4);
	
	// checks if date passed is valid
    var today = new Date();
    year = ((!year) ? y2k(today.getYear()):year);
    month = ((!month) ? today.getMonth():month-1);
    if (!day) return false
    var test = new Date(year,month,day);
    if ( (y2k(test.getYear()) == year) &&
         (month == test.getMonth()) &&
         (day == test.getDate()) ){
        obj.style.backgroundColor = '#FFFFFF';
        return true;
    }
    else{
        alert(invalidMsg);
        obj.focus();
        obj.style.backgroundColor = 'red';
    }
}

function fgCriaMascara( _RefObjeto,
						_Modelo,
						_Alfa,
						_Space, 
						_Campo )
{
	var valorAtual			= _RefObjeto.value;
	var valorNumerico		= '';
	var nIndexModelo		= 0;
	var nIndexString		= 0;
	var valorFinal			= '';
	var adicionarValor		= true;
	var Campo				= _Campo
	var focus				= 'document.frm.' + Campo + '.focus();'
	var zera				= _RefObjeto.value = '';
	
	// limpa a string valor atual para verificar
	// se todos os caracteres são números
	for ( i = 0; i < _Modelo.length; i++ )
	{
		if ( _Modelo.substr( i, 1 ) != '#' )
		{
		  valorAtual = valorAtual.replace( _Modelo.substr( i, 1 ), '' );
		}
	}
	
	// verifica se poderá ser exibidos caracteres alfanuméricos
	if( _Alfa == 'true')
	{
		for ( i = 0; i < valorAtual.length; i++ )
		{
			// verifica se permite ser inserido "espaço"
			if( _Space == 'true')
			{
				// verifica se é um caracter válido ou um "espaço"
				if (	( isCaracterValido(valorAtual.substr( i, 1 )) ) || 
							( valorAtual.substr( i, 1 ) == ' ' ) )
				{
				  valorNumerico = valorNumerico + valorAtual.substr( i, 1 );
				}
			}
			else
			{
				// verifica se é um caracter válido
				if ( isCaracterValido(valorAtual.substr( i, 1 )) )
				{
				  valorNumerico = valorNumerico + valorAtual.substr( i, 1 );
				}
			}
		}
	}
	else
	{
		for ( i = 0; i < valorAtual.length; i++ )
		{
			// verifica se permite ser inserido "espaço"
			if( _Space == 'true')
			{
				// verifica se é um número ou um "espaço"
				if (	( !isNaN(parseFloat(valorAtual.substr( i, 1 ))) ) || 
							( valorAtual.substr(i,1) == ' ' ) )
				{
				  valorNumerico = valorNumerico + valorAtual.substr( i, 1 );
				}
			}
			else
			{
				// verifica se é um número
				if ( !isNaN(parseFloat(valorAtual.substr( i, 1 ))) )
				{
				  valorNumerico = valorNumerico + valorAtual.substr( i, 1 );
				}
			}
		}
	}
	// aplica a máscara ao campo informado usando
	// o modelo de máscara informado no script
	for ( i = 0; i < _Modelo.length; i++ )
	{
		if ( _Modelo.substr(i,1) == '#' )
		{
			if ( valorNumerico.substr( nIndexModelo, 1 ) != '' )
			{
				valorFinal = valorFinal + valorNumerico.substr( nIndexModelo, 1 );
				nIndexModelo++; 
				nIndexString++;
							
				if ( nIndexString == '2' )
				{
					if ( valorFinal > '23' )
					{
						alert("Hora Inválida");
						zera;
						return;
						focus;						
					}				
				}			
				
				if ( nIndexString == '1' )
				{
					if ( valorFinal > '2' )
					{
						alert("Hora Inválida");
						zera;
						return;
						focus;						
					}					
				}			
								
			}
			else 
			{
				adicionarValor = false;				
			}
		}
		else 
		{
		  if ( adicionarValor && valorNumerico.substr( nIndexModelo, 1 ) != '' )
		  {
				valorFinal = valorFinal + _Modelo.substr( nIndexString, 1 )
				nIndexString++;
				
				if(valorNumerico.substr( nIndexModelo, 1 ) > '5' )
				{
					alert("Hora Inválida");
					zera;
					return;
					focus;					
				}
			}
		}
	}
	_RefObjeto.value = valorFinal	
}
