var DHTML1 = (document.getElementById || document.all || document.layers);
if (!DHTML1) {
//alert('Your browser is not capable of displaying DHTML');
}

function getObj1(name) {
	if (document.getElementById) {
		this.obj = document.getElementById(name);
		this.style = document.getElementById(name).style;
	} else if (document.all) {
		this.obj = document.all[name];
		this.style = document.all[name].style;
	} else if (document.layers) {
		this.obj = document.layers[name];
		this.style = document.layers[name];
	}
}

var curImg1 = 0; // index of the array entry
var lastImg1 = 0;

var slides1 = [];
function initImageArray(length) {
    for (x=0;x<length;x = x+1) {
	slides1[x] = 'slide' + x;
    }
}

function changeSlide1 (change) {
    if (!DHTML1) return;
    firstFade1 = true;
    curImg1 += change;
    if ( curImg1 < 0 ) curImg1 = 0;
    else if ( curImg1 >= slides1.length ) curImg1 = 0;
    prepLyr1(slides1[lastImg1], true );
    fadeLayer1("image_cycle1", 10, 50);

    lastImg1 = curImg1;
} 

var clipOpacity1, lyrOpacity1;
var time1, amount1, theTime1, middle1;

function prepLyr1(idImage, vis) {
	if (!DHTML1) return;
	objImageCycle1 = new getObj1("image_cycle1");
	x1 = new getObj1( idImage );
	if (document.getElementById || document.all) {
		lyrOpacity1 = 100;
		if ( vis ) {
			middle1 = Math.round(lyrOpacity1/2);
			clipOpacity1 = lyrOpacity1;
		} else {
			middle1 = Math.round(lyrOpacity1/2);
			clipOpacity1 = middle1;
			objImageCycle1.obj.src = x1.obj.src;
		}

	}
}


function fadeLayer1(layername, amt, tim) {
	if (!DHTML1) return;
	thelayer1 = new getObj1( layername );
	if (!thelayer1) return;
	amount1 = amt;
	theTime1 = tim;
	realFade1();
}

var firstFade1 = true;

function realFade1() {
    clipOpacity1 -= amount1;
    if (clipOpacity1 < middle1 || clipOpacity1 > lyrOpacity1) {
//	if ( clipTop1 > middle1) thelayer1.style.visibility = 'hidden';
//	if (clipOpacity1 < middle1)
	if ( firstFade1 ) nextFade1();
	return;
    }
    if (document.getElementById || document.all) {
	thelayer1.style.opacity = clipOpacity1/100;
	thelayer1.style.filter = "alpha(opacity="+clipOpacity1+")";
    }
    time1 = setTimeout("realFade1()",theTime1);
}

function nextFade1() {
    firstFade1 = false;
    prepLyr1(slides1[lastImg1], false);
    fadeLayer1("image_cycle1", -10, 100);
} 