///////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////// REMODELACIÓ //////////////////////////////////// 

///////////////////////////////////////////////////////////////////////////////////////

// MENÚS

function swapMenu(count,className,id) {

	for(var i=1;i<=count;i++){

		var idNow = className+i;

		var liIdNow = className+'_'+i;

		document.getElementById(idNow).className = 'nodisp';

		document.getElementById(liIdNow).className = '';

		if(i == id){

			document.getElementById(idNow).className = className;

			document.getElementById(liIdNow).className = 'actiu';

		}

	}

}



// MENÚS DESPLEGABLES

function desplegaMenu(id_btn,id_div){

	jQuery(id_btn).mouseenter(

		function () {

			jQuery(id_div).show();

		}		

	);

	jQuery(id_div).mouseleave(

		function () {

			jQuery(this).hide();

		}		

	);

}



function desplegaDiv(id_btn1,id_btn2,id_div){

	jQuery(id_btn1).click(

		function () {

			jQuery(id_div).slideToggle('s');

		}		

	);

	jQuery(id_btn2).click(

		function () {

			jQuery(id_div).slideToggle('fast');

		}		

	);

}



// PESTANYES 

function swapTab(count,className,id) {

	for(var i=1;i<=count;i++){

		var idNow = className+i;

		var liIdNow = className+'_'+i;

		document.getElementById(idNow).className = 'nodisp';

		document.getElementById(liIdNow).className = '';

		if(i == id){

			document.getElementById(idNow).className = className;

			document.getElementById(liIdNow).className = 'actiu';

			ajaxSite_DoHit();

		}

	}

}



// RELLOTGE HEADER

function mueveReloj(op){

	momentoActual = new Date();

	hora = momentoActual.getHours();

	minuto = momentoActual.getMinutes();

	segundo = momentoActual.getSeconds();



	str_segundo = new String (segundo);

	if (str_segundo.length == 1)

	segundo = "0" + segundo;



	str_minuto = new String (minuto);

	if (str_minuto.length == 1)

	minuto = "0" + minuto;



	str_hora = new String (hora);

	if (str_hora.length == 1)

	hora = "0" + hora;



	var mes = momentoActual.getMonth()+1;

	var num = momentoActual.getDate();

	var any=momentoActual.getFullYear();



	var diasemana = new Array ('Diumenge', 'Dilluns', 'Dimarts', 'Dimecres', 'Dijous', 'Divendres', 'Dissabte', 'Diumenge');

	var dia = momentoActual.getDay();

	var nombreDia = diasemana[dia];



	horaImprimible = hora + ":" + minuto;



	//ahora = ''+horaImprimible + " " + nombreDia +" "+num + "/" + mes + "/" +any +'';

	ahora = '<strong>' + nombreDia + '</strong> ' + num + '/' + mes + '/' + any;



	if(op == 2){

		if(segundo == "00"){

			document.getElementById("data").innerHTML = ahora;

		}				

	}

	if(op == 1){

		document.getElementById("data").innerHTML = ahora;

		mueveReloj(2);

	}

	setTimeout("mueveReloj(2)",1000);

}



// TEMPERATURA HEADER

function temperatura(){

	jQuery.ajax({

		type: "POST",

		url: "/meteo/xml/temps.xml",

		success: function(dadesTemps){

			var str = '';

			var horaActual = new Date().getHours();



			jQuery(dadesTemps).find('provincia').each(function(){

				var jQueryTemperatura = jQuery(this);

				var provincia = jQueryTemperatura.attr('nombre');// Nom província

				var tempMinima = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('tempMin').text();// Temperatura mínima

				var tempMaxima = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('tempMax').text();// Temperatura màxima

				var icoActual = '';// Nom de la icona - Franjes horàries

				if((6<= horaActual) && ( horaActual <14)){

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloManana').text();				

				}else if ( (14<= horaActual) && (horaActual < 18)){

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloTarde').text();

				}else {

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloNoche').text();

				}

			str += '<div class="temperatura"><ul><li class="location">'+provincia+'</li><li class="temp_min">'+tempMinima+'&deg;</li><li class="temp_max">'+tempMaxima+'&deg;<li class="icona"><img src="http://www.324.cat/temperatura/img/'+icoActual+'.png" alt="" title="" /></li></ul></div>';

			});



			jQuery('#temperatura').html(str);



			//S'activa l'scroll

			jQuery(function(){

				jQuery("#temperatura").mbScrollable({

				width:142,

				height:20,

				slideTimer:200,

				autoscroll:true,

				scrollTimer:5000

				});

			});

		}

	});

}





// TEMPERATURA HEADER BLOGS 324
var numVegades = 0;
function temperaturaBlogs(xmlTemps){
	numVegades++;
	var urlPeticio = "http://blogs.324.cat/sindicacions/temps.xml";
	if(xmlTemps != undefined) {
		urlPeticio = xmlTemps;
	}
	jQuery.ajax({
		type: "POST",
		url: urlPeticio,
		error: function () {if (numVegades < 2) temperaturaBlogs("http://blogs.ccrtvi.com/sindicacions/temps.xml")},
		success: function(dadesTemps){

			var str = '';

			var horaActual = new Date().getHours();



			jQuery(dadesTemps).find('provincia').each(function(){

				var jQueryTemperatura = jQuery(this);

				var provincia = jQueryTemperatura.attr('nombre');// Nom província

				var tempMinima = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('tempMin').text();// Temperatura mínima

				var tempMaxima = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('tempMax').text();// Temperatura màxima

				var icoActual = '';// Nom de la icona - Franjes horàries

				if((6<= horaActual) && ( horaActual <14)){

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloManana').text();				

				}else if ( (14<= horaActual) && (horaActual < 18)){

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloTarde').text();

				}else {

					icoActual = jQueryTemperatura.find('prevision[previsionDiaNum=1]').find('simboloNoche').text();

				}

			str += '<div class="temperatura"><ul><li class="location">'+provincia+'</li><li class="temp_min">'+tempMinima+'&deg;</li><li class="temp_max">'+tempMaxima+'&deg;<li class="icona"><img src="http://www.324.cat/temperatura/img/'+icoActual+'.png" alt="" title="" /></li></ul></div>';

			});



			jQuery('#temperatura').html(str);



			//S'activa l'scroll

			jQuery(function(){

				jQuery("#temperatura").mbScrollable({

				width:142,

				height:20,

				slideTimer:200,

				autoscroll:true,

				scrollTimer:5000

				});

			});

		}

	});

}

// FINAL TEMPERATURA HEADER BLOGS 324





// SUPERCARUSSEL

function superCarussel(id){

	// Inicia scroll

	jQuery(function(){

		jQuery('#superCar'+id).mbScrollable({

		width:992,

		height:103,

		controls:"#controlsSuperCar"+id,

		scrollTimer:5000,

		nextCallback: 

			function() {

				carregaDadesCarrouselHome('carga_'+id,'next');

				superCarusselHover(id);				

			},

		prevCallback: 

			function() {

				carregaDadesCarrouselHome('carga_'+id,'prev');

				superCarusselHover(id);			

			}

		});

	});

	// Textos

	superCarusselHover(id);

}



function superCarusselHover(id){

	jQuery('#superCar'+id+' li a').hover(function(){

		jQuery('.info_superCar',this).animate({

			bottom:'0'

	  },350, function() {

	  });

	}, function(){

		jQuery('.info_superCar',this).animate({

			bottom:'-68'

	  },150, function() {

	  });

	});

}

///////////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////////////////////////



function roundNumber(num, dec) {

	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);

	return result;

}

				

//Modul Flash Comarques ///////////////////////////////////////////////////////

function insertSimpleFlash(url,w,h) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param value="exactfit" name="scale" />';

	str+='<embed src="'+url+'" quality="high" wmode="opaque" scale="exactfit" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}

function insertComarquesFlash(url,w,h,comarca) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'" />';

	str+='<param name="FlashVars" value="'+comarca+'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param value="exactfit" name="scale" />';

	str+="<embed src='"+url+"' FlashVars='comarca='"+comarca+"' quality='high' wmode='opaque' scale='exactfit' menu='false' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' allowScriptAccess='sameDomain' width='"+ w +"' height='"+ h +"'></embed>";

	str+='</object>';

	document.write(str);

}

function insertGraficaFlash(url,w,h) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param value="noscale" name="scale" />';

	str+='<embed src="'+url+'" quality="high" wmode="opaque" scale="noscale" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}



function insertGrafic(url,prePathYear,dir,id,w,h,nBarres,nReg,altres,tempsRefrec) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">';

	str+='<param name="movie" value="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+w+'&limitBarra='+nBarres+'&minRegidors='+nReg+'&mostraAltres='+altres+'&refrescDades='+tempsRefrec+'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param name="scale" value="noscale" />';

	str+='<param name="swliveconnect" value="true" />';

	str+='<embed swliveconnect="true" src="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+w+'&limitBarra='+nBarres+'&minRegidors='+nReg+'&mostraAltres='+altres+'&refrescDades='+tempsRefrec+'" quality="high" wmode="opaque" scale="noscale" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}

function insertGraficCompara(url,localitat,prevPath,w,h) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'?localitat='+ localitat +'&prevPath='+ prevPath +'&amplada='+ w +'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param name="scale" value="noscale" />';

	str+='<embed src="'+url+'?localitat='+ localitat +'&prevPath='+ prevPath +'&amplada='+ w +'" quality="high" wmode="opaque" scale="noscale" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}

/*function insertGrafic(url,prePathYear,dir,id,w,h) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+ w +'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param name="scale" value="noscale" />';

	str+='<embed src="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+ w +'" quality="high" wmode="opaque" scale="noscale" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}*/

function graficCompara2010(url,prePathYear,dir,id,w,h,nBarres,nReg,altres,tempsRefrec) {

	var str='';

	str+='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+ w +'" height="'+ h +'">';

	str+='<param name="movie" value="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+ w +'&limitBarra='+nBarres+'&minRegidors='+nReg+'&mostraAltres='+altres+'&refrescDades='+tempsRefrec+'" />';

	str+='<param name="quality" value="high" />';

	str+='<param name="wmode" value="opaque" />';

	str+='<param name="menu" value="false" />';

	str+='<param name="scale" value="noscale" />';

	str+='<param name="swliveconnect" value="true" />';

	str+='<embed swliveconnect="true" src="'+url+'?prePathYear='+prePathYear+'&dir='+dir+'&id='+id+'&amplada='+ w +'&limitBarra='+nBarres+'&minRegidors='+nReg+'&mostraAltres='+altres+'&refrescDades='+tempsRefrec+'" quality="high" wmode="opaque" scale="noscale" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowScriptAccess="sameDomain" width="'+ w +'" height="'+ h +'"></embed>';

	str+='</object>';

	document.write(str);

}

// url = Path de l'arxiu de gràfica flash

// prePathYear = any de les eleccions

// dir = directori de l'xml (mun, dem, aut...)

// id = nom de l'xml (sense l'extensió)

// w = amplada del flash

// h = alçada del flash

// nBarres = número de barres màxim que es pinten

// nReg = número mínim d'escons que ha de tenir un partit per apareixer

// altres = true o false. Apareix la barra "Altres partits"

// tempsRefrec = número (en segons) pel temps de refresc de la gràfica. Per defecte 90.000

/////////////////////////////////////////////////////////////////////////////



//Canviar mida del text /////////////////////////////////////////////////////



function zoomText(Accion,Elemento){



//inicializaciones

obj=document.getElementById(Elemento);



if (obj.style.fontSize==""){

obj.style.fontSize="75%";

}

actual=parseInt(obj.style.fontSize); //valor actual del tamanyo del texto

incremento=20;// el valor del incremento o decremento en el tamanyo



//accion sobre el texto

if(Accion=="reestablecer"){

obj.style.fontSize="100%"

}

if(Accion=="aumentar"){

valor=actual+incremento;

	if(valor <= 115){

	obj.style.fontSize=valor+"%"

	}

}

if(Accion=="disminuir"){

valor=actual-incremento;

	if(valor >= 75){

	obj.style.fontSize=valor+"%"

	}

}

}



var t = 0;

function changeTxtSize(id,operator) {

	var tamany = ["75%","100%","120%","160%"];

	if(operator){

		t++;

		if(t>=tamany.length){

			t = tamany.length-1;

		}

	}else{

		t--;

		if(t<=0){

			t = 0;

		}

	}

	identity=document.getElementById(id);

	identity.style.fontSize = tamany[t];

	statb();

}

function statb() {

self.status = ""

}



var t = 0;

function changeTxtSize2(id,operator) {

	var tamany = ["50%","75%","100%","120%"];

	if(operator){

		t++;

		if(t>=tamany.length){

			t = tamany.length-1;

		}

	}else{

		t--;

		if(t<=0){

			t = 0;

		}

	}

	identity=document.getElementById(id);

	identity.style.fontSize = tamany[t];

	statb();

}

function statb() {

self.status = ""

}

/////////////////////////////////////////////////////////////////////////////



//Modul 1 Fotogaleria ///////////////////////////////////////////////////////

//var selectedClass = "selected";

//var normalClass = "normal";

//var tempId;

function selectFoto(modulId,modulIdName,id,tot){

	var modulFoto = modulIdName+"_foto";

	for(i=0;i<tot;i++){

		var tempId = modulIdName+"_btnNav"+i;

		document.getElementById(tempId).className = "normal";

		if(i == id){

			document.getElementById(tempId).className = "selected";

		}

	}

	document.getElementById(modulFoto).src = modulId[id];

}

/////////////////////////////////////////////////////////////////////////////



//Modul 2 sequencia de fotos ///////////////////////////////////////////////////////

//var selectedClass = "selected";

//var normalClass = "normal";

//var tempId;

function selectFotoNew(modulId,modulIdName,id){

	var modulFoto = modulIdName+"_foto";

	for(i=0;i<modulId.srcFoto.length;i++){

		var tempId = modulIdName+"_btnNav"+i;

		document.getElementById(tempId).className = "normal";

		if(i == id){

			document.getElementById(tempId).className = "selected";

		}

	}

	document.getElementById(modulFoto).src = modulId.srcFoto[id];

	document.getElementById(modulFoto).alt = modulId.altFoto[id];

	document.getElementById(modulFoto).title = modulId.altFoto[id];

}

/////////////////////////////////////////////////////////////////////////////







//Modul Ultimes Noticies ////////////////////////////////////////////////////

function swapTabClassName(count,tabPre,llistaPre,id,className,doHitParam) {

	for(var i=1;i<=count;i++) {

		var tabIdNow = tabPre+i;

		var llistaIdNow = llistaPre+i;

		document.getElementById(tabIdNow).className = '';

		document.getElementById(llistaIdNow).className = 'hide';

		if(i == id){

			document.getElementById(tabIdNow).className = className;

			document.getElementById(llistaIdNow).className = className;

			if(doHitParam != null && doHitParam != "undefined"){

				ajaxSite_DoHit(doHitParam);

			}

			else{

				ajaxSite_DoHit();

			}

		}

	}

}

/////////////////////////////////////////////////////////////////////////////





//Paginador ////////////////////////////////////////////////////

function paginador_1(count,tabPre,llistaPre,id,className) {

	

	var i = 1;

	var tabIdNow;

	var llistaIdNow;

	var iniPag = 1;

	var maxPag = count;

	var pagActual = document.getElementById("num_pag_Actual").innerHTML;

	var pagSeg = (pagActual*1) + 1;

	var pagAnt = (pagActual*1) - 1;

	

	//alert (pagActual+" "+ pagSeg);

	if(id == "Seg") {

		

		//document.getElementById(tabPre + pagSeg).className = className;

		document.getElementById(llistaPre + pagSeg).className = className;

		document.getElementById("B_" + pagSeg).className = "active";

		document.getElementById("num_pag_Actual").innerHTML = "";

		document.getElementById("num_pag_Actual").innerHTML = pagSeg;

		

		for(i;i<=count;i++) {

			if(i == pagSeg){ continue; }

			tabIdNow = tabPre+i;

			llistaIdNow = llistaPre+i;

			document.getElementById(tabIdNow).className = '';

			document.getElementById(llistaIdNow).className = 'hide';

			document.getElementById("B_" + i).className = "";

			

			if(pagSeg == maxPag)

			{

				document.getElementById("notiTabRes_B_Seg").className = 'hidden';

			}else{

				document.getElementById("notiTabRes_B_Seg").className = '';

			}

			if(pagSeg > iniPag)

			{

				document.getElementById("notiTabRes_B_Ant").className = '';

			}else{

				document.getElementById("notiTabRes_B_Ant").className = 'hidden';

			}

		}

			

	}

	

		if(id == "Ant") {

		

//		document.getElementById(tabPre + pagAnt).className = className;

		document.getElementById(llistaPre + pagAnt).className = className;

		document.getElementById("B_" + pagAnt).className = "active";

		document.getElementById("num_pag_Actual").innerHTML = "";

		document.getElementById("num_pag_Actual").innerHTML = pagAnt;

		

		for(i;i<=count;i++) {

			if(i == pagAnt){ continue; }

			tabIdNow = tabPre+i;

			llistaIdNow = llistaPre+i;

			document.getElementById(tabIdNow).className = '';

			document.getElementById(llistaIdNow).className = 'hide';

			document.getElementById("B_" + i).className = "";

			

			if(pagAnt == iniPag)

			{

			document.getElementById("notiTabRes_B_Ant").className = 'hidden';

			document.getElementById("notiTabRes_B_Seg").className = '';

			}else{

			document.getElementById("notiTabRes_B_Ant").className = '';

			document.getElementById("notiTabRes_B_Seg").className = '';

			}

		}

			

	}



	

for(i;i<=count;i++) {

		tabIdNow = tabPre+i;

		llistaIdNow = llistaPre+i;

		document.getElementById(tabIdNow).className = '';

		document.getElementById(llistaIdNow).className = 'hide';

		document.getElementById("B_" + i).className = "";

		

		if(i == id){

			pagActual = id;

			document.getElementById("num_pag_Actual").innerHTML = "";

			document.getElementById("num_pag_Actual").innerHTML = pagActual;

//			document.getElementById(tabIdNow).className = className;

			document.getElementById(llistaIdNow).className = className;

			document.getElementById("B_" + pagActual).className = "active";

		}

		

		if(pagActual == maxPag)

		{

			document.getElementById("notiTabRes_B_Seg").className = 'hidden';

		}else{

			document.getElementById("notiTabRes_B_Seg").className = '';

		}

		

		if(pagActual == iniPag)

		{

			document.getElementById("notiTabRes_B_Ant").className = 'hidden';

		}else{

			document.getElementById("notiTabRes_B_Ant").className = '';

		}

	}

}

/////////////////////////////////////////////////////////////////////////////





//Modul Fotogaleria NOVA /////////////////////////////////////////////////////////

function fotoGaleria(uid) { 

	this.id = uid;

}

fotoGaleria.prototype.update = function(symbol, idint, inicial) {

	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual >= this.vo.size){

			this.vo.actual = 0;

		}

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = (this.vo.size-1);

		}

	}

	document.getElementById("Galeriatitol"+idint).innerHTML = this.vo.titolGaleria;

	document.getElementById("Galeriatitol"+idint).href = this.vo.href[this.vo.actual];

	document.getElementById("Galeriatitol"+idint).title = "Galeria: "+this.vo.titolGaleria;

	document.getElementById("Galeria"+idint).src = this.vo.foto[this.vo.actual];

	document.getElementById("Galeria"+idint).alt = this.vo.alt[this.vo.actual];

	document.getElementById("Galeria"+idint).title = this.vo.alt[this.vo.actual];

	document.getElementById("Galerialink"+idint).href = this.vo.href[this.vo.actual];

	document.getElementById("TitolGaleria"+idint).innerHTML = "<a href='"+this.vo.href[this.vo.actual]+"' title='Galeria: "+ this.vo.titolGaleria +"' >"+this.vo.titol[this.vo.actual]+"<a>";

	if(inicial == '1') {

		ajaxSite_DoHit();

	}

}

//Modul Fotogaleria Antiga /////////////////////////////////////////////////////////

function ModGaleria(uid) { 

	this.id = uid;

}

ModGaleria.prototype.update = function(symbol, idint) {

	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual >= this.vo.size){

			this.vo.actual = 0;

		}

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = (this.vo.size-1);

		}

	}

	document.getElementById("Galeria"+idint).src = this.vo.foto[this.vo.actual];

	document.getElementById("Galeria"+idint).alt = this.vo.alt[this.vo.actual];

	document.getElementById("Galeria"+idint).title = this.vo.alt[this.vo.actual];

	document.getElementById("Galerialink"+idint).href = this.vo.href[this.vo.actual];

	document.getElementById("TitolGaleria"+idint).innerHTML = "<a href='"+this.vo.href[this.vo.actual]+"' >"+this.vo.titol[this.vo.actual]+"<a>";

}





function VO() {

}



//Modul Fotogaleria /////////////////////////////////////////////////////////

function ModGaleriaItem(uid) { 

	this.id = uid;

}

ModGaleriaItem.prototype.update = function(symbol, idint) {

	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual >= this.vo.size){

			this.vo.actual = 0;

		}

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = (this.vo.size-1);

		}

	}

	document.getElementById("Galeria"+idint).src = this.vo.foto[this.vo.actual];

	document.getElementById("Galeria"+idint).alt = this.vo.alt[this.vo.actual];

	document.getElementById("Galeria"+idint).title = this.vo.alt[this.vo.actual];

	document.getElementById("TitolGaleria"+idint).innerHTML = this.vo.titol[this.vo.actual];

}

function VO() {

}





/////////////////////////////////////////////////////////////////////////////

//Modul Carrousel ///////////////////////////////////////////////////////////

function ModCarrousel(uid) { 

	this.id = uid;

}

ModCarrousel.prototype.update = function(symbol, idint) {

	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual >= this.vo.size){

			this.vo.actual = 0;

		}

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = (this.vo.size-1);

		}

	}

	document.getElementById("Carrousel"+idint).src = this.vo.foto[this.vo.actual];

	document.getElementById("Carrousel"+idint).alt = this.vo.alt[this.vo.actual];

	document.getElementById("Carrousel"+idint).title = this.vo.alt[this.vo.actual];

	document.getElementById("Carrousellink"+idint).href = this.vo.href[this.vo.actual];

	document.getElementById("TitolCarrousel"+idint).innerHTML = "<a href='"+this.vo.href[this.vo.actual]+"' >"+this.vo.titol[this.vo.actual]+"<a>";

/*	stopCarrus();*/



}

function VO() {

}

/*Carrusel Automatic*/



/*var carrusInterval;

function actualitza(){

	carrusInterval = setTimeout("modCarrousel.vo = voc1; modCarrousel.update('seguent','1');", 10000);

}



function stopCarrus() {

    clearTimeout(carrusInterval);

	actualitza();

}

*/

/////////////////////////////////////////////////////////////////////////////



//Modul Enquesta ////////////////////////////////////////////////////////////

var i,j;

var css = ['winner','normal'];

function sendSelectedOption(form){

	var selectedOpt = undefined;

	for(j=0;j<opcions.length;j++){	

		if(document.getElementById(form)[j].checked == true){

			selectedOpt = j;

		}

	}

	if(selectedOpt != undefined){

		// SEND TO DO

		// alert(selectedOpt);

		// UPDATE

		updateEnquesta();

	}

}

function updateEnquesta(){

	var winnerOpt = getWinner();

	var tempValue;

	var str = "";

	for(j=0;j<opcions.length;j++){	

		tempValue = Math.floor((values[j]*200)/100);

		if(j == winnerOpt){

			str += '<li>'+opcions[j]+'<br /><div class="'+css[0]+'"><div class="Contorno"><img  src="img/Barra_Encuesta_Rojo.gif" width="'+tempValue+'" height="10px" alt="" title=""/></div> <span class="Porcentaje_Numero">'+values[j]+'%</span></div></li>';

		}else{

			str += '<li>'+opcions[j]+'<br /><div class="'+css[1]+'"><div class="Contorno"><img  src="img/Barra_Encuesta.gif" width="'+tempValue+'" height="10px" alt="" title=""/></div> <span class="Porcentaje_Numero">'+values[j]+'%</span></div></li>';

		}

	}

	// PINTO

	document.getElementById("resultat").innerHTML = str;

}

function getWinner(){

	var tempValue = 0;

	for(i=0;i<opcions.length;i++){	

		if(values[i]>tempValue){

			tempValue = i;

		}

	}

	return tempValue;

}

/////////////////////////////////////////////////////////////////////////////



//Modul VIDEOS //////////////////////////////////////////////////////////////

//Pintar Video Seleccionat	

		function insertVideo(infoVideo, idint, idvid){

			

			var ConfigData = new Object()

				ConfigData.VIDEO_ID =					9251;

				ConfigData.VIDEO_URL =					infoVideo.videoURL[idvid];//"/svp2/media/salt.flv";

				ConfigData.POSTER_URL =					infoVideo.posterURL[idvid];//"/svp2/media/svp2_poster.jpg";

				ConfigData.WIDTH =						infoVideo.midas[0];

				ConfigData.HEIGHT =						infoVideo.midas[1];

				ConfigData.PREVIDEO_DURATION_SECONDS =	4;

				ConfigData.SKIN_URL =					"/svp2/themes/svp2_skinTemplate.swf";

				ConfigData.SKIN_FORM_URL =				"/svp2/themes/svp2_skinFormTemplate.swf";

				ConfigData.START_TEMPLATE =				0;

				ConfigData.END_TEMPLATE =				1;

				ConfigData.STATS_REF =					51235134;

				ConfigData.USE_CONSOLE =				"true";

				ConfigData.AUTOPLAY =					"false";

				//ConfigData.PLAYLIST_URL

				//ConfigData.END_EXTERNALMC_URL =	

			

			var FlashParams = new Object()

				FlashParams.src = 						"/svp2/svp2.swf";

				FlashParams.bgcolor = 					"#ffffff";

				FlashParams.width  =					infoVideo.midas[2];

				FlashParams.height =					infoVideo.midas[3];

				FlashParams.quality =					"high";

				FlashParams.swLiveConnect =				"true";

				FlashParams.menu =						"false";

				FlashParams.scale =						"noscale";

				FlashParams.salign =					"tl";

				FlashParams.align =						"l";

				FlashParams.allowFullScreen =			"false";

								

			insertaSVP( "Video"+idint, ConfigData , FlashParams );

		}

		

/////////////////////////////////////////////////////////////////////////////



//Modul AUDIOS //////////////////////////////////////////////////////////////

function insertAudio(infoAudio, idinta, idaud) {

	var foto = '<img src="'+infoAudio.posterURL[idaud]+'" alt="'+infoAudio.alt[idaud]+'" title="'+infoAudio.alt[idaud]+'" width="320" height="240" />';

	document.getElementById("Foto"+idinta).innerHTML = foto;

	audio = "";

	audio += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='320' height='40' title='Player'>"

	audio += "<param name='movie' value='/audio/player_audio.swf' />"

	audio += "<param name='quality' value='high' />"

	audio += "<param name='wmode' value='transparent' />"

	audio += "<param name='FlashVars' value='musica="+infoAudio.AudioURL[idaud]+"' />"

	audio += "<embed src='/audio/player_audio.swf' FlashVars='musica="+infoAudio.AudioURL[idaud]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' width='320' height='40'>"

	audio += "</embed></object>";

	document.getElementById("Audio"+idinta).innerHTML = audio;

}



function insertAudioNoFoto(infoAudio, idinta, idaud) {

	audio = "";

	audio += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='320' height='40' title='Player'>"

	audio += "<param name='movie' value='/audio/player_audio.swf' />"

	audio += "<param name='quality' value='high' />"

	audio += "<param name='wmode' value='transparent' />"

	audio += "<param name='FlashVars' value='musica="+infoAudio.AudioURL[idaud]+"' />"

	audio += "<embed src='/audio/player_audio.swf' FlashVars='musica="+infoAudio.AudioURL[idaud]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' width='320' height='40'>"

	audio += "</embed></object>";

	document.getElementById("Audio"+idinta).innerHTML = audio;

}

//Modul AUDIO petit /////////////

function insertAudioPetit(infoAudio, idinta) {

	audio = "";

	audio += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='313' height='32' title='Player'>"

	audio += "<param name='movie' value='/audio/playerAudio_petit.swf' />"

	audio += "<param name='quality' value='high' />"

	audio += "<param name='wmode' value='transparent' />"

	audio += "<param name='FlashVars' value='musica="+infoAudio+"' />"

	audio += "<embed src='/audio/playerAudio_petit.swf' FlashVars='musica="+infoAudio+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent' width='313' height='32'>"

	audio += "</embed></object>";

	document.getElementById("Audio"+idinta).innerHTML = audio;

}



function insertAudioSkin2(infoAudio, idinta) {

	audio = "";

	audio += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/swflash.cab#version=9,0,0,0" width="220" height="53" align="middle" name="SRP'+infoAudio+'IE" id="SRP'+infoAudio+'IE">';

	audio += '<param name="allowScriptAccess" value="always" />';

	audio += '<param name="movie" value="/ria/players/audio/srp/srp.swf" />';

	audio += '<param name="quality" value="high" />';

	audio += '<param name="swliveconnect" value="true" />';

	audio += '<param name="bgcolor" value="#ffffff" />';

	audio += '<param name="menu" value="false" />';

	audio += '<param name="wmode" value="transparent" />';

	audio += '<param value="item='+infoAudio+'&amp;skin=/audio/skin_3cat_new.swf&amp;text=1&amp;autoPlay=false" name="flashvars" />';

	audio += '<embed wmode="transparent" swliveconnect="true" src="/ria/players/audio/srp/srp.swf" quality="high" bgcolor="#ffffff" height="53" width="220" name="SRP'+infoAudio+'IE" align="middle" allowscriptaccess="always" menu="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="SRP358366" flashvars="item='+infoAudio+'&amp;skin=/audio/skin_3cat_new.swf&amp;text=1&amp;autoPlay=false"></embed>';

	audio += '</object>';

	document.getElementById("Audio"+idinta).innerHTML = audio;

}



function insertAudioMeu3cat(swf_src_ref, audio_ref,idAudio, w, h, cguID_ref) {

	audio = '';

	audio += '<object width="' + w + '" height="' + h + '" title="Player" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="svp" name="' + idAudio + '">';

	audio += '	<param value="' + swf_src_ref + '?cguID='+cguID_ref+'" name="movie"/>';

	audio += '	<param value="high" name="quality"/>';

	audio += '	<param value="musica=' + audio_ref + '" name="flashvars"/>';

	audio += '	<embed width="' + w + '" height="' + h + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" flashvars="musica=' + audio_ref + '" src="' + swf_src_ref + '?cguID='+cguID_ref+'" wmode="opaque">';

	audio += '</embed></object>';

	document.write(audio);

}

/////////////////////////////////////////////////////////////////////////////



//Modul Video Item ////////////////////////////////////////////////////////////

//Carregar Info Videos

function TitolVideo(infoVideo, idint) {

	document.getElementById("VideoTitol"+idint).innerHTML = "<span>"+infoVideo.titol+"</span>";

}

/////////////////////////////////////////////////////////////////////////////



//Modul Video Noticia Gran //////////////////////////////////////////////////

//Modificar Class

//Modul Video Noticia Gran //////////////////////////////////////////////////

function selectInfoBackground(idint,idSel) {

	var nodeList = document.getElementsByName(idint + "b");

	for (var i = 0; i < nodeList.length; i++){

		nodeList[i].className = "BackgroundnoSel";

	}

	document.getElementById(idint + "b_"+idSel).className = "BackgroundSel";

}

//Modificar Background

function selectBackground(idint,idSel,infoBackground){

	document.getElementById("NotiGranFoto"+idint).innerHTML = '<img src="'+infoBackground.background[idSel]+'" alt="'+infoBackground.altBackground[idSel]+'" title="'+infoBackground.altBackground[idSel]+'" />';

	//Ocultar Video Player

	document.getElementById("VideoPlayer"+idint).style.visibility="hidden";

}

//Veure el Video Player

function verVideoPlayer(idint) {

	document.getElementById("VideoPlayer"+idint).style.visibility="visible";

	ajaxSite_DoHit();

}

function ocultarVideoPlayer(idint) {

	document.getElementById("VideoPlayer"+idint).style.visibility="hidden";

}

function contNoticiaGran(){

	if(document.getElementById('NoticiaGran_mostra01').className == 'nodisp'){

		document.getElementById('NoticiaGran_mostra01').className = 'block';

		document.getElementById('NoticiaGran_mostra02').className = 'block';

		document.getElementById('notiGran_mostra').className = 'NoticiaGran_mes NoticiaGran_menys';

	}else{

		document.getElementById('NoticiaGran_mostra01').className = 'nodisp';

		document.getElementById('NoticiaGran_mostra02').className = 'nodisp';

		document.getElementById('notiGran_mostra').className = 'NoticiaGran_mes';

	}

}

/////////////////////////////////////////////////////////////////////////////



//Modul Videos/Audios de Portada ////////////////////////////////////////////

//Carregar Info Videos 

function TitolVideoDePortada(infoVideo, idint, idvid) {

	document.getElementById("InfoVideo"+idint).innerHTML = "<ul><li>"+infoVideo.data[idvid]+"</li><li><span>"+infoVideo.titol[idvid]+"</span></li></ul>";

}

//Carregar Info Audios 

function TitolAudioDePortada(infoAudio, idinta, idaud) {

	document.getElementById("InfoAudio"+idinta).innerHTML = "<ul><li>"+infoAudio.data[idaud]+"</li><li><span>"+infoAudio.titol[idaud]+"</span></li></ul>";

	//document.getElementById("InfoAudio"+idinta).innerHTML = "<ul><li>"+infoAudio.data[idaud]+"<img src='/img/clock.gif' alt='clock' title='clock' class='clock' /><strong>"+infoAudio.temps[idaud]+"</strong></li><li><span>"+infoAudio.titol[idaud]+"</span></li></ul>";

}

//Pintar Info Video Seleccionat

function selectVideo(infoVideo, idint, idvid) {

	document.getElementById("VidPrin"+idint).innerHTML = "<ul class='TitolVidPrincipal'><li>"+infoVideo.data[idvid]+"</li><li><h2><a href='/video/"+infoVideo.videoURL[idvid]+"' title='"+infoVideo.titol[idvid]+"'>"+infoVideo.titol[idvid]+"</a></h2></li></ul>";

	document.getElementById("v"+idPlay).className = "VideonoSel";

	identity=document.getElementById("v"+idvid);

	identity.className="VideoPlay";

	idPlay=idvid;

	ajaxSite_DoHit();

}



function selectVideoInicial(infoVideo, idint, idvid) {

	document.getElementById("VidPrin"+idint).innerHTML = "<ul class='TitolVidPrincipal'><li>"+infoVideo.data[idvid]+"</li><li><h2><a href='/video/"+infoVideo.videoURL[idvid]+"' title='"+infoVideo.titol[idvid]+"'>"+infoVideo.titol[idvid]+"</a></h2></li></ul>";

	document.getElementById("v"+idPlay).className = "VideonoSel";

	identity=document.getElementById("v"+idvid);

	identity.className="VideoPlay";

	idPlay=idvid;

}

//Pintar Info Audio Seleccionat

function selectAudioPest(id) {

	audio = "";

	audio += '<object width="'+infoAudioDePortada.midesAudio[0]+'" height="'+infoAudioDePortada.midesAudio[1]+'" align="middle" id="SRP'+infoAudioDePortada.AudioID[id]+'IE" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';

	audio += '	<param value="always" name="allowScriptAccess">';

	audio += '	<param value="/ria/players/audio/srp/srp.swf" name="movie">';

	audio += '	<param value="high" name="quality">';

	audio += '	<param value="#ffffff" name="bgcolor">';

	audio += '	<param value="false" name="menu">';

	audio += '	<param value="opaque" name="wmode" />';

	audio += '	<param value="item='+infoAudioDePortada.AudioID[id]+'&skin=/audio/skin_3cat24.swf&text=1&autoPlay=false" name="flashvars">';

	audio += '	<embed width="'+infoAudioDePortada.midesAudio[0]+'" height="'+infoAudioDePortada.midesAudio[1]+'" align="middle" wmode="opaque" id="SRP'+infoAudioDePortada.AudioID[id]+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" allowscriptaccess="always" name="SRP'+infoAudioDePortada.AudioID[id]+'" bgcolor="#ffffff" quality="high" src="/ria/players/audio/srp/srp.swf" flashvars="item='+infoAudioDePortada.AudioID[id]+'&skin=/audio/skin_3cat24.swf&text=1&autoPlay=false">';

	audio += '</object>';

	document.getElementById('txt_titAudio').innerHTML = infoAudioDePortada.titolAudio[id];

	document.getElementById('dataAudio').innerHTML = infoAudioDePortada.data[id];

	document.getElementById('txt_titNoti').innerHTML = infoAudioDePortada.titol[id];

	document.getElementById('contAudioPortada').innerHTML = audio;

}



function selectAudio(infoAudio, idinta, idaud) {

	document.getElementById("AudPrin"+idinta).innerHTML = "<ul class='TitolAudPrincipal'><li>"+infoAudio.data[idaud]+"</li><li><h2>"+infoAudio.titol[idaud]+"</h2></li></ul>";

	document.getElementById("a"+idaPlay).className = "VideonoSel";

	identity=document.getElementById("a"+idaud);

	identity.className="VideoPlay";

	idaPlay=idaud;

	ajaxSite_DoHit();

}

function selectAudioInicial(infoAudio, idinta, idaud) {

	document.getElementById("AudPrin"+idinta).innerHTML = "<ul class='TitolAudPrincipal'><li>"+infoAudio.data[idaud]+"</li><li><h2>"+infoAudio.titol[idaud]+"</h2></li></ul>";

	document.getElementById("a"+idaPlay).className = "VideonoSel";

	identity=document.getElementById("a"+idaud);

	identity.className="VideoPlay";

	idaPlay=idaud;

}

//Modificar Class Videos

var idPintado = 0;

var idPlay = 0;

var idaPlay = 0;

function selectInfoVideo(id) {

	document.getElementById("v"+idPintado).className = "VideonoSel";

	document.getElementById("v"+id).className = "VideoSel";

	idPintado = id;

	document.getElementById("v"+id).className = "VideoSel";

	document.getElementById("v"+idPlay).className = "VideoPlay";

}

//Modificar Class Audios

var idAPintado = 0;

function selectInfoAudio(id) {

	document.getElementById("a"+idAPintado).className = "VideonoSel";

	document.getElementById("a"+id).className = "VideoSel";

	idAPintado = id;

	document.getElementById("a"+id).className = "VideoSel";

	document.getElementById("a"+idaPlay).className = "VideoPlay";

}

//Modificar Info Directes

function canviInfoCanal(id){

	document.getElementById('infoDirecte').innerHTML = '<span>EST&Agrave;S VEIENT</span>' + infoDirectesDePortada.titol[id];

}

//Directe CI

function directeCI(id,canal){

	var audio = "";

	audio += '<object align="middle" id="PLAYER_SRPIE" width="311" height="30" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">';

	audio += '	<param value="always" name="allowScriptAccess" />';

	audio += '	<param value="/ria/players/audio/srp/srp.swf" name="movie" />';

	audio += '	<param value="high" name="quality" />';

	audio += '	<param value="true" name="swliveconnect" />';

	audio += '	<param value="#ffffff" name="bgcolor" />';

	audio += '	<param value="false" name="menu" />';

	audio += '	<param value="transparent" name="wmode" />';

	audio += '	<param name="flashvars" value="item='+canal+'&amp;skin=/audio/skin_3cat24_directe.swf&amp;text=0&amp;autoPlay=true" />';

	audio += '	<embed flashvars="item='+canal+'&amp;skin=/audio/skin_3cat24_directe.swf&amp;text=0&amp;autoPlay=true" id="PLAYER_SRP" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" allowScriptAccess="always" align="middle" name="PLAYER_SRP" width="311" height="30" bgcolor="#ffffff" quality="high" src="/ria/players/audio/srp/srp.swf" swliveconnect="true" wmode="transparent" />';

	audio += '</object>';

	document.getElementById('divplayerEVP').innerHTML = '<div class="playerDirectesAud"><div>'+audio+'</div></div><div class="gr_blocInformatiu"><p><strong>Estructura b&agrave;sica del bloc informatiu</strong></p><div><img src="/img/graf_bloc_informatiu.gif" alt="Estructura del bloc informatiu" title="Estructura del bloc informatiu" /></div></div>';

	document.getElementById('infoDirecte').innerHTML = '<span>EST&Agrave;S ESCOLTANT</span>' + infoDirectesDePortada.titol[id];

}

/////////////////////////////////////////////////////////////////////////////



//Modul Home Videos//////////////////////////////////////////////////////////

function TitolNoClockDeHome(infoVideo, idint, idvid) {

	

	document.getElementById("InfoVideo"+idint).innerHTML = "<div><ul></ul></div><div><span>"+infoVideo.data[idvid]+"</span><h2>"+infoVideo.titol[idvid]+"</h2></div>";

}



function TitolVideoDeHome(infoVideo, idint, idvid) {

	

	document.getElementById("InfoVideo"+idint).innerHTML = "<div><ul></ul></div><div><span>"+infoVideo.data[idvid]+"</span><img src='/img/clock.gif' alt='clock' title='clock' class='clock' /> <strong>"+infoVideo.temps[idvid]+"</strong><h2>"+infoVideo.titol[idvid]+"</h2></div>";

}

function selectVideoHome(infoVideo, idint, idvid, target, idamic) {

	document.getElementById("VidPrin"+idint).innerHTML = "<div class='Caixa'><span style='color:#FF0000'>"+infoVideo.data[idvid]+"</span></div><div class='Caixa'>"+infoVideo.provincia[idvid]+"</div><div class='Caixa'><h2><a href='"+infoVideo.href[idvid]+"' target='"+target+"'>"+infoVideo.titol[idvid]+"</a></h2></div><div class='Caixa'><span style='font-weight:normal'>"+infoVideo.caixa[idvid]+"</span></div>";

	document.getElementById(idamic).innerHTML="<img src=\"/img/ico_vid_amic.gif\" alt=\"enviar\" class=\"enviamic_fonsN\"/><a href='javascript:void(0)' onClick=\"javascript:mostrarAmics('TextAmic"+infoVideo.enviarAmicUniqueId[idvid]+"','enviar_a_un_amic"+infoVideo.enviarAmicUniqueId[idvid]+"','iframe"+infoVideo.enviarAmicUniqueId[idvid]+"');\" id=\"enviar_a_un_amic"+infoVideo.enviarAmicUniqueId[idvid]+"\">envia-ho a un amic</a>";

	document.getElementById("v"+idPlay).className = "VideonoSel";

	identity=document.getElementById("v"+idvid);

	identity.className="VideoPlay";

	idPlay=idvid;

	//ajaxSite_DoHit();

}



function selectAudioHome(infoVideo, idint, idvid, target) {

	document.getElementById("VidPrin"+idint).innerHTML = "<div class='Caixa'><span style='color:#FF0000'>"+infoVideo.data[idvid]+"</span></div><div class='Caixa'>"+infoVideo.provincia[idvid]+"</div><div class='Caixa'><h2><a href='"+infoVideo.href[idvid]+"' target='"+target+"'>"+infoVideo.titol[idvid]+"</a></h2></div><div class='Caixa'><span style='font-weight:normal'>"+infoVideo.caixa[idvid]+"</span></div>";

	document.getElementById("v"+idPlay).className = "VideonoSel";

	identity=document.getElementById("v"+idvid);

	identity.className="VideoPlay";

	idPlay=idvid;

	ajaxSite_DoHit();

}

/////////////////////////////////////////////////////////////////////////////



//*Modul Home FotoGaleria*///////////////////////////////////////////////////

function selectFotoGPortada(infoFoto, idint, idvid,idamic) {

	var tam = infoFoto.label[idvid].split("x");

	if(eval(tam[0])<eval(tam[1])){

		//vertical

		document.getElementById("FotoG"+idint).innerHTML = '<a href="'+infoFoto.href[idvid]+'"><img src="'+infoFoto.src[idvid]+'" alt="'+infoFoto.alt[idvid]+'" title="'+infoFoto.alt[idvid]+'" border="0"/></a>';

		}   

	else{

		//horizontal adaptar el tamanyo

		document.getElementById("FotoG"+idint).innerHTML = '<a href="'+infoFoto.href[idvid]+'"><img src="'+infoFoto.src[idvid]+'" alt="'+infoFoto.alt[idvid]+'" title="'+infoFoto.alt[idvid]+'" border="0" width="512" /></a>';

		}

	document.getElementById(idamic).innerHTML="<img src=\"/img/ico_vid_amic.gif\" alt=\"enviar\" class=\"enviamic_fonsN\"/><a href='javascript:void(0)' onClick=\"javascript:mostrarAmics('TextAmic"+infoFoto.enviarAmicUniqueId[idvid]+"','enviar_a_un_amic"+infoFoto.enviarAmicUniqueId[idvid]+"','iframe"+infoFoto.enviarAmicUniqueId[idvid]+"');\" id=\"enviar_a_un_amic"+infoFoto.enviarAmicUniqueId[idvid]+"\">envia-ho a un amic</a>";

	//ajaxSite_DoHit();

}





function selectFotogHome(infoFoto, idint, idvid) {

	document.getElementById("FotPrin"+idint).innerHTML = "<div class='Caixa'><span style='color:#FF0000'>"+infoFoto.data[idvid]+"</span></div><div class='Caixa'>"+infoFoto.provincia[idvid]+"</div><div class='Caixa'><h2><a href='"+infoFoto.href[idvid]+"'>"+infoFoto.titol[idvid]+"</a></h2></div><div class='Caixa'><span style='font-weight:normal'>"+infoFoto.caixa[idvid]+"</span></div>";

	

	document.getElementById("f"+idPlay).className = "FotognoSel";

	identity=document.getElementById("f"+idvid);

	identity.className="FotogPlay";

	idPlay=idvid;

}

function TitolFotogDeHome(infoFotog, idint, idvid) {

	

	document.getElementById("InfoFotog"+idint).innerHTML = "<div><ul></ul></div><div><span>"+infoFotog.data[idvid]+"</span><h2>"+infoFotog.titol[idvid]+"</h2></div>";

}

/////////////////////////////////////////////////////////////////////////////



//Modificar Class Fotog////////////////////////

var idPintado = 0;

var idPlay = 0;

function selectInfoFotog(id) {

	document.getElementById("f"+idPintado).className = "FotognoSel";

	document.getElementById("f"+id).className = "FotogSel";

	idPintado = id;

	document.getElementById("f"+id).className = "FotogSel";

	document.getElementById("f"+idPlay).className = "FotogPlay";

}

///////////////////////////7



startList = function() {

	if (document.all&&document.getElementById) {

		navRoot = document.getElementById("nav");

		for (i=0; i<navRoot.childNodes.length; i++) {

			node = navRoot.childNodes[i];

			if (node.nodeName=="LI") {

				node.onmouseover=function() {

					this.className+=" over";

					

				}

				node.onmouseout=function() {

					this.className=this.className.replace(" over", "");

				}

			}

		}

	}

}

window.onload=startList;







//////////////////////////////////////////////////////////////////////////////////////////////////

//Modul Fotogaleria_Horitzontal_Vertical /////////////////////////////////////////////////////////

function FotogaleriaHV(uid) { 

	this.id = uid;

}



FotogaleriaHV.prototype.update = function(symbol) {



	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual+6 >= this.vo.size){

			this.vo.actual =this.vo.size-7;

		}

		

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = 0;

		}

	}





	var tope=this.vo.actual+6;

	if(tope<=this.vo.foto.length && tope >= 0)

	{

		document.getElementById("Foto0").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual, symbol)] ;

		document.getElementById("Foto0").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual, symbol)] ;	

		document.getElementById("Foto0").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual, symbol)] ;	

		document.getElementById("Link0").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual, symbol)] ;

		document.getElementById("Foto1").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+1, symbol)] ;

		document.getElementById("Foto1").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+1, symbol)] ;

		document.getElementById("Foto1").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+1, symbol)] ;

		document.getElementById("Link1").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+1, symbol)] ;

		document.getElementById("Foto2").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+2, symbol)] ;

		document.getElementById("Foto2").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+2, symbol)] ;		

		document.getElementById("Foto2").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+2, symbol)] ;

		document.getElementById("Link2").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+2, symbol)] ;	

		document.getElementById("Foto3").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+3, symbol)] ;

		document.getElementById("Foto3").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+3, symbol)] ;		

		document.getElementById("Foto3").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+3, symbol)] ;

		document.getElementById("Link3").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+3, symbol)] ;	

		document.getElementById("Foto4").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+4, symbol)] ;

		document.getElementById("Foto4").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+4, symbol)] ;		

		document.getElementById("Foto4").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+4, symbol)] ;

		document.getElementById("Link4").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+4, symbol)] ;

		document.getElementById("Foto5").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+5, symbol)] ;

		document.getElementById("Foto5").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+5, symbol)] ;		

		document.getElementById("Foto5").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+5, symbol)] ;

		document.getElementById("Link5").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+5, symbol)] ;

		document.getElementById("Foto6").alt =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+6, symbol)] ;

		document.getElementById("Foto6").title =  this.vo.alt[getNextElement(this.vo.alt, this.vo.actual+6, symbol)] ;		

		document.getElementById("Foto6").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+6, symbol)] ;

		document.getElementById("Link6").href = this.vo.href[getNextElement(this.vo.href, this.vo.actual+6, symbol)] ;		

	}

		

}

function VO() {

}









function getNextElement(vector, index, symbol){

	if(index >= vector.length){

		return 0;

	}

	else if(index < 0) {

		return  vector.length;

	}

	else{

		if(symbol == "seguent"){

			return index;

		}

		else{

			return index;

		}

	}

}

/////////////////////////////////////////////////////////////////////////////



//-----------------------------------------------------------------------------------------------------------------------------

/*Desplega al presionar fes-ho ara */

function DesplegarResta(flag,id_normal,id_vermell) {

 var clase=document.getElementById('DesplegableResta').className;

 if(flag==0)

 {

  document.getElementById('DesplegableResta').className="DisplayBlock";

 

  

 }else if(flag==1){

  document.getElementById('DesplegableResta').className="DisplayNone";

 

 }

  document.getElementById(id_vermell).className="bt_100_Ver";

  document.getElementById(id_normal).className="bt_100";

}

function mostrarAceptar(id1,condid) {

 if (document.getElementById(condid).checked)

 {

 document.getElementById(id1).style.visibility="visible";

 

 }else

 {

 document.getElementById(id1).style.visibility="hidden";

 }

}



//Modul Fotogaleria_Home /////////////////////////////////////////////////////////////////////////

function FotogaleriaHome(uid) { 

	this.id = uid;

}



FotogaleriaHome.prototype.update = function(symbol) {



	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual+1 >= this.vo.size){

			this.vo.actual =this.vo.size-2;

		}

		

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = 0;

		}

	}





	var tope=this.vo.actual+1;

	if(tope<=this.vo.foto.length && tope >= 0)

	{

		document.getElementById("Foto0").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual, symbol)];

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual];

		document.getElementById("Foto1").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+1, symbol)];

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual+1];

		document.getElementById("Foto2").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+2, symbol)];

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual+2];

	}

		

}



function VO() {

}







function getNextElement(vector, index, symbol){

	if(index >= vector.length){

		return 0;

	}

	else if(index < 0) {

		return  vector.length;

	}

	else{

		if(symbol == "seguent"){

			return index;

		}

		else{

			return index;

		}

	}

}

/////////////////////////////////////////////////////////////////////////////



//Modul Fotogaleria_Home /////////////////////////////////////////////////////////////////////////

function FotogaleriaHome(uid) { 

	this.id = uid;

}

FotogaleriaHome.prototype.update = function(symbol) {



	if (symbol == "seguent") {

		this.vo.actual++;

		if(this.vo.actual+1 >= this.vo.size){

			this.vo.actual =this.vo.size-2;

		}

		

	}

	else {

		this.vo.actual--;

		if(this.vo.actual < 0) {

			this.vo.actual = 0;

		}

	}





	var tope=this.vo.actual+1;

	if(tope<=this.vo.foto.length && tope >= 0)

	{

		document.getElementById("Foto0").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual, symbol)];

		document.getElementById("Foto1").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+1, symbol)];

		document.getElementById("Foto2").src =  this.vo.foto[getNextElement(this.vo.foto, this.vo.actual+2, symbol)];

	}

		

}

FotogaleriaHome.prototype.update2 = function() {

	var tope=this.vo.actual+1;

	if(tope<=this.vo.foto.length && tope >= 0)

	{

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual];

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual+1];

		document.getElementById("GaleriaData").innerHTML = this.vo.data[this.vo.actual+2];

	}

}

function VO() {

}









function getNextElement(vector, index, symbol){

	if(index >= vector.length){

		return 0;

	}

	else if(index < 0) {

		return  vector.length;

	}

	else{

		if(symbol == "seguent"){

			return index;

		}

		else{

			return index;

		}

	}

}

/////////////////////////////////////////////////////////////////////////////

//-----------------------------------------------------------------------------------------------------------------------------









function getAbsoluteElementPosition(element) {

  var y = 0;

  var x = 0;

  while (element.offsetParent) {

    x += element.offsetLeft;

    y += element.offsetTop;

    element = element.offsetParent;

  }

  return {top:y,left:x};

}



function mostrarAmics(capa,id,frame) {

	var elemento = document.getElementById(id);

	var pos = getAbsoluteElementPosition(elemento)

	document.getElementById(capa).style.top=(pos.top+15) + "px";

	document.getElementById(capa).style.left=(pos.left-20) + "px";  

	document.getElementById(frame).style.top=(pos.top+33) + "px";

	document.getElementById(frame).style.left=(pos.left-20) + "px";  

	document.getElementById(capa).className="bg_com_amicblock";

	document.getElementById(frame).className="FrameAmicsblock";

}

function mostrarAmics2(capa,id,frame) {



  var elemento = document.getElementById(id);

  var pos = getAbsoluteElementPosition(elemento)

 document.getElementById(capa).style.top=(pos.top+15) + "px";

 document.getElementById(capa).style.left=(pos.left-30) + "px";  

  document.getElementById(frame).style.top=(pos.top+33) + "px";

 document.getElementById(frame).style.left=(pos.left-30) + "px";  

  document.getElementById(capa).className="bg_com_amicblock";

 document.getElementById(frame).className="FrameAmics2block";

}



function mostrarAgregar1(capa,id,frame) {



  var elemento = document.getElementById(id);

  var pos = getAbsoluteElementPosition(elemento)

 document.getElementById(capa).style.top=(pos.top+240) + "px";

 document.getElementById(capa).style.left=(pos.left+100) + "px";  

  document.getElementById(frame).style.top=(pos.top) + "px";

 document.getElementById(frame).style.left=(pos.left) + "px";  

  document.getElementById(capa).className="bg_com_amicblock";

 document.getElementById(frame).className="FrameAmics2block";

}



function enviaFormulariCercador(idForm){

	document.getElementById(idForm).submit();

}



function enviaFormulariCercadorCanviaNoms(idForm, strData1, strData2){

	document.getElementsByName(strData1)[0].name = 'startDate';

	document.getElementsByName(strData2)[0].name = 'endDate';

	document.getElementById(idForm).submit();

}





/* Avis quan l input cercar es buit */

function verificaCercar()

{ 



	valor = document.getElementById("cercar").value;

	if(valor == "")

	{

		alert("Insereix una paraula o paraules per a buscar");

	}

		

}



/****************** Mes Enquestes *****************/

function mostrarTornar(idact, idamagat){

	document.getElementById(idact).style.display="none";

	document.getElementById(idamagat).style.display="block";

}



//////////////////// Minut a Minut //////////////////////



/* Player */

var bWin32IE = ((navigator.userAgent.indexOf("IE")!= "-1") && (navigator.userAgent.length > 1));

function GetWMO(idname,url,img,autostart,w,h) {

var shtml = "";

	if (img!=null) {

		imgshowed = true;			

		shtml= '<a href="#" onclick="PlayWMO(\'' + idname + '\',\'' + url + '\',\'' + w + '\',\'' + h + '\'); return false;"><img src="img/ico_play.gif" alt="Play"  title="Play" class="ico_play320" /></a><img src="' + img + '" alt="View Video" border="0" class="thumbnail"/>';

	}else{

		imgshowed = false;

		shtml = '<div id="wmo'+idname+'"><object id="'+idname+'" name="'+idname+'" width="'+w+'" height="'+h+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"	codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject"><PARAM NAME="ShowControls" VALUE="1" /><PARAM NAME="ShowDisplay" VALUE="0" /><PARAM NAME="ShowStatusBar" VALUE="0" /><PARAM NAME="AutoStart" value="' + (autostart?'1':'0') + '" /><PARAM NAME="uiMode" value="none" /><PARAM NAME="FileName" value="' + url + '" />' +

		'<embed autostart="' + (autostart?'1':'0') + '" src="' + url + '" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/" width="'+w+'" height="'+h+'" showcontrols="1" showdisplay="0" showstatusbar="0" id="e'+idname+'" name="e'+idname+'"></embed></object></div>'; 

	}

	return shtml;

}



function mostraDirecteMin() {

	document.getElementById('dMediaPlayer').innerHTML = GetWMO('MediaPlayer','http://www.tv3.cat/su/tvc/tvcConditionalAccess.jsp?ALTERNATE=YES&ID=333333355&ID_BACKUP=333333255&QUALITY=A&FORMAT=WM&AGENT=WEBTV3',null,true,306,241);

}



function mostraDirecte() {

	document.getElementById('dMediaPlayer').innerHTML = GetWMO('MediaPlayer','http://www.tv3.cat/su/tvc/tvcConditionalAccess.jsp?ALTERNATE=YES&ID=333333355&ID_BACKUP=333333255&QUALITY=H&FORMAT=WM&AGENT=WEBTN',null,true,306,241);

}





/* Mostra / Amaga */

function MostraAmaga() { //v9.0

  var i,p,v,obj,args=MostraAmaga.arguments;

  for (i=0; i<(args.length-2); i+=3) 

  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];

    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }

    obj.visibility=v; }

}



/* ModULS VidEO I AuDIO */

function cargaInfoThumb(id) {

	var ident = 'infoVid' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoVideoDePortada.data[id] + '</p><p class="info">' + infoVideoDePortada.titol[id] + '</p>';

}

function cargaInfoThumbAud(id) {

	var ident = 'infoAud' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoAudioDePortada.data[id] + '</p><p class="info">' + infoAudioDePortada.titol[id] + '</p>';

}



function cargaInfoThumbHome(id) {

	var ident = 'infoVid' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoVideoDeHome.data[id] + '</p><p class="info">' + infoVideoDeHome.titol[id] + '</p>';

}

function cargaInfoThumbAudHome(id) {

	var ident = 'infoVid' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoAudioDeHome.data[id] + '</p><p class="info">' + infoAudioDeHome.titol[id] + '</p>';

}

function cargaInfoThumbTN(id) {

	var ident = 'infoVid' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoVideoInformatius.data[id] + '</p><p class="info">' + infoVideoInformatius.titol[id] + '</p>';

}

function cargaInfoThumbProg(id) {

	var ident = 'infoVid' + id;

	document.getElementById(ident).innerHTML = '<p class="data">' + infoVideoProgrames.data[id] + '</p><p class="info">' + infoVideoProgrames.titol[id] + '</p>';

}





/* Windows Media Player*/

function playWMOVideo(idname,idvideo,w,h){

	document.getElementById('VideoCentre').className = "VideoCentreWMP";

	var url = 'http://www.tv3.cat/su/tvc/tvcConditionalAccess.jsp?ALTERNATE=YES&amp;ID_BACKUP=&amp;ID='+idvideo+'&amp;QUALITY=A&amp;FORMAT=WM';

	var str = '<object id="e'+idname+'" width="'+w+'" height="'+h+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'+

	'    <PARAM NAME="ShowControls" VALUE="1" />'+   

	'    <PARAM NAME="ShowDisplay" VALUE="0" />'+

	'    <PARAM NAME="ShowStatusBar" VALUE="0" />'+

	'    <PARAM NAME="FileName" value="'+url+'" />'+

	'    <PARAM NAME="AutoStart" value="True" />'+

	'	<embed src="'+url+'" autostart="True" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/" width="'+w+'" height="'+h+'" showcontrols="1" showdisplay="0" showstatusbar="0" name="e'+idname+'"></embed>'+

	'</object>';

	document.getElementById(idname).innerHTML = str;

}



function playWMOVideoQualitat(idname,idvideo,w,h,q){

	document.getElementById('VideoCentre').className = "VideoCentreWMP";

	var url = 'http://www.tv3.cat/su/tvc/tvcConditionalAccess.jsp?ALTERNATE=YES&amp;ID_BACKUP=&amp;ID='+idvideo+'&amp;QUALITY='+q+'&amp;FORMAT=WM';

	var str = '<object id="e'+idname+'" width="'+w+'" height="'+h+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">'+

	'    <PARAM NAME="ShowControls" VALUE="1" />'+   

	'    <PARAM NAME="ShowDisplay" VALUE="0" />'+

	'    <PARAM NAME="ShowStatusBar" VALUE="0" />'+

	'    <PARAM NAME="FileName" value="'+url+'" />'+

	'    <PARAM NAME="AutoStart" value="True" />'+

	'	<embed src="'+url+'" autostart="True" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/" width="'+w+'" height="'+h+'" showcontrols="1" showdisplay="0" showstatusbar="0" name="e'+idname+'"></embed>'+

	'</object>';

	document.getElementById(idname).innerHTML = str;

}







////////// Scroller de noticies ///////////



function swapTabScroller(count,tabPre,llistaPre,id,className) {

	for(var i=1;i<=count;i++) {

		var tabIdNow = tabPre+i;

		var llistaIdNow = llistaPre+i;

		document.getElementById(tabIdNow).className = '';

		document.getElementById(llistaIdNow).className = 'hide';

		if(i == id){

			document.getElementById(tabIdNow).className = className;

			document.getElementById(llistaIdNow).className = className;

			ajaxSite_DoHit();

		}

	}

}

// Scroller

var dw_Event = {

  

    add: function(obj, etype, fp, cap) {

        cap = cap || false;

        if (obj.addEventListener) obj.addEventListener(etype, fp, cap);

        else if (obj.attachEvent) obj.attachEvent("on" + etype, fp);

    }, 



    remove: function(obj, etype, fp, cap) {

        cap = cap || false;

        if (obj.removeEventListener) obj.removeEventListener(etype, fp, cap);

        else if (obj.detachEvent) obj.detachEvent("on" + etype, fp);

    }, 

    

    DOMit: function(e) { 

        e = e? e: window.event; // e IS passed when using attachEvent though ...

        if (!e.target) e.target = e.srcElement;

        if (!e.preventDefault) e.preventDefault = function () { e.returnValue = false; return false; }

        if (!e.stopPropagation) e.stopPropagation = function () { e.cancelBubble = true; }

        return e;

    },

    

    getTarget: function(e) {

        e = dw_Event.DOMit(e); var tgt = e.target; 

        if (tgt.nodeType != 1) tgt = tgt.parentNode; // safari...

        return tgt;

    }

    

}



function addLoadEvent(func) {

    var oldQueue = window.onload? window.onload: function() {};

    window.onload = function() {

        oldQueue();

        func();

    }

}







// horizId only needed for horizontal scrolling

function dw_scrollObj(wndoId, lyrId, horizId) {

    var wn = document.getElementById(wndoId);

    this.id = wndoId; dw_scrollObj.col[this.id] = this;

    this.animString = "dw_scrollObj.col." + this.id;

    this.load(lyrId, horizId);

    

    if (wn.addEventListener) {

        wn.addEventListener('DOMMouseScroll', dw_scrollObj.doOnMouseWheel, false);

    } 

    wn.onmousewheel = dw_scrollObj.doOnMouseWheel;

}



dw_scrollObj.isSupported = function () {

    if ( document.getElementById && document.getElementsByTagName 

         && document.addEventListener || document.attachEvent ) {

        return true;

    }

    return false;

}



dw_scrollObj.col = {}; // collect instances

dw_scrollObj.defaultSpeed = dw_scrollObj.prototype.speed = 100; // default for mouseover or mousedown scrolling

dw_scrollObj.defaultSlideDur = dw_scrollObj.prototype.slideDur = 500; // default duration of glide onclick



// pseudo events 

dw_scrollObj.prototype.on_load = function() {} // when dw_scrollObj initialized or new layer loaded

dw_scrollObj.prototype.on_scroll = function() {}

dw_scrollObj.prototype.on_scroll_start = function() {}

dw_scrollObj.prototype.on_scroll_stop = function() {} // when scrolling has ceased (mouseout/up)

dw_scrollObj.prototype.on_scroll_end = function() {} // reached end

dw_scrollObj.prototype.on_update = function() {} // called in updateDims



dw_scrollObj.prototype.on_glidescroll = function() {}

dw_scrollObj.prototype.on_glidescroll_start = function() {}

dw_scrollObj.prototype.on_glidescroll_stop = function() {} // destination (to/by) reached

dw_scrollObj.prototype.on_glidescroll_end = function() {} // reached end



dw_scrollObj.prototype.load = function(lyrId, horizId) {

    var wndo, lyr;

    if (this.lyrId) { // layer currently loaded?

        lyr = document.getElementById(this.lyrId);

        lyr.style.visibility = "hidden";

    }

    this.lyr = lyr = document.getElementById(lyrId); // hold this.lyr?

    this.lyr.style.position = 'absolute'; 

    this.lyrId = lyrId; // hold id of currently visible layer

    this.horizId = horizId || null; // hold horizId for update fn

    wndo = document.getElementById(this.id);

    this.y = 0; this.x = 0; this.shiftTo(0,0);

    this.getDims(wndo, lyr); 

    lyr.style.visibility = "visible";

    this.ready = true; this.on_load(); 

}



dw_scrollObj.prototype.shiftTo = function(x, y) {

    if (this.lyr) {

        this.lyr.style.left = (this.x = x) + "px"; 

        this.lyr.style.top = (this.y = y) + "px";

    }

}



dw_scrollObj.prototype.getX = function() { return this.x; }

dw_scrollObj.prototype.getY = function() { return this.y; }



dw_scrollObj.prototype.getDims = function(wndo, lyr) { 

    this.wd = this.horizId? document.getElementById( this.horizId ).offsetWidth: lyr.offsetWidth;

    this.maxX = (this.wd - wndo.offsetWidth > 0)? this.wd - wndo.offsetWidth: 0;

    this.maxY = (lyr.offsetHeight - wndo.offsetHeight > 0)? lyr.offsetHeight - wndo.offsetHeight: 0;

}



dw_scrollObj.prototype.updateDims = function() {

    var wndo = document.getElementById(this.id);

    var lyr = document.getElementById( this.lyrId );

    this.getDims(wndo, lyr);

    this.on_update();

}



// for mouseover/mousedown scrolling

dw_scrollObj.prototype.initScrollVals = function(deg, speed) {

    if (!this.ready) return; 

    if (this.timerId) {

        clearInterval(this.timerId); this.timerId = 0;

    }

    this.speed = speed || dw_scrollObj.defaultSpeed;

    this.fx = (deg == 0)? -1: (deg == 180)? 1: 0;

    this.fy = (deg == 90)? 1: (deg == 270)? -1: 0;

    this.endX = (deg == 90 || deg == 270)? this.x: (deg == 0)? -this.maxX: 0; 

    this.endY = (deg == 0 || deg == 180)? this.y: (deg == 90)? 0: -this.maxY;

    this.lyr = document.getElementById(this.lyrId);

    this.lastTime = new Date().getTime();

    this.on_scroll_start(this.x, this.y);  

    this.timerId = setInterval(this.animString + ".scroll()", 10);    

}



dw_scrollObj.prototype.scroll = function() {

    var now = new Date().getTime();

    var d = (now - this.lastTime)/1000 * this.speed;

    if (d > 0) { 

        var x = this.x + Math.round(this.fx * d); var y = this.y + Math.round(this.fy * d);

        if ( ( this.fx == -1 && x > -this.maxX ) || ( this.fx == 1 && x < 0 ) || 

                ( this.fy == -1 && y > -this.maxY ) || ( this.fy == 1 && y < 0 ) ) 

       {

            this.lastTime = now;

            this.shiftTo(x, y);

            this.on_scroll(x, y);

        } else {

            clearInterval(this.timerId); this.timerId = 0;

            this.shiftTo(this.endX, this.endY);

            this.on_scroll(this.endX, this.endY);

            this.on_scroll_end(this.endX, this.endY);

        }

    }

}



// when scrolling has ceased (mouseout/up)

dw_scrollObj.prototype.ceaseScroll = function() {

    if (!this.ready) return;

    if (this.timerId) {

        clearInterval(this.timerId); this.timerId = 0; 

    }

    this.on_scroll_stop(this.x, this.y); 

}



// glide onclick scrolling

dw_scrollObj.prototype.initScrollByVals = function(dx, dy, dur, ojdParameter) {

    if ( !this.ready || this.sliding ) return;

    this.startX = this.x; this.startY = this.y;

    this.destX = this.destY = this.distX = this.distY = 0;

    if ((ojdParameter == undefined) || (ojdParameter == "")) {

    	ajaxSite_DoHit();

    }

    else {

    	ajaxSite_DoHit(ojdParameter);

    }

    if (dy < 0) {

        this.distY = (this.startY + dy >= -this.maxY)? dy: -(this.startY  + this.maxY);

    } else if (dy > 0) {

        this.distY = (this.startY + dy <= 0)? dy: -this.startY;

    }

    if (dx < 0) {

        this.distX = (this.startX + dx >= -this.maxX)? dx: -(this.startX + this.maxX);

    } else if (dx > 0) {

        this.distX = (this.startX + dx <= 0)? dx: -this.startX;

    }

    this.destX = this.startX + this.distX; this.destY = this.startY + this.distY;

    this.glideScrollPrep(this.destX, this.destY, dur);

}



dw_scrollObj.prototype.initScrollToVals = function(destX, destY, dur) {

    if ( !this.ready || this.sliding ) return;

    this.startX = this.x; this.startY = this.y;

    this.destX = -Math.max( Math.min(destX, this.maxX), 0);

    this.destY = -Math.max( Math.min(destY, this.maxY), 0);

    this.distY = this.destY - this.startY;

    this.distX = this.destX - this.startX;

    this.glideScrollPrep(this.destX, this.destY, dur);

}



dw_scrollObj.prototype.glideScrollPrep = function(destX, destY, dur) {

    this.slideDur = (typeof dur == 'number')? dur: dw_scrollObj.defaultSlideDur;

    this.per = Math.PI/(2 * this.slideDur); this.sliding = true;

    this.lyr = document.getElementById(this.lyrId); 

    this.startTime = new Date().getTime();

    this.timerId = setInterval(this.animString + ".doGlideScroll()",10);

    this.on_glidescroll_start(this.startX, this.startY);

}



dw_scrollObj.prototype.doGlideScroll = function() {

    var elapsed = new Date().getTime() - this.startTime;

    if (elapsed < this.slideDur) {

        var x = this.startX + Math.round( this.distX * Math.sin(this.per*elapsed) );

        var y = this.startY + Math.round( this.distY * Math.sin(this.per*elapsed) );

        this.shiftTo(x, y); 

        this.on_glidescroll(x, y);

    } else {	// if time's up

        clearInterval(this.timerId); this.timerId = 0; this.sliding = false;

        this.shiftTo(this.destX, this.destY);

        this.on_glidescroll(this.destX, this.destY);

        this.on_glidescroll_stop(this.destX, this.destY);

        // end of axis reached ? 

        if ( this.distX && (this.destX == 0 || this.destX == -this.maxX) 

          || this.distY && (this.destY == 0 || this.destY == -this.maxY) ) { 

            this.on_glidescroll_end(this.destX, this.destY);

        } 

    }

}



//  resource: http://adomas.org/javascript-mouse-wheel/

dw_scrollObj.handleMouseWheel = function(id, delta) {

    var wndo = dw_scrollObj.col[id];

    var x = wndo.x;

    var y = wndo.y;

    wndo.on_scroll_start(x,y);

    var ny;

    ny = 12  * delta + y

    ny = (ny < 0 && ny >= -wndo.maxY)? ny: (ny < -wndo.maxY)? -wndo.maxY: 0;

    wndo.shiftTo(x, ny);

    wndo.on_scroll(x, ny);

}



dw_scrollObj.doOnMouseWheel = function(e) {

    var delta = 0;

    if (!e) e = window.event;

    if (e.wheelDelta) { /* IE/Opera. */

        delta = e.wheelDelta/120;

        if (window.opera) delta = -delta;

    } else if (e.detail) { // Mozilla 

        delta = -e.detail/3;

    }

    if (delta) { // > 0 up, < 0 down

        dw_scrollObj.handleMouseWheel(this.id, delta);

    }

    if (e.preventDefault) e.preventDefault();

    e.returnValue = false;

}



dw_scrollObj.GeckoTableBugFix = function() {} // no longer need old bug fix





// Get position of el within layer (oCont) sOff: 'left' or 'top'

// Assumes el is within oCont

function dw_getLayerOffset(el, oCont, sOff) {

    var off = "offset" + sOff.charAt(0).toUpperCase() + sOff.slice(1);

    var val = el[off];

    while ( (el = el.offsetParent) != oCont ) 

        val += el[off];

    var clientOff = off.replace("offset", "client");

    if ( el[clientOff] ) val += el[clientOff];

    return val;

}



/////////////////////////////////////////////////////////////////////







/////////////////////////////////////////////////////////////////////

// two ways to add style sheet for capable browsers



dw_writeStyleSheet = function(file) {

    document.write('<link rel="stylesheet" href="' + file + '" media="screen" />');

}



function dw_addLinkCSS(file) {

    if ( !document.createElement ) return;

    var el = document.createElement("link");

    el.setAttribute("rel", "stylesheet");

    el.setAttribute("type", "text/css");

    el.setAttribute("media", "screen");

    el.setAttribute("href", file);

    document.getElementsByTagName('head')[0].appendChild(el);

}

/////////////////////////////////////////////////////////////////////



// Example class names: load_wn_lyr1, load_wn_lyr2_t2

dw_scrollObj.prototype.setUpLoadLinks = function(controlsId) {

    var wndoId = this.id; var el = document.getElementById(controlsId); 

    var links = el.getElementsByTagName('a');

    var cls, parts;

    for (var i=0; links[i]; i++) {

        cls = dw_scrollObj.get_DelimitedClass( links[i].className );

        parts = cls.split('_');

        if ( parts[0] == 'load' && parts[1] == wndoId && parts.length > 2 ) {

            // no checks on lyrId, horizId

            var lyrId = parts[2]; var horizId = parts[3]? parts[3]: null;

            dw_Event.add( links[i], 'click', function (wndoId, lyrId, horizId) {

                return function (e) {

                    dw_scrollObj.col[wndoId].load(lyrId, horizId);

                    if (e && e.preventDefault) e.preventDefault();

                    return false;

                }

            }(wndoId, lyrId, horizId) ); // see Crockford js good parts pg 39

        }

    }

}



dw_scrollObj.prototype.setUpScrollControls = function(controlsId, autoHide, axis, ojdParameter) {

    var wndoId = this.id; var el = document.getElementById(controlsId); 

    if ( autoHide && axis == 'v' || axis == 'h' ) {

        dw_scrollObj.handleControlVis(controlsId, wndoId, axis);

        dw_Scrollbar_Co.addEvent( this, 'on_load', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );

        dw_Scrollbar_Co.addEvent( this, 'on_update', function() { dw_scrollObj.handleControlVis(controlsId, wndoId, axis); } );

    }

    

    var links = el.getElementsByTagName('a'), cls, eType;

    for (var i=0; links[i]; i++) { 

        cls = dw_scrollObj.get_DelimitedClass( links[i].className );

        eType = dw_scrollObj.getEv_FnType( cls.slice(0, cls.indexOf('_') ) );

        switch ( eType ) {

            case 'mouseover' :

            case 'mousedown' :

                dw_scrollObj.handleMouseOverDownLinks(links[i], wndoId, cls);

                break;

            case 'scrollToId': 

                dw_scrollObj.handleScrollToId(links[i], wndoId, cls);

                break;

            case 'scrollTo' :

            case 'scrollBy':

            case 'click': 

                dw_scrollObj.handleClick(links[i], wndoId, cls, ojdParameter) ;

                break;

        }

    }

}



dw_scrollObj.handleMouseOverDownLinks = function (linkEl, wndoId, cls) {

    var parts = cls.split('_'); var eType = parts[0];

    var re = /^(mouseover|mousedown)_(up|down|left|right)(_[\d]+)?$/;

                

    if ( re.test(cls) ) { 

        var eAlt = (eType == 'mouseover')? 'mouseout': 'mouseup';

        var dir = parts[1];  var speed = parts[2] || null; 

        var deg = (dir == 'up')? 90: (dir == 'down')? 270: (dir == 'left')? 180: 0;

        

        dw_Event.add(linkEl, eType, function (e) { dw_scrollObj.col[wndoId].initScrollVals(deg, speed); } );

        dw_Event.add(linkEl, eAlt, function (e) { dw_scrollObj.col[wndoId].ceaseScroll(); } );

            

        if ( eType == 'mouseover') {

            dw_Event.add( linkEl, 'mousedown', function (e) { dw_scrollObj.col[wndoId].speed *= 3; } );

            dw_Event.add( linkEl, 'mouseup', function (e) { 

                dw_scrollObj.col[wndoId].speed = dw_scrollObj.prototype.speed; } ); 

        }

        dw_Event.add( linkEl, 'click', function(e) { if (e && e.preventDefault) e.preventDefault(); return false; } );

    }

}



// scrollToId_smile, scrollToId_smile_100, scrollToId_smile_lyr1_100    

dw_scrollObj.handleScrollToId = function (linkEl, wndoId, cls) {

    var parts = cls.split('_'); var id = parts[1], lyrId, dur;

    if ( parts[2] ) {

        if ( isNaN( parseInt(parts[2]) ) ) { 

            lyrId = parts[2];

            dur = ( parts[3] && !isNaN( parseInt(parts[3]) ) )? parseInt(parts[3]): null;

        } else {

            dur = parseInt( parts[2] );

        }

    }

    dw_Event.add( linkEl, 'click', function (e) {

            dw_scrollObj.scrollToId(wndoId, id, lyrId, dur);

            if (e && e.preventDefault) e.preventDefault();

            return false;

        } );

}



// doesn't checks if lyrId in wndo, el in lyrId

dw_scrollObj.scrollToId = function(wndoId, id, lyrId, dur) {

    var wndo = dw_scrollObj.col[wndoId];

    var el = document.getElementById(id);

    if (el) {

        if ( lyrId ) {

            if ( document.getElementById(lyrId) && wndo.lyrId != lyrId ) {

                wndo.load(lyrId);

            }

        }

        var lyr = document.getElementById(wndo.lyrId);

        var x = dw_getLayerOffset(el, lyr, 'left');

        var y = dw_getLayerOffset(el, lyr, 'top');

        wndo.initScrollToVals(x, y, dur);

    }

}



dw_scrollObj.handleClick = function (linkEl, wndoId, cls, ojdParameter) {

    var wndo = dw_scrollObj.col[wndoId];

    var parts = cls.split('_'); var eType = parts[0]; 

    var dur_re = /^([\d]+)$/; var fn, re, x, y, dur;

    

    switch (eType) {

        case 'scrollTo' :

            fn = 'scrollTo';  re = /^(null|end|[\d]+)$/;

            x = re.test( parts[1] )? parts[1]: '';

            y = re.test( parts[2] )? parts[2]: '';

            dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;

            break;

        case 'scrollBy': // scrollBy_m30_m40, scrollBy_null_m100, scrollBy_100_null

            fn = 'scrollBy';  re = /^(([m]?[\d]+)|null)$/;

            x = re.test( parts[1] )? parts[1]: '';

            y = re.test( parts[2] )? parts[2]: '';

            

            // negate numbers (m not - but vice versa) 

            if ( !isNaN( parseInt(x) ) ) {

                x = -parseInt(x);

            } else if ( typeof x == 'string' ) {

                x = x.indexOf('m') !=-1 ? x.replace('m', ''): x;

            }

            if ( !isNaN( parseInt(y) ) ) {

                y = -parseInt(y);

            } else if ( typeof y == 'string' ) {

                y = y.indexOf('m') !=-1 ? y.replace('m', ''): y;

            }

            

            dur = ( parts[3] && dur_re.test(parts[3]) )? parts[3]: null;

            break;

        

        case 'click': 

            var o = dw_scrollObj.getClickParts(cls);

            fn = o.fn; x = o.x; y = o.y; dur = o.dur;

            break;

    }

    if ( x !== '' && y !== '' ) {

        if (x == 'end') { x = wndo.maxX; }

        if (y == 'end') { y = wndo.maxY; }

        if (x === 'null' || x === null) { x = wndo.x; }

        if (y === 'null' || y === null) { y = wndo.y; }

        

        x = parseInt(x); y = parseInt(y);  

        dur = !isNaN( parseInt(dur) )? parseInt(dur): null;

        

        if (fn == 'scrollBy') {

            dw_Event.add( linkEl, 'click', function (e) {

                    dw_scrollObj.col[wndoId].initScrollByVals(x, y, dur, ojdParameter);

                    if (e && e.preventDefault) e.preventDefault();

                    return false;

                } );

        } else if (fn == 'scrollTo') {

            dw_Event.add( linkEl, 'click', function (e) {

                    dw_scrollObj.col[wndoId].initScrollToVals(x, y, dur);

                    if (e && e.preventDefault) e.preventDefault();

                    return false;

                } );

        }

    }

}



// get info from className (e.g., click_down_by_100)

dw_scrollObj.getClickParts = function(cls) {

    var parts = cls.split('_');

    var re = /^(up|down|left|right)$/;

    var dir, fn = '', dur, ar, val, x = '', y = '';

    

    if ( parts.length >= 4 ) {



        ar = parts[1].match(re);

        dir = ar? ar[1]: null;

            

        re = /^(to|by)$/; 

        ar = parts[2].match(re);

        if (ar) {

            fn = (ar[0] == 'to')? 'scrollTo': 'scrollBy';

        } 

    

        val = parts[3]; // value on x or y axis

        re = /^([\d]+)$/;

        dur = ( parts[4] && re.test(parts[4]) )? parts[4]: null;

    

        switch (fn) {

            case 'scrollBy' :

                if ( !re.test( val ) ) {

                    x = ''; y = ''; break;

                }

                switch (dir) { // 0 for unspecified axis 

                    case 'up' : x = 0; y = val; break;

                    case 'down' : x = 0; y = -val; break;

                    case 'left' : x = val; y = 0; break;

                    case 'right' : x = -val; y = 0;

                 }

                break;

            case 'scrollTo' :

                re = /^(end|[\d]+)$/;

                if ( !re.test( val ) ) {

                    x = ''; y = ''; break;

                }

                switch (dir) { // null for unspecified axis 

                    case 'up' : x = null; y = val; break;

                    case 'down' : x = null; y = (val == 'end')? val: -val; break;

                    case 'left' : x = val; y = null; break;

                    case 'right' : x = (val == 'end')? val: -val; y = null;

                 } 

                break;

         }

    }

    return { fn: fn, x: x, y: y, dur: dur }

}



dw_scrollObj.getEv_FnType = function(str) {

    var re = /^(mouseover|mousedown|scrollBy|scrollTo|scrollToId|click)$/;

    if (re.test(str) ) {

        return str;

    }

    return '';

}



// return class name with underscores in it 

dw_scrollObj.get_DelimitedClass = function(cls) {

    if ( cls.indexOf('_') == -1 ) {

        return '';

    }

    var whitespace = /\s+/;

    if ( !whitespace.test(cls) ) {

        return cls;

    } else {

        var classes = cls.split(whitespace); 

        for(var i = 0; classes[i]; i++) { 

            if ( classes[i].indexOf('_') != -1 ) {

                return classes[i];

            }

        }

    }

}



dw_scrollObj.handleControlVis = function(controlsId, wndoId, axis) {

    var wndo = dw_scrollObj.col[wndoId];

    var el = document.getElementById(controlsId);

    if ( ( axis == 'v' && wndo.maxY > 0 ) || ( axis == 'h' && wndo.maxX > 0 ) ) {

        el.style.visibility = 'visible';

    } else {

        el.style.visibility = 'hidden';

    }

}







//pel cercadors de trivials

var URL_HOME				= "http://www.324.cat";

var URL_SEARCHER			= URL_HOME + '/searcher/Search';



function getElemId(id) {

	return document.getElementById(id);

}



function getFormS() {

	var frmId = arguments[0]!=null ? arguments[0] : "frmSearch";

	return getElemId(frmId);

}



function send() {

	var frm = getFormS(arguments[0]);

	if (arguments[1]!=null) {

		frm.hiStartValue.value = arguments[1];

	}

	var bCheck = false;

	eval("bCheck = frm.startDate!=null && frm."+frm.name+"_startDate!=null;");

	if (bCheck) {

		eval("frm.startDate.value = frm."+frm.name+"_startDate.value;");

	}

	eval("bCheck = frm.endDate!=null && frm."+frm.name+"_endDate!=null;");

	if (bCheck) {

		eval("frm.endDate.value = frm."+frm.name+"_endDate.value;");

	}

	frm.action = URL_SEARCHER;

	frm.method = "get";

	//frm.method = "post";

	frm.submit();

}





/****** ACORDEO JQUERY *******/

//** Animated Collapsible DIV v2.0- (c) Dynamic Drive DHTML code library: http://www.dynamicdrive.com.

//** May 24th, 08'- Script rewritten and updated to 2.0.

//** June 4th, 08'- Version 2.01: Bug fix to work with jquery 1.2.6 (which changed the way attr() behaves).

//** March 5th, 09'- Version 2.2, which adds the following:

			//1) ontoggle($, divobj, state) event that fires each time a DIV is expanded/collapsed, including when the page 1st loads

			//2) Ability to expand a DIV via a URL parameter string, ie: index.htm?expanddiv=jason or index.htm?expanddiv=jason,kelly



//** March 9th, 09'- Version 2.2.1: Optimized ontoggle event handler slightly.

//** July 3rd, 09'- Version 2.4, which adds the following:

			//1) You can now insert rel="expand[divid] | collapse[divid] | toggle[divid]" inside arbitrary links to act as DIV togglers

			//2) For image toggler links, you can insert the attributes "data-openimage" and "data-closedimage" to update its image based on the DIV state



var animatedcollapse={

divholders: {}, //structure: {div.id, div.attrs, div.$divref, div.$togglerimage}

divgroups: {}, //structure: {groupname.count, groupname.lastactivedivid}

lastactiveingroup: {}, //structure: {lastactivediv.id}

preloadimages: [],



show:function(divids){ //public method

	if (typeof divids=="object"){

		for (var i=0; i<divids.length; i++)

			this.showhide(divids[i], "show")

	}

	else

		this.showhide(divids, "show")

},



hide:function(divids){ //public method

	if (typeof divids=="object"){

		for (var i=0; i<divids.length; i++)

			this.showhide(divids[i], "hide")

	}

	else

		this.showhide(divids, "hide")

},



toggle:function(divid){ //public method

	if (typeof divid=="object")

		divid=divid[0]

	this.showhide(divid, "toggle")

},



addDiv:function(divid, attrstring){ //public function

	this.divholders[divid]=({id: divid, $divref: null, attrs: attrstring})

	this.divholders[divid].getAttr=function(name){ //assign getAttr() function to each divholder object

		var attr=new RegExp(name+"=([^,]+)", "i") //get name/value config pair (ie: width=400px,)

		return (attr.test(this.attrs) && parseInt(RegExp.$1)!=0)? RegExp.$1 : null //return value portion (string), or 0 (false) if none found

	}

	this.currentid=divid //keep track of current div object being manipulated (in the event of chaining)

	return this

},



showhide:function(divid, action){

	var $divref=this.divholders[divid].$divref //reference collapsible DIV

	if (this.divholders[divid] && $divref.length==1){ //if DIV exists

		var targetgroup=this.divgroups[$divref.attr('groupname')] //find out which group DIV belongs to (if any)

		if ($divref.attr('groupname') && targetgroup.count>1 && (action=="show" || action=="toggle" && $divref.css('display')=='none')){ //If current DIV belongs to a group

			if (targetgroup.lastactivedivid && targetgroup.lastactivedivid!=divid) //if last active DIV is set

				this.slideengine(targetgroup.lastactivedivid, 'hide') //hide last active DIV within group first

				this.slideengine(divid, 'show')

			targetgroup.lastactivedivid=divid //remember last active DIV

		}

		else{

			this.slideengine(divid, action)

		}

	}

},



slideengine:function(divid, action){

	var $divref=this.divholders[divid].$divref

	var $togglerimage=this.divholders[divid].$togglerimage

	if (this.divholders[divid] && $divref.length==1){ //if this DIV exists

		var animateSetting={height: action}

		if ($divref.attr('fade'))

			animateSetting.opacity=action

		$divref.animate(animateSetting, $divref.attr('speed')? parseInt($divref.attr('speed')) : 500, function(){

			if ($togglerimage){

				$togglerimage.attr('src', ($divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open)

			}

			if (animatedcollapse.ontoggle){

				try{

					animatedcollapse.ontoggle(jQuery, $divref.get(0), $divref.css('display'))

				}

				catch(e){

					alert("An error exists inside your \"ontoggle\" function:\n\n"+e+"\n\nAborting execution of function.")

				}

			}

		})

		return false

	}

},



generatemap:function(){

	var map={}

	for (var i=0; i<arguments.length; i++){

		if (arguments[i][1]!=null){ //do not generate name/value pair if value is null

			map[arguments[i][0]]=arguments[i][1]

		}

	}

	return map

},



init:function(){

	var ac=this

	jQuery(document).ready(function($){

		animatedcollapse.ontoggle=animatedcollapse.ontoggle || null

		var urlparamopenids=animatedcollapse.urlparamselect() //Get div ids that should be expanded based on the url (['div1','div2',etc])

		var persistopenids=ac.getCookie('acopendivids') //Get list of div ids that should be expanded due to persistence ('div1,div2,etc')

		var groupswithpersist=ac.getCookie('acgroupswithpersist') //Get list of group names that have 1 or more divs with "persist" attribute defined

		if (persistopenids!=null) //if cookie isn't null (is null if first time page loads, and cookie hasnt been set yet)

			persistopenids=(persistopenids=='nada')? [] : persistopenids.split(',') //if no divs are persisted, set to empty array, else, array of div ids

		groupswithpersist=(groupswithpersist==null || groupswithpersist=='nada')? [] : groupswithpersist.split(',') //Get list of groups with divs that are persisted

		jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object

			this.$divref=$('#'+this.id)

			if ((this.getAttr('persist') || jQuery.inArray(this.getAttr('group'), groupswithpersist)!=-1) && persistopenids!=null){ //if this div carries a user "persist" setting, or belong to a group with at least one div that does

				var cssdisplay=(jQuery.inArray(this.id, persistopenids)!=-1)? 'block' : 'none'

			}

			else{

				var cssdisplay=this.getAttr('hide')? 'none' : null

			}

			if (urlparamopenids[0]=="all" || jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains the single array element "all", or this div's ID

				cssdisplay='block' //set div to "block", overriding any other setting

			}

			else if (urlparamopenids[0]=="none"){

				cssdisplay='none' //set div to "none", overriding any other setting

			}

			this.$divref.css(ac.generatemap(['height', this.getAttr('height')], ['display', cssdisplay]))

			this.$divref.attr(ac.generatemap(['groupname', this.getAttr('group')], ['fade', this.getAttr('fade')], ['speed', this.getAttr('speed')]))

			if (this.getAttr('group')){ //if this DIV has the "group" attr defined

				var targetgroup=ac.divgroups[this.getAttr('group')] || (ac.divgroups[this.getAttr('group')]={}) //Get settings for this group, or if it no settings exist yet, create blank object to store them in

				targetgroup.count=(targetgroup.count||0)+1 //count # of DIVs within this group

				if (jQuery.inArray(this.id, urlparamopenids)!=-1){ //if url parameter string contains this div's ID

					targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded). Overrides other settings

					targetgroup.overridepersist=1 //Indicate to override persisted div that would have been expanded

				}

				if (!targetgroup.lastactivedivid && this.$divref.css('display')!='none' || cssdisplay=="block" && typeof targetgroup.overridepersist=="undefined") //if this DIV was open by default or should be open due to persistence								

					targetgroup.lastactivedivid=this.id //remember this DIV as the last "active" DIV (this DIV will be expanded)

				this.$divref.css({display:'none'}) //hide any DIV that's part of said group for now

			}

		}) //end divholders.each

		jQuery.each(ac.divgroups, function(){ //loop through each group

			if (this.lastactivedivid && urlparamopenids[0]!="none") //show last "active" DIV within each group (one that should be expanded), unless url param="none"

				ac.divholders[this.lastactivedivid].$divref.show()

		})

		if (animatedcollapse.ontoggle){

			jQuery.each(ac.divholders, function(){ //loop through each collapsible DIV object and fire ontoggle event

				animatedcollapse.ontoggle(jQuery, this.$divref.get(0), this.$divref.css('display'))

			})

		}

 		//Parse page for links containing rel attribute

		var $allcontrols=$('a[rel]').filter('[rel^="collapse["], [rel^="expand["], [rel^="toggle["]') //get all elements on page with rel="collapse[]", "expand[]" and "toggle[]"

		$allcontrols.each(function(){ //loop though each control link

			this._divids=this.getAttribute('rel').replace(/(^\w+)|(\s+)/g, "").replace(/[\[\]']/g, "") //cache value 'div1,div2,etc' within identifier[div1,div2,etc]

			if (this.getElementsByTagName('img').length==1 && ac.divholders[this._divids]){ //if control is an image link that toggles a single DIV (must be one to one to update status image)

				animatedcollapse.preloadimage(this.getAttribute('data-openimage'), this.getAttribute('data-closedimage')) //preload control images (if defined)

				$togglerimage=$(this).find('img').eq(0).data('srcs', {open:this.getAttribute('data-openimage'), closed:this.getAttribute('data-closedimage')}) //remember open and closed images' paths

				ac.divholders[this._divids].$togglerimage=$(this).find('img').eq(0) //save reference to toggler image (to be updated inside slideengine()

				ac.divholders[this._divids].$togglerimage.attr('src', (ac.divholders[this._divids].$divref.css('display')=="none")? $togglerimage.data('srcs').closed : $togglerimage.data('srcs').open)

			}

			$(this).click(function(){ //assign click behavior to each control link

				var relattr=this.getAttribute('rel')

				var divids=(this._divids=="")? [] : this._divids.split(',') //convert 'div1,div2,etc' to array 

				if (divids.length>0){

					animatedcollapse[/expand/i.test(relattr)? 'show' : /collapse/i.test(relattr)? 'hide' : 'toggle'](divids) //call corresponding public function

					return false

				}

			}) //end control.click

		})// end control.each



		$(window).bind('unload', function(){

			ac.uninit()

		})

	}) //end doc.ready()

},



uninit:function(){

	var opendivids='', groupswithpersist=''

	jQuery.each(this.divholders, function(){

		if (this.$divref.css('display')!='none'){

			opendivids+=this.id+',' //store ids of DIVs that are expanded when page unloads: 'div1,div2,etc'

		}

		if (this.getAttr('group') && this.getAttr('persist'))

			groupswithpersist+=this.getAttr('group')+',' //store groups with which at least one DIV has persistance enabled: 'group1,group2,etc'

	})

	opendivids=(opendivids=='')? 'nada' : opendivids.replace(/,$/, '')

	groupswithpersist=(groupswithpersist=='')? 'nada' : groupswithpersist.replace(/,$/, '')

	this.setCookie('acopendivids', opendivids)

	this.setCookie('acgroupswithpersist', groupswithpersist)

},



getCookie:function(Name){ 

	var re=new RegExp(Name+"=[^;]*", "i"); //construct RE to search for target name/value pair

	if (document.cookie.match(re)) //if cookie found

		return document.cookie.match(re)[0].split("=")[1] //return its value

	return null

},



setCookie:function(name, value, days){

	if (typeof days!="undefined"){ //if set persistent cookie

		var expireDate = new Date()

		expireDate.setDate(expireDate.getDate()+days)

		document.cookie = name+"="+value+"; path=/; expires="+expireDate.toGMTString()

	}

	else //else if this is a session only cookie

		document.cookie = name+"="+value+"; path=/"

},



urlparamselect:function(){

	window.location.search.match(/expanddiv=([\w\-_,]+)/i) //search for expanddiv=divid or divid1,divid2,etc

	return (RegExp.$1!="")? RegExp.$1.split(",") : []

},



preloadimage:function(){

	var preloadimages=this.preloadimages

	for (var i=0; i<arguments.length; i++){

		if (arguments[i] && arguments[i].length>0){

			preloadimages[preloadimages.length]=new Image()

			preloadimages[preloadimages.length-1].src=arguments[i]

		}

	}

}



}

function MVAswapTabClassName(count,tabPre,llistaPre,id,className,doHitParam) {
	for(var i=1;i<=count;i++) {
		var tabIdNow = tabPre+i;
		var llistaIdNow = llistaPre+i;
		document.getElementById(tabIdNow).className = '';
		document.getElementById(llistaIdNow).className = 'hide';
		if(i == id){
			document.getElementById(tabIdNow).className = className;
			document.getElementById(llistaIdNow).className = className;
			if(doHitParam != null && doHitParam != "undefined"){
				ajaxSite_DoHit(doHitParam);
			}
			else{
				ajaxSite_DoHit();
			}
		}
	}
}

function MVAselectVideo(idv,pos,f,p,s,ojd) {
	if("true" == ojd){ajaxSite_DoHit("selectVideo");}
	var idvideo = document.getElementById("togid"+idv+pos).innerHTML;
	document.getElementById('data'+idv).innerHTML = document.getElementById('togdata'+idv+pos).innerHTML;
	var titolaux = document.getElementById('titol'+idv);
	titolaux.innerHTML = document.getElementById('togtitol'+idv+pos).innerHTML;
	titolaux.href = "/video/"+document.getElementById('togid'+idv+pos).innerHTML;
	titolaux.title = document.getElementById('togtitol'+idv+pos).innerHTML;
	f.videoid = idvideo;
	insertaEVP('divplayerEVP'+idv,f,p,s);
}

function MVAselectAudio(ida,pos,s,ojd) {
	if("true" == ojd){ajaxSite_DoHit("selectAudio");}
	var idaudio = document.getElementById('togid'+ida+pos).innerHTML;
	audio = "";
	audio += '<object width="'+s.width+'" height="'+s.height+'" align="middle" id="SRP'+idaudio+'IE" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">';
	audio += '	<param value="always" name="allowScriptAccess">';
	audio += '	<param value="/ria/players/audio/srp/srp.swf" name="movie">';
	audio += '	<param value="high" name="quality">';
	audio += '	<param value="#ffffff" name="bgcolor">';
	audio += '	<param value="false" name="menu">';
	audio += '	<param value="opaque" name="wmode" />';
	audio += '	<param value="item='+idaudio+'&skin=/audio/skin_3cat24.swf&text=1&autoPlay=false" name="flashvars">';
	audio += '	<embed width="'+s.width+'" height="'+s.height+'" align="middle" wmode="opaque" id="SRP'+idaudio+'" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" menu="false" allowscriptaccess="always" name="SRP'+idaudio+'" bgcolor="#ffffff" quality="high" src="/ria/players/audio/srp/srp.swf" flashvars="item='+idaudio+'&skin=/audio/skin_3cat24.swf&text=1&autoPlay=false">';
	audio += '</object>';
	document.getElementById('contAudioPortada'+ida).innerHTML = audio;
	document.getElementById('data'+ida).innerHTML = document.getElementById('togdata'+ida+pos).innerHTML;
	document.getElementById('titol'+ida).innerHTML = document.getElementById('togtitol'+ida+pos).innerHTML;
	document.getElementById('entradeta'+ida).innerHTML = document.getElementById('togentradeta'+ida+pos).innerHTML;
}

//function MVAselectCanal(idd,pos,f,p,s,ojd){
function MVAselectCanal(idd,pos,f,p,s,ojd,auto){
	if("true" == ojd){ajaxSite_DoHit("selectCanal");}
	document.getElementById('infoDirecte'+idd).innerHTML = '<span>Segueix en directe:</span>' + document.getElementById('togtitol'+idd+pos).innerHTML;
	f.videoid = pos;
	f.autostart = auto;
	f.poster_url = 'http://www.324.cat/img/poster-emissiodirecte-'+pos+'.jpg';
	insertaEVP('divplayerEVP'+idd,f,p,s);
}

function MVAshowToggle(idv,pos) {
	var v = document.getElementById('toginfo'+idv+pos).style.visibility;
	document.getElementById('toginfo'+idv+pos).style.visibility = (v=='visible')?'hidden':'visible';
	v = document.getElementById('togbg'+idv+pos).style.visibility;
	document.getElementById('togbg'+idv+pos).style.visibility = (v=='visible')?'hidden':'visible';
	v = document.getElementById('togplay'+idv+pos).style.visibility;
	document.getElementById('togplay'+idv+pos).style.visibility = (v=='visible')?'hidden':'visible';
}

function MVAdw_Scroll_portada(idv) {
	var wndo = new dw_scrollObj('thumb'+idv, 'scroll'+idv);
	wndo.setUpScrollControls('scrollControls'+idv);
}







/*

<script type="text/javascript">

animatedcollapse.addDiv('jason', 'fade=1,height=80px')

animatedcollapse.addDiv('kelly', 'fade=1,height=100px')

animatedcollapse.addDiv('michael', 'fade=1,height=120px')

animatedcollapse.addDiv('cat', 'fade=0,speed=400,group=pets')

animatedcollapse.addDiv('dog', 'fade=0,speed=400,group=pets,persist=1,hide=1')

animatedcollapse.addDiv('rabbit', 'fade=0,speed=400,group=pets,hide=1')



animatedcollapse.ontoggle=function($, divobj, state){ //fires each time a DIV is expanded/contracted

//$: Access to jQuery

//divobj: DOM reference to DIV being expanded/ collapsed. Use "divobj.id" to get its ID

//state: "block" or "none", depending on state

}

animatedcollapse.init()

</script>

<b><a href="javascript:animatedcollapse.show(['jason', 'kelly', 'michael'])">Show Examples 1, 2, 3</a> | <a href="javascript:animatedcollapse.hide(['jason', 'kelly', 'michael'])">Hide Examples 1, 2, 3</a></b>

<p><b>Example 1 (individual):</b></p>

<a href="javascript:animatedcollapse.toggle('jason')"><img src="toggle.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('jason')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('jason')">Slide Up</a>

<div id="jason" style="width: 300px; background: #FFFFCC; display:none">

<b>Content inside DIV!</b><br />

<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br />

</div>

<p><b>Example 2 (individual):</b></p>

<a href="javascript:animatedcollapse.toggle('kelly')"><img src="toggle.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('kelly')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('kelly')">Slide Up</a>

<div id="kelly" style="width: 300px; background: #D2FBFF; display:none">

<b>Content inside DIV!</b><br />

<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br />

</div>

<p><b>Example 3 (individual):</b></p>

<a href="javascript:animatedcollapse.toggle('michael')"><img src="toggle.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('michael')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('michael')">Slide Up</a>

<div id="michael" style="width: 300px; background: #E7FFCC; display:none">

<b>Content inside DIV!</b><br />

<b>Note: Fade effect enabled. Height programmically defined. DIV hidden using inline CSS.</b><br />

</div>

<hr style="margin: 1em 0" />

<p><b>Example 4 (part of group "pets"):</b></p>

<a href="#" rel="toggle[cat]" data-openimage="collapse.jpg" data-closedimage="expand.jpg"><img src="collapse.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('cat')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('cat')">Slide Up</a>

<div id="cat" style="width: 400px; background: #BDF381;">

The cat (Felis catus), also known as the domestic cat or house cat to distinguish it from other felines, is a small carnivorous species of crepuscular mammal that is often valued by humans for its companionship and its ability to hunt vermin. It has been associated with humans for at least 9,500 years. A skilled predator, the cat is known to hunt over 1,000 species for food. It can be trained to obey simple commands.

</div>

<p><b>Example 5 (part of group "pets"):</b></p>

<a href="#" rel="toggle[dog]" data-openimage="collapse.jpg" data-closedimage="expand.jpg"><img src="collapse.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('dog')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('dog')">Slide Up</a>

<div id="dog" style="width: 400px; background: #BDF381;">

The dog (Canis lupus familiaris) is a domesticated subspecies of the wolf, a mammal of the Canidae family of the order Carnivora. The term encompasses both feral and pet varieties and is also sometimes used to describe wild canids of other subspecies or species. The domestic dog has been one of the most widely kept working and companion animals in human history, as well as being a food source in some cultures.

</div>

<p><b>Example 6 (part of group "pets"):</b></p>

<a href="#" rel="toggle[rabbit]" data-openimage="collapse.jpg" data-closedimage="expand.jpg"><img src="collapse.jpg" border="0" /></a> <a href="javascript:animatedcollapse.show('rabbit')">Slide Down</a> || <a href="javascript:animatedcollapse.hide('rabbit')">Slide Up</a>

<div id="rabbit" style="width: 400px; background: #BDF381">

Rabbits are ground dwellers that live in environments ranging from desert to tropical forest and wetland. Their natural geographic range encompasses the middle latitudes of the Western Hemisphere. In the Eastern Hemisphere rabbits are found in Europe, portions of Central and Southern Africa, the Indian subcontinent, Sumatra, and Japan.

</div>*/


