$(document).ready(function(){
	active_tab = 'canada';
	$('a.button').each(function(){
		$(this).click(function(){
			if (active_tab != this.id)
			{
				$(this).removeClass('inactive');
				$('div#'+ this.id +'-body').css({ display: 'block' });
				$('a#'+active_tab).addClass('inactive');
				$('div#'+ active_tab +'-body').css({ display: 'none' });
				active_tab = this.id;
			}
			return false;
		});
	})
	active_accordian = '';
	$('div.accordian-header').each(function(){
		$(this).click(function(){
			if ($(this).find('img')[0].src.indexOf('expand') >= 0)
			{
				$(this).find('img')[0].src = $(this).find('img')[0].src.replace('expand', 'collapse');
				accordian_body = $(this).next('div.accordian-body')[0];
				$(accordian_body).css({ overflow: 'visible', display: 'block' });
				bucket_height = $(accordian_body).find('div.accordian-mask').height();
				$(accordian_body).animate({ height: bucket_height });
				active_accordian = this;
			}
			else
			{
				$(this).find('img')[0].src = $(this).find('img')[0].src.replace('collapse', 'expand');
				accordian_body = $(this).next('div.accordian-body')[0];
				$(accordian_body).css({ overflow: 'hidden' })
				$(accordian_body).animate({ height: 0 }, 300, function(){
					$(this).css({ display: 'none' });			
				});
				active_accordian = '';
			}
		});
		$(this).mouseover(function(){
			if (active_accordian != this)
			{
				$(this).css({ backgroundColor: '#ccc'});
			}
		});
		$(this).mouseout(function(){
			$(this).css({ backgroundColor: '#fff'});
		});
	});
})
