vLastPlayedLast = 'Ha sonat: ';
vLastPlayedNow = 'Estŕ sonant: ';

function HTML(w, oParam){
	var op = '';
	switch(w){
		
		/**
		 * Login Failure Message
		 * --------------------------------------------------------------------------------
		 */
		case 'LoginFailureMessage':
			op += '<div class="warning">';
			op += 	'Nom d\'usuari/clau incorrecte';
			op += '</div>';
			op += '<ul>';
			op += 	'<li><a href="https://secure.ccrtvi.com/su/cr/crClauOblidada.jsp" target="_blank">Recordar clau</a></li>';
			op += 	'<li><a href="https://secure.ccrtvi.com/su/cr/crReg1.jsp" target="_blank">Registra\'t</a></li>';
			op += '</ul>';
			break;
		
		
		/**
		 * Anonymous Identification Form
		 * --------------------------------------------------------------------------------
		 */
		case 'AnonymousID':
			
			op += '<div class="result">';
			op +=    '<img src="img/message_error.gif" alt="Enviant" />';
			op +=    '<div>';
			op +=       'Recorda que per participar en el debat has de ser usuari registrat.';
			op += 		'<div><strong>Si us plau, inicia sessió.</strong></div>';
			op += 		'<div><strong>Si no tens usuari, <a href="/registre" target="_blank">registra\'t</a>.</strong></div>';
			op +=    '</div>';
			op += '</div>';

			break;
			
		
		
		/**
		 * Anonymous Identification Loading Status
		 * --------------------------------------------------------------------------------
		 */
		case 'AnonymousIDLoading':
			op += '<div class="loading"><img src="img/sending2.gif" alt="Enviant" /><div>Enviant</div></div>';
			break;
			
		/**
		 * Anonymous Identification Success Window
		 * --------------------------------------------------------------------------------
		 */
		case 'AnonymousIDSuccess':
			op += '<div class="result">';
			op +=    '<img src="img/message_ok.gif" alt="Enviant" />';
			op +=    '<div>';
			//op +=       'El teu missatge s\'ha enviat correctament.';
			if( code==0 && modType=="PUBNM" ) {
				op += 		'<div><strong>El teu missatge s&acute;ha enviat correctament, per&ograve; tardar&agrave; uns moments a   publicar-se. </strong><br>Gr&agrave;cies per haver participat</div>';
			}else{
				op += 		'<div><strong>El teu missatge s&acute;ha enviat correctament.</strong> Es publicar&agrave; quan hagi passat el   proc&eacute;s de validaci&oacute;. <br>Gr&agrave;cies per haver participat.</strong></div>';	
			}
			op +=    '</div>';
			op += '</div>';
			break;
		
		
		/**
		 * Anonymous Identification Failure Window
		 * --------------------------------------------------------------------------------
		 */
		case 'AnonymousIDFailure':
			op += '<div class="result">';
			op +=    '<img src="img/message_error.gif" alt="Enviant" />';
			op +=    '<div>';
			op +=       'El teu missatge no s\'ha pogut enviar.';
			op += 		'<div><strong>Torna-ho a intentar.</strong></div>';
			op +=    '</div>';
			op += '</div>';
			break;

		/**
		 * If the arrow points to llistaBCs[0], we try to put the divTitol's title
		 * because when we initialize the llistaTitolsBCs[0], maybe we haven't
		 * updated this. If it fails, we put the default title.
		 */			
		case 'HeaderLastPlayed':
			op += '<span id="arrowsLastPlayed">';//last played
			var bScrollLeft= (indexLastSelected < (numBCs -1))? true : false;
			var bScrollRight= (indexLastSelected >0)? true: false;
			// Left scroll arrow?
			if(bScrollLeft) {
				op += '<a class="thumbnail" href="javascript:loadBCFromList('+(indexLastSelected+1)+')" style="float: left; margin-right: 5px;';
				if(!bScrollRight) op += ' margin-right: 22px;';
				op += '">';
				op += '<img src="img/h3previous.gif" alt="" />';
				
				var vTitleTmp;
				if ((indexLastSelected+1)==0){
					try{vTitleTmp= vLastPlayedNow + vdivTitol.data["titol"]; if(vTitleTmp==undefined) throw("no data");}
					catch(error){vTitleTmp= vLastPlayedNow + vlastPlayed.data["llistaTitolsBCs"][0];}
				}
				else {
					vTitleTmp= vLastPlayedLast + vlastPlayed.data["llistaTitolsBCs"][(indexLastSelected+1)];
				}
				//alert("len: "+vlastPlayed.data["llistaTitolsBCs"].length);
				op += '<span>'+vTitleTmp+'</span>';
				op += '</a>';
			}
			
			// Right scroll arrow?
			if(bScrollRight) {
				op += '<a class="thumbnail" href="javascript:loadBCFromList('+(indexLastSelected-1)+')" style="float: left; margin-right: 5px;';
				if(!bScrollLeft) op += ' margin-left: 16px;';
				op += '">';
				op += '<img src="img/h3next.gif" alt="" />';
				var vTitleTmp;
				if ((indexLastSelected-1)==0){
					try{vTitleTmp= vLastPlayedNow + vdivTitol.data["titol"]; if(vTitleTmp==undefined) throw("no data");}
					catch(error){vTitleTmp= vLastPlayedNow + vlastPlayed.data["llistaTitolsBCs"][0];}
				}
				else {
					vTitleTmp= vLastPlayedLast + vlastPlayed.data["llistaTitolsBCs"][(indexLastSelected-1)];
				}
				op += '<span>'+vTitleTmp+'</span>';
				op += '</a>';
			}
			op += '</span>';//last played
			
			if(vlastPlayed.data["llistaTitolsBCs"].length <=1){
				//Do not add any title
			}else if (indexLastSelected==0){
				op += vTitolLastPlayed;
			}
			else{
				op += vLastPlayedLast + oParam;
			}	
			break;
			
		case 'HideCommentRows':
			op += 'En aquests moments els comentaris estan desactivats.';
			op += 'Si ens vols contactar, ho pots fer a trav&eacute;s de:';
			op += '<p>';
			op +=    '<a title="Atenció a l\'Audičncia" href="http://www.catradio.cat/atencio">Atenció a l\'Audičncia <img class="contacta" alt="Atenció a l\'Audičncia" src="http://proves.catradio.cat/img/logoatencio_peu.gif"/></a>';
			op += '</p>';		
			break;
			
		/**
		 * InactiveMessages
		 * --------------------------------------------------------------------------------
		 */
		case 'InactiveMessages':
			op += '<div class="warning">';
			op += 	'Els comentaris no estan activats!';
			op += '</div>';
			break;			
		
	}
	
	// return the requested piece of HTML
	return op;
}

function disableLiveInterface() {

	var thumbs = new Array();
	// programacio estiu
	/*
	thumbs[0] = new Array();
	thumbs[0]['source'] = 'img/thumb_factorestiu2011.jpg';
	thumbs[0]['title'] = 'Factor estiu';
	thumbs[0]['description'] = 'de dilluns a divendres, de 16.00 a 19.00';
	
	thumbs[1] = new Array();
	thumbs[1]['source'] = 'img/thumb_generaciodigital2010.jpg';
	thumbs[1]['title'] = 'Generació digital';
	thumbs[1]['description'] = 'dissabte, de 16.00 a 18.00';
	*/
	// per la tardor
	/*thumbs[0] = new Array();
	thumbs[0]['source'] = 'img/thumb_elmati2010.jpg';
	thumbs[0]['title'] = 'El matí de Catalunya Rŕdio';
	thumbs[0]['description'] = 'de dilluns a divendres, de 06.00 a 12.00';

	thumbs[1] = new Array();
	thumbs[1]['source'] = 'img/thumb_totesmoltconfus2010.jpg';
	thumbs[1]['title'] = 'Tot és molt confús';
	thumbs[1]['description'] = 'de dilluns a divendres, de 12.00 a 14.00';

	thumbs[2] = new Array();
	thumbs[2]['source'] = 'img/thumb_loracle2010.jpg';
	thumbs[2]['title'] = 'L\'oracle';
	thumbs[2]['description'] = 'de dilluns a divendres, de 15.00 a 16.00';
	
	thumbs[3] = new Array();
	thumbs[3]['source'] = 'img/thumb_elsecret2010.jpg';
	thumbs[3]['title'] = 'El secret';
	thumbs[3]['description'] = 'de dilluns a divendres, de 16.00 a 19.00';

	thumbs[4] = new Array();
	thumbs[4]['source'] = 'img/thumb_elcafedelarepublica2010.jpg';
	thumbs[4]['title'] = 'El Cafč de la República';
	thumbs[4]['description'] = 'de dilluns a divendres, de 21.00 a 23.00';

	thumbs[5] = new Array();
	thumbs[5]['source'] = 'img/thumb_clubdelamitjanit2010.jpg';
	thumbs[5]['title'] = 'El club de la mitjanit';
	thumbs[5]['description'] = 'de dilluns a divendres, de 23.00 a 01.00';

	thumbs[6] = new Array();
	thumbs[6]['source'] = 'img/thumb_mans2010.jpg';
	thumbs[6]['title'] = 'Mans';
	thumbs[6]['description'] = 'dissabte, de 6.00 a 8.00';
	
	thumbs[7] = new Array();
	thumbs[7]['source'] = 'img/thumb_generaciodigital2010.jpg';
	thumbs[7]['title'] = 'Generació digital';
	thumbs[7]['description'] = 'dissabte, de 16.00 a 18.00';

	thumbs[8] = new Array();
	thumbs[8]['source'] = 'img/thumb_totgira2010.jpg';
	thumbs[8]['title'] = 'Tot gira';
	thumbs[8]['description'] = 'dissabte, de 18.00 a 01.00, i diumenge, de 16.00 a 23.00';*/

	InterfaceAgent.disableLiveInterface(thumbs);
}

