
/* Interação: Votação */

function exibir_votacao(formulario, contador, imagem, nota, extensao) {
	document.getElementById(formulario + '_' + contador + '_votacao_opcao_1').src = (imagem + ( (nota < 1) ? 0 : 2 ) + extensao);
	document.getElementById(formulario + '_' + contador + '_votacao_opcao_2').src = (imagem + ( (nota < 2) ? 0 : 2 ) + extensao);
	document.getElementById(formulario + '_' + contador + '_votacao_opcao_3').src = (imagem + ( (nota < 3) ? 0 : 2 ) + extensao);
	document.getElementById(formulario + '_' + contador + '_votacao_opcao_4').src = (imagem + ( (nota < 4) ? 0 : 2 ) + extensao);
	document.getElementById(formulario + '_' + contador + '_votacao_opcao_5').src = (imagem + ( (nota < 5) ? 0 : 2 ) + extensao);
}

/* Idioma: template drop_down */

var situacao_langpulldown = Array();

function selectLang(id, url) {
	collapseLandLangPulldown(id);
	document.location = url;
}

function hiLight(langImg, idx, cor) {
   langImg.bgcolor = cor;
}

function findPos(obj) {
	var curleft = 0;
    var curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
    return [curleft,curtop];
}

function runLangPulldown(id) {
    if (situacao_langpulldown[id] == 1) {
		situacao_langpulldown[id] = 0;
        setTimeout('collapseLandLangPulldown(' + id + ')', 500);
    }
    else {
		situacao_langpulldown[id] = 1;
		img = document.getElementById('caixaselidiomatable_' + id);
        expandLangPulldown(id, img);
    }
}

function collapseLandLangPulldown(id) {
	if ((situacao_langpulldown[id] == 0) && (document.getElementById('langselection_' + id)))
		document.getElementById('langselection_' + id).style.display = 'none';
}

function expandLangPulldown(id, img) {
	if (!document.getElementById('langselection_' + id)) {
		var langPulldown = document.createElement("DIV");
		langPulldown.id = 'langselection_' + id;
		langPulldown.style.border = 'none';
		langPulldown.style.position = 'absolute';
		document.body.appendChild(langPulldown);
    	langPulldown.innerHTML = document.getElementById('langselection_lista_' + id).innerHTML;
		if (document.getElementById('google_translate_element')) {
			langPulldown.innerHTML.replace('/google_translate_element/', document.getElementById('google_translate_element').innerHTML);
		}
	} else
		langPulldown = document.getElementById('langselection_' + id);

	var espaco_esquerda = findPosX(img);
	var espaco_topo = findPosY(img);
	langPulldown.style.left = (espaco_esquerda + 0) + 'px';
	langPulldown.style.top = (espaco_topo+ 28) + 'px';

	// Definir Z-Index para garantir que aparecerá no topo
	var ultimo_zIndex = findPosZ();
    langPulldown.style.zIndex = ultimo_zIndex + 1;

    langPulldown.style.display = 'block';
}

