
$(document).ready(function() {
	gal_total = new Array( $('.gallerys').children().length, $('.uccs').children().length );
	gal_width = new Array( $('#gallery_0').outerWidth(true), $('#ucc_0').outerWidth(true) );
	gal_start = new Array( $('#gallery_0').position(), $('#ucc_0').position() );
	
	$('.gallerys').css({'width':gal_total[0]*gal_width[0]});
	$('.uccs').css({'width':gal_total[1]*gal_width[1]});

	$('#dBanner_00').css('display','block');
	
	_uccItemIndex = 0;
	_galleryItemIndex = 0;
	
	$('a[name=galleryMove]').click(function(e) {
		e.preventDefault();
		
		var _target = $('#gallerys');
		var _items = _target.children();
		
		switch($(this).attr('data-direction')) {
			case 'left':
				if(_galleryItemIndex < _items.length - 4)
					_galleryItemIndex++;
				break;
			case 'right':
				if(_galleryItemIndex > 0)
					_galleryItemIndex--;
				break;
		}
		
		_target.animate({
			left : -_galleryItemIndex * parseInt($(_items[0]).css('width'))
		},'slow');
	});
	
	$('a[name=uccMove]').click(function(e) {
		e.preventDefault();
		
		var _target = $('#uccs');
		var _items = _target.children();
		
		switch($(this).attr('data-direction')) {
			case 'left':
				if(_uccItemIndex < _items.length - 4)
					_uccItemIndex++;
				break;
			case 'right':
				if(_uccItemIndex > 0)
					_uccItemIndex--;
				break;
		}
		
		_target.animate({
			left : -_uccItemIndex * parseInt($(_items[0]).css('width'))
		},'slow');
	});
});

