$(document).ready(function() {
	$("#com1").click( function() { 
		$("#com1").slideToggle("fast");
		$("#com2").slideToggle("fast");
		return false;
	} );
	$(".txtUs a").click( function() { 
		$(".txtP").slideUp("fast");
		texto = this.id+'txt';
		$("#"+texto).slideToggle('normal');
		return false;
	} );
	$(".a_video_tab").click( function() { 
		$(".video_tab").hide();
		$("#"+this.rel).show("slow");
		return false;
	} );
	$("#SearchString").keypress( function(e) {
		// ENTER KEY
		if(e.which == 13){
			window.location = "/buscar/"+$(this).attr("value");
			return false;
		}
	} );
	$("#frm_search_button").click( function() { 
		window.location = "/buscar/"+$("#"+this.rel).attr("value");
		return false;
	} );
});

function vote(rate,id){
	$.ajax({
		url:     "/ratings/vote/" + rate + "/" + id,
		cache:   false,
		success: function(html){
			$("#u_votes").html(html);
			$.ajax({
				url:     "/ratings/result/" + id,
				cache:   false,
				success: function(html){
					$("#g_votes").html(html);
				}
			});
		}
	});
}
