// function fadeBgImage(element, image)
// {
// 	var icon = new Fx.Tween(element, {duration: 'short'});
// 	
// 	icon.start('background-image', 'url(images/'+image+'.png)');
// }
// 
// function fadeBgColor(element, backgroundcolor, textcolor)
// {
// 	var textfield = new Fx.Morph(element, {duration: 'short'});
// 
// 	textfield.start({
// 	    'background-color': backgroundcolor,
// 	    'color': textcolor,
// 	});
// }

window.addEvent('domready', function(){
		
	// news
	if(location.pathname != '/news.php')
	{
		var news_color = $('news_text').getStyle('backgroundColor');

		$('news').addEvents({
			mouseenter: function(){
				// morhs background color & text color
				$('news_text').morph({
					'background-color': '#368A2C',
					'color': '#FFFFFF'
				});
			},
			mouseleave: function(){
				// Morphes back to the original style
				$('news_text').morph({
					'background-color': news_color,
					'color': '#000000'
				});
			}
		});	
	}
	
	// adaptive music
	if(location.pathname != '/adaptivemusic.php')
	{
		var adaptivemusic_color = $('adaptivemusic_text').getStyle('backgroundColor');

		$('adaptivemusic').addEvents({
			mouseenter: function(){
				// morhs background color & text color
				$('adaptivemusic_text').morph({
					'background-color': '#2C6E8A',
					'color': '#FFFFFF'
				});
			},
			mouseleave: function(){
				// Morphes back to the original style
				$('adaptivemusic_text').morph({
					'background-color': adaptivemusic_color,
					'color': '#000000'
				});
			}
		});	
	}

	
	// portfolio
	if(location.pathname != '/portfolio.php')
	{
		var portfolio_color = $('portfolio_text').getStyle('backgroundColor');

		$('portfolio').addEvents({
			mouseenter: function(){
				// morhs background color & text color
				$('portfolio_text').morph({
					'background-color': '#CB6B2F',
					'color': '#FFFFFF'
				});
			},
			mouseleave: function(){
				// Morphes back to the original style
				$('portfolio_text').morph({
					'background-color': portfolio_color,
					'color': '#000000'
				});
			}
		});	
	}
	
	// about us
	if(location.pathname != '/about.php')
	{
		var aboutus_color = $('aboutus_text').getStyle('backgroundColor');

		$('aboutus').addEvents({
			mouseenter: function(){
				// morhs background color & text color
				$('aboutus_text').morph({
					'background-color': '#521A75',
					'color': '#FFFFFF'
				});
			},
			mouseleave: function(){
				// Morphes back to the original style
				$('aboutus_text').morph({
					'background-color': aboutus_color,
					'color': '#000000'
				});
			}
		});	
	}
});

function layout(page)
{
	if(page == 'news')
	{
		document.getElementById('news_text').style.width 			= '560px';
		document.getElementById('news_text').style.backgroundColor	= '#368A2C';
		document.getElementById('news_text').style.color			= '#FFFFFF';
		
		document.getElementById('adaptivemusic_text').style.width 	= '10px';
		document.getElementById('adaptivemusic_text').style.left 	= '400px';		
		
		document.getElementById('portfolio_text').style.width 		= '10px';
		document.getElementById('portfolio_text').style.left 		= '250px';		
		
		document.getElementById('aboutus_text').style.width 		= '10px';
		document.getElementById('aboutus_text').style.left 			= '100px';
	}
	
	if(page == 'adaptivemusic')
	{
		document.getElementById('news_text').style.width 			= '10px';
		document.getElementById('news_text').style.left 			= '0px';
		
		document.getElementById('adaptivemusic_text').style.width 	= '560px';
		document.getElementById('adaptivemusic_text').style.left 	= '-150px';	
		document.getElementById('adaptivemusic_text').style.backgroundColor	= '#2C6E8A';
		document.getElementById('adaptivemusic_text').style.color			= '#FFFFFF';
		
		document.getElementById('portfolio_text').style.width 		= '10px';
		document.getElementById('portfolio_text').style.left 		= '250px';		
		
		document.getElementById('aboutus_text').style.width 		= '10px';
		document.getElementById('aboutus_text').style.left 			= '100px';
	}
	
	if(page == 'portfolio')
	{
		document.getElementById('news_text').style.width 			= '10px';
		document.getElementById('news_text').style.left 			= '0px';
		
		document.getElementById('adaptivemusic_text').style.width 	= '10px';
		document.getElementById('adaptivemusic_text').style.left 	= '-150px';	
		
		document.getElementById('portfolio_text').style.width 		= '560px';
		document.getElementById('portfolio_text').style.left 		= '-300px';
		document.getElementById('portfolio_text').style.backgroundColor	= '#CB6B2F';
		document.getElementById('portfolio_text').style.color			= '#FFFFFF';	
		
		document.getElementById('aboutus_text').style.width 		= '10px';
		document.getElementById('aboutus_text').style.left 			= '100px';
	}
	
	if(page == 'aboutus')
	{
		document.getElementById('news_text').style.width 			= '10px';
		document.getElementById('news_text').style.left 			= '0px';
		
		document.getElementById('adaptivemusic_text').style.width 	= '10px';
		document.getElementById('adaptivemusic_text').style.left 	= '-150px';	
		
		document.getElementById('portfolio_text').style.width 		= '10px';
		document.getElementById('portfolio_text').style.left 		= '-300px';
	
		document.getElementById('aboutus_text').style.width 		= '560px';
		document.getElementById('aboutus_text').style.left 			= '-450px';
		document.getElementById('aboutus_text').style.backgroundColor	= '#521A75';
		document.getElementById('aboutus_text').style.color			= '#FFFFFF';
	}
}

function navigate(page)
{	
	document.getElementById('news_text').innerHTML = '';
	document.getElementById('adaptivemusic_text').innerHTML = '';
	document.getElementById('portfolio_text').innerHTML = '';
	document.getElementById('aboutus_text').innerHTML = '';
	
	if(page == 'news')
	{
		document.getElementById('news_text').style.zIndex = '100';

		var news			= new Fx.Morph('news_text', {duration: 350});
		var adaptivemusic 	= new Fx.Morph('adaptivemusic_text', {duration: 50});
		var portfolio 		= new Fx.Morph('portfolio_text', {duration: 50});
		var aboutus 		= new Fx.Morph('aboutus_text', {duration: 50});

		news.start({
			'width': '560px'
		});

		adaptivemusic.start({
			'width': '10px',
			'left': '400px'
		});

		portfolio.start({
			'width': '10px',
			'left': '250px'
		});

		aboutus.start({
			'width': '10px',
			'left': '100px'
		});
	}
	
	if(page == 'adaptivemusic')
	{
		document.getElementById('adaptivemusic_text').style.zIndex = '100';

		var news			= new Fx.Morph('news_text', {duration: 50});
		var adaptivemusic 	= new Fx.Morph('adaptivemusic_text', {duration: 350});
		var portfolio 		= new Fx.Morph('portfolio_text', {duration: 50});
		var aboutus 		= new Fx.Morph('aboutus_text', {duration: 50});

		news.start({
			'width': '10px',
			'left': '0'
		});

		adaptivemusic.start({
			'width': '560px',
			'left': '-150px'
		});

		portfolio.start({
			'width': '10px',
			'left': '250px'
		});

		aboutus.start({
			'width': '10px',
			'left': '100px'
		});
	}
	
	if(page == 'portfolio')
	{
		document.getElementById('portfolio_text').style.zIndex = '100';

		var news			= new Fx.Morph('news_text', {duration: 50});
		var adaptivemusic 	= new Fx.Morph('adaptivemusic_text', {duration: 50});
		var portfolio 		= new Fx.Morph('portfolio_text', {duration: 350});
		var aboutus 		= new Fx.Morph('aboutus_text', {duration: 50});

		news.start({
			'width': '10px',
			'left': '0'
		});

		adaptivemusic.start({
			'width': '10px',
			'left': '-150px'
		});

		portfolio.start({
			'width': '560px',
			'left': '-300px'
		});

		aboutus.start({
			'width': '10px',
			'left': '100px'
		});
	}
	
	if(page == 'about')
	{		
		document.getElementById('aboutus_text').style.zIndex = '100';

		var news			= new Fx.Morph('news_text', {duration: 50});
		var adaptivemusic 	= new Fx.Morph('adaptivemusic_text', {duration: 50});
		var portfolio 		= new Fx.Morph('portfolio_text', {duration: 50});
		var aboutus 		= new Fx.Morph('aboutus_text', {duration: 350});

		news.start({
			'width': '10px',
			'left': '0'
		});

		adaptivemusic.start({
			'width': '10px',
			'left': '-150px'
		});

		portfolio.start({
			'width': '10px',
			'left': '-300px'
		});

		aboutus.start({
			'width': '560px',
			'left': '-450px'
		});
	}
	
	setTimeout("window.location='"+page+".php'", 500);
}

function backHome()
{
	document.getElementById('news_text').innerHTML = '';
	document.getElementById('adaptivemusic_text').innerHTML = '';
	document.getElementById('portfolio_text').innerHTML = '';
	document.getElementById('aboutus_text').innerHTML = '';
	
	var news			= new Fx.Morph('news_text', {duration: 350});
	var adaptivemusic 	= new Fx.Morph('adaptivemusic_text', {duration: 350});
	var portfolio 		= new Fx.Morph('portfolio_text', {duration: 350});
	var aboutus 		= new Fx.Morph('aboutus_text', {duration: 350});

	news.start({
		'width': '160px',
		'left': '0'
	});

	adaptivemusic.start({
		'width': '160px',
		'left': '0'
	});

	portfolio.start({
		'width': '160px',
		'left': '0'
	});

	aboutus.start({
		'width': '160px',
		'left': '0'
	});
	
	setTimeout("window.location='index.php'", 400);
}

function toggle(element)
{	
	var slide = new Fx.Slide(element);
	
	slide.toggle();
}

function hide()
{
	for(var i = 0; i < arguments.length; i++)
	{
		var slide = new Fx.Slide(arguments[i]);

		slide.hide();	
	}
}
