// JavaScript to move content in div: portfolio, about, contact; messages, portfolio

// - change the left div, shift to right
currentLeft = 'portfolio'; // retain the id of the current info div

function shiftLeft(div)
{
	//load the next div to the left, prepare for shift animation
	document.getElementById(div).id='preloaderLeft';
	
//	shift divs with id: preloaderLeft, infoLeft

var shiftInfo = new Fx.Tween('infoLeft', {duration: 300, transition: Fx.Transitions.Sine.easeInOut});
var shiftPre = new Fx.Tween('preloaderLeft', {duration: 300, transition: Fx.Transitions.Sine.easeInOut});

shiftPre.addEvents({
       'complete': function() {
		   
//  move the old div to the hidden position (right:290px)
	document.getElementById('infoLeft').style.right = '290px';
//  change the old div id to the original
	document.getElementById('infoLeft').id = currentLeft;
//  change new div id to 'infoLeft' and retain the old id to currentLeft
	document.getElementById('preloaderLeft').id = 'infoLeft';
	currentLeft = div;

    }
});

	shiftInfo.start('right',-290);
	shiftPre.start('right',15);
}//shiftLeft


//-------------------------------------------------------------------------------------------------

// - fade the right div
currentRight = 'messages'; // retain the id of the current info div

function fadeRight(div)
{
	document.getElementById(div).id='preloaderRight';
	var slideFirst = new Fx.Tween('preloaderRight', {duration: 300, transition: Fx.Transitions.Sine.easeInOut});
	
	slideFirst.addEvents({
       'complete': function() {	
	//change the old div id to the original
	document.getElementById('infoRight').id = currentRight;
	//change new div id to 'infoRight' and retain the old id to currentLeft
	document.getElementById('preloaderRight').id = 'infoRight';
	currentRight = div;	
	   }
	   });//addEvents
	slideFirst.start('right',10);
	
	
	//	$('infoRight').fade('out');
	$('infoRight').fade('out');
	//fade in div with id: preloaderRight; fade out div with id: infoRight
	$('preloaderRight').fade('in');
	

}
//-------------------------------------------------------------------------------------------------

//- shift the right content div
currentRight = 'messages'; // retain the id of the current info div

function shiftRight(div)
{
	//load the next div to the left, prepare for shift animation
	document.getElementById(div).id='preloaderRight';
	
//	shift divs with id: preloaderLeft, infoLeft

var shiftInfoR = new Fx.Tween('infoRight', {duration: 300, transition: Fx.Transitions.Sine.easeInOut});
var shiftPreR = new Fx.Tween('preloaderRight', {duration: 300, transition: Fx.Transitions.Sine.easeInOut});

shiftPreR.addEvents({
       'complete': function() {
		   
//  move the old div to the hidden position (right:290px)
//	document.getElementById('infoRight').style.right = '290px';
//  change the old div id to the original
	document.getElementById('infoRight').id = currentRight;
//  change new div id to 'infoLeft' and retain the old id to currentLeft
	document.getElementById('preloaderRight').id = 'infoRight';
	currentRight = div;

    }
});

	shiftInfoR.start('right',290);
	shiftPreR.start('right',10);
}//shiftLeft



