// ----------------------------------------
// ----- toggle mWebSlider
// ----------------------------------------
function mWeb_init_slider()
{
	// add moo.fx toggle to h2 elements that have a class of .mWebSlide
	$$('h2.mWebSlide').each(function(el){
		var headLines= el.getElements('td.name');
		headLines.each(function(h){
			new Fx.Style(h, 'opacity').set(0);
		});		

		var mySlide= new Fx.Slide(el.getProperty('rel'));
		el.addEvent('click', function(){
			mySlide.toggle();

			var headLines= el.getElements('td.name');
			headLines.each(function(h){
					if( el.status == 0 )
					{
						new Fx.Style(h, 'opacity').start(0,1);
					} else
					{
						new Fx.Style(h, 'opacity').start(1,0);
					}
			});		

			if( el.status == 0 )
			{
				el.status = 1;
			} else
			{
				el.status = 0;
			}
		});		

		el.addEvent('open', function(){
			mySlide.slideIn();

			var headLines= el.getElements('td.name');
			headLines.each(function(h){
				new Fx.Style(h, 'opacity').start(0,1);
			});		
			el.status= 1;
		});		

		el.addEvent('close', function(){
			mySlide.slideOut();
			
			var headLines= el.getElements('td.name');
			headLines.each(function(h){
				new Fx.Style(h, 'opacity').start(1,0);
			});	
			el.status= 0;
		});		

		var mySlide= new Fx.Slide(el.getProperty('rel'));
		mySlide.hide();
		el.status= 0;
	});
}

function mWeb_open()
{
	$$('h2.mWebSlide').each(function(el){
		el.fireEvent( 'open' );
	});
}
function mWeb_close()
{
	$$('h2.mWebSlide').each(function(el){
		el.fireEvent( 'close' );
	});
}


// ----------------------------------------
// ----- init zebra tables
// ----------------------------------------
function mWeb_init_zebra()
{
	// add mouse over trigger to tr elements that have a class of .zebra
	$$('tr.zebra').each(function(el){
		el.addEvent('mouseover', function(){
			el.style.backgroundColor = '#EEE';
		});		

		el.addEvent('mouseout', function(){
			el.style.backgroundColor = '#FFF';
		});	

		var theUrl= el.getProperty('rel');
		if( theUrl != null )
		{
			el.addEvent('click', function(){
				document.location.href = theUrl;
			});			
		}
	});
}


// ----------------------------------------
// ----- toolstips
// ----------------------------------------
function mWeb_init_tooltips()
{
	var Tip= new Tips($$('.ToolTip'), {
		className: 'custom'
	});
}


// ----------------------------------------
// ----- init
// ----------------------------------------
window.addEvent('domready', mWeb_init_slider);
window.addEvent('domready', mWeb_init_zebra);
window.addEvent('domready', mWeb_init_tooltips);
