// JavaScript Document
function preencheCidade(vc_estado,vc_cidade_selec,actB) {
	
	var tempIFrame					= document.createElement('iframe');
	tempIFrame.setAttribute('id','iframe_refresh');
	tempIFrame.setAttribute('name','iframe_refresh');

	tempIFrame.style.border			='0px';
	tempIFrame.style.width			='0px';
	tempIFrame.style.height			='0px';

	tempIFrame.setAttribute('src','codigos/cidade.asp?vc_estado='+vc_estado+'&vc_cidade='+vc_cidade_selec+'&actB='+actB);
	IFrameObj						= document.body.appendChild(tempIFrame);
	
	//Limpa as informações no combo página
	var selec						= eval('document.getElementById("vc_cidade")');

	for (var x = selec.length; x >= 0; x--) 
	{
		selec.options[x]	= null;
	}	

	selec.options[0] = new Option('Carregando...', '');
	
}

function preenchePagina(vc1,vc_cidade_selec) {

	var array_cidade			= vc1.split("|");
//	var array_nome 				= nome.split("|");
	var selec					= eval('document.getElementById("vc_cidade")');

	
	if (vc1.length != 0) 
	{
		/*#LIMPAR CAIXA#*/
	
		for (var x = selec.length; x >= 0; x--) 
		{
			selec.options[x]	    = null;
		}	
		
		/*#INSERE NOVOS#*/
		var n = 1;
		selec.options[0] 		= new Option('Selecione a opção', '');


		// Carrega combo pagina
		for (var t = 0; t < (array_cidade.length)-1 ; t++) 
		{
			selec.options[n] 	     = new Option(array_cidade[t], array_cidade[t]);
			//Verifica qual das cidades que retornar ficará selecionada
			if (vc_cidade_selec.toLowerCase() == array_cidade[t].toLowerCase()) {
					selec.options[n].selected = true;
			}
			n++;
		}
				
	}	
	else	
	{
		selec.options[0] 	    = new Option('Selecione a opção', '');	
	}

}

function pesquisa(vc_estado, vc_cidade, actB) {
	parent.location.href = "default.asp?actA=23&estadoVC="+vc_estado+"&cidadeVC="+vc_cidade+"&actB="+actB;
}


function atendimento(id_filial,bt){
	var current 	= document.getElementById(id_filial);
	var current1 	= document.getElementById(bt);
	if(current.style.display == 'none'){
		current.style.display 		= 'block';
		current1.src				= "imagens/bt_17.gif"
	}
	else{
		current.style.display 		= 'none';
		current1.src				= "imagens/bt_16.gif"
	}
}

