var Timer;

function movescroll(DivID,Mve){
	var i = 1;
	var e = $(DivID);
	for(var x=1; x<100; x++){
		Timer = setInterval("", 5 * x);//apenas um delay
		e.scrollLeft = e.scrollLeft + Mve;
	}
}

function ScrollLeft(obj) {
	Timer = setInterval("document.getElementById('" + obj + "').scrollLeft -= 2", 10);
}

function ScrollRight(obj) {
	Timer = setInterval("document.getElementById('" + obj + "').scrollLeft += 2", 10);
}

function limpar_div(DivID){
	$(DivID).innerHTML='';
}

function showSubmenu(ID){
   $(ID).style.visibility="visible";
}

function hideSubmenu(ID){
   $(ID).style.visibility="hidden";
}

function loadSubmnu(Obj,Opt){		
	var IdName = "idMnu"+Obj;//.name;
	var IdImg = "Mnu"+Obj;
	
	swapimg(IdImg,Opt);
	
	if($(IdName)){
		if(Opt){
			$(IdName).style.display="block";
		}else{
			$(IdName).style.display="none";
		}
	}//fim do if
	
}//fim do function

function swapimg(ObjSel,opt){
    if(opt){
    	$(ObjSel).style.backgroundImage = "url(images/mnufd_on.png)";
    	$(ObjSel).style.backgroundRepeat="repeat-x"; 
    }else{
    	$(ObjSel).style.backgroundImage = "none";
    	$(ObjSel).style.backgroundRepeat="no-repeat"; 
    }
}

/* ****  Imprime o conteudo de uma DIV   ******* */
function imprimir(DivID){
	var a = window.open();
	a.document.open("text/html");
	a.document.write('<html><head><link rel="stylesheet" href="css/estilos_index.css" /></head><body>');
	a.document.write($(DivID).innerHTML);
	a.document.write('</body></html>');
	a.document.close();
	a.print();
}

function enviamail(){
	if(!$('f_nome').value){
		alert("Preencha o campo NOME.");
		return false;
	}
	if(!checkMail($('f_email').value)){
		alert("Preencha o campo Email e/ou não é um email válido.");
		return false;
	}
	if(!$('f_mensagem').value){
		alert("Não há uma mensagem para ser enviada.");
		return false;
	}
	if(!$('f_imgverif').value){
		alert("Informe os caracteres da imagem.");
		return false;
	}
	submit('conteudo','includes/fale_conosco/envia.php',document.frm);
}

function swapImageBt(ID,swapimg){
	$(ID).style.backgroundImage="url("+swapimg+")";
}

function algumaSelecao(){
	var cod = $('corede').value; 
	var mun = $('municipio').value; 
	var tipo = $('tipo').value; 
	
	if(cod!="00" || mun!="000000" || tipo!="00"){
 		window.open("https://www1.badesul.com.br/crf/Consulta_Rede.asp?parm="+cod+""+mun+""+tipo+"00","_blank");
 	}else{ 
 		alert("Favor selecionar itens para a pesquisa.");
	}
}

function pagLogin(){
	window.open("https://www1.badesul.com.br/caa/CAA_3.asp","_blank");
}

function redirMapa(cod){
 	window.open("https://www1.badesul.com.br/crf/Consulta_Rede.asp?parm=0000000000"+cod,"_blank");
}

