//*****************************************************************************
//Objetivo:					Encapsular funcionalidades do Calendário de Mercado
//Autor:					Marcelo Pacheco (7COMm)
//Autor:					Alan A. Oliveira (Vertente)
//Autor:					Flávio Almeida (EDW/DI)
//Data:						11/11/2005
//Motivo:					-
//*****************************************************************************

//*****************************************************************************
// DECLARAÇÃO DAS VARIÁVEIS
//*****************************************************************************
	
//============================================================================================
// objetivo.........: Selecionar Ano
// Premissas.......: 
// Entradas........: MostrarID  - Ano a ser mostrado
// ................: EsconderID - Ano a ser Escondido
// Saida...........: 
//============================================================================================		
function TrocarAno(MostrarID, EsconderID)	
{
	//try
	//{
		strAno = MostrarID.substr(2,2);
		with(document){
			with(getElementById(EsconderID)){
				style.display = 'none';
			}
			with(getElementById('Ano'+EsconderID)){
				style.backgroundImage = '';
				style.color = '#999999';
			}
		
			with(getElementById(MostrarID)){
				style.display = 'block';
			}
			with(getElementById('Ano'+MostrarID)){
				style.backgroundImage = 'url(/Images/ImgMarcadorAnoOn.gif)';
				style.color = '#809bdd';
			}
		}
		
		EstiloAno(MostrarID,EsconderID)	
	//}
	//catch(objEx)
	//{
		//alert(objEx.toString());
		//alert(objEx.message);
	//}

}

//============================================================================================
// objetivo.........: Configurar Estilo Ano
// Premissas.......: 
// Entradas........: MostrarID  - Ano a ser mostrado
// ................: EsconderID - Ano a ser Escondido
// Saida...........: 
//============================================================================================		
function EstiloAno(MostrarID,EsconderID)
{

	if (EsconderID != 0)
	{
		//document.getElementById(EsconderID).style.color='#999999'
		//document.getElementById(EsconderID).style.backgroundImage =''
	}
	///alert(document.getElementById(MostrarID).id)
	/*document.getElementById(MostrarID).style.color = '#809bdd';
	document.getElementById(MostrarID).style.backgroundImage = 'url(/Images/ImgMarcadorAnoOn.gif)';
	document.getElementById(MostrarID).style.backgroundRepeat ='no-repeat';
	document.getElementById(MostrarID).style.backgroundPosition='center';
	document.getElementById(MostrarID).style.backgroundAttachment='fixed';
	document.getElementById(MostrarID).style.paddingTop='20px';*/

}

//============================================================================================
// objetivo.........: Trocar Mes de visualização
// Premissas.......: 
// Entradas........: strMes - Mes a ser mostrado
// Saida...........: 
//============================================================================================		
function TrocarMes(strMes)
{
	var intIaux; // Variavel utilizada no laço for
	var strID; // Recebe o id do objeto
	//try
	//{
	    
		EstiloAno('20' + strAno,0)
		
		for (intIaux=0;intIaux<ArrMeses.length;intIaux++)
		{
			strID = ArrMeses[intIaux] + strAno;
			
			document.getElementById(strID).style.display = 'none';
			document.getElementById(ArrMeses[intIaux].toString()).style.color='#999999';
			document.getElementById(ArrMeses[intIaux].toString()).style.backgroundImage = 'url(/Images/ImgMarcadorMesOff.gif)'
		}
		 
		document.getElementById(strMes).style.color='#809bdd';
		document.getElementById(strMes).style.backgroundImage = 'url(/Images/ImgMarcadorMesOn.gif)'
		strMes = strMes + strAno;
	   
		document.getElementById(strMes).style.display = 'block';
	/*}
	catch(objEx)
	{
		alert(objEx.toString());
		alert(objEx.message);
	}*/
}

//============================================================================================
// objetivo.........: Trocar Ano a ser impresso
// Premissas.......: 
// Entradas........: strId - Ano a ser impresso
// ................: strArquivo - Nome do arquivo a ser exibido para impressão
// Saida...........: 
//============================================================================================		
function CalendarioImpressao(strId,strArquivo)
{
	document.getElementById(strId).href = '/pdf/'+ strArquivo + strAno + '.pdf';
}

//============================================================================================
// objetivo........: Efeito hover dos meses
// Premissas.......: 
// Entradas........: strMes - Mes a ser mostrado
// ................: intStatus - Recebe o estado ativo(0) ou inativo(1) do link
// Saida...........: 
//============================================================================================		
function EfeitoMes(strMes,intStatus)
{
	if (intStatus==0)
	{	
		if(document.getElementById(strMes).style.color!='#809bdd')
		{
			document.getElementById(strMes).style.color='#808bdd';
			document.getElementById(strMes).style.backgroundImage = 'url(/Images/ImgMarcadorMesOn.gif)'
		}
	}
	else if (intStatus==1)
	{

		if(document.getElementById(strMes).style.color!='#809bdd')
		{
			document.getElementById(strMes).style.color='#999999';
			document.getElementById(strMes).style.backgroundImage = 'url(/Images/ImgMarcadorMesOff.gif)'
		}
	}
}

//============================================================================================
// objetivo........: Efeito hover dos meses
// Premissas.......: 
// Entradas........: strAno - Mes a ser mostrado
// ................: intStatus - Recebe o estado ativo(0) ou inativo(1) do link
// Saida...........: 
//============================================================================================		
function EfeitoAno(strAno,intStatus)
{
	/*if (intStatus==0)
	{	
		if(document.getElementById(strAno).style.color!='#809bdd')
		{
			document.getElementById(strAno).style.color = '#808bdd';
		}
	}
	else if (intStatus==1)
	{
		if(document.getElementById(strAno).style.color!='#809bdd')
		{
			document.getElementById(strAno).style.color='#999999';
			document.getElementById(strAno).style.backgroundImage = '';
		}
	}*/
}
