// JavaScript Document
function botonDosEstados(idBtn,path1,path2)
{
	boton = $("#"+idBtn);
	boton.bind('mousedown',function(e){
		$(this).attr("src",path2);
	});
	boton.bind('mouseout',function(e){
		$(this).attr("src",path1);
	});
	boton.bind('mouseup',function(e){
		$(this).attr("src",path1);
	});
	
}

function validarFormulario(idform)
{
	campos = $("#"+idform+" :input");
	for(i=0; i<campos.length; i++){
		field = $(campos[i]);
		if(field.attr("required")=="true" && field.val()==''){
			alert("El campo "+field.attr("id")+" es requerido");						
			field.focus();
			return(false);
		}	
	}
	return true;
}

function postFormAjax(idForm, contenedor)
{	
		url = $("#"+idForm).attr("action");
		$.ajax({
		type: "POST",
		url: "contenidos/contacto.php",
		data: $("#"+idForm).serialize(),
		success: function(data){
		$(contenedor).html(data);
		},
		error: function(objeto, quepaso, otroobj){
		alert("ERROR: "+quepaso);
		}
	});
}
