// JavaScript Document

// Start Cooking session
var jar;
var garbageCollector = {};

// When ready.
Event.observe(document, 'dom:loaded', function(event) {


	jar = new CookieJar({
		expires:3600, // seconds
		path: '/'
	});


	// Swap video/text at runtime
	if( $('texte_pro') ){ $('texte_pro').hide(); }



	// Attach event/behavior on video controler.
	if( $('video_ctrl') )
	{
		garbageCollector.video_ctrl = $('video_pro').innerHTML;																	 
		
		Event.observe($('video_ctrl') , 'click', function(event) {
		
			btnstatus = ( $('video_ctrl').hasClassName('sound_on') )? true:false;
			if(btnstatus)
			{
				$('video_ctrl').removeClassName('sound_on');
				$('video_ctrl').addClassName('sound_off');
				
			   if(Prototype.Browser.IE){$('video_pro').down('object').hide();}
				$('video_pro').hide();
$('video_pro').update("");
				$('texte_pro').show();
				
				jar.put('ui_videoControl', {mode: 'texto'});

			}else{
				$('video_ctrl').removeClassName('sound_off');
				$('video_ctrl').addClassName('sound_on');
				
				$('texte_pro').hide();
				$('video_pro').show();
$('video_pro').update( garbageCollector.video_ctrl );
$('video_pro').show();
			    if(Prototype.Browser.IE){$('video_pro').down('object').show();}
				
				jar.put('ui_videoControl', {mode: 'video'});
			}
			
		});
		
	}


	// Initialize disoplayed mode (video/text)
	ui_videoControl = jar.get('ui_videoControl');
	if(ui_videoControl == null)
	{
		jar.put('ui_videoControl', {mode: 'video'});
	}
	
	// Retreive again
	ui_videoControl = jar.get('ui_videoControl');
	
	// Check html node presence
	if( $('video_ctrl') && $('texte_pro') )
	{
		if(ui_videoControl.mode == 'video')
		{
			$('video_ctrl').removeClassName('sound_off');
			$('video_ctrl').addClassName('sound_on');
			
			$('texte_pro').hide();
			$('video_pro').show();
$('video_pro').update( garbageCollector.video_ctrl );
$('video_pro').show();
			
			jar.put('ui_videoControl', {mode: 'video'});
	
		}else{
			$('video_ctrl').removeClassName('sound_on');
			$('video_ctrl').addClassName('sound_off');
			
			$('video_pro').hide();
$('video_pro').update("");
			$('texte_pro').show();
			
			jar.put('ui_videoControl', {mode: 'texto'});
		}
	}




	// Ini on visit ...
	//	new Effect.Morph('tabslider', { style:'width:0px', duration: 0.1, transition: Effect.Transitions.SwingFromTo });
	if( $('tabslider') )
	{
	$('tabslider').setStyle( {width:'1px'} ).hide();
	}
	
	

	$$('table.datagrid tr td').each(function(item,index){
		
		
		Event.observe(item , 'mouseover', function(event) {
				elm = Event.element(event);
				if(elm.hasClassName('datatext')){
				    elm.addClassName('tr_over');
				}else{
				    elm.addClassName('tr_overimg');
				}
		});
		
		Event.observe(item , 'mouseout', function(event) {
				elm = Event.element(event);
				if(elm.hasClassName('datatext')){
				    elm.removeClassName('tr_over');
				}else{
				    elm.removeClassName('tr_overimg');
				}
		});
		
	});
	
	
	
	// Event control on links
	/*
	$$('.menu_item').each(function(itm,idx){
		
		Event.observe(itm, 'click', function(event) {
			Event.stop(event);

			new Effect.Morph('tabslider', {
				style:'width:750px',
				duration: 1.8,
				transition: Effect.Transitions.Elastic,
				beforeStart: function(){
					$('tabslider').show().setStyle( {width:'1px'} );
				},
				afterFinish: function(){
					window.location = itm.readAttribute('href');
					$('tabslider').hide();
				}
			});
			
		});

	});
	/**/
	
	

	// Mail anti spam
	if( $$('li.mailcontact a.menu_item').length>0 )
	{
	$$('li.mailcontact a.menu_item')[0].update( "boost<span class='darkness'>@</span>boost-asp.com" );
	$$('li.mailcontact a.menu_item')[0].writeAttribute('href', "mail"+"to"+":boost@boost-asp.com" );
	}
	
	if( $('LienRecrutement') )
	{
	$('LienRecrutement').update( "recrutement<span class='darkness'>@</span>boost-asp.com" );
	}
	
	// Ringback
	if( $$('li.telephone a.menu_item').length>0 )
	{
	$$('li.telephone a.menu_item')[0].writeAttribute('href', "Nous_Contacter.htm#ParTelephone" );
	}
	

	// Initialize Feed (jsFeedRotator)	
	$('jsFeedRotator').update("Bienvenue sur le site de Boost !");
	
	var aFeedRSS = ["Le site web BOOST fait peau neuve...", "BOOST a annoncé son Bureau Virtuel iPhone.","BOOST prestataire de FONCIA pour leur système d’information « locations saisonnières ».","BOOST recrute sur Annecy, Lyon et Paris.", "BOOST vient d'annoncer fin janvier l’ouverture d’une agence Paris Intra muros.", "CALISEO retient BOOST pour proposer des services hébergés à ses clients.", "BOOST fait le une de la lettre des ASP.", "Encore plus d'actualité ! BOOST lance son Blog..."];
	var icurrentFeed = -1;
	var oFeedRotator = window.setInterval( function(){
		
		icurrentFeed++;
		if( icurrentFeed >= aFeedRSS.length ){ icurrentFeed=0; }
		$('jsFeedRotator').update( aFeedRSS[icurrentFeed] );
		$('jsFeedRotator').writeAttribute( 'title', aFeedRSS[icurrentFeed] );
		
	}, 10000);
	
	
	

	if( $('frmContact') )
	{
		Event.observe( $('frmContact') , 'submit', function(event) {
	
			sURI = $('frmContact').readAttribute('action');
			var frm_plopbox = openCTKFORMPopup(sURI,'frm_plopbox',400,300);
				
	  });
	}
	


	// Create the fluidspaner component.
	Spaner.create( 'mySpaner' , {autowidth:true, usewheel:true, prevnextloop:false, usearrowkeys:true} );
	
	// Fill ...
	$$('#Pane1 div.content')[0].update( '<a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_axa"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_skf"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_set"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_ladyf"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_jouetc"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_dmc"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_cnomk"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_foncia"></a>' );
	$$('#Pane2 div.content')[0].update( '<a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_adm"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_aec"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_avanti"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_laydernier"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_barep"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_carl"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_homveil"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_neocoach"></a>' );
	$$('#Pane3 div.content')[0].update( '<a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_apollon"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_compositec"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_cea"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_masternaut"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_lmdc"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_pea"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_medialib"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_scmr"></a>' );
	$$('#Pane4 div.content')[0].update( '<a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_baya"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_datalogic"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_comtrade"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_ideis"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_pme"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_prmb"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_polybel"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_mobilis"></a>' );
//	$$('#Pane4 div.content')[0].update( '<a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_spirit"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_staubli"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_xlsoft"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_ozconseil"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_etec"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_optim"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_opalines"></a><a class="fsp_cbox" href="Nos_References_Clients.htm" id="fsp_tit"></a>' );


	Spaner.slide('mySpaner','Pane1');



	// Exclude framesetting
	if (window!=top) {top.location=window.location;}


});





// AS to JS (Flash to Javascript)
var _jsNavTo = function(page)
{
/*
	new Effect.Morph('tabslider', {
		style:'width:750px',
		duration: 1.8,
		transition: Effect.Transitions.SwingFromTo,
		afterFinish: function(){
*/
			window.location = page;
/*
			new Effect.Morph('tabslider', { style:'width:0px', duration: 0.1, transition: Effect.Transitions.SwingFromTo });
		}
	});
*/
};






/*****************************************************
* popup
* 19/08/2001
*
* Open a simple nice window with url,width and height
* in arguments.
*
* --Sébastien Brémond--
* http://www.tocra.org
*****************************************************/
function openCTKFORMPopup(sURI,sWinName,w,h){
	var FULLSCREEN_const = 'no';
	
	var sh = parseInt(screen.availHeight || screen.width);
	var sw = parseInt(screen.availWidth || screen.height);
	var pH = h;
	var pW = w;
	var hasSB = (arguments.length==5)? arguments[4] :'yes' ;
	return open(sURI,sWinName,'top='+((sh-pH)/2)+',left='+((sw-pW)/2)+',width='+pW+',height='+pH+',scrollbars='+hasSB+',fullscreen='+FULLSCREEN_const);
}
