// JavaScript Document

function ajaxInit() {
	var req;
	try {
		 req = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(e) {
		 try {
			  req = new ActiveXObject("Msxml2.XMLHTTP");
		 } catch(ex) {
		 try {
		   req = new XMLHttpRequest();
	     } catch(exc) {
	 		  alert("Esse browser não tem recursos para uso do Ajax");
	  		 req = null;
	     }
	 }
}
return req;
}

function carregaCombo(url, codigo, id) {
	//alert(url + "?tipo=" + tipo)
	ajax = ajaxInit();
	if(ajax) {
		ajax.open("GET",url + "?codigo=" + codigo, true);
		
		ajax.onreadystatechange = function() {
			if(ajax.readyState == 4) {
				if(ajax.status == 200) {
					document.getElementById(id).innerHTML = ajax.responseText;
				}else{
					alert(ajax.statusText);
				}
			}
		}
		ajax.send(null);
	}
}



//funções para menu suspenso
function pegaDados(codigo,controle,submenu,menu){
	conter = document.getElementById(controle).value;
	if (conter=="1"){
		h=100;
		document.getElementById(controle).value="0";
		document.getElementById(submenu).padding="0px";
		document.getElementById(submenu).style.lineHeight="0px";
		document.getElementById(submenu).style.display="none";
		
	}else{
		h=0;
		document.getElementById(controle).value="1";
		document.getElementById(submenu).style.lineHeight="normal";
		document.getElementById(submenu).style.display="";
		document.getElementById(controle).value="1";
	}
}

function checado(name, cod, id){
	
	novoCod="";
	if(document.getElementById(name).checked){
		document.getElementById(id).value += cod+"|"; 
	}
	if(document.getElementById(name).checked==false){
		valores = document.getElementById(id).value;
		document.getElementById(id).value="";
		codigos = valores.split("|");
		
		for (i=0;i<=codigos.length-2;i++){
			
			if(codigos[i] != cod){
				novoCod = novoCod+codigos[i]+"|";
				document.getElementById(id).value=novoCod;
			}
		}
	}
}
function isInt(id)
{
   	element = document.getElementById(id)
	var str = /^\d+$/;
	return str.test(valor_text);
}


function formatar(id, mask)
{
	src = document.getElementById(id);
	var i = src.value.length;
  	var saida = mask.substring(0,1);
  	var texto = mask.substring(i)
	if (texto.substring(0,1) != saida)
  	{
    	src.value += texto.substring(0,1);
  	}
}
function formatarFone(id)
{
	src = document.getElementById(id);
	var i = src.value.length;
	if(i==1)
	{
		src.value = "(" + src.value;
	}
	if(i==3)
	{
		src.value = src.value + ") " 
	}
	if(i==9)
	{
		src.value = src.value + "-" 
	}
	
	
}
function formatarValor(id)
{
	obj = document.getElementById(id)
	valor_aux = obj.value;
	if( valor_aux != "")
	{
		if(isFloat(valor_aux) == true)
		{
			pos = valor_aux.search(",");
			if(pos != -1)
			{
				vet_valor = valor_aux.split(",");
				valor = vet_valor[0];
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor= valor.replace(".","")
				valor = valor * 100;
				valor = valor / 100;
				valor = new String(valor);	
				if(valor != "")
				{
					if (vet_valor[1].length == 2)
					{
						valor = formataFloatPonto(valor) + "," + vet_valor[1];
						document.getElementById(id).value = valor;
					}
					else
					{
						if (vet_valor[1].length > 2)
						{
							vet_valor[1] = vet_valor[1].substring(0,2);	
							valor = formataFloatPonto(valor) + "," + vet_valor[1]
							document.getElementById(id).value = valor;
						}
						else
						{
							valor = formataFloatPonto(valor) + "," + vet_valor[1] + "0"	
							document.getElementById(id).value = valor;
						}
					}
				}
				else
				{
					valor = formataFloatPonto(valor) + ",00"; 
					document.getElementById(id).value = valor;
				}
			}
			else
			{
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				valor_aux= valor_aux.replace(".","")
				obj = document.getElementById(id);
				obj.value = formataFloatPonto(valor_aux) + ",00"
				
			}
		}
	}
	
}
function formataFloatPonto(valorParam)
{
	valor = valorParam;	
	tam_vet = parseInt(valor.length / 3)
	var vet_aux = new Array();				
	cont = 0;
	contVet = 0
	if (valor != "")
	{
		if (valor.length > 3)
		{
				
			for(i=valor.length;i>0;i--)
			{
				if( ( cont % 3 == 0)  && (cont > 0) )
				{
					vet_aux[contVet] = i;
					contVet = contVet + 1;
				}	
				cont = cont + 1
			}
			for(i=0;i<vet_aux.length;i++)
			{
				valor = valor.substring(0,vet_aux[i]) + "." + valor.substring(vet_aux[i],valor.length);				
			}
			
		}
	}
	else
	{
		valor = "0";
	}
	return valor
}

function insNumeric(obj,event)
{
    var tecla = event.charCode;
    var ie = event.keyCode;
    if (!event) event = window.event;
    var code;
    if (event.keyCode) code = event.keyCode;
    else if (event.which) code = event.which; // Netscape 4.?
//se nao for número nem parentesis ou espaço
    if ((code < 48 || code > 59) && (code != 8 ) ){
      event.returnValue = false;
      if (event.which){
        event.preventDefault();
      }
      return false;
    }else{
      event.returnValue = true;
      return true;
    }
 }
function insFloat(obj,event)
{
    var tecla = event.charCode;
    var ie = event.keyCode;
    if (!event) event = window.event;
    var code;
    if (event.keyCode) code = event.keyCode;
    else if (event.which) code = event.which; // Netscape 4.?
//se nao for número nem parentesis ou espaço
    if ((code < 48 || code > 59) && (code != 8 ) & (code != 44)){
      event.returnValue = false;
      if (event.which){
        event.preventDefault();
      }
      return false;
    }else{
      event.returnValue = true;
      return true;
    }
 } 

function isFloat(valor)
{
	var valor_text = valor;
	var str = /^[+-]?((\d+|\d{1,3}(\.\d{3})+)(\,\d*)?|\,\d+)$/;
	return str.test(valor_text);
}

function pegarHora(campo){
	hora = new Date;
	wHora = hora.getHours();
	wMin = hora.getMinutes();
	if(wMin < 10){
		wMin = "0" + wMin;
	}
	wSec = hora.getSeconds();
	if(wSec < 10){
		wSec = "0" + wSec;
	}
	
	//wHoraF = wHora +":"+ wMin +":"+ wSec;
	wHoraF = wHora +":"+ wMin;
	
	document.getElementById(campo).innerHTML = wHoraF;
	
	setTimeout("pegarHora('"+campo+"')",1);
}
function pegarData(){
	var nomeDia;
	data = new Date;
	dia  = data.getDay();
	mes = data.getMonth();
	ano = data.getFullYear();
	
	switch(dia){
		case 0:
			nomeDia = "Domingo";
		case 1:
			nomeDia = "Segunda-feira";
		case 2:
			nomeDia = "Terça-feira";
		case 3:
			nomeDia = "Quarta-feira";
		case 4:
			nomeDia = "Quinta-feira";
		case 5:
			nomeDia = "Sexta-feira";
		case 6:
			nomeDia = "Sábado";
	}
	
	switch(mes){
		case 0:
			nomeMes = "janeiro";
		case 1:
			nomeMes = "fevereiro";
		case 2:
			nomeMes = "março";
		case 3:
			nomeMes = "abril";
		case 4:
			nomeMes = "maio";
		case 5:
			nomeMes = "junho";
		case 6:
			nomeMes = "julho";
		case 7:
			nomeMes = "agosto";
		case 8:
			nomeMes = "setembro";
		case 9:
			nomeMes = "outubro";
		case 10:
			nomeMes = "novembro";
		case 11:
			nomeMes = "dezembro";
	}
	
	campoData = document.getElementById("data_semana");
	campoData.innerHTML = nomeDia +", "+ dia +" de "+ nomeMes +" de "+ ano +".";	
}


function janelaBusca(url,id,idIns,IdDel,largura,altura)
{
	element = document.getElementById(id)
	extra = document.getElementById("extra")
	wurl = url + "&digitado="+ element.value + "&camposIns=" + idIns + "&camposApagar=" + IdDel	
	
	if( (extra) && (extra.value != "") )
	{
		vet_extra = extra.value.split("|");
		campoExtra = vet_extra[0];
		valorCampo = document.getElementById(vet_extra[1]);
		if (valorCampo)
		{
			wurl = wurl + "&campoExtra=" + campoExtra + "&valorExtra=" + valorCampo.value
		}
	}
	
	winDt = window.open(wurl,'','top=300,left=600,width='+ largura +',height='+ altura +',scrollbars=1,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=0');
	winDt.focus();
}

function janelaForm(largura,altura,url)
{
	winDt = window.open(url,'','top=300,left=150,width='+ largura +',height='+ altura +',scrollbars=1,status=0,toolbar=0,location=0,menubar=0,directories=0,resizable=1');
	winDt.focus();
}
function salvarForm()
{
	document.getElementById("form").submit();	
}
function setarValor(cod,desc)
{
	id_anterior = document.getElementById("recebemValor").value
	vet_divAnt = id_anterior.split("|")
	valorAnterior = window.opener.document.getElementById(vet_divAnt[0].value);
	if (valorAnterior != cod)
	{
		
		id_anteriorAp = document.getElementById("apagamValor").value;
		
		if (id_anteriorAp != "")
		{
			vet_divAntAp = id_anteriorAp.split("|")
			for(i=0;i<vet_divAntAp.length;i++)
			{
				element = window.opener.document.getElementById(vet_divAntAp[i]);
				
				if(element)
				{
					element.value = "";	
				}
			}
		}
	}
	window.opener.document.getElementById(vet_divAnt[0]).value = cod;
	window.opener.document.getElementById(vet_divAnt[1]).value = desc
	//window.opener.document.location.href=url;
	fechar();
}
function setarValorLista(cod,desc)
{
	id_anterior = document.getElementById("recebemValor").value
	vet_divAnt = id_anterior.split("|")
	valorAnterior = document.getElementById(vet_divAnt[0].value);
	
	if (valorAnterior != cod)
	{
		
		id_anteriorAp = document.getElementById("apagamValor").value;
		
		if (id_anteriorAp != "")
		{
			vet_divAntAp = id_anteriorAp.split("|")
			for(i=0;i<vet_divAntAp.length;i++)
			{
				element = document.getElementById(vet_divAntAp[i]);
				
				if(element)
				{
					element.value = "";	
				}
			}
		}
	}
	document.getElementById(vet_divAnt[0]).value = cod;
	document.getElementById(vet_divAnt[1]).value = desc
	//window.opener.document.location.href=url;
	limpaListagem();	
}

function inicializaForm()
{
	cod = document.getElementById("codigo")
	if(cod)
	{
		if(cod.value != "")
		{
			edit = document.getElementById("bot_editar")
			excluir = document.getElementById("bot_excluir")
			if(edit)
			{
				edit.disabled = "";
				edit.onclick = function(){editReg();}
				edit.className = "imagem_pointer";
				edit.src = urlImagem + "bt_editar.jpg";
			}
			if(excluir)
			{
				url=document.getElementById("url_det")
				excluir.disabled = "";	
				excluir.onclick = function(){excluirReg(cod.value,url.value);}
				excluir.className = "imagem_pointer";
				excluir.src = urlImagem + "bt_excluir.jpg";
			}
		}
	}
}
function excluirReg(url)
{
	if (confirm("Deseja realmente excluir o registro"))
	{
		location.href=url;	
	}
}
function fechar()
{
	close();
}
function salvar(id)
{
	document.getElementById(id).submit();	
}

function abrirMenu(wcontrole)
{
	$("#"+wcontrole).slideToggle("normal")
}

/*
function insBusca(obj,event)
{
    var tecla = event.charCode;
    var ie = event.keyCode;
    if (!event) event = window.event;
    var code;
    if (event.keyCode) code = event.keyCode;
    else if (event.which) code = event.which; // Netscape 4.?
//se nao for número nem parentesis ou espaço
    //alert(code)
	if (code != 13)
	{
		buscaTexto()
	}
	else
	{
		repeteBusca()	
	}
}

valorEncontrado = 0;
function buscaTexto()
{
	
	var busca = document.getElementById("busca").value;
	busca = busca.toLowerCase();
	if (busca != "")
	{
		obj_cnpj = document.getElementById("cnpj");
		obj_razao = document.getElementById("razao");
		obj_fant = document.getElementById("fantasia");
		
		if( (obj_cnpj) && (obj_razao) && (obj_fant) )
		{
			
			if (obj_cnpj.checked == true)
			{
				obj = document.getElementsByTagName('p');
			}
			if (obj_razao.checked == true)
			{
				obj = document.getElementsByTagName('var');
			}
			if (obj_fant.checked == true)
			{
				obj = document.getElementsByTagName('span');
			}
		}
		else
		{
			obj = document.getElementsByTagName('p');
		}
		
		for (i=0;i<obj.length;i++)
		{
			//alert(element)
			if (obj)
			{
							
				texto = obj[i].firstChild.nodeValue.toLowerCase();
				pos = texto.search(busca);
				
				if(pos != -1)
				{
					obj[i].focus();
					classObj = obj[i].className;
					obj[i].style.textDecoration = "underline";
					valorEncontrado = i;
					retirarUnderline(obj[i]);					
					moverBarraRolagem(classObj);
					break;				
				}
				
			}
		}
	}
	
}

function repeteBusca()
{
	
	var busca = document.getElementById("busca").value;
	busca = busca.toLowerCase();
	encontrou = 0
	if (busca != "")
	{
		obj_cnpj = document.getElementById("cnpj");
		obj_razao = document.getElementById("razao");
		obj_fant = document.getElementById("fantasia");
		
		if( (obj_cnpj) && (obj_razao) && (obj_fant) )
		{
			if (obj_cnpj.checked == true)
			{
				obj = document.getElementsByTagName('p');
			}
			if (obj_razao.checked == true)
			{
				obj = document.getElementsByTagName('var');
			}
			if (obj_fant.checked == true)
			{
				obj = document.getElementsByTagName('span');
			}
		}
		else
		{
			obj = document.getElementsByTagName('p');	
		}
		
		for (i=valorEncontrado;i<obj.length;i++)
		{
			//alert(element)
			if( (obj) && (i != valorEncontrado) )
			{
				texto = obj[i].firstChild.nodeValue.toLowerCase();
				
				pos = texto.search(busca);
				if(pos != -1)
				{
					obj[i].focus();
					
					classObj = obj[i].className;
					obj[i].style.textDecoration = "underline";
					valorEncontrado = i;
					retirarUnderline(obj[i])
					moverBarraRolagem(classObj);
					encontrou = 1;
					break;				
				}
			}
		}
		if (encontrou == 0)
		{
			valorEncontrado = -1;		
		}
	}
	
}


function retirarUnderline(id)
{
	
	obj_cnpj = document.getElementById("cnpj");
	obj_razao = document.getElementById("razao");
	obj_fant = document.getElementById("fantasia");
	
	if( (obj_cnpj) && (obj_razao) && (obj_fant) )
	{
		if (obj_cnpj.checked == true)
		{
			obj = document.getElementsByTagName('p');
		}
		if (obj_razao.checked == true)
		{
			obj = document.getElementsByTagName('var');
		}
		if (obj_fant.checked == true)
		{
			obj = document.getElementsByTagName('span');
		}
	}
	else
	{
		obj = document.getElementsByTagName('p');	
	}
	
	for (i=0;i<obj.length;i++)
	{
		if (obj)
		{
			if(obj[i] != id)
			{
				obj[i].style.textDecoration = "none";	
			}
		}
	}
}
function moverBarraRolagem(classObj)
{
	filt = document.getElementById("conteudo_busca_list")
	aux = filt.scrollHeight / 3
	aux = parseInt(aux)
	if(classObj == "div_1")
	{
		filt.scrollTop = 0;	
	}
	if(classObj == "div_2")
	{
		filt.scrollTop = aux;	
	}
	
	if(classObj == "div_3")
	{
		filt.scrollTop = aux * 2;	
	}
	filt.scrollTop = classObj	
	
}*/

function camposFile(idFoto,idLegenda,contador,acao){
	if(acao == "+"){
		if(parseInt(document.getElementById(contador).value) < 30){
			document.getElementById(contador).value = parseInt(document.getElementById(contador).value)+1;
			//document.getElementById(idFoto + document.getElementById(contador).value).style.display = "";
			document.getElementById(idLegenda + document.getElementById(contador).value).style.display = "";
			document.getElementById('botDel').style.display = "";
		}
		
		if(parseInt(document.getElementById(contador).value) == 30){
			document.getElementById('botAd').style.display = "none";
		}
	}else{
		if(parseInt(document.getElementById(contador).value) > 1){
			//
			document.getElementById('qtde' + document.getElementById(contador).value).value = "";
			document.getElementById('unid' + document.getElementById(contador).value).value = "";
			document.getElementById('cod_espec' + document.getElementById(contador).value).value = "";
			document.getElementById('descricao' + document.getElementById(contador).value).value = "";
			//
			
			//document.getElementById(idFoto + document.getElementById(contador).value).style.display = "none";
			document.getElementById(idLegenda + document.getElementById(contador).value).style.display = "none";
			document.getElementById(contador).value = parseInt(document.getElementById(contador).value)-1;
			document.getElementById('botAd').style.display = "";
		}
		
		if(parseInt(document.getElementById(contador).value) == 5){
			document.getElementById('botDel').style.display = "none";
		}
	}
}

function janelaRelatorio(wurl)
{
	var winDt = window.open(wurl,'','scrollbars=1,status=1,toolbar=1,location=0,menubar=1,directories=1,resizable=1');
	winDt.focus();
}

function horaImpressao()
{
	data_aux = new Date;
	whora = data_aux.getHours()
	wminuto = data_aux.getMinutes()
	
	dia = data_aux.getDate();
	mes = data_aux.getMonth();
	mes = parseInt(mes) + 1;
	ano = data_aux.getFullYear();
	if (dia < 10)
	{
		dia = "0" + dia;
	}
	if (mes < 10)
	{
		mes = "0" + mes;
	}
	if (whora < 10)
	{
		whora = "0" + whora;
	}
	if (wminuto < 10)
	{
		wminuto = "0" +wminuto;
	}
	
	obj = document.getElementsByTagName("span");
	
	for (i=0;i<obj.length;i++)
	{
		
		if (obj[i])
		{
			if (obj[i].className == "hora")
			{
				obj[i].innerHTML = dia + "/" + mes + "/" + ano + " " + whora + ":" + wminuto;
			}
		}
	}		
	
}

function Banco()
{
	
	document.getElementById("extra").value = "";	
	preecheInput('cod_banco','razao','BANCO','CODIGO','BAN_NOME')
	document.getElementById("cod_agencia").value = "";
	document.getElementById("agencia").value = "";
	document.getElementById("cod_conta").value = "";
	document.getElementById("conta").value = "";

}
function verBanco(tipo)
{
	// D - quando chama a funcao para autopreenchimento
	// N - quando a busca é por numero
	
	if(document.getElementById("cod_banco").value == "")
	{
		obj_input = document.getElementById("agencia");
		if (tipo == "N")
		{
			obj_input.value = "";
			obj_input.value = "Selecione um banco"	
			document.getElementById("cod_agencia").value = ""		
		}
		else
		{
			if (tipo == "D")
			{
				obj_input.value = "";
				obj_input.value = "Selecione um banco"
				
				obj_input.onkeypress = function(){ verBanco('D') ;}			
			}	
			else
			{
				obj_input.value = "Selecione um banco"	
			}	
		}
	}
	else
	{
		document.getElementById("extra").value = "BAN_CODIGO|cod_banco";
		
		obj_input = document.getElementById("agencia");
			
		if (tipo == "N")
		{
			preecheInput('cod_agencia','agencia','AGENCIA','CODIGO','NOME');				
		}
		else
		{
			if( tipo == "D" )
			{
				return true
				//obj_input.onkeypress = function(){ verTecla(obj_input,'event','busca.asp|AGENCIA|CODIGO|NOME|380|62','agencia','cod_agencia|agencia','cod_conta|conta','result_02');}		
			}	
			else
			{	
				janelaBusca('busca.asp?tabelaBusca=AGENCIA&campoCodigo=CODIGO&campo=NOME&titulo_campo=Agência','agencia','cod_agencia|agencia','cod_conta|conta','550','500')
				
			}
		}
	}

}
function verAgencia(tipo)
{
	// D - quando chama a funcao para autopreenchimento
	// N - quando a busca é por numero
	
	if( document.getElementById("cod_agencia").value == "")
	{
		obj_input = document.getElementById("conta");
		if (tipo == "N")
		{
			obj_input.value = "";
			obj_input.value = "Selecione uma agência"	
			document.getElementById("cod_conta").value = ""			
		}
		else
		{
			if (tipo == "D")
			{			
				obj_input.value = "";
				obj_input.value = "Selecione uma agência"
				obj_input.onkeypress = function(){ verAgencia('D') ;}			
			}
			else
			{
				obj_input.value = "Selecione uma agência"
			}
		}
	}
	else
	{
		document.getElementById("extra").value = "AGE_CODIGO|cod_agencia"
				
		if (tipo == "N")
		{
			preecheInput('cod_conta','conta','CONTA','CON_NUMERO','DESCRICAO')		
		}
		else
		{
			if( tipo == "D")
			{
				return true;				
			}	
			else
			{	
				janelaBusca('busca.asp?tabelaBusca=CONTA&campoCodigo=CON_NUMERO&campo=DESCRICAO&titulo_campo=Conta','conta','cod_conta|conta','','550','500')
			}
		}
	}
	

}

function trocaPessoa(campo1, campo2, parametrosL, parametrosD){
	var parL, parD;
	if(document.getElementByID(campo1).checked = true){
		parL = parametrosL.split("|")
	}
}

function pessoaFisica(){
	if(document.getElementById("pf").checked = true){
		document.getElementById("cxNomeFantasia").style.display = "none";
		document.getElementById("nomeFantasia").disabled = true;
		document.getElementById("nomeFantasia").className = "";
		document.getElementById("cxRazao").style.display = "none";
		document.getElementById("razao").disabled = true;
		document.getElementById("razao").className = "";
		document.getElementById("cxCNPJ").style.display = "none";
		document.getElementById("cxIE").style.display = "none";
		
		document.getElementById("cxCPF").style.display = "";
		document.getElementById("cpf").disabled = false;
		document.getElementById("cxNome").style.display = "";
		document.getElementById("nome").disabled = false;
		document.getElementById("nome").className = "obrigatorio";
	}
}

function pessoaJuridica(){
	if(document.getElementById("pj").checked = true){
		document.getElementById("cxNomeFantasia").style.display = "";
		document.getElementById("nomeFantasia").disabled = false;
		document.getElementById("nomeFantasia").className = "obrigatorio";
		document.getElementById("cxRazao").style.display = "";
		document.getElementById("razao").disabled = false;
		document.getElementById("razao").className = "obrigatorio";
		document.getElementById("cxCNPJ").style.display = "";
		document.getElementById("cxIE").style.display = "";
		
		document.getElementById("cxCPF").style.display = "none";
		document.getElementById("cpf").disabled = true;
		document.getElementById("cxNome").style.display = "none";
		document.getElementById("nome").disabled = true;
		document.getElementById("nome").className = "";
	}
}
//fim
var idDepoimentoAnterior = "#faq_0"
function mostraFaq(num)
{
	var id =  "#faq_"+num
	if ($(id).is(":hidden"))
	{
        /*$(id).slideDown(1000,function(){
       		if(id != idDepoimentoAnterior)
			{
				$(idDepoimentoAnterior).slideUp();
			}	
     	 });*/
		$(id).slideDown()
		/*idDepoimentoAnterior = id
		/*$(idDepoimentoAnterior).slideUp(1000,function(){
       		//if(id != idDepoimentoAnterior)
			//{
				//$(idDepoimentoAnterior).slideUp(1000);
				$(id).slideDown(1000)
			//}	
			
			idDepoimentoAnterior = id
        });*/
		

    }
	else
	{
		$(id).slideUp();	
	}
}
function iniciarQuiz()
{
	obj = $(".lista_Pergunta input:radio")	
	for(i=0;i<obj.length;i++)
	{
		obj[i].checked = false		
	}
}
function finalizarQuiz()
{
	
	obj = $(".lista_Pergunta")
	var respCorreta = ""
	var id = ""
	var idElement = ""
	var erro = true
	for(i=0;i<obj.length;i++)
	{
		if(! $("#"+obj[i].id + " input:radio:checked").val()  )		
		{
			objFocus = $("resposta_"+i)
			alert("Pergunta " + (parseInt(i)+1) + " não foi respondida")			
			erro= false			
			break;
		}
	}
	//obj = $(".lista_Pergunta")
	var top = 0
	var contCorretas = 0
	return erro
	/*if(erro == false)
	{
		$(".lista_Pergunta").css("position","relative")
		for(i=0;i<obj.length;i++)
		{
			top = ( $("#" + obj[i].id).height() - 30) / 2
			$("#" + obj[i].id + " label").css("color","#ffffff")
			if( $("#correta_"+i).val() == $("#"+obj[i].id + " input:radio:checked").val() )
			{
				if(($("#" + obj[i].id + " img").length) ==0)
				{
					$("#"+obj[i].id).append("<img src='imagens/icon_ok.gif' alt='Resposta Correta' style='position:absolute;top:" + top + "px;left:610px;'>")
				}
				else
				{
					$("#" + obj[i].id + " img").attr("src","imagens/icon_ok.gif")
				}
				contCorretas = parseInt(contCorretas) + 1
				var wcorreta = i
				
			}
			else
			{
				/*if(($("#" + obj[i].id + " img").length) ==0)
				{
					$("#"+obj[i].id).append("<img src='imagens/icon_errada.gif' alt='Resposta Incorreta' style='position:absolute;top:" + top + "px;left:610px;'>")	
				}
				else
				{
					$("#" + obj[i].id + " img").attr("src","imagens/icon_errada.gif")	
					
				}
				
				var wcorreta = i
					
				
			}
			$("#span_"+wcorreta).remove()
			$("#lbl_"+ wcorreta + "_" + $("#correta_"+wcorreta).val() ).append("<span id='span_" + wcorreta + "'><strong>Justificativa: </strong>" + $("#exp_"+wcorreta).html() +  "</span>")
			$("#lbl_"+ wcorreta + "_" + $("#correta_"+wcorreta).val() ).css("color","#ff7e00")
			
		}
		var contPergunta= obj.length
		var porc = ( (parseInt(contCorretas) * 100) / parseInt(contPergunta) )
		/*if( parseFloat(porc) < 25 ) 
		{
			$("#total").html("Péssimo, você acertou " + contCorretas + " pergunta(s) de " + contPergunta)
		}
		else
		{
			if( parseFloat(porc) < 50 )
			{
				$("#total").html("Ruim, você acertou "+ contCorretas + " pergunta(s) de " + contPergunta)
			}
			else
			{
				if( parseFloat(porc) < 75 )
				{
					$("#total").html("Ótimo, você acertou "+ contCorretas + " pergunta(s) de " + contPergunta)
				}
				else
				{
					$("#total").html("Excelente, você acertou "+ contCorretas + " pergunta(s) de " + contPergunta)
				}
			}
		} 
		$("#total").css("display","block")
		location.href= "#total"
		
	}*/
	
}

function ocultaEvento(wcontrole)
{
	idImg = "#img_" + wcontrole;
	idDiv = "#m_" + wcontrole;
	if ($(idDiv).is(":hidden")) 
	{
        $(idDiv).slideDown("slow");
		$(idImg).attr("src","imagens/menos.jpg")
		$(idImg).attr("title","Ocultar")
		$(idImg).attr("alt","Ocultar")
    } 
	else 
	{
        $(idDiv).slideUp();
		$(idImg).attr("src","imagens/mais.jpg")
		$(idImg).attr("title","Mostrar")
		$(idImg).attr("alt","Mostrar")
    }

}
function janelaExterna(url)
{
	winDt = window.open(url,'','width='+ window.width +',height='+ window.height +',scrollbars=1,status=1,toolbar=1,location=1,menubar=1,directories=1,resizable=1');
	winDt.focus();
}

