// JavaScript Document

var basedir       = '' ;
var mediasdir     = basedir + '/blog/public/' ;
var playersdir    = basedir + '/blog/players/' ;
var mp3player     = playersdir + 'dewplayer.swf' ;
var flvplayer     = playersdir + 'mediaplayer.swf' ;
var diapoplayer   = playersdir + 'diapo.swf' ;
var rotatorplayer = playersdir + 'imagerotator.swf' ;
var zoomplayer    = playersdir + 'zoomifyViewer.swf' ;

var idmp3     = 0 ;
var idflv     = 0 ;
var iddiapo   = 0 ;
var idrotator = 0 ;
var idzoom    = 0 ;

function liremp3(file,legende) {
	mp3file = mediasdir + file + ".mp3" ;

	idmp3 ++ ;
	
	html  = '<div class="lecteur-mp3">\n' ;
	html += '<span class="legende">' + legende + '</span>\n' ;
	html += '<div class="player-container">\n' ;
	html += '<div class="player" id="mp3player' + idmp3 + '"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\n' ;
	html += '<div class="img-telecharger">\n' ;
	html += '<a target="_blank" href="../' + mp3file + '">\n' ;
	html += '<img alt="Clic droit, enregistrer la cible du lien sous..." src="' + playersdir + 'telecharger.png" />\n' ;
	html += '</a>\n' ;
	html += '</div>\n' ;
	html += '</div>\n' ;
	html += '</div>\n' ;
	html += '<br class="nettoyeur" />\n' ;

	document.write( html );
	var so = new SWFObject(mp3player,'dp'+idmp3,'200','20','6');
	so.addParam('allowscriptaccess','always');
	so.addParam('quality','high');
	so.addParam('bgcolor','FFFFFF');
	so.addParam('wmode','transparent');
	so.addVariable('width','200');
	so.addVariable('height','20');
	so.addVariable('mp3', mp3file );
	so.addVariable('showtime','1');
	so.write('mp3player'+idmp3);

	return("true");
}


function lireflv(file, legende, largeur, hauteur) {
	flvfile = mediasdir + file + '.flv' ;
	jpgfile = mediasdir + file + '.jpg' ;
	hauteurtotale = hauteur + 20 ;

	idflv ++ ;
	
	html  = '<div class="lecteur-flv">\n' ;
	html += '<div class="player" id="flvplayer'+idflv+'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\n' ;
	html += '<div class="legende">' + legende + '</div>\n' ;
	html += '</div>\n' ;
	html += '<br class="nettoyeur" />\n' ;

	document.write( html );
	var s0 = new SWFObject(flvplayer,'mp'+idflv,largeur,hauteurtotale,'7');
	s0.addParam('allowfullscreen','true');
	s0.addParam('quality','high');
	s0.addParam('bgcolor','FFFFFF');
	s0.addParam('wmode','transparent');
	s0.addVariable('width',largeur);
	s0.addVariable('height',hauteurtotale);
	s0.addVariable('file',flvfile);
	s0.addVariable('image',jpgfile);
	s0.addVariable('displayheight',hauteur);
	s0.addVariable('searchbar','false');
	s0.addVariable('frontcolor','0x00CC00');
	s0.addVariable('lightcolor','0xFF9900');
	s0.addVariable('screencolor','0xFFFFFF');
	s0.addVariable('showstop','true');
	s0.addVariable('showdownload','true');
	s0.write('flvplayer'+idflv);

	return("true");
}

function lirediapo(dir, nb, zik, enroute) {
	diapodir = mediasdir + dir ;

	iddiapo ++ ;
	
	html  = '<div class="lecteur-diapo">\n' ;
	html += '<div class="player" id="diapoplayer'+iddiapo+'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\n' ;
	html += '</div>\n' ;
	html += '<br class="nettoyeur" />\n' ;

	document.write( html );
	var s0 = new SWFObject(diapoplayer,'dp'+iddiapo,'560','420','6');
	s0.addParam('allowfullscreen','false');
	s0.addParam('quality','high');
	s0.addParam('bgcolor','FFFFFF');
	s0.addParam('wmode','transparent');
	s0.addVariable('p_nb_img',nb);
	s0.addVariable('p_duree','5000');
	s0.addVariable('p_largeurBordure','1');
	s0.addVariable('p_couleurBordure','000000');
	s0.addVariable('p_chemin',diapodir);
	s0.addVariable('p_nom','img');
	s0.addVariable('p_affichernumero','1');
	s0.addVariable('p_son',zik);
	s0.addVariable('p_sonEnRoute',enroute);
	s0.addVariable('p_hp','1');
	s0.write('diapoplayer'+iddiapo);
	return("true");
}

function lirerotator(xmlfile) {

	rotatorfile = mediasdir + xmlfile ;
	idrotator ++ ;
	
	html  = '<div class="lecteur-rotator">\n' ;
	html += '<div class="player" id="rotatorplayer'+idrotator+'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\n' ;
	html += '</div>\n' ;
	html += '<br class="nettoyeur" />\n' ;
  
	document.write( html );
	var s0 = new SWFObject(rotatorplayer,'rp'+idrotator,'560','420','7');
	s0.addParam('allowfullscreen','false');
	s0.addParam('quality','high');
	s0.addParam('bgcolor','FFFFFF');
	s0.addParam('wmode','transparent');
	s0.addVariable('file',rotatorfile);
	s0.addVariable('transition','fade');
	s0.addVariable('shownavigation','false');
	s0.addVariable('overstretch','false');
	s0.write('rotatorplayer'+idrotator);
	return("true");
}

function lirezoom(dir, zoom, x) {
	zoomdir = mediasdir + dir ;
	idzoom ++ ;
	
	html  = '<div class="zoomify">\n' ;
	html += '<div class="player" id="zoom'+idzoom+'"><a href="http://www.macromedia.com/go/getflashplayer">Get the Flash Player</a> to see this player.</div>\n' ;
	html += '</div>\n' ;
	html += '<br class="nettoyeur" />\n' ;

	document.write( html );
	var s0 = new SWFObject(zoomplayer,'z'+idzoom,'560','450','6');
	s0.addParam('allowfullscreen','false');
	s0.addParam('quality','high');
	s0.addParam('bgcolor','FFFFFF');
	s0.addParam('wmode','transparent');
	s0.addParam('MENU','FALSE');
	s0.addVariable('zoomifyImagePath',zoomdir);
	s0.addVariable('zoomifyZoom',zoom);
	s0.addVariable('zoomifyX',x);
	s0.write('zoom'+idzoom);
	return("true");
}
