function ChangeBackground(element, tipo, relacionado, end)
{
	//resetar estilos descricao produtos com descricao complementar
	if (tipo == 'span'){
		document.getElementById('S0').style.backgroundImage = '';
		document.getElementById('S0').style.color = '';
		var cont = 1;
		while(document.getElementById('S' + cont) != null)
		{
			document.getElementById('S'+ cont).style.backgroundImage = '';
			document.getElementById('S'+ cont).style.color = '';
			cont = cont + 1;
		}
	}

	if (tipo == 'a'){
		document.getElementById('A0').style.backgroundImage = '';
		document.getElementById('A0').style.color = '';
		var cont = 1;
		while(document.getElementById('A' + cont) != null)
		{
			document.getElementById('A'+ cont).style.backgroundImage = '';
			document.getElementById('A'+ cont).style.color = '';
			cont = cont + 1;
		}
	}

	//estilos

	if (tipo == 'span')
	{
		var arquivo = ('/aba_direita_hover.gif');
		var endereco = "url('" + end + arquivo + "')";
		element.style.backgroundImage = endereco;
		element.style.color= "#FFFFFF";
	}
	
	if (tipo == 'a')
	{
		var arquivo = ('/aba_esquerda_hover.gif');
		var endereco = "url('" + end + arquivo + "')";
		element.style.backgroundImage = endereco;
		element.style.color= "#FFFFFF";
	}
}

function changeTab(Id, pfId){
	var cAjax = new Ajax();
    if (Id == 9999) {
        document.getElementById('descricao').style.visibility = 'hidden';
        document.getElementById('descricao').style.position = 'absolute';
        document.getElementById('borda_conteudo').style.visibility = 'hidden';
        document.getElementById('borda_conteudo').style.position = 'absolute';
        /*document.getElementById('relacionados').style.visibility = 'visible';
         document.getElementById('relacionados').style.position = 'static';*/
    }
    else 
        if (Id == 0) {
            document.getElementById('descricao').style.visibility = 'visible';
            document.getElementById('descricao').style.position = 'static';
            document.getElementById('borda_conteudo').style.visibility = 'hidden';
            document.getElementById('borda_conteudo').style.position = 'absolute';
        /*document.getElementById('relacionados').style.visibility = 'hidden';
         document.getElementById('relacionados').style.position = 'absolute';*/
        }
        else {
            document.getElementById('descricao').style.visibility = 'hidden';
            document.getElementById('descricao').style.position = 'absolute';
            document.getElementById('borda_conteudo').style.visibility = 'visible';
            document.getElementById('borda_conteudo').style.position = 'static';
            /*document.getElementById('relacionados').style.visibility = 'hidden';
         document.getElementById('relacionados').style.position = 'absolute';*/
            cAjax.onStateChange = function(classState, httpState, retornoHTML, retornoXML){
                if (httpState == 200) {
                    document.getElementById('borda_conteudo').innerHTML = retornoHTML;
                }
                else {
                    alert('Erro ' + httpState + '\n\nFavor entrar em contato com o administrador do sistema.');
                }
                
            }
            cAjax.load('../borda_conteudo.asp', 'id=' + Id + '&pf_id=' + pfId, 'POST'); // Chama a função AJAX
        }
}