var side_togs  = $$('.acc_tog');
var side_cons  = $$('.acc_con');

side_togs.each(function(el,i) {
	el.grab(new Element('div', {'class':'minmax'}));
	el.addEvent('click', function(ev){
		if(side_cons[i].getStyle('display')=='none')
		{
			if (el.get('text')=='top') ssgo = true;
			Cookie.write('side:'+el.get('text'), 'max', {domain:location.host});
				side_cons[i].reveal();
				el.addClass('max');
		}
		else {
			if (el.get('text')=='top') ssgo = false;
			Cookie.write('side:'+el.get('text'), 'min', {domain:location.host});
			side_cons[i].dissolve();
			el.removeClass('max');
		}
	});
});


var ngSlideshow = new Class({

	cur: 0,

	initialize: function(slides)
	{
		new Asset.images(slides, {
			onComplete: function(){
				slides.each(function(im) {
					new Element('img',{src:im}).fade('hide').inject($('show'));
				});
				this.slide = $$('#show img');
				this.run();
			}.bind(this)
		});
	},

	run: function()
	{
		this.slide[this.cur].get('tween',{property:'opacity', duration:2000}).start(0);
		this.cur++;
		if (this.cur == this.slide.length) this.cur = 0;
		this.slide[this.cur].get('tween',{property:'opacity', duration:2000}).start(1);

		this.run.delay(5000, this);
	}
});


$('fontsize_big').addEvent('click', function(ev){
	if (ev) ev.stop();
	Cookie.write('tricare_bigfont', 'true', {domain:location.host});
//	window.location = window.location;
//	return;

	$$('p').morph({
		'font-size':'20px',
		'line-height':'24px'
	});

	$$('ul.mainmenu a').setStyles({ // see menu.css
		'font-weight':'bold',
		'font-size':'14px'
	});

	$$('label').setStyles({
		'font-size':'16px',
		'font-weight': 'bold'
	});
});

$('fontsize_reset').addEvent('click', function(ev){
	if (ev) ev.stop();
	Cookie.write('tricare_bigfont', null, {domain:location.host});
//	window.location = window.location;
//	return;

	$$('p').morph({
		'font-size':'14px',
		'line-height':'18px'
	});

	$$('ul.mainmenu a').setStyles({ // see menu.css
		'font-weight':'normal',
		'font-size':'12px'
	});

	$$('label').setStyles({
		'font-size':'14px',
		'font-weight': 'normal'
	});
});

$('fontsize_toggle').addEvent('click', function(ev){
	ev.stop();
	if (Cookie.read('tricare_bigfont') == 'true')
		$('fontsize_reset').fireEvent('click');
	else
		$('fontsize_big').fireEvent('click');
});


var myShow = new ngSlideshow(tc_slides);

