function ShowPages(id){
   if(id == 'offshore'){
         document.getElementById('offshore').style.display = '';
         document.getElementById('corporate').style.display = 'none';
         document.getElementById('healthcare').style.display = 'none';
   }
   if(id == 'corporate'){
         document.getElementById('offshore').style.display = 'none';
         document.getElementById('corporate').style.display = '';
         document.getElementById('healthcare').style.display = 'none';
   }
   if(id == 'healthcare'){
         document.getElementById('offshore').style.display = 'none';
         document.getElementById('corporate').style.display = 'none';
         document.getElementById('healthcare').style.display = '';
   }
}

var scrollGallery = function(galleryId, direction) {
	var _gallery;
	var _galleryItems;
	var _galleryDirection = 'left';
	var _maxScrollLeft;
	var _actualWidth;
	var _actualItemCount;
	var _itemWidth;
	var _scrollTimer;
	var _autoTimer;
	var _scrollWidth;
	var _scrollDirection;
	var _isScrolling = false;

	var divGallery = document.getElementById(galleryId);
	if(divGallery) {
		divGallery = divGallery.getElementsByTagName('div');
		if(divGallery.length > 0) {
			divGallery = divGallery[0];

			var uls = divGallery.getElementsByTagName('ul');
			if(uls.length > 0) {
				_gallery = uls[0];
				_gallery.style.position = 'relative';

				_galleryItems = _gallery.getElementsByTagName('li');

				if(_galleryItems.length > 1) {
					var maxWidth = divGallery.offsetWidth;
					_scrollWidth = _itemWidth = _galleryItems[0].offsetWidth;
					_actualItemCount = _galleryItems.length;
					_actualWidth = _itemWidth * _actualItemCount;
					_maxScrollLeft = 0 - _actualWidth;

					var extendedWidth = 0;
					var iterator = 0;

					do
					{
						var node = _galleryItems[iterator++].cloneNode(true);

						_gallery.appendChild(node);

						extendedWidth += node.offsetWidth;

						if(iterator >= _galleryItems.length)
							iterator = 0;
					}
					while(extendedWidth < maxWidth);

					_galleryItems = _gallery.getElementsByTagName('li');

					_gallery.style.width = (_actualWidth + extendedWidth) + 'px';

					if(direction == 'right') {
						_gallery.style.left = (maxWidth - (_actualWidth + extendedWidth)) + 'px';
						_galleryDirection = direction;
					}
					else {
						_gallery.style.left = '0px';
					}

					//var as = divGallery.parentNode.getElementsByTagName('b')[0].getElementsByTagName('a');
					//as[0].onclick = function () {
					//	if(!_isScrolling || _scrollDirection != 'right') {
					//		clearTimeout(_scrollTimer);
                    //
					//		if(_isScrolling) {
					//			_scrollWidth = _itemWidth - _scrollWidth;
					//		}
                    //
					//		_isScrolling = true;
					//		_scrollDirection = 'right';
                    //
					//		Move();
					//	}
					//};
                    //
					//as[1].onclick = function () {
					//	if(!_isScrolling || _scrollDirection != 'left') {
					//		clearTimeout(_scrollTimer);
                    //
					//		if(_isScrolling) {
					//			_scrollWidth = _itemWidth - _scrollWidth;
					//		}
                    //
					//		_isScrolling = true;
					//		_scrollDirection = 'left';
                    //
					//		Move();
					//	}
					//};

					SetAutoTimer(_galleryDirection);
				}
			}
		}
	}

	function Move() {
		var leftPos = parseInt(_gallery.style.left);
		var shiftPx = 1;

		if(_scrollWidth > 0) {
			switch(_scrollDirection) {
				case "left":
					if(leftPos > _maxScrollLeft) {
						_gallery.style.left = (leftPos - shiftPx) + 'px';
					}
					else {
						_gallery.style.left = '-1px';
					}

					_scrollWidth = _scrollWidth - shiftPx;
					break;
				case "right":
					if(leftPos < 0) {
						_gallery.style.left = (leftPos + shiftPx) + 'px';
					}
					else {
						_gallery.style.left = (1 - _actualWidth) + 'px';
					}

					_scrollWidth = _scrollWidth - shiftPx;
					break;
				default:
					_scrollWidth = 0;
					break;
			}
		}

		if(_scrollWidth > 0) {
			clearTimeout(_autoTimer);

			_scrollTimer = setTimeout( function() { Move(); }, 10);
		}
		else {
			clearTimeout(_scrollTimer);

			_scrollWidth = _itemWidth;
			_isScrolling = false;

			SetAutoTimer(_scrollDirection);
		}
	}

	function SetAutoTimer(direction) {
		_autoTimer = setTimeout( function() {
			if(!_isScrolling) {
				_isScrolling = true;
				_scrollDirection = direction;
				Move();
			}}, 10);
	}
};

