/*********************************************************************************************/

/* Este script ha sido desarrollado exclusivamente para ExpoBellaSalud 2008. Queda terminantemente 

/* prohibida la copia y uso sin autorizacion escrita del autor: www.clubpaginasweb.com		 */

/*********************************************************************************************/

function objhttp(){

	try {

		objetus = new ActiveXObject("Msxml2.XMLHTTP");

	} catch (e) {

		try {

			objetus = new ActiveXObject("Microsoft.XMLHTTP");

		} catch (E) {

			objetus = false;

		}

	}

	if(!objetus && typeof XMLHttpRequest!='undefined'){

		objetus = new XMLHttpRequest();

	}

	return objetus;

}



function confirmarBorrado(id, expositor){

	var respuesta = confirm("Esta seguro que desea borrar el expositor " + expositor + "?");

	if(respuesta){

		location.href='eliminar.php?idexp=' + id;

	} else {

		return false;

	}

}

function confirmarBorradoUsr(id, usuario){

	var respuesta = confirm("Esta seguro que desea borrar el usuario " + usuario + "?");

	if(respuesta){

		location.href='eliminar.php?idusr=' + id;

	} else {

		return false;

	}

}

function confirmarBorradoPatrocinador(id, patrocinador){

	var respuesta = confirm("Esta seguro que desea borrar el patrocinador " + patrocinador + "?");

	if(respuesta){

		location.href='eliminar.php?idpatr=' + id;

	} else {

		return false;

	}

}



function confirmarBorradoTar(id){

	var respuesta = confirm("Esta seguro que desea borrar la tarifa?");

	if(respuesta){

		location.href='eliminar.php?idtar=' + id;

	} else {

		return false;

	}

}



function confirmarBorradoRubro(id, rubro){

  //alert("hola");

	_elObjeto = objhttp();

        _URL = "actor.php?";

	_URL += "idrubro=" + id;

	_elObjeto.open("GET",_URL,true);

	_elObjeto.onreadystatechange=function(){

		if(_elObjeto.readyState==1){

			//elDiv.innerHTML="Procesando datos... favor espere";

			elDiv.innerHTML="<img src=\"../imgs/esperar.gif\" width=\"120px\" height=\"120px\" alt=\"Favor espere\" />";

		} else if(_elObjeto.readyState==4) {

			var response = _elObjeto.responseText;

			//document.getElementById("divEliminar").innerHTML = response;

                        //alert(response);

                        if(response > 0){

                          alert("Todavia existen expositores para esta categoria.");

                        } else {

                          var respuesta = confirm("Esta seguro que desea borrar la categoria " + rubro + "?");

                          if(respuesta){

                                  location.href='eliminar.php?idrubro=' + id;

                          } else {

                                  return false;

                          }

                        }

		}

	}

	_elObjeto.send(null);

}



function buscador(){

		_objcroquishttp = objhttp();

		_URL = "actor_buscador.php?";

		_URL += "nombre=" + document.frmBuscador.nombre.value;

		_objcroquishttp.open("GET",_URL,true);

		_objcroquishttp.onreadystatechange=function(){

			if(_objcroquishttp.readyState==1) {

				document.getElementById("resultados").innerHTML = "Cargando...";

			}

			if(_objcroquishttp.readyState==4) {

				var response = _objcroquishttp.responseText;

				document.getElementById("resultados").innerHTML = response;

			}

		}

		_objcroquishttp.send(null);

}