// diashow


var diashow_data = new Array();
var diashow_pos  = 0;
var play = false;

function diashow_define(picture) {
  diashow_data[diashow_data.length] = new Array(picture);
}

function diashow_update(id,speed) {
  if(play) {
      container = document.getElementById(id);
      img = diashow_data[diashow_pos++];
      if (diashow_pos >= diashow_data.length) {
        diashow_pos = 0;
      }
      container.innerHTML = '<a href="javascript:next();"><img lowsrc="images/load.gif" src="'+img+'" border="0"></a>';
      setTimeout('diashow_update("'+id+'",'+speed+')',speed);
  }
}

function update_image(id, pos) {
   container = document.getElementById(id);
   img = diashow_data[pos];
   container.innerHTML = '<a href="javascript:next();"><img src="'+img+'" border="0"></a>';
}

function previous() {
    if(diashow_pos <= 0) {
        diashow_pos = diashow_data.length-1;
    } else {
        diashow_pos--;
    }
    update_image("g",diashow_pos);
}

function next() {
    if(diashow_pos == diashow_data.length-1) {
        diashow_pos = 0;
    } else {
        diashow_pos++;
    }
    update_image("g",diashow_pos);
}

function dplay() {
    play = true;
    container = document.getElementById("player");
    container.innerHTML = '<a href="javascript:dstop();"><img src="images/pause.png" border="0" />';
    diashow_update("g",3000);
	document.getElementById("pfeil_links").style.display = "none";
	document.getElementById("pfeil_rechts").style.display = "none";
}

function dstop() {
    play = false;
    container = document.getElementById("player");
    container.innerHTML = '<a href="javascript:dplay();"><img src="images/play.png" border="0" />';
	document.getElementById("pfeil_links").style.display = "block";
	document.getElementById("pfeil_rechts").style.display = "block";
}
