// JavaScript Document ********************************************
function objetoAjax(){
	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;
}
//*****************************************************************
		
//Detalles dependientes del combo *********************************
function muestraCatalogo(dir){
	divResultado = document.getElementById('catalogo');
	ajax=objetoAjax();	
	ajax.open("POST", "galeria.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("dir=" + dir)
}
//*****************************************************************
function colorIn(elemento){
			//elemento.style.color = "#003366";
			elemento.style.background = "#666666";		
	}

function colorOut(elemento){
			//elemento.style.color = "#003366";
			elemento.style.background = "#999999";	
	}
function carrito(){
	
			divResultado = document.getElementById('carrito');
			ajax=objetoAjax();	
			ajax.open("POST", "shop/carrito.php",true);
			ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				divResultado.innerHTML = "Cargando detalles ..."
			}
			if (ajax.readyState==4) {
				divResultado.innerHTML = ajax.responseText
			}
			}
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			ajax.send("0")	
	}
function validaLogin(){
			divResultado = document.getElementById('resultado');
			usuario = document.getElementById('usuario').value;
			pass = document.getElementById('pass').value;
			ajax=objetoAjax();	
			ajax.open("POST", "log.php",true);
			ajax.onreadystatechange=function() {
			if (ajax.readyState==1) {
				divResultado.innerHTML = "Cargando detalles ..."
			}
			if (ajax.readyState==4) {
				divResultado.innerHTML = ajax.responseText
				
					if(ajax.responseText == "Accesando ..."){
								location.reload();
						}
				
			}
			}
			ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
			ajax.send("usuario="+usuario+"&pass="+pass+"&mov=1")	
	
	}
function logout(){
	
		if(confirm("Desea cerrar la sesion ?")){
				window.location = "log.php?out";
			}else{
					return false;
				}	
	
	}
