function wdm_slide( objParams ) {
	objParams = objParams || {};
	var _iterator;
	for (_iterator in objParams) {
		this[_iterator] = objParams[_iterator];
	}
	
	var _countChild = this.elemCarousel.find('> li').length - 1;
	this.maxMove = ( _countChild * objParams.perMove) * -1;
    
    var _elemWidth = ( _countChild + 3 ) * this.perMove;
    this.elemCarousel.css('width', _elemWidth + 'px');
    
	this.perMove = this.perMove * -1;
	this.currentMove = 0;
	var _self = this;
	
	this.move = function(moveTo) {
			
		if ( moveTo < this.maxMove) {
            moveTo = 0;
		}
        else if ( moveTo > 0 ) {
            moveTo = this.maxMove;
        }
        
		this.elemCarousel.animate({
				marginLeft : moveTo
			}, 'slow');
		this.currentMove = moveTo;
	};
	
	this.next = function() {
		var _moveTo = _self.currentMove + _self.perMove;
		_self.move(_moveTo);
		
	}
	
	this.prev = function() {
		var _moveTo = _self.currentMove - _self.perMove;
		_self.move(_moveTo);
	}
    this.nextBtn.click( function () { 
        _self.next();
        return false;
    });
    
    this.prevBtn.click( function () { 
        _self.prev();
        return false;
    })
}

$(function(){
    var _slide = $('div.slide ul');
    new wdm_slide( {
            elemCarousel : _slide,
            nextBtn      : _slide.parent('.slide').nextAll('a.next'),
            prevBtn      : _slide.parent('.slide').nextAll('a.prev'),
            perMove      : 160
       });
});


// homepage
$(function() {
	var _sitebanner = $('.container .sitebanner a'),
		_bubble = $('.container .sitebanner span').hide(),
		_rightSetting = [575, 310, 10];
	
	if ( _sitebanner.length < 1 ) return;
	
	_sitebanner.each(function(i) {
		var _span = _bubble.get(i);
		
		$(_span).css('right', _rightSetting[i]);
		
		$(this, _span).hover(
			function() {
				$(_span).show();
			},
			
			function() {
				$(_span).hide();
			}
		)
	});
})
