
var DHTML = (document.getElementById || document.all || document.layers);
var crossFadeDuration = 1; /* Duration of crossfade (seconds) */
var recallinterval = 1000; /* intervalof a-s image (milliseconds) */
var j=0;
var w=1;

var timer = null;
var timer2 = null;
var loaded= 0;




function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}

function invi(id,flag)
{
	if (!DHTML) return;
	var x = new getObj(id);
	x.style.visibility = (flag) ? 'hidden' : 'visible'
}

function fill_div (id,text) {
	if (!DHTML) return;
	var x = new getObj(id);
	x.obj.innerHTML = '';
	x.obj.innerHTML = text;
}

function countmusic(txt)
{
// var t='<iframe src="http://www.hervejacque.be/test/counters/count.php?what='+txt+'"></iframe>';
var t='<iframe src="counters/count.php?what='+txt+'"></iframe>';


// window.alert(t);

   fill_div("count",t);

// window.open(t,"_blank");

}

function runmusic(musicname){

countmusic(musicname);

txt='<OBJECT id="mediaPlayer" width="320" height="45" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Chargement des composants Microsoft Windows Media Player..." type="application/x-oleobject"><param name="fileName" value="'+musicname+'.mp3"><param name="animationatStart" value="false"><param name="transparentatStart" value="true"><param name="autoStart" value="true"><param name="showControls" value="true"><param name="showstatusbar" value="false"><param name="loop" value="false"><EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="mediaPlayer" name="mediaPlayer" displaysize="4" autosize="-1" bgcolor="darkblue" showcontrols="true" showtracker="-1" showdisplay="0" showstatusbar="false" videoborder3d="-1" width="320" height="45" src="'+musicname+'.mp3" autostart="true" designtimesp="5311" loop="false"></EMBED> </OBJECT>';

if (!DHTML) 
{
 window.open(musicname+".mp3","_parent"); 
 return;
}
else
{
invi("music",false);
fill_div("music",txt);
}
}




function msg(txt){

window.alert(txt);

}




function pictloaded(){
	loaded=1;
        display_buttons();
}

function disable_buttons(){
	document.images["next"].src = "forth-off.gif";
  	document.images["prev"].src = "back-off.gif";
}
function button_no_next(){
  document.images["next"].src = "forth-off.gif";
}
function button_no_prev(){
  document.images["prev"].src = "back-off.gif";
}
function button_next(){
  document.images["next"].src = forth.src;
}
function button_prev(){
  document.images["prev"].src = back.src;
}

function display_buttons(){

	if (j > 0) {button_prev();}
        if (j == (Pic.length-1)) {button_no_next();}
	if (j < (Pic.length-1)) {button_next();}
        if (j == 0) {button_no_prev();}
}


function display_pict(id){

//        disable_buttons();

        display_buttons();

	document.images["picture"].src = preLoadPic[id].src;

//  	if (document.all){document.images["picture"].filters.blendTrans.Play();}

}



function next_picture(){ 

  if (j == (Pic.length-1)) {return;}
  if (loaded==0) {return;}

//  if (document.all){ 
//      document.images["picture"].style.filter="blendTrans(duration=crossFadeDuration)";
//      document.images["picture"].filters.blendTrans.Apply();  }

  if (j < (Pic.length-1)) {
	j = j + 1;


// display picture


	display_pict(j);

	// pre-load next

  	w = w + 1;
  	if (w <= (Pic.length-1)){
      		preLoadPic[w] = new Image();
      		preLoadPic[w].src = Pic[w];

  	}
  } else button_no_next();

} 

function prev_picture(){ 

  if (j == 0) {button_no_prev();return;}
  if (loaded==0) {return;}

//  if (document.all){ 
//      document.images["picture"].style.filter="blendTrans(duration=crossFadeDuration)";
//      document.images["picture"].filters.blendTrans.Apply(); }

  if (j == -1) {return;}
  if (j > 0) {

	j = j - 1;
	
// display picture


	display_pict(j);

	// pre-load next
 
 	w = w + 1;
  	if (w <= (Pic.length-1)){
      		preLoadPic[w] = new Image();
      		preLoadPic[w].src = Pic[w];
  	}
  } else button_no_prev();
} 
 