var mydelay = 8000; //Verzögerung in milli-Sekunden
//var path = '../med-img/';
var path = 'http://geos-pl.de/picss/';
var ext  = '.jpg';
var TIMER1;
var text;
//Daten einlesen :
for (i=0; i < data_arr.length; i++) {
   sg_row = data_arr[i].split("\|");
   medimg[i] = new Image();
     medimg[i].src = path + sg_row[0] + ext;
   text[i] = new Array();
   text[i]['pznlink'] = 'http://apotheke-bockau-shop.de/bin/geossql.pl?Proc=&Sid=bockau-0-0&Stype=Pzn&Scont=' + sg_row[0];
   text[i]['title'] = sg_row[1];
   text[i]['beschr'] = sg_row[2];
   text[i]['menge'] = sg_row[3];
   text[i]['preis'] = sg_row[4];
   text[i]['bildw'] = sg_row[5];
}

function setImgWidth (Mode, Identifier, ElementNumber, w) {
  var Element = getElement(Mode, Identifier, ElementNumber);
      Element.width = w;

}

function setLink (Mode, Identifier, ElementNumber, link) {
  var Element = getElement(Mode, Identifier, ElementNumber);
      Element.href = link;

}


function change_img () {

   if (document.all && document.all.sonder.filters) {

        document.all.sonder.filters.revealTrans.Apply();
        document.all.sonder.src = medimg[counter].src;
        document.all.sonder.filters.revealTrans.Play();

   }else {
       self.document.images['sonder'].src = medimg[counter].src;
   }
   change_text();


   counter++; //nächstes Bild
   //Array ist eins länger als der höchste Index => zurück auf 0
   if (counter == medimg.length) {
      counter = 0;
   }
   clearTimeout(TIMER1);
   TIMER1=self.setTimeout("change_img()", mydelay);

}

function stop_changing() {
   clearTimeout(TIMER1);
}
function restart_changing() {
   TIMER1=self.setTimeout("change_img()",2000);
}

function change_text() {
    var preis = text[counter]['preis'];
    if (DHTML && !NS4 && !MSIE4) {
      setContent("id", "medtitle", null, text[counter]['title']);
      setContent("id", "beschr", null, text[counter]['beschr']);
      setContent("id", "menge", null, text[counter]['menge']);
      setContent("id", "preis", null, preis);
      setImgWidth("id", "sonder", null,text[counter]['bildw']);
      setLink("id", "onlinelink", null, text[counter]['pznlink']);

    }
}