// Relógio
function getMes()
{
	var classe;
	datetoday = new Date();
	timenow = datetoday.getTime();
	datetoday.setTime(timenow);
	thehour = datetoday.getHours();
	
	mesAtual = datetoday.getMonth();
	
	var month = new Array(12);
		month[0]="Janeiro";
		month[1]="Fevereiro";
		month[2]="Marco";
		month[3]="Abril";
		month[4]="Maio";
		month[5]="Junho";
		month[6]="Julho";
		month[7]="Agosto";
		month[8]="Setembro";
		month[9]="Outubro";
		month[10]="Novembro";
		month[11]="Dezembro";

	classe = month[datetoday.getMonth()];
	classe += DiaNoite(thehour);			

	var clock = document.getElementById("relogio");
	clock.className = classe;
}

function DiaNoite(n)
{
	if( n > 6 && n < 18 ) return "Dia"; else return "Noite";
}
			
// Valida tamanho do texto.
function verificaTamanho(target, maximo, cont)
{
	var strLen = 0;
	var contador = cont;
	
	if( target.value != ""  )
	{
		strLen = strLen + target.value.length;
	}
	
	if( strLen == 1 && target.value.substring(0,1) == " " )
    {
        target.value = "";
		strLen = strLen - 1;
    }
    
    if( strLen > maximo )
	{
		target.value = target.value.substring(0,maximo);
		strLen = strLen - 1;
	}
		
	contador.value = maximo - strLen;			
}

// Museu
function tela()
{
	if(screen.height == '600')
		window.open('http://www.fundacaobradesco.org.br/museu/museu.asp','Museu','fullscreen=yes');
	else
		window.open('http://www.fundacaobradesco.org.br/museu/museu.asp','','width=800, height=600, top=5, left=0,scrollbars=0, noresize');
}			
		
// Redireciona
function redirectToUrl(object)
{
	url = object.value; 
	
	if(url != '')
	{
		if(url != 'javascript:tela();')
		{ 
			window.open(url,'','');
			object.selectedIndex = 0;
		}
		else
			if(screen.height == '600')
				window.open('http://www.fundacaobradesco.org.br/museu/museu.asp','Museu','fullscreen=yes');
			else
				window.open('http://www.fundacaobradesco.org.br/museu/museu.asp','','width=800, height=600, top=5, left=0,scrollbars=0, noresize');
		}
}

// Abre URL
function OpenUrl(url,x,y)
{	
	var parametros = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=" + x + ", height= " + y;
	window.open(url,"new",parametros);
}

// Altera Título
function changeTitle()
{
    var elem = document.getElementById("titulo");
    
    if (elem)
    {
        elem.innerHTML = "Forma&ccedil;&atilde;o Inicial e Continuada";
    }
}
