MyComp = {
	toggleServiceBox: function()
	{
		this[$('service-icons').visible() ? 'hideServiceBox' : 'showServiceBox']();
	},
	hideServiceBox: function()
	{
		Effect.SlideUp('service-icons', {
			duration: 0.3,
			afterFinish: function() {
				MyComp.setCookie('servicebox', $('service-icons').visible());
			}
		});
		$('service-bar-top').down('div').show();
		$('service-close').hide();
	},
	showServiceBox: function()
	{
		Effect.SlideDown('service-icons', {
			duration: 0.3,
			afterFinish: function() {
				MyComp.setCookie('servicebox', $('service-icons').visible());
			}
		});
		$('service-bar-top').down('div').hide();
		$('service-close').show();
	},
	onPageLoad: function(start)
	{
		/*if (start) {
			Effect.SlideDown('service-icons', {duration: 0.3});
			$('service-bar-top').down('div').hide();
		} else			
			if (this.getCookie('servicebox') == 'true') this.showServiceBox();*/
	},
	getCookie: function(name)
	{
		var value;
		$H(document.cookie.toString().toQueryParams(';')).each(function(pair) {
			if (pair.key.toString().gsub(' ', '') == name) {
				value = pair.value;
				return true;
			}
		});
		return (value || false);
	},
	setCookie: function(name, value)
	{
		var date = new Date();
		date.setTime(date.getTime()+(arguments[2] || 2678400));
		var expires = "; expires="+date.toGMTString();
		document.cookie = name + "=" + encodeURIComponent(value) + expires + "; path=" + Page.options.root
	},
	menuEffect: function()
	{
		$('topmenu').down('ul').select('li > a').each(function(el) {
			if (el.up('li').hasClassName('active')) return;
			el.observe('mouseenter', function() {
				if (this.animating) return;
				this.animating = true;
				new Effect.Morph(this, {style: 'background: #2e2e2e; color: #fff;', duration: 0.8, queue: {position: 'front', scope: el.identify()}, afterFinish: function() { this.animating = false; }.bind(this)});
			});
			el.observe('mouseleave', function() {
				//if (this.animating) return;
				//this.animating = true;
				new Effect.Morph(this, {style: 'background: #f2f2f0; color: #2e2e2e;', duration: 0.8, queue: {position: 'end', scope: el.identify()}, afterFinish: function() { this.animating = false; }.bind(this)});
			});
		});
	}
};

