var curr	= 0;
var img		= new Array();
var amp		= new Array();

var ampel	= new Array();

ampel[1]	= new Array("../images/ampel/3_off.jpg","../images/ampel/3_on.jpg",96,73);
ampel[2]	= new Array("../images/ampel/2_off.jpg","../images/ampel/2_on.jpg",96,64);
ampel[3]	= new Array("../images/ampel/1_off.jpg","../images/ampel/1_on.jpg",96,74);

function preload(set) {
	if (images.length>0) {
		for (i=1;i<=(images.length-1);i++) {
			timg				= images[i];
			img[i]				= new Array();
			img[i]["on"]		= new Image();
			img[i]["on"].src	= timg[1];
			img[i]["on"].b		= timg[2];
			img[i]["on"].h		= timg[3];
			img[i]["off"]		= new Image();
			img[i]["off"].src	= timg[0];
			img[i]["off"].b		= timg[2];
			img[i]["off"].h		= timg[3];
		}
	}
	if (ampel.length>0) {
		for (i=1;i<=(images.length-1);i++) {
			timg				= ampel[i];
			amp[i]				= new Array();
			amp[i]["on"]		= new Image();
			amp[i]["on"].src	= timg[1];
			amp[i]["on"].b		= timg[2];
			amp[i]["on"].h		= timg[3];
			amp[i]["off"]		= new Image();
			amp[i]["off"].src	= timg[0];
			amp[i]["off"].b		= timg[2];
			amp[i]["off"].h		= timg[3];
			
		}
	}
	if (set) {
		setPicture(set);
		curr	= set;
	} else {
		setPicture(0);
	}
}

function setPicture (no,state) {

	for (i=1;i<=(img.length-1);i++) {
		if (i==no) {
			document.getElementById("item"+i).src	= img[i]["on"].src;
			document.getElementById("ampel"+i).src	= amp[i]["on"].src;
		} else {
			if (curr==i) {
				document.getElementById("item"+i).src	= img[i]["on"].src;
			} else {
				document.getElementById("item"+i).src	= img[i]["off"].src;
				document.getElementById("ampel"+i).src	= amp[i]["off"].src;
			}
		}
	}
}

function get(no,url) {
	curr = no;
	setPicture(no);
	parent.icontent.location.href=url;
}

