uniAnimation=function(id, param) {
	var self=this;
	var modulesList=['MSG', 'uniAnimationItemEffect'];
	if (param.textBox.animation) modulesList.push('uniAnimationTextBoxEffect');	
	if (!this.checkModules(modulesList)) return false;

	Array.prototype.inArray=function(val) {
		for (var i=0; i<this.length; i++) if (this[i]=val) return true;
		return false;
	}

	this.msg=new MSG({
		'NOT_FOUND':	'Element "%id%" not found.'
	});

	var obj=document.getElementById(id);
	var eList;
	if (!obj) {
		this.msg.getError('NOT_FOUND', {id: id});
		return false;
	}

	eList=obj.getElementsByTagName("*");
	for (var i=0; i<eList.length; i++) {
		if (eList[i].className == 'navigation') nav=eList[i];
		if (eList[i].className == 'item_list') this.container=eList[i];
	}

	// Searching Navigation Elements

	if (nav) {
		eList=eList[0].getElementsByTagName("div");
		for (var i=0; i<eList.length; i++) {
			if (eList[i].className == 'prev')	eList[i].onclick=function() {self.prevHandler();}
			if (eList[i].className == 'next')	eList[i].onclick=function() {self.nextHandler();}
			if (eList[i].className == 'pause')	eList[i].onclick=function() {self.pauseHandler();}
		}
	}

	// ***
	
	// Searching Elements Container

	if (!this.container) {
		this.msg.getError('NOT_FOUND', {id: "animation_container"});
		return false;
	}
	this.container.Effect=new uniAnimationItemEffect(this.container, param);
	// ***

	if (param.clickAreaID) {
		if (obj=document.getElementById(param.clickAreaID)) {
			obj.style.cursor='pointer';
			obj.onclick=function() {self.container.Effect.onClick();}
		}
	}
}

uniAnimation.prototype.checkModules=function(modulesList) {
	var res='';
	for (var i=0; i<modulesList.length; i++) {
		if (typeof(window[modulesList[i]]) == "undefined") res+=(res ? "\n" : '')+'Module "'+modulesList[i]+'" not implemented.';
	}
	if (res.length) alert("ERROR:\n\n"+res);
	return (res.length ? false : true);
}

uniAnimation.prototype.prevHandler=function() {
	if (this.container) {
		this.container.Effect.prev();
	}
}

uniAnimation.prototype.nextHandler=function() {
	if (this.container) {
		this.container.Effect.next();
	}
}

uniAnimation.prototype.pauseHandler=function() {
	if (this.container) {
		this.container.Effect.pause();
	}
}

uniAnimation.prototype.onClick=function() {
	
}
