var position = 0;
var max = 4;
var strap_position = 0;
var strap_max = 5;

function auto_play() {
	  setTimeout(continue_play,7000);
}
function strap_auto_play() {
	  setTimeout(strap_continue_play,7000);
}
function continue_play() {
	
		if ((position + 1)>=max) {
			 setTimeout(reset,0);
		} else {
			move_right();
			setTimeout(continue_play,7000);
		}
		
	
	
}
function strap_continue_play() {
	if ((strap_position + 1)>=strap_max) {
			 setTimeout(reset_strap,0);
		} else {
			strap_move_right();
			setTimeout(strap_continue_play,7000);
		}
}
function reset() {
	$('#banner_' + position).fadeOut(3500);	
	$('#banner_0').fadeIn(3500);	
	position = 0;
	auto_play();
}
function reset_strap() {
	$('#strapline_' + strap_position).fadeOut(3500);	
	$('#strapline_0').fadeIn(3500);	
	strap_position = 0;
	strap_auto_play();
}

function move_right() {
		if ((position+1) < max) {
			$('#banner_' + position).fadeOut(3500);
			$('#banner_' + (position+1)).fadeIn(3500);	
			position++;
		} else {
			$('#banner_' + position).fadeOut(3500);
			$('#banner_' + (position-1)).fadeIn(3500);
			position = 0;
		}
}
function strap_move_right() {
	
	
		if ((strap_position+1) < strap_max) {
			$('#strapline_' + strap_position).fadeOut(3500);
			$('#strapline_' + (strap_position+1)).fadeIn(3500);	
			strap_position++;
		} else {
			$('#strapline_' + strap_position).fadeOut(3500);
			$('#strapline_' + (strap_position-1)).fadeIn(3500);
			strap_position = 0;
		}
}

function show_dropdown(dropdown) {

	$('#' + dropdown).addClass('ddwn_'+dropdown);
	$('#dropdown_'+dropdown).css({ display: 'block'});
}

function hide_dropdown(dropdown) {
	$('#' + dropdown).removeClass('ddwn_'+dropdown);
	$('#dropdown_'+dropdown).css({ display: 'none'});
}


