/* FUNCIONS
 *
 *
 */

var URIPRE = location.origin + '/';

$(document).ready(function(){   
	$("#text").ajaxStart(function(){
	   $("#dreta_carrega").show();
	 });
	
	 $("#text").ajaxSuccess(function(){
	   $("#dreta_carrega").hide();
	 });
});

/*ENTRADA IMATGES*/
		
function TransImatge(Inici,dir) {
	if(Inici >= MatriuImatges.length) {
		Inici = 0;
	}
	if (dir == 1) {
		dir = 2;
		$("#imatge_entrada").attr({ src: cami + MatriuImatges[Inici] });
		$("#capa_imatge").css({backgroundImage :"url(" + cami + MatriuImatges[Inici] + ")"});
		window.setTimeout("TransImatge("+(Inici + 1)+","+(dir)+")", 4000);
	}
	else if(dir == 2) {
		dir = 3;
		$("#capa_imatge").css({backgroundImage :"url(" + cami + MatriuImatges[Inici] + ")"});
		$("#alt_imatge").fadeOut(2000);
	window.setTimeout("TransImatge("+(Inici + 1)+","+(dir)+")", 6000);
	}
	else if(dir == 3) {
		dir = 2;
		$("#imatge_entrada").attr({ src: cami + MatriuImatges[Inici] });
		$("#alt_imatge").fadeIn(2000);
		window.setTimeout("TransImatge("+(Inici + 1)+","+(dir)+")", 6000);
	}
}
/**/

function carrega(id)
{
	var fitx = "moduls/text.php?id=" + id;
	$("#text").load(fitx);
}


function veure_gal(id)
{
	$("#dreta_cont").load("moduls/fotos.php?id=" + id);
}

function veure_con(any)
{
	$("#dreta_cont").load("moduls/any_concerts.php?any=" + any);
}

function calendar(date){
    var arrDate = [];
    $.ajax({    
        type: 'GET',
        async: false,
        url: 'include/accions.php',
        data: 'accio=calendar&date=' + date,
        dataType: 'text',
        success: function(str){        
            var arrTmp = str.split('|');
            for (var i = 0; i < arrTmp.length; i++){
               var arrInt = arrTmp[i].split(',');
                arrDate.push(arrInt);
            }          
        }
    });
    
    return arrDate;
}

