document.observe('dom:loaded', function()
{
	if ($('scroll_content') && $('scroller')) {
		new Control.ScrollBar('scroll_content', 'scroller', {proportional: false});
	}

	if ($('city_drop'))
	{
		var scrollbar =	new Control.ScrollBar('city_ol', 'city_handle', {proportional: false});
		$('city_container').hide();

		$('city_drop').observe('click', function(evt)
		{
			scrollbar.enable();
			if ($('city_container').visible()) {
				$('city_container').hide();
			}
			else
			{
				$('city_container').show();
				evt.stop();
				$(document.body).observe('click', (function() {
					$('city_container').hide();
					document.body.stopObserving('click');
				}));
			}

			//observe the links in it
			$('city_container').select('a').each(function(link)
			{
				link.observe('click', function(e){
					lnk = Event.element(e);
					$('city_drop').select('.text').first().innerHTML = lnk.innerHTML;
					$('city_id').value = lnk.down().innerHTML;
				})
			});
		});
	}

	//attach auto hide value to the values for the search, user login and user pass fields
	var start_values = {'search': null, 'login_user': null, 'login_pass': null};
	for(id in start_values)
	{
		if($(id))
		{
			$(id).observe('focus', function(e){
				if(start_values[this.id] == null) start_values[this.id] = this.value;
				if(this.value == start_values[this.id]) this.value = '';
			}).observe('blur', function(e){
				if(this.value.toString().blank()) this.value = start_values[this.id];
			});
		}
	}

	if ($('site_section'))
	{
		var scrollbar =	new Control.ScrollBar('site_section_content', 'site_section_handle', {proportional: false});
		$('site_section_container').hide();

		$('site_section_drop').observe('click', function(evt)
		{
			scrollbar.enable();
			if ($('site_section_container').visible()) {
				$('site_section_container').hide();
			}
			else
			{
				$('site_section_container').show();
				evt.stop();
				$(document.body).observe('click', (function() {
					$('site_section_container').hide();
					document.body.stopObserving('click');
				}));
			}
		});
	}
});

function bgrMusicChange() {
	$('home_wrapper2').setStyle({
		backgroundPosition: 'center -831px'
	});
}

function bgrSoccerChange() {
	$('home_wrapper2').setStyle({
		backgroundPosition: 'center top'
	});
}

function bgrReset() {
	$('home_wrapper2').setStyle({
		backgroundPosition: 'center -1670px'
	});
}