///DEWPLAYER
function play() {
  var dewp = document.getElementById("dewplayer");
  if(dewp!=null) dewp.dewplay();
}
function stop() {
  var dewp = document.getElementById("dewplayer");
  if(dewp!=null) dewp.dewstop();
}
function pose() {
  var dewp = document.getElementById("dewplayer");
  if(dewp!=null) dewp.dewpause();
}
function next() {
  var dewp = document.getElementById("dewplayer");
  if(dewp!=null) dewp.dewnext();
}
function prev() {
  var dewp = document.getElementById("dewplayer");
  if(dewp!=null) dewp.dewprev();
}

///AGRANDISSEMENT DIMAGE
 function PopupImage(img) 
{
   
  w=open("",'image','weigth=toolbar=no,scrollbars=no,resizable=yes, width=510, height=210');
  w.document.write("<HTML><BODY onblur=\"window.close();\"><IMG src='"+img+"'>");
  w.document.write("</BODY></HTML>");
  w.document.close();
}


///OUVERTURE POPUP
function OuvrirPop(url,nom,haut,Gauche,largeur,hauteur,options) {
ouvpop=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}

///Telechargement VIDEO
function QuestionDlVideo()
{
	if (GetCookie("question1fois")==null) 
{
	// pose une question au visiteur
	if (confirm("\tBONJOUR ET BIENVENUE,\n Depuis le Mardi 1 Août 2006, une interview vidéo de Manu-DPK est disponible, souhaitez-vous la télécharger maintenant ?"))
 {
		alert("\tOK ! Le chargement est en cours.\n Cette question ne vous sera plus posée si vous avez autorisé les cookies dans votre navigateur internet et  que vous ne les supprimez pas.");
		// Enregistre le cookie pour une durée de 365jours
var pathname=location.pathname;
		var myDomain=pathname.substring(0,pathname.lastIndexOf('/')) +'/';
		var date_exp = new Date();
		date_exp.setTime(date_exp.getTime()+(365*24*3600*1000)); // 24 heures
		SetCookie("question1fois","ok",date_exp,myDomain); 
	window.location="http://www.manu-dpk.net/index.php?page=compo&idmorceau=18&action=telecharge"

	}
 else
 {	
		alert("Domage, vous venez d'annuler le téléchargement de la vidéo.\n Sachez que vous pourrez l'obtenir directement à partir du site.");
		// Enregistre le cookie pour une durée de 7jours 

var pathname=location.pathname;
		var myDomain=pathname.substring(0,pathname.lastIndexOf('/')) +'/';
		var date_exp = new Date();
		date_exp.setTime(date_exp.getTime()+(7*24*3600*1000)); //7jours 
		SetCookie("question1fois","ok",date_exp,myDomain); 
}
}

function SetCookie (name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}

function getCookieVal(offset) {
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1)
      		endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
	var arg=name+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg)
                        return getCookieVal (j);
                i=document.cookie.indexOf(" ",i)+1;
                        if (i==0) break;}
	return null;
}

}

///DEBUT SCRIPT PLAYER RADIO
var clips = "RadioDpk.m3u";


var multimedObj = null;
var currentClip = -1;
var pause =
true;

function obj () {
if (multimedObj == null) multimedObj = 

document.getElementById('multimediaObject');

if (multimedObj == null)
{
var x = new Object();
x.src = ""; x.fileName = "", x.CurrentPosition = -1; x.Duration = -1; 

x.Rate = -1; x.Volume = -1;
x.stop = function ()
{};
x.play = function () {};
return x;
}
else return multimedObj;
}
function formatTime (n) {
n = Math.floor(n);
var min = Math.floor(n/60);
var
sec = n%60;

var str = "";
if (min < 10) str += "0";
str += ""+min+":";
if (sec < 10) str += "0";
str += ""+sec+"";
return str;
}
function
updateTime () {

if (pause) {
document.forms["f"].elements["timeinfo"].value = "--:-- / --:--";
setTimeout("updateTime();", 1000);
return;
}

if
(obj().CurrentPosition >= obj().Duration) nextClip();

document.forms["f"].elements["timeinfo"].value = "" + 

formatTime(obj().CurrentPosition) +
" / " + formatTime(obj().Duration) + "";
setTimeout("updateTime();", 1000);
}
function prevClip () {
currentClip--;
if (currentClip < 0)
currentClip = clips.length-1;
playClip(currentClip);
}
function clipRandom ()  {
var n = Math.floor(Math.random() * clips.length);
playClip(n);
}
function
nextClip () {
currentClip++;
if (currentClip >= clips.length) currentClip = 0;
playClip(currentClip);
}
function playClip (n) {
currentClip
= n;
obj().fileName = clips[currentClip];
obj().src = clips[currentClip];
//obj().play();
pause = false;
changeVolume(0);
changeRate(0);
document.forms["f"].elements["list"].selectedIndex
= currentClip;
}
function seek (n) {
if (pause) return;
var cp = obj().CurrentPosition;
var d = obj().Duration;

if (cp+n >= d) return
nextClip();
if (cp+n < 0) return;
obj().CurrentPosition += n;
}
function changeRate (n) {
if (pause) return;
obj().Rate += n;
document.getElementById('rateinfo').innerHTML
= "" + Math.round(obj().Rate * 100) + "%";
}
function changeVolume (n) {
if (pause) return;
obj().Volume += n;
var n = obj().Volume;
n
+= 3000;
n /= 30;
n=Math.floor(n);
document.getElementById('volumeinfo').innerHTML = ""+n+"%";
}
function clickPause (x) {

if (pause)
{
obj().play();
pause = false;
x.value = "Arrêter";
}
else {
pause = true;
obj().stop();

}
}
function
clickDownload () {
document.location = clips[currentClip];
}
///FIN SCRIPT PLAYER RADIO
