var posLogo_LeftTop = [ 70, 70 ];
var posRefletLogo_LeftTop = [ 70, 600 ];
var posLogo_Center = [ 407, 313 ];
var posRefletLogo_Center = [ 407, 507 ];
var eStatus = "Accueil";
var oControleur = new controleur();
 
 function displayContent( url )
{
	var xhr_object = null;
	var position = "textDiv";
	if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest();
	else
	if (window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	
	// On ouvre la requete vers la page désirée
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function()
	{
		if ( xhr_object.readyState == 4 )
		{
			// j'affiche dans la DIV spécifiées le contenu retourné par le fichier
			document.getElementById(position).innerHTML = xhr_object.responseText;
		}
	}
	// dans le cas du get
	xhr_object.send(null); 
}

function showOndes()
{
	var arrayElts = [ $('img_fondOndes') ];
	var myElementsEffects = new Fx.Elements( arrayElts, { duration : 1500 } );
		
	myElementsEffects.start(
		{
			'0': {
				'opacity' : [ 0.0, 0.3 ]
			}
		}
	);
}

function moveLogo( bHideOndes )
{
	// Déplacement et diminution du logo [ Cap Graphique ] en haut à gauche du site
	var arrayEltsLogo = [ $('div_Logo'), $('img_Logo'), $('div_LogoReflet'), $('img_RefletLogo') ];
		var eltsEffectsLogo = new Fx.Elements( arrayEltsLogo, { transition: Fx.Transitions.Expo.easeOut, duration : 1500 } );
		eltsEffectsLogo.start(
			{
				'0': { 
					'left': posLogo_LeftTop[ 0 ],
					'top' : posLogo_LeftTop[ 1 ]			
				},
				'1': {
					'width': [ 290, 173 ],
					'height': [ 194, 115 ]
				},
				'2': { 
					'left': posRefletLogo_LeftTop[ 0 ],
					'top' : posRefletLogo_LeftTop[ 1 ],
					'opacity': 0.0
				},
				'3': {
					'width': [ 289, 173 ],
					'height': [ 193, 115 ]
				}
			}
		);
		
	// Disparition progressive du reflet du logo et de l'onde
	/*var arrayEltsHide = [ $('div_LogoReflet'), $('img_RefletLogo') ];
	var eltsEffectsHide = new Fx.Elements( arrayEltsHide, { duration : 2500 } );
	eltsEffectsHide.start(
		{
			'0': { 
				'left': posRefletLogo_LeftBottom[ 0 ],
				'bottom' : posRefletLogo_LeftBottom[ 1 ],
				'opacity': 0.0
			},
			'1': {
				'width': [ 289, 173 ],
				'height': [ 193, 115 ]
			}
		}
	);*/
	
	if( bHideOndes == true )
	{
		// Disparition progressive du reflet du logo et de l'onde
		var arrayEltsHide = [ $('img_fondOndes') ];
		var eltsEffectsHide = new Fx.Elements( arrayEltsHide, { duration : 500 } );
		eltsEffectsHide.start(
			{
				'0': {
					'opacity': [ 0.3, 0.0 ]
				}
			}
		);
	}
}

function unmoveLogo( bDisplayOndes )
{
	var arrayElts = [ $('div_Logo' ), $('img_Logo' ), $('div_LogoReflet'), $('img_RefletLogo') ];
	var myElementsEffects = new Fx.Elements( arrayElts, { transition: Fx.Transitions.Expo.easeIn, duration : 1500 } );
		
	myElementsEffects.start(
		{
			'0': { /*	let's change the first element's opacity and width	*/
				'left': [ posLogo_LeftTop[ 0 ], posLogo_Center[ 0 ] ],
				'top': [ posLogo_LeftTop[ 1 ], posLogo_Center[ 1 ] ]
			},
			'1': { /*	and the second one's opacity	*/
				'width': [ 173, 290 ],
				'height': [ 115, 194 ]
			},
			'2': { /*	and the third's height	*/
				'left': [ posRefletLogo_LeftTop[ 0 ], posRefletLogo_Center[ 0 ] ],
				'top': [ posRefletLogo_LeftTop[ 1 ], posRefletLogo_Center[ 1 ] ],
				'opacity': [ 0.0, 1.0 ]
			},
			'3': {
				'width': [ 173, 289 ],
				'height': [ 115, 193 ]
			}
		}
	);
	
	if( bDisplayOndes )
	{
		var arrayElts = [ $('img_fondOndes') ];
		var myElementsEffects = new Fx.Elements( arrayElts, { duration : 1500 } );
		
		myElementsEffects.start(
			{
				'0': {
					'opacity' : [ 0.0, 0.3 ]
				}
			}
		);
	}
}


function showItemsDiaporamas()
{}

/****************************************************************************************/
/*************** Onglet Presentation ****************************************************/
/****************************************************************************************/
function showPresentation()
{}

function hidePresentation()
{}

/****************************************************************************************/
/*************** Onglet Projet **********************************************************/
/****************************************************************************************/
function showProjet()
{}
function hideProjet()
{}


/****************************************************************************************/
/*************** Onglet Contact *********************************************************/
/****************************************************************************************/
function showContact()
{
	var oDivParent = document.getElementById( "div_Content" );
	
	// création des nouveaux noeuds
	var oDiv_Contact = document.createElement( "div" );
	var oDiv_Top = document.createElement( "div" );
	var oDiv_Adresse = document.createElement( "div" );
	var oDiv_Mail = document.createElement( "a" );
	//var oDiv_Localisation = document.createElement( "a" );
	
	// paramétrage des nouveaux noeuds
	oDiv_Contact.id = "div_Contact";
	oDiv_Top.className = "style_divTop";
	oDiv_Adresse.className = "style_divAdresse";
	oDiv_Mail.className = "style_divMail";
	//oDiv_Localisation.className = "style_divLocalisation";
	// raccord des noeuds
	oDivParent.appendChild( oDiv_Contact );
	oDiv_Contact.appendChild( oDiv_Top );
	oDiv_Contact.appendChild( oDiv_Adresse );
	//oDiv_Contact.appendChild( oDiv_Localisation );
	oDiv_Contact.appendChild( oDiv_Mail );
	oDiv_Mail.setAttribute( "href", "mailto:contact@cap-graphique.fr" );
	var arrayElts = [ $('div_Contact' )];
	var myElementsEffects = new Fx.Elements( arrayElts, { duration : 1500 } );
			
	myElementsEffects.start(
		{
			'0': {
				'opacity': [ 0.0, 1.0 ]
			}
		}
	);
}

function hideContact()
{
	var arrayEltsHide = [ $('div_Contact') ];
	var eltsEffectsHide = new Fx.Elements( arrayEltsHide, 
		{ 
			duration : 1000,
			onComplete : function() 
				{
					var oDivParent = document.getElementById( "div_Content" );
					var oDivContact = document.getElementById( "div_Contact" );
					oDivParent.removeChild( oDivContact );
				}
										  
		}
	);
	eltsEffectsHide.start(
		{
			'0': { 
				'opacity': 0.0
			}
		}
	);
}









/*
function changeBackgroundSite( bAccueil)
{
	if( bAccueil == true )
	{
		document.getElementById( "div_Main" ).style.backgroundImage = 'url("images/fond-accueil-avec-ondes.png")';
	}
	else
		document.getElementById( "div_Main" ).style.backgroundImage = 'url("images/fond-accueil-sans-ondes.png")';	
}		
	*/		
function sleep(millis) {
 /*   var notifier = new EventNotifier();
    setTimeout(notifier, millis);
    notifier.wait();*/
	date = new Date();  
         var curDate = null;  
           
         do { var curDate = new Date(); }  
         while(curDate-date < millis);  
}

var id = 1;
function displayItem()
{
	var FXItem = new Fx.Morph( 'item'+id, { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	if( id < 5 ) setTimeout( "displayItem()", 1000);
	id++;
		
}

function displayItem2()
{
	var FXItem = new Fx.Morph( 'item'+id, { duration : 500 } );
	FXItem.start( {'opacity' : 1.0 } );
	var FXItem2 = new Fx.Morph( 'imgItem'+id, { duration : 1000 } );
	FXItem2.start(  
			{ 
				'left' : [ 221, 0 ],
				'clip' : [ [ 0, 0, 43, 0 ], [ 0, 221, 43, 0 ] ]
			} 
	);
	if( id < 5 ) 
	{
		setTimeout( "displayItem2()", 500);
		id++;
	}
}

function displayItemDiaporama()
{
/*	var FXItem = new Fx.Morph( 'item1', { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	sleep( 1000 );
	var FXItem2 = new Fx.Morph( 'item2', { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem2.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	sleep( 1000 );
	var FXItem3 = new Fx.Morph( 'item3', { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem3.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	sleep( 1000 );
	var FXItem4 = new Fx.Morph( 'item4', { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem4.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	sleep( 1000 );
	var FXItem5 = new Fx.Morph( 'item5', { transition: Fx.Transitions.Back.easeOut, duration : 2000 } );
	FXItem5.start(  { 'right': [-200, 0], 'opacity' : 1.0 } );
	*/
	setTimeout( "displayItem2()", 1000);

	
}
