function ajudaItens(idLi, idConteudo) {
	if (document.getElementById(idConteudo).style.display == 'none') {
		document.getElementById(idConteudo).style.display = '';
		document.getElementById(idLi).className = "listaAjudaAberta";
	} 
	else {
		document.getElementById(idConteudo).style.display = 'none';
		document.getElementById(idLi).className = "listaAjudaFechada";
	}
}



// LAYER SOLICITE ATENDIMENTO
function abreLayer(url) {
	document.getElementById('layerFundo').style.display = 'block';
	document.getElementById('layerCaixa').style.visibility = "visible";
	
	comboBox = document.getElementsByTagName('select');
	for (i=0;i<comboBox.length;i++) {
		comboBox[i].style.visibility="hidden";
	}
}
function fechaLayer() {
	document.getElementById('layerFundo').style.display = 'none';
	//document.getElementById('centraliza').className = "opacidadeNormal";
	//document.getElementById('coluna1024').className = "opacidadeNormal";
	document.getElementById('layerCaixa').style.visibility = "hidden";
	
	comboBox = document.getElementsByTagName('select');
	for (i=0;i<comboBox.length;i++) {
		comboBox[i].style.visibility = (comboBox[i].name == 'estado') ? "hidden" : "visible";
	}
}

var xmlhttp 
function GetXmlHttpObject(){
	if (window.XMLHttpRequest)	return new XMLHttpRequest();
	if (window.ActiveXObject)	return new ActiveXObject("Microsoft.XMLHTTP");
	return null;
}

function abreLayerAjax(url) {
	document.getElementById('retornoLayerFrame').innerHTML = '<br />'
	document.getElementById('layerFundo').style.display = 'block';
	document.getElementById('layerCaixa').style.visibility = "visible";
	xmlhttp = GetXmlHttpObject();
	if (xmlhttp == null) return;
	xmlhttp.onreadystatechange = stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	
	comboBox = document.getElementsByTagName('select');
	for (i=0;i<comboBox.length;i++) {
		comboBox[i].style.visibility="hidden";
	}
}

function stateChanged(){
	if (xmlhttp.readyState == 4){
		document.getElementById('retornoLayerFrame').innerHTML = xmlhttp.responseText;
	}
}

// HELP - Legenda 
function helpOn(id) {
	document.getElementById(id).style.display = "block";
}

function helpOff(id) {
	document.getElementById(id).style.display = "none";
}


//
function btnAdquiraOver(id) {
	var aba = "abaAdquira"+id;
	document.getElementById(aba).className = "abaAdquira abaAdquiraOver"
	
	var img11 = "btnAdquira"+id+"1img1";
	var img12 = "btnAdquira"+id+"1img2";
	document.getElementById(img11).style.display = "none";
	document.getElementById(img12).style.display = "none";
	
	var img21 = "btnAdquira"+id+"2img1";
	var img22 = "btnAdquira"+id+"2img2";
	document.getElementById(img21).style.display = "block";
	document.getElementById(img22).style.display = "block";
}

function btnAdquiraOut(id) {
	var aba = "abaAdquira"+id;
	document.getElementById(aba).className = "abaAdquira"
	
	var img11 = "btnAdquira"+id+"1img1";
	var img12 = "btnAdquira"+id+"1img2";
	document.getElementById(img11).style.display = "block";
	document.getElementById(img12).style.display = "block";
	
	var img21 = "btnAdquira"+id+"2img1";
	var img22 = "btnAdquira"+id+"2img2";
	document.getElementById(img21).style.display = "none";
	document.getElementById(img22).style.display = "none";
}



function mudaCampo( maxTam, idAtual, proxCampo ) {	
	if ( idAtual.value.length >= maxTam) {
		document.getElementById( proxCampo ).focus();
	}
}

//Retorna true se o valor digitado for numérico.
function validateInt(event) {		
	var charCode = event.which;

	if ( charCode > 31 && (charCode < 48 || charCode > 57 ) && (charCode != 8) && (charCode != 0) || (charCode == 13)) {		
		return false;
	}
	else {
		return true; 
	}	
}


// Carrega Over do botão adquira
function pre_carregar_imagens(){	
	var imagem_lista = Array('../img/imgAbaLaranjaInversaL.gif', '../img/imgAbaLaranjaInversaR.gif', '../img/imgAbaLaranjaInversaM.gif');
	var imagem_qtd = imagem_lista.length;
	for (i = 0; i <imagem_qtd; i++) {
	    var preload = new Image();
	    preload.src = imagem_lista[i];
	}
}
pre_carregar_imagens();


// FLASH
function flash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id){
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
	+'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '
	+'width="'+w+'" height="'+h+'" id="'+id+'" align="">'
	+'<param name="movie" value="'+swf+'">'
	+'<param name="menu" value="'+menu+'"> '
	+'<param name="quality" value="'+q+'"> '
	+'<param name="wmode" value="'+mode+'"> '
	+'<param name="bgcolor" value="'+bgcolor+'"> '
	+'<param name="flashvars" value="'+flashVarString+'"> '
	+'<param name="allowScriptAccess" value="always"> '
	+'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
	+' bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" name="'+swf+'" '
	+' align="" type="application/x-shockwave-flash" '
	+' pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always"></embed></object> ');
}


function popup(url) {
	window.open(url,'_blank','width=780,height=455,scrollbars=1');	
}


function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};


ligaIdAntigo = "";
function liga(idArg){
	if( ligaIdAntigo != "" ) {
		if( idArg == ligaIdAntigo ){
			if (document.getElementById(idArg).style.display == 'none') {
				document.getElementById(idArg).style.display = '';
			} 
			else {
				document.getElementById(idArg).style.display = 'none';
			}
		} 
		else{
			document.getElementById(idArg).style.display = '';
			document.getElementById(ligaIdAntigo).style.display = 'none';
		}
	 
	} 
	else{
		document.getElementById(idArg).style.display = '';
	}
	ligaIdAntigo = idArg;
}
