/*****************************************
 Favoritos
 *****************************************/
function citas(exp)
{
app = "_agenda.php?flag_citas="+trim(exp); 
document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}
function buscar_favorito(exp)
{
app = "_favoritos.php?id_favorito="+trim(exp); 
document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}
function load_editar(exp)
{
	
	app = "_perfil_contacto.php"; 
	document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}
function load_rapido(exp)
{
	
	app = trim(exp)+".php"; 
	document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}
function load_rapidoagenda(exp)
{
	
	app = trim(exp); 
	document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}
function load_editar_empre(exp)
{
app = "_empresa.php"; 
document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}

function tiposervicio()
{
	
	var cboservicio		=  document.getElementById("tipo_servicio"); 
	var tipo_servicio	=	cboservicio.value;
	
	app = "_servicios.php?tipo="+tipo_servicio;
	document.getElementById("ajaxcontentarea").innerHTML = "<img src='../../img/front_esp/loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
    
}



/*****************************************
 registrar mi empresa
 *****************************************/
function winREGISTRAR()
{
	winREGISTRAR = window.open("guia/mi-empresa.html","winREGISTRAR","WIDTH=550,HEIGHT=650,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	winREGISTRAR.moveTo(0,0);
}

/*****************************************
 abrir ventana
 *****************************************/
function openWINDOW()
{
	winRESULT = window.open("","winRESULT","WIDTH=450,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	winRESULT.moveTo(100,100);
	return true;
}


/*******************************************
Envia el mail
********************************************/
function sendMAIL()
{
		if (document.mail.subject.value=='' || document.mail.bodyMAIL.value=='') {
			alert ("Debe indicar el tema y el mensaje a enviar");
			return;
		}

		document.mail.submit();
}

/*******************************************
Evalua la tecla presionada
********************************************/
function evaluaTECLA(e)
{
    if(event.keyCode==13) runSEARCH();
}

/*****************************************
 otra busqueda
 *****************************************/
function otraBUSQUEDA(tipo)
{

	if (tipo=="") expandtab("maintab",0);
	if (tipo=="diccionario") expandtab("maintab",1);
	if (tipo=="arbol") expandtab("maintab",2);
	if (tipo=="proceso") expandtab("maintab",3);
	
}

/*****************************************
 elimina espacios en blanco
 *****************************************/
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

/*****************************************
 valida estado del formulario
 *****************************************/
function checkEXPRESION()
{

    exp = trim(top.document.guiaSEARCH.buscar.value);
	long= (top.document.guiaSEARCH.buscar.value.length);
	//expla = len(top.document.guiaSEARCH.buscar.value);
    if (exp=="" || long == 1 || long == 2 )
	{
        alert("Debe ingresar minimo de caracteres en la Búsqueda");
        return false;
    }

    return true;
}


/*****************************************
 busqueda rapida
 *****************************************/
function fastSEARCH(exp)
{

    app = "guia/app/searchee94.html?exp=" + trim(exp)+"&tipo=fast";
    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";

    ajaxRUN(app,'ajaxcontentarea');
}

/*****************************************
 busqueda rapida
 *****************************************/


/*****************************************
 busqueda por procesos
 *****************************************/
function searchPROCESO(exp)
{
    app = "guia/app/search738b.html?tipo=proceso&amp;back=arbol&amp;exp=" + trim(exp);

/*
    document.getElementById("resultPROCESOS").style.visibility="visible";
    document.getElementById("resultPROCESOS").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,'resultPROCESOS');
*/

    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,"ajaxcontentarea");


}

/*****************************************
 inicia la busuqeda alfabetica
 *****************************************/
function runSEARCH_ALFA(letra)
{
    app = "guia/app/search8489.html?tipo=diccionario&amp;exp="+letra;
    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,'ajaxcontentarea');
    return;
}


/*****************************************
 inicia la busuqeda
 *****************************************/
function runSEARCH()
{
    if (checkEXPRESION()){
    	filtro = (top.document.guiaSEARCH.filtro[0].checked=="1" ? top.document.guiaSEARCH.filtro[0].value : top.document.guiaSEARCH.filtro[1].value );
        app = "guia/app/search40e1.html?filtro="+filtro+"&exp=" + trim(top.document.guiaSEARCH.buscar.value);

    	  document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
        ajaxRUN(app,'ajaxcontentarea');
    }
    return false;
}

/*****************************************
 refresca la busqueda
 *****************************************/
function refreshSEARCH(exp,tipo)
{
    app = "guia/app/searchedc8.html?tipo="+tipo+"&exp=" + exp;
    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,'ajaxcontentarea');
    return;
}

/*****************************************
 detalles de la empresa
 *****************************************/
function showDETALLE(empresa,exp,tipo)
{
    document.empresa.codigo.value = empresa;    
    app = "guia/app/show-detalleedc8.html?tipo="+tipo+"&empresa=" + empresa  + "&exp=" + exp;
    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,'ajaxcontentarea');

}

/*****************************************
 show empresas similares
 *****************************************/
function showSIMILAR(empresa)
{
    app = "guia/app/search73a9.html?tipo=similares&amp;exp=" + empresa;
    document.getElementById("ajaxcontentarea").innerHTML = "<img src='loading.gif' /> Recuperando información. Espere un momento...";
    ajaxRUN(app,'ajaxcontentarea');
}


/*****************************************
 Enviar consulta por mail
 *****************************************/
function enviarMAIL(to)
{
	app = "guia/app/mail9e15.html?to=" + to;
	mail = window.open(app,"mail","WIDTH=450,HEIGHT=245,menubar=no,resizable=no,scrollbars=no,status=yes,location=no,toolbar=no");
	mail.moveTo(100,100);
}

/*****************************************
 opc.CLIENTES
 *****************************************/
function showCLIENTES()
{
	emp = document.empresa.codigo.value;
	nom = document.empresa.empresa.value;
	app = "guia/app/show-clientes4da7.html?empresa=" + emp+"&nombreEMPRESA="+nom;
	det = window.open(app,"det","WIDTH=550,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	det.moveTo(100,100);
}

/*****************************************
 opc.CATALOGO
 *****************************************/
function showCATALOGO()
{
	emp = document.empresa.codigo.value;
	nom = document.empresa.empresa.value;
	app = "guia/app/show-catalogo4da7.html?empresa=" + emp+"&nombreEMPRESA="+nom;
	det = window.open(app,"det","WIDTH=450,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	det.moveTo(100,100);
}


/*****************************************
 opc.CERTIFICACIONES
 *****************************************/
function showCERTIFICACIONES()
{
	emp = document.empresa.codigo.value;
	nom = document.empresa.empresa.value;
	app = "guia/app/show-certificado4da7.html?empresa=" + emp+"&nombreEMPRESA="+nom;
	det = window.open(app,"det","WIDTH=450,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	det.moveTo(100,100);
}


/*****************************************
 opc.UBICACIONES
 *****************************************/
function showUBICACION()
{
	emp = document.empresa.codigo.value;
	nom = document.empresa.empresa.value;
	app = "guia/app/show-ubicacion4da7.html?empresa=" + emp+"&nombreEMPRESA="+nom;
	ubi = window.open(app,"ubi","WIDTH=650,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	ubi.moveTo(100,100);
}


/*****************************************
 genera arbol de temas
 *****************************************/
function getTEMAS()
{
    app = "guia/app/arbol-temas.html";
//	ajaxRUN(app,'ajaxcontentarea');
    ajaxRUN(app,'listaTEMAS');

}

/*****************************************
 opc.CLIENTES
 *****************************************/
function showCLIENTES_LOCAL(emp,nom)
{
	app = "guia/app/show-clientes4da7.html?empresa=" + emp+"&nombreEMPRESA="+nom;
	det = window.open(app,"det","WIDTH=450,HEIGHT=245,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	det.moveTo(100,100);
}

/*****************************************
 asigna puntaje a la empresa
 *****************************************/
function asignarPUNTAJE(F)
{
	codEMP  = F.it_empresa.value;
	puntos = 0;

	for (i=0; i < 5; i++) {
		if (F.puntaje[i].checked) {
			puntos = F.puntaje[i].value;
		}
	}

	app = "guia/app/asigna-puntaje4da7.html?empresa=" + codEMP + "&puntaje=" + puntos;
	detP = window.open(app,"detP","WIDTH=0,HEIGHT=0,menubar=no,resizable=no,scrollbars=yes,status=yes,location=no,toolbar=no");
	detP.moveTo(10000,10000);

	document.getElementById(codEMP).style.visibility="hidden";

}