var base="http://www.runningway.com/";
function openProduct(id,titulo){
	document.location.href = base + "tienda/articulos/" + id + "-" + titulo;
}
function addToCart(id){
	
}
function checkEnterBuscar(){
	//TODO
	if(teclapulsada=ENTER){
		buscar();
	}
}
function buscar(){
	document.location.href= base + "busqueda/" + document.getElementById("busqueda").value;
	
}

function goTo(pag){
	document.location.href = base + pag;
}


function recuperarPass(){
	
}

function filtraMarcas(){
	var valor=document.getElementById("filtromarcas").value;
	if(valor==""){
		
	}else{
		document.location.href= base + valor;
	}
}

function cambiaImg(img){
	document.getElementById("imgProducto").src=img.src;
	
}

function enviaForm(){
    if(document.getElementById('nombre').value=="" || document.getElementById('email').value=="" || document.getElementById('mensaje').value==""){
        alert("Debe rellenar al menos su Nombre, Email y el Mensaje");
		return;
    }
    var conexion = llamadaAJAX();
	var params = 'Nombre='+document.getElementById('nombre').value+'&Apellidos='+document.getElementById('apellidos').value+'&Email='+document.getElementById('email').value+'&Telefono='+document.getElementById('telefono').value+'&Mensaje='+document.getElementById('mensaje').value;
    if (!conexion) {
        alert("Error: No se ha podido cargar la información.");
        return false;
    }
	
    conexion.open("POST", base + "modulos/contactomail.php", true);
	document.forms.contacto.reset();
    conexion.onreadystatechange = function(){
        if (conexion.readyState == 4) {
            alert(conexion.responseText);
        }
    }
	
	conexion.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	conexion.setRequestHeader("Content-length", params.length);
	conexion.setRequestHeader("Connection", "close");
	
	conexion.send(params);
	
}
