var sponsor = new Array();	
var url = new Array();

sponsor[0] = "genzyme";		url[0] = "http://www.genzyme.com";
sponsor[1] = "nycomed";		url[1] = "http://www.nycomed.at";
sponsor[2] = "pfizer";		url[2] = "http://www.pfizer.at";
sponsor[3] = "abbott";		url[3] = "http://";
sponsor[4] = "novartis";	url[4] = "http://www.transplant.at";
sponsor[5] = "fresenius";	url[5] = "http://www.fmc-ag.com";
sponsor[6] = "roche";		url[6] = "http://www.roche.at";
sponsor[7] = "amgen";		url[7] = "http://www.amgen.at";
sponsor[8] = "baxter";		url[8] = "http://www.renal.at";
sponsor[9] = "astropharma";		url[9] = "http://www.astro-pharma.at";
sponsor[10] = "janssen";	url[10] = "http://www.janssen-cilag.at";
sponsor[11] = "wyeth";		url[11] = "http://www.wyeth.at";
sponsor[12] = "takeda";		url[12] = "http://";
sponsor[13] = "shire";		url[13] = "http://www.shire.de";
sponsor[14] = "gambro";		url[14] = "http://www.gambro.at";
sponsor[15] = "sanova";		url[15] = "http://www.sanova.at";
sponsor[16] = "astellas";	url[16] = "http://www.astellas-transplant.at";
sponsor[17] = "inovamet";	url[17] = "http://www.inovamet.at";
sponsor[18] = "daiichi-sankyo";	url[17] = "http://www.daiichi-sankyo.at";

var count = 1;
var active = new Array();
	
active[0] = -1;
active[1] = -1;
active[2] = -1;
active[3] = -1;
active[4] = -1;

function active_sponsor(index)
{
	found = false;
	
	for(j = 0; j <= 4; j++)
	{
		if(active[j] == index){found = true;}
	}
	
	return found;
}

function init_sponsor()
{
	for(i = 1; i <= 5; i++)
	{
		do
		{
			random_number = Math.random();
			index = Math.floor(random_number * sponsor.length);
		}
		while(active_sponsor(index))

		active[i - 1] = index;

		if(i == 1){document.images['sponsor1'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
		if(i == 2){document.images['sponsor2'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
		if(i == 3){document.images['sponsor3'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
		if(i == 4){document.images['sponsor4'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
		if(i == 5){document.images['sponsor5'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
	}
	window.setInterval("cycle_sponsor()", 2000);
}

function cycle_sponsor()
{
	do
	{
		random_number = Math.random();
		index = Math.floor(random_number * sponsor.length);
	}
	while(active_sponsor(index))

	active[count - 1] = index;

	if(count == 1){document.images['sponsor1'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
	if(count == 2){document.images['sponsor2'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
	if(count == 3){document.images['sponsor3'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
	if(count == 4){document.images['sponsor4'].src = "images/sponsoren/" + sponsor[index] + ".gif";}
	if(count == 5){document.images['sponsor5'].src = "images/sponsoren/" + sponsor[index] + ".gif";}

	count++;
	if(count > 5){count = 1;}
}

function select_sponsor(index)
{
	window.open(url[active[index - 1]]);
}