﻿function loadHomeTutorialsRecentlyUploaded(){
	actionLoad("../hometutorialists.php", function(data) {
		$("#homeTutorialesRecienteslist").html(data);

		$('td[id^=row_recently]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_recently_"+index).html()
			});
		});

	}, "action=recently");
}

function loadHomeTutorialsMostViewed(){
	actionLoad("../hometutorialists.php", function(data) {
		$("#homeTutorialesMasVistoslist").html(data);

		$('td[id^=row_viewed]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_viewed_"+index).html()
			});
		});

	}, "action=viewed");
}

function loadTutorialsRecentlyUploaded(){
	actionLoad("tutorialeslist.php", function(data) {
		$("#tutorialesRecienteslist").html(data);

		$('td[id^=row_recently]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_recently_"+index).html()
			});
		});

	}, "action=recently");
}

function loadTutorialsMostViewed(){
	actionLoad("tutorialeslist.php", function(data) {
		$("#tutorialesMasVistoslist").html(data);

		$('td[id^=row_viewed]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_viewed_"+index).html()
			});
		});

	}, "action=viewed");
}

function loadTutorialsPreferred(){
	actionLoad("tutorialeslist.php", function(data) {
		$("#tutorialesPreferidoslist").html(data);

		$('td[id^=row_preferred]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_preferred_"+index).html()
			});
		});
		
	}, "action=preferred");
}

function loadTutorialsFilter(keyword, tutorialcurso, orderby){
	var result = '';
	var herramientas = document.getElementById('searchform').selectedHerramientas;
	
	for(var i = 0; i < herramientas.length; i++) {
		if(herramientas[i].checked) {
			result += herramientas[i].value + ",";
		}
	}
	
	result = result.substring(0, result.lastIndexOf(','));
	if (result == '')
		result = '-1';

	actionLoad("tutorialeslist.php", function(data) {
		$("#tutorialeslist").html(data);

		$('td[id^=row_filter]').each(function(index) {
		    $(this).simpletip({
				content: $("#rowdesc_filter_"+index).html()
			});
		});

	}, "action=filter&keyword="+keyword+"&herramientas="+result+"&tutorialcurso="+tutorialcurso+"&orderby="+orderby);

}


