function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|\\\\s)" + className + "(\\\\s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}


function slideshow(images,divID)
{
	// var ajaxObj = this;

	if (/\b(function|object)\b/i.test(typeof XMLHttpRequest) && XMLHttpRequest)
	{
		// try..catch wird nicht universell unterstützt, ist aber hier
		// möglicherweise notwendig
		try
		{
			this.request = new XMLHttpRequest();
		}
		catch (e) {}
	}
	else if(/\b(function|object)\b/i.test(typeof ActiveXObject) && ActiveXObject)
	{
		// s.o.; try..catch ist hier notwendig
		try
		{
			this.request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) {}
	}
}




    var oc = 0;
    var ocIE = 0;
    var timer;
    var j;

    
    
    slideshow.prototype = {
    constructor: slideshow,
    request: null,


    fadeIn: function(id)
    {
        this.constructor();
		var req = this.request;
		var me = this;

        if(oc < 2)
        {
            document.getElementById(id).style.MozOpacity = oc;
            document.getElementById(id).style.opacity = oc;
            document.getElementById(id).style.filter="alpha(opacity="+ocIE+")";

            oc = oc + 0.10;
            ocIE = ocIE + 10;

            window.setTimeout(function () { me.fadeIn(id) }, 120);
            // timer = setTimeout('fadeIn(elId)',60);
        }
        document.getElementById(id).focus();
    },

    showImg: function(imgSrc,divID)
    {
        this.constructor();
		var req = this.request;
		var me = this;

        
        oc = 0;
        ocIE = 0;
        document.getElementById(divID).style.MozOpacity = 0;
        document.getElementById(divID).style.opacity = 0;
        document.getElementById(divID).style.filter="alpha(opacity="+0+")";
        document.getElementById(divID).src = imgSrc;
        this.fadeIn(divID);
    },

    
    startSlideShow: function(images,id)
    {
        clearTimeout();
        newImages = images;
        newId = id;

        this.constructor();
	   var req = this.request;
	   var me = this;

	   this.showImg(images[0],id);
	   var delay = (counter*2500)+5000;
        setTimeout(function () { me.secondslideShow(images,id,'1') },delay);        
    },


    secondslideShow: function(images,id,index)
    {
        clearTimeout();
        newImages = images;
        newId = id;

        this.constructor();
	   var req = this.request;
	   var me = this;
        
        this.showImg(images[index],id);
	   index++;
	   
	   if(index == images.length)
        {
          setTimeout(function () { me.startSlideShow(images,id) },5000);
        }
        else
        {
          setTimeout(function () { me.secondslideShow(images,id,index) },delay); 
        }
    }
  
}

