
	function cargar_carrousel(from, to, es_portada, tags)
    {
		var limit = to-from;
		var offset = from;
        var url = document.URL;
        var domain = url.split('/', 3);

		$.post('http://'+domain[2]+"/ajax/videos_portada.php",{ 
            limit:limit, 
            offset:offset,
            es_portada: es_portada,
            tags:tags
            },
            function(data){
				if(data != -1){
					$('#thumbs_video_1').html(data);
				}
			}
		);
		$('#thumbs_video_prev').css('display','none');
		if(total>6){
			$('#thumbs_video_next').css('display','inline');
		}else{
			$('#thumbs_video_next').css('display','none');
		}
	
		return false;
		
	}
	
	
	function endavant_video(es_portada, tags){
		/*Mostrem els seguents i mirem si hem de deshabilitar el boto en questio*/
		from = from + 6;
		if(to+6 > total){
			to=total;
		}else{
			to=to+6;
		}
		var limit = to-from;
		var offset = from;
		if(total <= to){
			$('#thumbs_video_next').css('display','none');
			$('#thumbs_video_1 table').css('margin-right','0px');
		}
		$('#thumbs_video_prev').css('display','inline');
		$('#thumbs_video_1 table').css('margin-left','0px');
		$.ajax({
			type:'POST',
			url:'/ajax/videos_portada.php',
			timeout:'20000',
			data: { limit:limit, offset:offset, es_portada:es_portada, tags:tags },
			success: function(data){
				$('#thumbs_video_1').html(data);
			}
		
		});
		
	
	}
	
	function endarrera_video(es_portada, tags){
		/*Mostrem els seguents i mirem si hem de deshabilitar el boto en questio*/
		to=from;
		from = from - 6;
		var limit = to-from;
		var offset = from;
		if(from == 0){
			$('#thumbs_video_prev').css('display','none');
			$('#thumbs_video_1 table').css('margin-left','0px');
		}
		$('#thumbs_video_next').css('display','inline');
		$('#thumbs_video_1 table').css('margin-right','0px');
		$.ajax({
			type:'POST',
			url:'/ajax/videos_portada.php',
			timeout:'20000',
			data: { limit:limit, offset:offset, es_portada:es_portada, tags:tags },
			success: function(data){
				$('#thumbs_video_1').html(data);
			}
		
		});
	}

    
    function modul_video(video, image, peu, streaming, force, refresh, idembed)
    {
        var url = document.URL;
        var domain = url.split('/', 3);

        // abans de cridar l'ajax de l'streaming, netegem
        // les entitats numèriques que hi pugui haber. Altrament
        // les tornaria a codificar
        
        peu = peu.replace(/&#(\d+);/g,
        function(wholematch, parenmatch1) {
        return String.fromCharCode(+parenmatch1);
        });

        $.ajax({
            type:'POST',
            url:'http://'+domain[2]+'/ajax/streaming.php',
            data:{
                video_url: video, 
                foto_url : image, 
                peu      : peu,
                streaming: streaming,
                force    : force,
                refresh  : refresh,
                idembed  : idembed
            },
            success:function(data){
                $('#aux_video').html(data);
            }
        });
    }

