var Clients = {};
var ClientsItem = function (item) {
	var self = this;
	this.target_position = this.current_position = -Clients.textHeight;
	this.item = item;
	var subitems = item.getElementsByTagName('div');
	for (var i = 0; i < subitems.length; i++) {
		var subitem = subitems[i];
		if (subitem.className == 'hider') {
			this.content = subitem;
			break;
		}
	}
	if (!this.content) {
		return;
	}
	item.onmouseover = function () {
		self.MouseOver();
	};
	item.onmouseout = function () {
		self.MouseOut();
	};
	this.Animate();
	setInterval(function () { self.Animate(); }, 30);
};

Clients = {
	containerId: 'body_content_sec_full_width',
	textHeight: 149,
	list: [],
	
	Init: function () {
		var container = document.getElementById(this.containerId);
		var containerItems = container.getElementsByTagName('div');
		for (var i = 0; i < containerItems.length; i++) {
			var item = containerItems[i];
			if (item.className == 'client') {
				this.list[this.list.length] = new ClientsItem(item);
			}
		}
	}
};

ClientsItem.prototype = {
	MouseOver: function () {
		this.target_position = 0;
	},
	MouseOut: function () {
		this.target_position = -Clients.textHeight;
	},
	Animate: function () {
		/* ease animation start */
		//this.current_position += (this.target_position - this.current_position) / 10;
		if (this.target_position > this.current_position) {
			this.current_position += Math.min(20, this.target_position - this.current_position);
		} else {
			this.current_position -= Math.min(20, this.current_position - this.target_position);
		}
		/* ease animation end */
		this.content.style.marginTop = String(Math.round(this.current_position)) + 'px';
	}
};

var prevOnLoad = window.onload || function () {};
window.onload = function () {
	Clients.Init();
}


function gotoURL(URL){
window.location.href=URL;
}