/*   ---   JS EN FUMADORES   ----------------------------------------------------       */

$(document).ready(function() {
						   
	//Tabs				   
	$(".tabvistoBot").click( function() { 
		$(".tabvisto").hide();
		$(".tabvalorado").show();
		return false;
	} );
	
	$(".tabvaloradoBot").click( function() { 
		$(".tabvalorado").hide();
		$(".tabvisto").show();
		return false;
	} );
	
	//-
	
	
	//Videos home				   
	$("#changetoultimos").click( function() { 
		$("#videohomevistos").hide();
		$("#videohomeultimos").show();
		return false;
	} );
	
	$("#changetovistos").click( function() { 
		$("#videohomeultimos").hide();
		$("#videohomevistos").show();
		return false;
	} );
	
	//-
	
	//load video o foto				   
	
	$("#load_archivo").click( function() { 
		$("#loader").show();
		$("#div_submit_button").hide();
		return false;
	} );
	
	$("#load_archivo_no").click( function() { 
		$("#loader").hide();
		$("#div_submit_button").show();
		return false;
	} );
	
	//-


});

// JavaScript Votaciones
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);
				}
			});
		}
	});
}

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

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