sponsors = new Array({imgSrc:"sponsorenfotos/alpenhof.gif",sponsorUrl:"http://www.alpen-hof.info"},
		     {imgSrc:"sponsorenfotos/dacapo.gif", sponsorUrl:"http://www.dacapo.at"},
		     {imgSrc:"sponsorenfotos/freisinger.jpg", sponsorUrl:"http://www.freisinger-holzbau.at/"},
		     {imgSrc:"sponsorenfotos/raiffeisen.jpg", sponsorUrl:"http://www.raiffeisen-versicherung.at/"},
		     {imgSrc:"sponsorenfotos/rosseeo.jpg", sponsorUrl:"http://www.rosseeo.at/"},		     
		     {imgSrc:"sponsorenfotos/voba.gif", sponsorUrl:"http://www.volksbankkufstein.at/"},		     
		     {imgSrc:"sponsorenfotos/witti.gif", sponsorUrl:"http://www.wittlinger-therapiezentrum.at"}		     
		     );

window.onload = sponsorChange;
window.setInterval("sponsorChange()", 4000);

function sponsorChange() {
	var randomSponsorNumber = Math.floor(Math.random()*sponsors.length);
	var sponsorSpan = document.getElementById("sponsors");
	removeAllChilds(sponsorSpan);
	var sponsor = sponsors[randomSponsorNumber];
	var parentDiv = document.createElement("div");
	parentDiv.setAttribute("style","padding-LEFT: 206px;padding-TOP: 22px;width: 270px;height:100px;");
	sponsorSpan.appendChild(parentDiv);

	if(sponsor.sponsorUrl != null) {
		var linkTag = document.createElement("a");
		linkTag.href = sponsor.sponsorUrl;
		linkTag.target = "_blank";
		linkTag.setAttribute("style", "color:#F7D000");

		var imgTag = document.createElement("img");
		imgTag.src = sponsor.imgSrc;
		linkTag.appendChild(imgTag);
		
		parentDiv.appendChild(linkTag);
	}
	else {
		var imgTag = document.createElement("img");
		imgTag.src = sponsor.imgSrc;
		

		parentDiv.appendChild(imgTag);
	}

}

function removeAllChilds(elem) {
if ( elem.hasChildNodes() )
{
    while ( elem.childNodes.length >= 1 )
    {
        elem.removeChild( elem.firstChild );       
    } 
}
	
}

