var $j = jQuery.noConflict();
function Cargar(url,contenedor){
	$j("#"+ contenedor).load(url);
}




function validarf(){
	var name = document.getElementById('name').value;
	var lastname = document.getElementById('lastname').value;
	var email1 = document.getElementById('email1').value;
	var comments = document.getElementById('comments').value;
	
	var formName = document.getElementById('formName');
	
	if(name==""){ alert("Escriba un nombre"); return false; }
	if(lastname==""){ alert("Escriba un apellidos"); return false; }
	if(email1==""){ alert("Escriba un email"); return false; }
	if(comments==""){ alert("Escriba un comentario"); return false; }
	else{ formName.submit(); }
}


function validarcomentario(){
		var name = document.getElementById('name').value;
		var lastname = document.getElementById('lastname').value;
		var email1 = document.getElementById('email1').value;
		var comments = document.getElementById('comments').value;
		
		if(name==""){ Cargar('comments_error.php','comment-c'); }
		if(lastname==""){ Cargar('comments_error.php','comment-c'); }
		if(email1==""){ Cargar('comments_error.php','comment-c'); }
		if(comments==""){ Cargar('comments_error.php','comment-c'); }
		
		if(name!="" && lastname!="" && email1!="" && comments!="")
		{ Cargar('comments_process.php','comment-c'); }
}

$j(document).ready(function(){
	$j(".accordion p").hide();
	
	
	
	$j(".patch-btn").click(function(){
		var name = document.getElementById('name').value;
		var lastname = document.getElementById('lastname').value;
		var email1 = document.getElementById('email1').value;
		var comments = document.getElementById('comments').value;
		
		if(name==""){ Cargar('comments_error.php','comment-c'); }
		if(lastname==""){ Cargar('comments_error.php','comment-c'); }
		if(email1==""){ Cargar('comments_error.php','comment-c'); }
		if(comments==""){ Cargar('comments_error.php','comment-c'); }
		
		if(name!="" && lastname!="" && email1!="" && comments!="")
		{ Cargar('comments_process.php','comment-c'); }
	});
	
	$j("#d-ac").click(function(){
		$j(".accordion p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$j(".accordion p").toggleClass("active");
	});
	
	$j("#top-menu .top-menu-a .txt-11-2").click(function(){
		var valor = $j("#textfield").val();
		location.href="resultados.php?criterio=" + valor;
	});
	
});
