function Menu(tipo){
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "galeria.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo)
	}
	
function Usuario(tipo,id){
	var cadena = "";
	
	if (tipo == 4){
		cadena = "&id=" + id
		}
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "usuarios.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo+cadena)
	}

function Cliente(tipo,id){
	var cadena = "";
	
	if (tipo == 4){
		cadena = "&id=" + id
		}
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "clientes.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo+cadena)
	}
	
function Valla(tipo,id){
	var cadena = "";
	
	if (tipo == 4){
		cadena = "&id=" + id
		}
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "vallas.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo+cadena)
	}

function Reserva(tipo,id){
	var cadena = "";
	
	if (tipo == 4){
		cadena = "&id=" + id
		}
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "reserva.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo+cadena)
	}


function Accion(tipo,id){
	var cadena = "";
	
	if (tipo == 'nuevousuario'){
		t1 = document.getElementById('nomb').value;
		t2 = document.getElementById('pass').value;
		cadena = "&nomb=" + t1 + "&pass=" + t2
		}
	if (tipo == 'eliminarusuario'){
		cadena = "&id=" + id
		}
	if (tipo == 'editarusuario'){
		t1 = document.getElementById('nomb').value;
		t2 = document.getElementById('pass').value;
		cadena = "&nomb=" + t1 + "&pass=" + t2 + "&id=" + id
		}
		
	if (tipo == 'nuevocliente'){
		t1 = document.getElementById('nit').value;
		t2 = document.getElementById('emp').value;
		t3 = document.getElementById('con').value;
		t4 = document.getElementById('dir').value;
		t5 = document.getElementById('tel').value;
		t6 = document.getElementById('mail').value;
		cadena = "&nit=" + t1 + "&emp=" + t2 + "&con=" + t3 + "&dir=" + t4 + "&tel=" + t5 + "&mail=" + t6
		}
	if (tipo == 'eliminarcliente'){
		cadena = "&id=" + id
		}
		
	if (tipo == 'editarcliente'){
		t1 = document.getElementById('nit').value;
		t2 = document.getElementById('emp').value;
		t3 = document.getElementById('con').value;
		t4 = document.getElementById('dir').value;
		t5 = document.getElementById('tel').value;
		t6 = document.getElementById('mail').value;
		cadena = "&nit=" + t1 + "&emp=" + t2 + "&con=" + t3 + "&dir=" + t4 + "&tel=" + t5 + "&mail=" + t6 + "&id=" + id	
		}
		
	if (tipo == 'eliminarvalla'){
		cadena = "&id=" + id
		}
	if (tipo == 'editarvalla'){
		t1 = document.getElementById('tipo').value;
		t2 = document.getElementById('dir').value;
		t3 = document.getElementById('val').value;
		t4 = document.getElementById('obs').value;
		foto = document.getElementById('foto').value;
		cadena = "&nit=" + t1 + "&emp=" + t2 + "&con=" + t3 + "&dir=" + t4 + "&foto=" + t5 + "&mail=" + t6 + "&id=" + id	
		}
	if (tipo == 'nuevareserva'){
		t1 = document.getElementById('cliente').value;
		t2 = document.getElementById('valla').value;
		t3 = document.getElementById('fechain').value;
		t4 = document.getElementById('fechaout').value;

		cadena = "&cliente=" + t1 + "&valla=" + t2 + "&fechain=" + t3 + "&fechaout=" + t4
		}
	if (tipo == 'eliminarreserva'){
		cadena = "&id=" + id
		}
		
	
	Contenedor = document.getElementById('Contenido');
	ajax=nuevoAjax();
	ajax.open("POST", "accion.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			Contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("tipo="+tipo+cadena)
	}

function NuevaValla(){
	document.forms['form1'].submit();
	
}

function EditarValla(){
	document.forms['form2'].submit();
}

function wait(msecs)
{
var start = new Date().getTime();
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime();
}
} 

function nuevoAjax(){
	var xmlhttp=false;
 	try {
 		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 	} catch (e) {
 		try {
 			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 		} catch (E) {
 			xmlhttp = false;
 		}
  	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

function cargarContenido(){
	var t1, t2, contenedor,contenedor2;
	contenedor = document.getElementById('contenedor');
	contenedor2 = document.getElementById('login');
	t1 = document.getElementById('user').value;
	t2 = document.getElementById('pass').value;
	ajax=nuevoAjax();
	ajax2=nuevoAjax();
	ajax.open("POST", "main.php",true);
	ajax2.open("POST", "login.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax2.onreadystatechange=function() {
		if (ajax2.readyState==4) {
			contenedor2.innerHTML = ajax2.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("user="+t1+"&pass="+t2)
	ajax2.send(null)
}
function cargarContenido1(){
	var t1, t2, contenedor;
	contenedor = document.getElementById('contenedor');
	t1 = document.getElementById('user').value;
	t2 = document.getElementById('pass').value;
	ajax=nuevoAjax();
	ajax.open("POST", "main.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText
	 	}
	}
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send("user="+t1+"&pass="+t2)
}

function oculta(str){
 document.getElementById(str).style.display  = "none";
}
function muestra(str){
 document.getElementById(str).style.display = "block";
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}