function ir(url){
  location.href = url;
}

function ventana(url){
        window.open(url,'window','scrollbars=1,width=650,height=350');
}	

function ventana2(url,ancho,alto){
        window.open(url,'window','scrollbars=1,width='+ancho+',height='+alto);
}

function enviar(){
	if(validar())	document.forma.submit();
}
function enviar2(){
	if(validar2())	document.forma2.submit();
}
function cargarContenido(){
	var d1,contenedor;
	contenedor = document.getElementById('contenedor');
	d1 = document.u.edo.options[document.u.edo.selectedIndex].value;
	ajax=nuevoAjax();
	ajax.open("GET", "buscar_ciudad.php?edo="+d1,true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		contenedor.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function buscar_cedula(){
	var d1,contenedor;
	ced = document.getElementById('ced');
	d1 = document.u.cedula.value;
	ajax=nuevoAjax();
	ajax.open("GET", "buscar_cedula.php?cedula="+d1,true);
	ajax.onreadystatechange=function() {
	if (ajax.readyState==4) {
		ced.innerHTML = ajax.responseText
		}
	}
	ajax.send(null)
}

function buscar_empleado(){
	var d1,contenedor;
	resultados = document.getElementById('resultados');
	d1 = document.u.cedula.value;
	d2 = document.u.nombres.value;
	d3 = document.u.nacionalidad.options[document.u.nacionalidad.selectedIndex].value;
	if(d1.length>0 || d2.length>0){
		ajax=nuevoAjax();
		ajax.open("GET", "buscar_empleado.php?cedula="+d1+"&nombre="+d2+"&nac="+d3,true);
		ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			resultados.innerHTML = ajax.responseText
			}
		}
		ajax.send(null)
	}
}
