/**
 * params
 *	elemCarousel
 *	perMove
 */
function wdm_slide_vertical( objParams ) {
	objParams = objParams || {};
	
	var _iterator;
	for (_iterator in objParams) {
		this[_iterator] = objParams[_iterator];
	}
	
	this.maxMove = (this.elemCarousel.height() - this.offSet) * -1;
	this.perMove = this.perMove * -1;
	this.currentMove = 0;
	this.timer = null;
	var _self = this;
	
	this.move = function(moveTo) {
			
		if ( moveTo < this.maxMove) moveTo = 0;
		else if ( moveTo > 0 ) moveTo = this.maxMove;

		this.elemCarousel.animate({
				top : moveTo
			}, 'slow');
		//this.elemCarousel.css('top', moveTo)
		this.currentMove = moveTo;
	};
	
	this.start = function() {
		_self.timer = setInterval(function() {
			var _moveTo = _self.currentMove + _self.perMove;
			_self.move(_moveTo);
		}, 3000);
	};
	
	
	this.stop = function() {
		clearInterval(_self.timer);
	};
	
	this.elemCarousel.parent().hover(
		function() {
			_self.stop();
		},
		function () {
			_self.start();
		}
	);
	
	this.start();
	
	/*
	this.elemUp.mousehold( function() {
		var _moveTo = _self.currentMove + _self.perMove;
		//console.log(_moveTo + ' - UP');
		_self.move(_moveTo);
		return false;
	}).click( function() { return false; } );
	
	this.elemDown.mousehold( function() {
		var _moveTo = _self.currentMove - _self.perMove;
		//console.log(_moveTo + ' - DOWN');
		_self.move(_moveTo);
		return false;
	}).click( function() { return false; } ); */
}

$(function() {
	// vertical slide news
	var _slide = new wdm_slide_vertical({
		'elemCarousel' : $('.news .news-cont ul').css('position', 'relative'),
		'perMove' : 125,
		'offSet' : 125
		});
});

$(document).ready(function () {
	var siteHeight = $(document).height();
	$('body').css('height', siteHeight);
});