//<--
/*

	@author: SWAT (Rostovtsev Ruslan)
	@url: http://www.jsysteam.ru
	@version: 1.0.0

*/



var site = new Class({
	
	Implements: Options,

	options: {
		body: null,
		content: null,
		data: null,
		debug: false,
		slide: {from: 'up', to: 'down'},
		onExit: null,
		anim: true
	},
	
	circles: new Array(),
	uplist: new Array(),
	cont: null,
	plvl: [1, 0],
	def: null,

	initialize: function(options) {
		
		this.setOptions(options);
		this.fixMenu();
		
		this.cont = this.options.body.getElement('.container');
		this.cont.set('morph', {duration: 'long', transition: 'back:in:out'});
		
		//if(Browser.Engine.trident) new Asset.javascript('/js/excanvas.js');
		
		this.def = new Definition({parent: this.cont});
		this.modifyLinks(this.def.node);
		this.show();
		
		window.addEvent('resize', this.calcPos.bind(this));
	},
	
	
	calcPos: function(mode) {
		
		var c = this.cont;
		var ws = window.getSize();
		c.set('morph', {duration: 'long', transition: 'back:in:out'});
		
		var l = (ws.x - c.getSize().x) / 2;
		if(Browser.Engine.webkit) l -= 7;
		
		
		if(Browser.Engine.trident5) {
			c.addClass('container_ie7');
		}
		
						
		if(mode == 'in') {

			$('loading').setStyle('display', 'none');
			
			switch(this.options.slide.from) {
				
				case 'up':
				
					c.setStyles({top: -c.getSize().y, left: l, visibility: 'visible'});
					if(this.options.anim) c.morph({top: 0});
					else c.setStyle('top', 0);
				
					break;
				case 'down':
				
					
					c.setStyles({top: c.getSize().y * 2, left: l, visibility: 'visible'});
					
					if(this.options.anim) {
						
						this.options.body.setStyle('overflow', 'hidden');	
						c.morph({top: 0});
						(function() { this.options.body.setStyle('overflow', 'auto'); }).delay(1000, this);
						
					} else {
						c.setStyle('top', 0);
					}
				
					break;
				case 'left':
				
					c.setStyles({top: 0, left: -c.getSize().x * 2, visibility: 'visible'});
					if(this.options.anim) c.morph({left: l});
					else c.setStyle('left', l);
				
					break;
				case 'right':

					c.setStyles({top: 0, left: ws.x + c.getSize().x, visibility: 'visible'});
					
					if(this.options.anim) {
						
						this.options.body.setStyle('overflow', 'hidden');
						c.morph({left: l});
						(function() { this.options.body.setStyle('overflow', 'auto'); }).delay(1000, this);
						
					} else {
						c.setStyle('left', l);
					}
				
					break;
				default:
					break;
			}
			
		} else if(mode == 'out') {
			
			switch(this.options.slide.to) {
				
				case 'up':
					c.morph({top: -c.getSize().y});
					break;
				case 'down':
					c.morph({top: c.getSize().y * 2});
					break;
				case 'left':
					c.morph({left: -c.getSize().x * 2});
					break;
				case 'right':
					c.morph({left: c.getSize().x * 2});
					break;
				default:
					break;
			}
			
		} else {
			
			if(this.options.anim) {
				c.set('morph', {duration: 'normal', transition: 'cubic:in:out'});
				c.morph({top: 0, left: l});
			} else {
				c.setStyles({top: 0, left: l});
			}
		}
	},
	
	
	hide: function() {

		if(this.options.onExit) this.options.onExit();

		if(this.options.anim && this.circles.length) {

			this.options.body.setStyle('overflow', 'hidden');
			this.hideCircles();
			(function() { this.calcPos('out'); }).delay(90 * this.circles.length, this);
			(function() { $('loading').setStyle('display', 'block'); }).delay(90 * this.circles.length + 800, this);
			
		} else {
			
			this.calcPos('out');
			if(this.options.anim) (function() { $('loading').setStyle('display', 'block'); }).delay(800, this);
		}
		
	},
	
	show: function() {

		try {

			var d = JSON.decode(window.name);
			
			if(d) {
				
				var cur = d[0];
				var prev = d[1];
				this.options.anim = d[2];
				
				this.plvl = cur ? cur : this.plvl;
				
				if(cur[0] < prev[0]) {
					
					this.options.slide.from = 'up';
					
				} else if(cur[0] > prev[0]) {
					
					this.options.slide.from = 'down';
					
				} else {
					
					if(cur[1] < prev[1]) {
					
						this.options.slide.from = 'left';
						
					} else if(cur[1] > prev[1]) {
						
						this.options.slide.from = 'right';
						
					} else {
						
						//this.options.slide.from = 'left';
					}
				}
			}
			
		} catch(E) {
			//alert(E);
		}
		
		
		this.parsePage();
		this.options.body.setStyle('overflow', 'auto');
		this.calcPos('in');
		
		if(this.options.anim) this.animListUpdate.delay(300, this);
	},
	
	hideShow: function(mode) {

		var delay = 2000 + this.circles.length * 100;
		
		switch(mode) {
			
			case 'up':
				this.options.slide = {from: 'up', to: 'down'};
				break;
			case 'down':
				this.options.slide = {from: 'down', to: 'up'};
				break;
			case 'left':
				this.options.slide = {from: 'left', to: 'right'};
				break;
			case 'right':
				this.options.slide = {from: 'right', to: 'left'};
				break;
			default:
				break;
			
		}
		
		this.hide();
		this.show.delay(delay, this);
		return false;
	},
	
	goTo: function(url, lvl) {
		
		if(!this.options.anim) {
			window.name = JSON.encode(new Array(0, 0, this.options.anim));
			document.location = url;
			return;
		}
		
		var delay = 1000 + (this.options.anim ? (this.circles.length * 100) : 0);
		var next = lvl ? lvl.split('.') : null;
		
		if(next) {
		
			try {
			
				var cur = this.plvl;
				
				window.name = JSON.encode(new Array(next, cur, this.options.anim));
				
				if(cur[0] < next[0]) {
					
					this.options.slide.to = 'up';
					
				} else if(cur[0] > next[0]) {
					
					this.options.slide.to = 'down';
					
				} else {
					
					if(cur[1] < next[1]) {
					
						this.options.slide.to = 'left';
						
					} else if(cur[1] > next[1]) {
						
						this.options.slide.to = 'right';
						
					} else {
						
						//this.options.slide.to = 'left';
					}
				}
			
			} catch(E) {
				//	
			}
			
		} 

		this.hide();
		(function() { document.location = url; }).delay(delay, this);
	},
	
	
	toggleAnim: function(t) {
		
		var o = this.options;
		
		if(this.options.anim) {
			
			this.options.anim = false
			if(t) t.setStyle('background-position', '0px 7px');
			
			this.circles.each(function(item, index) {				   
				item.update({move: {enabled: false}}); 
			});
			
		} else {
			
			this.options.anim = true;
			if(t) t.setStyle('background-position', '0px -14px');

			var ctx = this;
				  
			this.circles.each(function(item, index) {	
									   
				item.update({pos: ctx.getCirclesPos()}, {fx: {duration: 'long', transition: 'back:in:out'}});
				(function() { this.update({pos: ctx.options.data[index].pos, move: ctx.options.data[index].move}, {fx: {duration: 'long', transition: 'back:in:out'}}); }).delay((index * 100), item);
						  
			});

		}
	},
	
	
	modifyLinks: function(el) {
		
		var ctx = this;
		var node = el ? el : this.cont;
		var a = node.getElements('a');
		
		if(!$chk(a)) return false;

		a.each(function(item, index) {
		
			if(item.hasClass('term')) {
				
				
				item.addEvents({	   
					click: function(event) {
						event.stop();
						this.c.def.load(this.a.getProperty('target'), this.a.getCoordinates(this.c.cont));
					}.bind({c: ctx, a: item})/*,
					mouseenter: function() {
						
						//this.c.def.load(this.a.getProperty('target'), this.a.getCoordinates(this.c.cont));
						
					}.bind({c: ctx, a: item})*/
				});
				
				
			} else {
			
				item.addEvent('click', function(event) {
					
					if(this.getProperty('target') != '_blank' && this.getProperty('href') != '#') {
						
						event.stop();
						return ctx.goTo(this.getProperty('href'), this.getProperty('rel'));
					}	
					
					if(Browser.Engine.trident && this.getProperty('target') == '_blank') {
						window.open(url);
					}
				});
			
			}
		});
	},
	
	
	fixMenu: function() {
		
		var menu = this.options.body.getElement('ul.mainmenu');
		
		if($chk(menu)) {
			
			var li = menu.getChildren('li');
			var active = menu.getChildren('.active');
			var show = 0;
			
			li.each(function(item, index) {
							   
				item.addEvents({
					mouseenter: function() {
						
						if(!item.hasClass('active')) {
							
							active.removeClass('active');
							show = 1;
							
							if(Browser.Engine.trident4) item.addClass('active');
						}
					},
					mouseleave: function() {
						
						show = -1;
						
						if(Browser.Engine.trident4) item.removeClass('active');
						
						(function() { 
						
							if(show != 1 && show == -1) active.addClass('active');
							show = 0; 
						
						}).delay(200, this);
					}
				});
			});
		}
	},
	
	
	getCirclesPos: function(mode) {
		
		var m = mode == 'from' ? this.options.slide.from : this.options.slide.to;

		switch(m) {
			
			case 'up':
				return {y: -window.getSize().y, x: $random(0, 800)}
				break;
			case 'down':
				return {y: window.getSize().y * 2, x: $random(0, 800)}
				break;
			case 'left':
				return {x: -window.getSize().x, y: $random(-100, window.getSize().y)}
				break;
			case 'right':
				return {x: window.getSize().x + 800, y: $random(-100, window.getSize().y)}
				break;
			default: 
				return {y: -window.getSize().y, x: $random(0, 800)}
				break;
		}
	},
	
	
	hideCircles: function() {

		if(this.circles.length && this.options.anim) {
			
			var ctx = this;
			var len = this.circles.length;
			
			this.circles.each(function(item, index) {
				ctx.animUpdate.delay((index * 100), {c: item, p: {pos: ctx.getCirclesPos()}, anim: {fx: {duration: 'long', transition: 'back:in:out'}}});
			});
			
			//this.removeCircles.delay(200 * len, this);
		}
	},
	
	
	removeCircles: function() {
		
		this.circles.each(function(item, index) {
			item.node.destroy();
		});
		
		delete this.uplist;
		delete this.circles;
	},
	
	
	animUpdate: function() {
		this.c.update(this.p, this.anim);
	},
	
	animListUpdate: function() {
		
		if($chk(this.uplist)) {
			this.uplist.each(function(item, index) {
				item.delay((index * 100), item);
			});
		}
	},
	
	addToUpdate: function(p) {
		
		this.uplist.push(function() {	
			this.c.update(this.p, this.anim);	
		}.bind(p));
	},
	
	parsePage: function() {
		
		this.circles = new Array();
		this.uplist = new Array();
		
		this.modifyLinks();
		
		var opt = this.options;
		var cs = opt.content.getElement('.mkc');
		
		var fp = opt.content.getElements('.fixPng');
		if($chk(fp)) fp.ie6fix();
		
		if(!$chk(cs)) return false;

		var parent = cs.getParent();
		var cl = this.circles;
		var ps = opt.data;
		var ctx = this;
		var c = null;
		
		if(opt.anim) var cp = this.getCirclesPos('from');
		
		cs.getElements('li').each(function(item, index) {
			
			if(cs.hasChild(item)) {
				
				var p = {content: item.get('html'), parent: opt.content};

				if(opt.anim && ps) {

					if(ps.length > index) {
						p = $merge(ps[index], p);
					}

					if(opt.debug) {
						p.move = {enabled: true, fixed: false};
					}
					
					try {

						c = new Element('circle', $merge(p, {pos: {x: cp.x, y: (ps.length > index ? cp.y : 0)}}));
						parent.adopt(c);
					
					} catch (E) {
						//alert('p ' + E);
						return;
					}

					p.pos.z = 10 + index;
					ctx.addToUpdate({c: c, p: p, anim: {fx: {duration: 'long', transition: 'back:out'}}});

				} else {
					
					if(ps && ps.length > index) {
						p = $merge(ps[index], p);
					}
					
					if(!opt.anim) {
						p = $merge(p, {move: {enabled: false}});
					}
					
					if(opt.debug) {
						p = $merge(p, {move: {enabled: true, fixed: false}});
					}

					var c = new Element('circle', p);
					parent.adopt(c);
				}

				
				ctx.modifyLinks(c.contNode);
				cl.push(c);
				
				if(opt.debug) {
				
					c.addEvent('dblclick', function(e) {
						this.update(JSON.decode(window.prompt('Параметры', JSON.encode(this.options))));
					}.bind(c));
				}
			}
		});
		
		this.circles = cl;
	}
});	




var Definition = new Class({
	
	Implements: Options,

	options: {
		parent: $(document.body)
	},
	
	node: null,
	state: 0,
	word: null,
	desc: null,
	req: null,
	
	
	initialize: function(options) {
		
		this.setOptions(options);
		this.build();
	},
	
	build: function() {
		
		this.node = new Element('ul', {
			'class': 'definition', 
			'styles': {'opacity': 0, 'display': 'none', 'z-index': 999}
		});//.addEvent('mouseleave', function() { this.close(); }.bind(this));
		
		var top = new Element('li', {'class': 'dTop', 'html': '&nbsp;'});
		this.node.makeDraggable({handle: top});
		this.node.adopt(top);

		var mid = new Element('li', {'class': 'dMid'});
		mid.adopt(new Element('span', {'class': 'dClose', 'html': '&nbsp;'}).addEvent('click', function(event) { event.stop(); this.close(); }.bind(this)));
		
		this.word = new Element('span', {'class': 'dWord', 'html': '&nbsp;'});
		mid.adopt(this.word);
		
		this.desc = new Element('div', {'class': 'dCont', 'html': '&nbsp;'});
		mid.adopt(this.desc);
		
		mid.adopt(new Element('a', {'class': 'dict', 'html': 'Словарь терминов', 'rel': '1.5', 'href': '/dictionary/'}));
		
		this.node.adopt(mid);
		
		var bot = new Element('li', {'class': 'dBot', 'html': '&nbsp;'});
		//this.node.makeResizable({handle: bot});
		this.node.adopt(bot);
		
		this.options.parent.adopt(this.node);
	},
	
	load: function(id, p) {
		
		if(p) {
			if(!this.open(p)) return false;
		}

		this.word.set('html', '');
		this.desc.set('html', '<p align="center">Загрузка...</p>');
		
		this.req = new Request.HTML({
									
				headers: {'X-Request': 'HTML'},
				evalScripts: false, 
				
				onSuccess: function(responseTree, responseElements, responseHTML, responseJavaScript) {
					
					try {
						
						var d = responseHTML.split('[definition]')[1].split('[/definition]')[0].split('|');
						this.word.set('html', d[0]);
						this.desc.set('html', d[1]);
						
					} catch(E) {
						
						this.desc.set('html', 'Определение не найдено.');
						//this.desc.set('html', 'Произошла ошибка. <br /><small>' + E + '</small>');
					}
					
				}.bind(this),
				
				onFailure: function(xhr) { 
					
					this.desc.set('html', 'Произошла ошибка.<br />');
					this.desc.adopt(new Element('a', {'href': '#', html: 'Попробовать еще раз?'}).addEvent('click', function(event) { event.stop(); this.load(id); }.bind(this)));
					
				}.bind(this)
		});
		
		this.req.get('/dictionary/detail.php?ID=' + id);
	},
		
	open: function(p) {
		
		if(this.state != 0) return false;
		
		this.state = -1;
		this.node.morph({'opacity': [0, 1], display: 'block'/*, left: p.left.toInt() - 10, top: p.top.toInt() - 10*/});
		this.node.setStyles({left: p.left.toInt() - 10, top: p.top.toInt() - 10});
		(function() { this.state = 1; }).delay(800, this);
		return true;
	},
	
	close: function() {
		
		if(this.state != 1) return false;
		
		this.state = -1;
		this.node.tween('opacity', 1, 0);
		(function() { this.node.setStyle('display', 'none'); this.state = 0; }).delay(600, this);
		return true;
	}
});





Element.Constructors.circle = function(options) {
	return new Circle(options);
};	


var Circle = new Class({
	
	Implements: Options,

	options: {
		
		move: {
			enabled: false,
			fixed: true,
			fx: null
		},
		
		pos: {
			x: 0,
			y: 0,
			z: 0
		},
		
		radius: 70,
		content: '',
		color: '#FFF',
		styles: null,
		
		background: {
			color: null,
			image: null
		},
		
		border: {
			width: 2,
			color: '#000'
		},
		
		events: null,
		parent: $(document.body)
	},
	
	node: null,
	contNode: null,
	canvas: null,
	drag: null,
	
	initialize: function(options) {
		
		this.setOptions(options);
		this.build();
	},
	
	
	cDraw: function() {
		
		var opt = this.options;
		var rad = opt.radius;
		var ctx = this.canvas.getContext('2d');
		
		if(opt.background.color) {
			
			ctx.fillStyle = opt.background.color;
			ctx.fillRect (0, 0, rad * 2, rad * 2);
		}
		
		if(opt.background.image) {
			
			var bi = opt.background.image;
			ctx.drawImage(bi.el, bi.x, bi.y, bi.width, bi.height);
		}
		
		if(opt.border.width) {
			
			ctx.fillStyle = opt.border.color;
			ctx.beginPath();
			ctx.arc(rad, rad, rad, 0, Math.PI * 2, true);
			ctx.fill();
		}
		
		ctx.fillStyle = opt.color;
		ctx.beginPath();
		ctx.arc(rad, rad, (opt.border.width ? (rad - opt.border.width) : rad), 0, Math.PI * 2, true);
		ctx.fill();
	},
	

	build: function() {
	
		
		var opt = this.options;
		var rad = opt.radius;

		this.canvas = new Element('canvas', {
			'width': rad * 2,
			'height': rad * 2
		});
		
		this.node = new Element('div', {
			'class': 'circle',
			'styles': $merge({
				'width': rad * 2 + 'px',
				'height': rad * 2 + 'px',
				'left': opt.pos.x + 'px',
				'top': opt.pos.y + 'px',
				'z-index': opt.pos.z
			}, opt.styles)
		});
		
		
		var ul = new Element('ul');
		
		ul.adopt(new Element('li').adopt(this.canvas));
		this.cDraw();
		
		var wh = (rad * Math.sqrt(2)).round();
		var m = (rad * (Math.sqrt(2) - 1) / Math.sqrt(2)).round();
		
		this.contNode = new Element('li');
		this.contNode.setStyles({
			width: wh + 'px', 
			height: wh + 'px',
			marginTop: m + 'px', 
			marginLeft: m + 'px'
		});
		
		
		if(opt.move.enabled) {
			
			this.contNode.setStyle('cursor', 'move');
			
			if(opt.move.fx) {
				this.node.set('morph', opt.move.fx);
			}
			
			this.drag = new Drag.Move(this.node, {
			
				onDrop: function(element, droppable) {
					
					if(this.options.move.fixed) {
						
						element.morph({
							left: this.options.pos.x + 'px',
							top: this.options.pos.y + 'px',
							zIndex: this.options.pos.z
						});
						
					} else {
					
						var p = element.getStyles('left', 'top');
						this.options.pos.x = p.left.toInt();
						this.options.pos.y = p.top.toInt();
					}
				}.bind(this)		  
			});
		}

		this.setContent(opt.content);
		
		ul.adopt(this.contNode);
		this.node.adopt(ul);
		
		if(opt.events) {
			this.addEvents(opt.events);	
		}
		
		opt.parent.adopt(this.node);

	},
	
	addEvent: function(e, f) {
		return this.contNode.addEvent(e, f);
	},
	
	addEvents: function(e) {		
		return this.contNode.addEvents(e);
	},
	
	
	redraw: function(anim) {
		
		var opt = this.options;
		var rad = opt.radius;
		
		
		if(anim) {
			
			if($chk(anim.fx)) this.node.set('morph', anim.fx);
			
			this.node.morph({
					width: rad * 2 + 'px',
					height: rad * 2 + 'px',
					left: opt.pos.x + 'px',
					top: opt.pos.y + 'px',
					zIndex: opt.pos.z
			});
			
		} else {
			
			this.node.setStyles({
					'width': rad * 2 + 'px',
					'height': rad * 2 + 'px',
					'left': opt.pos.x + 'px',
					'top': opt.pos.y + 'px',
					'z-index': opt.pos.z
			});
		}
		
		if(opt.move.enabled) {
			
			this.contNode.setStyle('cursor', 'move');
			
			if(!this.drag) {
				
				this.drag = new Drag.Move(this.node, {
				
					onDrop: function(element, droppable) {
						
						if(this.options.move.fixed) {
							
							element.morph({
								left: this.options.pos.x + 'px',
								top: this.options.pos.y + 'px',
								zIndex: this.options.pos.z
							});
							
						} else {
						
							var p = element.getStyles('left', 'top');
							this.options.pos.x = p.left.toInt();
							this.options.pos.y = p.top.toInt();
						}
					}.bind(this)		  
				});
			}
			
		} else {
			this.contNode.setStyle('cursor', 'default');
		}

		this.canvas.setProperties({width: rad*2, height: rad*2});
		this.cDraw();
		
		var wh = (rad * Math.sqrt(2)).round();
		var m = (rad * (Math.sqrt(2) - 1) / Math.sqrt(2)).round();
		
		this.contNode.setStyles({
			width: wh + 'px', 
			height: wh + 'px',
			marginTop: m + 'px', 
			marginLeft: m + 'px'
		});
		
	},
	
	
	update: function(options, anim) {
		
		if(!this.options.events && options.events) {
			this.addEvents(options.events);	
		}
		
		this.setOptions(options);
		this.redraw(anim ? anim : null);
	},


	move: function(x, y, z) {
		
		with(this.options) {
			pos.x = x;
			pos.y = y;
			pos.z = z;
		}
		
		this.node.morph({
			left: x + 'px',
			top: y + 'px',
			zIndex: z
		});
	},
	
	resize: function(radius, timeout, anim) {
		
		if(timeout) {
			
			var timer = (function(){
					  
				if(this.options.radius != radius) {
					
					this.options.radius++
					this.resize(this.options.radius);
					
				} else {
					
					$clear(timer);
				}
					  
			}).periodical(timeout, this);
			
		} else {
		
			this.options.radius = radius;
			this.redraw(anim ? anim : null);
		}
	},
	
	
	setContent: function(c) {
	
		if($type(c) == 'element') {
			
			this.contNode.adopt(c);
			
		} else {
			
			this.contNode.set('html', c);
		}
	}
	

});



Element.implement({
				  
	ie6fix: function() {
		
		if(!Browser.Engine.trident4) return this;
		
		var img;
		
		if(this.get('tag') == 'img') {
			
			img = "'" + this.get('src') + "'";
			this.set('src', '/images/blank.gif');
			
		} else {
			
			var bg = this.getStyle('background-image');
			if(bg && bg != 'none') img = bg.match(/\(([^)]+)\)/)[1];
		}
		
		if(img) {
			
			if(this.getStyle('display') == 'inline' && !['input', 'textarea', 'button'].contains(this.get('tag'))) {
				
				this.setStyles({
					'display': 'block',
					'width': this.getStyle('width')
				});
				
			}
				
			this.setStyles({
				'background': '',
				'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', src=" + img + ", sizingMethod='crop')"
			});
		}
		return this;
	}
});



var utilex = null;
var __before_called = false;


window.addEvent('domready', function() { 
	if($defined(sConfig.before)) {
		sConfig.before();
		__before_called = true;
	}
});


//window.addEvent('domready', function() { 
window.onload = function() { 
			  
	try {
		

		if(__before_called == false && $defined(sConfig.before)) sConfig.before();
		
		utilex = new site({body: $(document.body), 
							content: $(document.body).getElement('.mainContent'), 
							data: sConfig.data, 
							debug: sConfig.debug, 
							slide: sConfig.slide, 
							onExit: sConfig.onExit,
							anim: sConfig.anim});
		
		try {
			var anim = $(document.body).getElement('.container').getElements('.snav').getElement('a.anim');
		} catch (E) {
			var anim = null;
		}
		
		if(anim) {
		
			anim.addEvents({
				click: function(event) { 	
					event.stop();
					utilex.toggleAnim(anim);
				},
				mouseenter: function() {
					if(utilex.options.anim) this.setStyle('background-position', '0px 7px');
					else this.setStyle('background-position', '0px -14px');
				},
				mouseleave: function() {
					if(!utilex.options.anim) this.setStyle('background-position', '0px 7px');
					else this.setStyle('background-position', '0px -14px');
				}
			}).setStyle('background-position', (utilex.options.anim ? '0px -14px' : '0px 7px'));
		}
		
		
		if(utilex.options.debug) {
			
			var c = new Element('circle', {
					   
				move: {
					enabled: true,
					fixed: false,
					fx: {
						duration: 'normal',
						transition: 'bounce:out'
					}
				},
				
				pos: {
					x: 1000,
					y: 5,
					z: 5
				},
				
				radius: 70,
				content: 'Кликните 2 раза для изменения всех параметров',
				color: '#FE0',
				styles: null,
				
				background: {
					color: null,
					image: null
				},
				
				border: {
					width: 2,
					color: '#000'
				},
				
				parent: $(document.body).getElement('.container')
			});
			
			
			c.addEvents({
					mouseenter: function() {
					
						var r = 80;
						
						this.update({color: '#F50', radius: r, pos: {
											x: this.options.pos.x - (r - this.options.radius),
											y: this.options.pos.y - (r - this.options.radius)
									}});
						
					}.bind(c),
			
					mouseleave: function() {
					
						var r = 70;
						
						this.update({color: '#FE0', radius: r, pos: {
											x: this.options.pos.x + (this.options.radius - r),
											y: this.options.pos.y + (this.options.radius - r)
									}});	
						
					}.bind(c),
					
					dblclick: function(e) {
						
							var p = new Array();
							var o = null;
							
							utilex.circles.each(function(item, index) {
								o = item.options;
								o.content = null;
								p.push(o);
							});
							
							var ol = JSON.decode(window.prompt('Параметры', JSON.encode(p)));
							
							ol.each(function(item, index) {
								utilex.circles[index].update(item, {fx: {duration: 'long', transition: 'back:in:out'}});
							});
						
					}.bind(c)
			});
		}
		
		
	} catch(E) {
		//alert(E);
	}
	
	if($defined(sConfig.after)) sConfig.after();
	
//});
}


var sConfig = {data: null, debug: false, slide: {to: 'up', from: 'up'}, onExit: null, anim: false};

//-->
