function mostraInfoTempo( lingua )// retirado de www.record.pt
{
	if( lingua == 'en' )
	{
		var Days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
		var Months = new Array('January','February','March','April','May','June','July','August','September','October','November','December');
	}
	else
	{
		var Days = new Array('Domingo','Segunda-Feira','Terça-Feira','Quarta-Feira','Quinta-Feira','Sexta-Feira','Sábado');
		var Months = new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
	}

	var today = new Date();
	var Year = takeYear(today);
	var MonthName = Months[today.getMonth()];
	var Month = leadingZero(today.getMonth()+1);
	var DayName = Days[today.getDay()];
	var Day = leadingZero(today.getDate());
	var Hours = leadingZero(today.getHours());
	var Minutes = leadingZero(today.getMinutes());

	if( lingua == 'en' )
		document.write (+ Hours + ':' + Minutes + ' | ' + Day + ' ' + MonthName + ' ' + Year)
	else
		document.write (+ Hours + ':' + Minutes + ' | ' + Day + ' de ' + MonthName + ' de ' + Year)
	/*document.write ('<span class="cump"> | ')
	if (Hours < 12)
		document.write('Bom dia </span>')
	else if (Hours < 19)
		document.write('Boa tarde </span>')
	else
		document.write('Boa noite </span>');*/
}

function takeYear(theDate)// retirado de www.record.pt
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function leadingZero(nr)// retirado de www.record.pt
{
	if (nr < 10) nr = "0" + nr;
		return nr;
}


function mudaLingua( lingua )
{
	$.ajax({ url:'/geral/' + lingua, success:function(){document.location.reload();} });
}

function alteraOpacidade( elemento, evento, imagemSol )
{
	if( evento == 'in' )
	{
		if( imagemSol )
			$('#imagemSol').animate( { opacity: 0.5 }, 700 );
		else
			$(elemento).animate( { opacity: 0.5 }, 0 );
	}
	else
  {
    if( imagemSol )
      $('#imagemSol').delay(400).animate( { opacity: 1 }, 1000 );
    else
      $(elemento).delay(400).animate( { opacity: 1 }, 1000 );
  }
	
}

function efeito()
{
	$('#imagemSol').animate({ width: "0px", height: "0px" }, 1000 ); 
	return false;
}


function mudaEstilo( estilo )
{
  if( estilo == 1 )
    $("[href^='/css/opencode']").attr( 'href', '/css/opencode.css' );
  else if( estilo == 2 )
    $("[href^='/css/opencode']").attr( 'href', '/css/opencode2.css' );
    
  createCookie('style', estilo, 365);
}
