/* ------------------------------------------------------------------------------------------------ */
/* 											VIDEOS													*/
/* ------------------------------------------------------------------------------------------------ */

function getUrlPlayerVideo (idPortal) {
	var urlPlayer = null;
	
	if ((idPortal == 'abc') || (idPortal == 'diariosur') || (idPortal == 'diariosur') || (idPortal == 'eldiariomontanes') || (idPortal == 'hoy') || (idPortal == 'ideal') || (idPortal == 'lasprovincias') || (idPortal == 'laverdad') || (idPortal == 'lavozdigital') || (idPortal == 'elnortedecastilla') || (idPortal == 'nortecastilla')  || (idPortal == 'elcomercio')) {
		urlPlayer = 'http://www.' + idPortal + '.es/swf/CTVMediaPlayer.swf';	
	}
	else if ((idPortal == 'diariovasco') || (idPortal == 'elcomerciodigital') || (idPortal == 'elcorreodigital') || (idPortal == 'larioja') || (idPortal == 'surinenglish')) {
		urlPlayer = 'http://www.' + idPortal + '.com/swf/CTVMediaPlayer.swf';	
	}
	
	return urlPlayer;
}

function getZonasPublicidad (idPortal) {
	var zonas = null;
	
	if (idPortal == 'abc') {
		zonas = '33,34,31,32';
	}
	else if (idPortal == 'diariosur') {
		zonas = '37,38,35,36';
	}
	else if (idPortal == 'diariovasco') {
		zonas = '45,46,43,44';
	}
	else if (idPortal == 'elcomerciodigital') {
		zonas = '49,50,47,48';
	}
	else if (idPortal == 'elcomercio') {
		zonas = '49,50,47,48';
	}
	else if (idPortal == 'elcorreodigital') {
		zonas = '41,42,39,40';
	}
	else if (idPortal == 'eldiariomontanes') {
		zonas = '73,74,71,72';
	}
	else if (idPortal == 'hoy') {
		zonas = '13,14,15,12';
	}
	else if (idPortal == 'ideal') {
		zonas = '57,58,55,56';
	}
	else if (idPortal == 'larioja') {
		zonas = '61,62,59,60';
	}
	else if (idPortal == 'lasprovincias') {
		zonas = '65,66,63,64';
	}
	else if (idPortal == 'laverdad') {
		zonas = '77,78,75,76';
	}
	else if (idPortal == 'lavozdigital') {
		zonas = '69,70,67,68';
	}
	else if (idPortal == 'nortecastilla') {
		zonas = '81,82,79,80';
	}
	else if (idPortal == 'elnortedecastilla') {
		zonas = '81,82,79,80';
	}
	else if (idPortal == 'surinenglish') {
		zonas = '85,86,83,84';
	}
	
	return zonas;	
}

function pintaVideo (idPortal, urlVideo, urlImagen, width, height, nombreDIV) {
	var urlPlayer = getUrlPlayerVideo(idPortal);
	if (urlPlayer != null) {
		var Player = urlPlayer;  
		var Video = urlVideo; 
		var Imagen = urlImagen;				
		var so = new SWFObject(Player, "pg_mp3", width, height, "8");
		so.addParam("allowfullscreen", "true");
		so.addParam('wmode', 'transparent');
		so.addParam("menu","false");
		so.addVariable('enablejs','true');
		so.addVariable("javascriptid","pg_mp3");
		so.addVariable("width", width);
		so.addVariable("height", height);
		so.addVariable('overstretch','false');	
		so.addVariable('usefullscreen','true');
		so.addVariable('displayheight',height);
		so.addVariable("file", Video);
		so.addVariable("image", Imagen);
		so.write(nombreDIV);	
	} 
}

function pintaVideoConPublicidad (idPortal, urlVideo, urlImagen, width, height, nombreDIV, categoria) {
	var urlPlayer = getUrlPlayerVideo(idPortal);
	if (urlPlayer != null) {
		var Player = urlPlayer;  
		var Video = urlVideo; 
		var Imagen = urlImagen;				
		var so = new SWFObject(Player, "pg_mp3", width, height, "8");
		so.addParam("allowfullscreen", "true");
		so.addParam('wmode', 'transparent');
		so.addParam("menu","false");
		so.addVariable('enablejs','true');
		so.addVariable("javascriptid","pg_mp3");
		so.addVariable("width", width);
		so.addVariable("height", height);
		so.addVariable('overstretch','false');	
		so.addVariable('usefullscreen','true');
		so.addVariable('displayheight',height);
		so.addVariable("file", Video);
		so.addVariable("image", Imagen);
		
		// Publicidad
		var sTags = 'CAT' + categoria + ',POR' + idPortal;
		var zonas = getZonasPublicidad (idPortal);
		if (zonas != null) {
	        so.addVariable("sZonas", zonas);
	        so.addVariable("p1U", zonas);
	        so.addVariable("sTags", sTags);        			
		}
		
		so.write(nombreDIV);	
	} 
}

/* ------------------------------------------------------------------------------------------------ */
/* 											AUDIOS													*/
/* ------------------------------------------------------------------------------------------------ */

function getUrlPlayerAudio (idPortal) {
	var urlPlayer = null;
	
	if ((idPortal == 'abc') || (idPortal == 'diariosur') || (idPortal == 'diariosur') || (idPortal == 'eldiariomontanes') || (idPortal == 'hoy') || (idPortal == 'ideal') || (idPortal == 'lasprovincias') || (idPortal == 'laverdad') || (idPortal == 'lavozdigital') || (idPortal == 'nortecastilla') || (idPortal == 'elnortedecastilla') || (idPortal == 'elcomercio')) {
		urlPlayer = 'http://www.' + idPortal + '.es/swf/CTVAudioPlayer.swf';	
	}
	else if ((idPortal == 'diariovasco') || (idPortal == 'elcomerciodigital') || (idPortal == 'elcorreodigital') || (idPortal == 'larioja') || (idPortal == 'surinenglish')) {
		urlPlayer = 'http://www.' + idPortal + '.com/swf/CTVAudioPlayer.swf';	
	}
	
	return urlPlayer;
}

function pintaAudio (idPortal, urlAudio, urlImagen, width, height, nombreDIV) {
	var urlPlayer = getUrlPlayerAudio(idPortal);

	var so = new SWFObject(urlPlayer,'mpa1', width, height, '7');
	so.addParam("allowfullscreen", "false");
	so.addVariable('file', urlAudio);
	so.addVariable('width', width);
	so.addVariable("height", height);
	so.addParam("wmode", "transparent");
	if (urlImagen != null) {
		so.addVariable("image", urlImagen);
	}
	so.write(nombreDIV);
}

