// wedomarkup slide
function wdm_slide( objParams ) {
	objParams = objParams || {};
	var _iterator;
	for (_iterator in objParams) {
		this[_iterator] = objParams[_iterator];
	}
	
	var _countChild = this.elemCarousel.find('li').length - 1;
	
	//compute width
	//this.elemCarousel.css('width', _countChild * objParams.perMove + objParams.perMove);
	
	this.maxMove = ( _countChild * objParams.perMove) * -1;
	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
			});
		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() {
	// carousel
	//slide
	var _carousel = $('#content div.portfolio'),
		_carousel2 = $('#inner div.process-div');
	if ( _carousel.length > 0 ) {
		var _slide = new wdm_slide({
			'elemCarousel' : $('ul', _carousel),
			'nextBtn' : $('a.next', _carousel),
			'prevBtn' : $('a.previous', _carousel),
			'perMove' :590
			});
	}
	
	if ( _carousel2.length > 0 ) {
		var _pagination = _carousel2.next('.pagination'),
			_slide = new wdm_slide({
			'elemCarousel' : $('ul', _carousel2),
			'nextBtn' : $('a.next', _pagination),
			'prevBtn' : $('a.previous', _pagination),
			'perMove' :637
			});
	}
})