
//---------------------------------------------------|
//---------------------------------------------------|
// ©2008 NEORION INTERNET LTDA. - www.neorion.com.br |
//---------------------------------------------------|
//---------------------------------------------------|

function FlashPlayer(x,y,arquivo)
	{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+x+'" height="'+y+'">')
	document.write('<param name="movie" value="'+arquivo+'">')
	document.write('<param name="quality" value="high">')
	document.write('<param name="menu" value="false">')	
	document.write('<param name="scale" value="noscale" />')
	document.write('<param name="allowScriptAccess" value="sameDomain" />')
	document.write('<embed src="'+arquivo+'"  scale="noscale" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  width="'+x+'" height="'+y+'" name="flash" align="middle" allowScriptAccess="sameDomain"></embed>')
	document.write('</object>')
	}


function Form(form1){

document.getElementById("BotSubmit").innerHTML = "<strong>PROCESSANDO...</strong>";

}

function GuiaUsuario(form2){

	
	if (form2.nome.value == ""){
	alert("DIGITE O NOME");
	form2.nome.focus();
	return (false);
	}	

	if (form2.email.value == ""){
	alert("DIGITE O E-MAIL");
	form2.email.focus();
	return (false);
	}	

	if (form2.telefone.value == ""){
	alert("DIGITE O TELEFONE");
	form2.telefone.focus();
	return (false);
	}	

	if (form2.endereco.value == ""){
	alert("DIGITE O ENDEREÇO");
	form2.endereco.focus();
	return (false);
	}	


document.getElementById("BotSubmit").innerHTML = "<strong>PROCESSANDO...</strong><br />";

}


function GuiaCadastra(form1){

	if (document.form1.tipo[0].checked == false && document.form1.tipo[1].checked == false){
	alert("INFORME A CATEGORIA ( EMPRESA / LABORATÓRIO )");
	return (false);
	}
	
	if (document.form1.atividade[0].checked == false && document.form1.atividade[1].checked == false && document.form1.atividade[2].checked == false){
	alert("INFORME A ATIVIDADE ( FABRICANTE / DISTRIBUIDOR / REPRESENTANTE COMERCIAL  )");
	return (false);
	}	
	
	if (form1.contato.value == ""){
	alert("DIGITE O NOME DE CONTATO");
	form1.contato.focus();
	return (false);
	}	

	if (form1.telefone.value == ""){
	alert("DIGITE O TELEFONE");
	form1.telefone.focus();
	return (false);
	}	


document.getElementById("BotSubmit").innerHTML = "<strong>PROCESSANDO...</strong><br />";

}



/* INICIA AJAX 
*****************************/

function IniciaAjax(){
	var ajax;
	if(window.XMLHttpRequest){	  // Mozilla, Safari,...
		ajax = new XMLHttpRequest();
	} else if (window.ActiveXObject){	// IE
		ajax = new ActiveXObject("Msxml2.XMLHTTP");
		if (!ajax) {
			ajax = new ActiveXObject("Microsoft.XMLHTTP");
		}
    } 
	else {
        alert("Seu navegador não possui suporte a essa aplicação!");
	}
	return ajax;
}



/* ADICIONA CATEGORIA
*****************************/
function AdicionaCategoria()
{
	
	ajax = IniciaAjax();
	if(ajax)
	{
			var idCategoria = document.formX.id_categoria.value;  		
			
			ajax.open("POST","categorias.php?tipo=adiciona&id_categoria="+idCategoria+"",true);			
			ajax.onreadystatechange = AdicionaCategoria2;
			ajax.send(null);
	}                      
		function AdicionaCategoria2() {   
			if (ajax.readyState == 1) {
				document.getElementById("Lista").innerHTML = '<strong>CADASTRANDO...AGUARDE...</strong>';
			} 			
			if (ajax.readyState == 4) {
				document.getElementById("Lista").innerHTML = ajax.responseText;
			} 
		}	

}


/* REMOVE CATEGORIA
*****************************/
function RemoveCategoria(idCategoria)
{
	
	ajax = IniciaAjax();
	if(ajax)
	{
			ajax.open("POST","categorias.php?tipo=remove&id_categoria="+idCategoria+"",true);			
			ajax.onreadystatechange = AdicionaCategoria2;
			ajax.send(null);
	}                      
		function AdicionaCategoria2() {   
			if (ajax.readyState == 1) {
				document.getElementById("Lista").innerHTML = '<strong>REMOVENDO...AGUARDE...</strong>';
			} 			
			if (ajax.readyState == 4) {
				document.getElementById("Lista").innerHTML = ajax.responseText;
			} 
		}	

}




/* ABRE EMPRESAS
*****************************/
function GuiaEmpresas(id)
{

	if(document.getElementById(id).style.display == 'inline') {
		document.getElementById(id).style.display = 'none';
	} else {
		document.getElementById(id).style.display = 'inline';
	}	




	ajax = IniciaAjax();
	if(ajax)
	{
			ajax.open("POST","guia_empresas.php?id="+id+"",true);
			ajax.onreadystatechange = GuiaEmpresas2;
			ajax.send(null);
	}                      
		function GuiaEmpresas2() {   
			if (ajax.readyState == 1) {
			document.getElementById(id).innerHTML = "<h2>PROCESSANDO...</h2>";
			}		
			if (ajax.readyState == 4) {
			document.getElementById(id).innerHTML = ajax.responseText; 	
									
			} 
		}

}


/* DETALHES
*****************************/
function GuiaDetalhes(id,div,destaque)
{
	if(document.getElementById(div).style.display == 'inline') {
		document.getElementById(div).style.display = 'none';
	} else {
		document.getElementById(div).style.display = 'inline';
	}	

	if(destaque == 1){
		document.getElementById('lightbox').style.display='block';				
	}	
	
	ajax = IniciaAjax();
	if(ajax)
	{
			ajax.open("POST","guia_detalhes.php?id="+id+"&div="+div,true);
			ajax.onreadystatechange = GuiaDetalhes2;
			ajax.send(null);
	}                      
		function GuiaDetalhes2() {   
			if (ajax.readyState == 1) {
			document.getElementById(div).innerHTML = "<h2>PROCESSANDO...</h2>";
			}		
			if (ajax.readyState == 4) {
			document.getElementById(div).innerHTML = ajax.responseText; 			
				if(destaque == 1){
					document.getElementById('light').style.display='block';			
				}						
			} 
		}
	

}

function GuiaDetalhesFecha(div)
{
document.getElementById(div).style.display='none';
document.getElementById('lightbox').style.display='none';
}

