var ajanlat_timer;
var ajanlat_scroll_x = -130;
var header_items = new Array();
var header_curr = 0;
var header_timer;

Event.observe(window, 'load', function() {
	ajanlat_timer = setTimeout(ajanlat_scroll, 5000);
	$$("#header_img div").each(function(d) {
		header_items.push(d);
	})
	header_timer = setInterval(header_change, 9000);
});

function header_change() {
	new Effect.Fade(header_items[header_curr], {
		afterFinish: function() {
			header_curr++;
			if (header_curr >= header_items.length) {
				header_curr = 0;
			}
			new Effect.Appear(header_items[header_curr]);
		}
	});
}

function ajanlat_scroll() {
	new Effect.Move('scrollcontainer', {
		x : ajanlat_scroll_x,
		y : 0,
		mode : 'relative'
	});
	ajanlat_scroll_x = ajanlat_scroll_x * -1;
	ajanlat_timer = setTimeout(ajanlat_scroll, 5000);
}

