var ol_current_gc_bg = 1;
var olimgdiv = "ol_bgout";

window.addEvent('domready', function(){
	ol_display_time();
});

function ol_display_time() {
window.setTimeout('ol_load_fade_out()',(ol_timer*500));
}
 
function ol_load_fade_out() {
$(olimgdiv).fx = $(olimgdiv).effect('opacity', {duration: 300}).start(0);
window.setTimeout('ol_change_img()',500);
}

function ol_load_fade_in() {
$(olimgdiv).fx = $(olimgdiv).effect('opacity', {duration: 300}).start(1);
window.setTimeout('ol_display_time()',(ol_timer*600));
}

function ol_change_img() {

if (ol_current_gc_bg == "1") {
	document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_2 + ")";
	ol_current_gc_bg = 2;
}

else if (ol_current_gc_bg == "2") {
	if (ol_bgr == "2") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_1 + ")";
		ol_current_gc_bg = 1;
	}
	if (ol_bgr > "2") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_3 + ")";
		ol_current_gc_bg = 3;
	}
}

else if (ol_current_gc_bg == "3") {
	if (ol_bgr == "3") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_1 + ")";
		ol_current_gc_bg = 1;
	}
	if (ol_bgr > "3") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_4 + ")";
		ol_current_gc_bg = 4;
	}
}

else if (ol_current_gc_bg == "4") {
	if (ol_bgr == "4") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_1 + ")";
		ol_current_gc_bg = 1;
	}
	if (ol_bgr > "4") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_5 + ")";
		ol_current_gc_bg = 5;
	}
}

else if (ol_current_gc_bg == "5") {
	if (ol_bgr == "5") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_1 + ")";
		ol_current_gc_bg = 1;
	}
	if (ol_bgr > "5") {
		document.getElementById("ol_bgout").style.backgroundImage = "url(" + ol_bg_img_6 + ")";
		ol_current_gc_bg = 6;
	}
}

ol_load_fade_in();

}
