/*var QuickTip = Class.create();
QuickTip.prototype = {
	initialize: function(qtPanel, qtControlPanel, qtTrigger, qtEndstate) {
		this.qtPanel = $(qtPanel);
		this.qtControlPanel = $(qtControlPanel);
		this.qtTrigger = $(qtTrigger);
		this.qtEndstate = $(qtEndstate);
		this.movieUrl = this.qtTrigger.href;
		this.qtController = null;
		Event.observe(qtTrigger, 'click', this.setupMovie.bindAsEventListener(this));
	},
	
	setupMovie: function(evt) {
		Event.stop(evt);
		var movie = AC.Quicktime.packageMovie('qt-movie', this.movieUrl, {
			width: 640,
			height: 400,
			autoplay: true,
			controller: false,
			cache: true,
			poster: ''
		});
		this.qtEndstate.hide();
		this.qtPanel.innerHTML = '';
		this.qtPanel.appendChild(movie);
		this.qtController = new AC.QuicktimeController(movie, {
			onMoviePlayable: function() {
				this.qtController.monitorMovie();
				this.qtController.Play();
				setTimeout(function() {
					this.qtController.options.onMovieFinished = this.resetMovie.bind(this);
				}.bind(this),1000);
			}.bind(this)
		});
		this.qtController.render(this.qtControlPanel);
		movie = null;
	},
	
	resetMovie: function() {
		this.qtController.options.onMovieFinished = null;
		this.qtController.Stop();
		this.qtControlPanel.innerHTML = '';
		this.qtPanel.innerHTML = '';
		this.qtEndstate.down('.text').innerHTML = 'Watch Again';
		var replay = Builder.node('p', { className:'pillbutton replay' }, [
			Builder.node('a', { href:'/business/theater/'}, [
				Builder.node('span', 'View more Quick Tips'),
				Builder.node('b', '&gt;')
			])
		]);
		this.qtEndstate.appendChild(replay);
		this.qtEndstate.show();
	}
}*/
var heroPromos = [
	'<a href="/befr/business/profiles/virtualaviation/"><img src="http://images.apple.com/befr/business/images/index_hero7.jpg" width="483" height="245" border="0" alt="Virtual Aviation"></a>',
	'<a href="/befr/business/profiles/cityinn/"><img src="http://images.apple.com/befr/business/images/index_hero6.jpg" width="483" height="245" border="0" alt="City Inn"></a>',
	'<a href="/befr/business/profiles/nymphestrandhotel/"><img src="http://images.apple.com/befr/business/images/index_hero5.jpg" width="483" height="245" border="0" alt="nymphe strand hotel"></a>', 
	'<a href="/befr/business/profiles/carrouxcoffee/"><img src="http://images.apple.com/befr/business/images/index_hero4.jpg" width="483" height="245" border="0" alt="Carroux Coffee"></a>', 
	'<a href="/befr/business/profiles/mymuesli/"><img src="http://images.apple.com/befr/business/images/index_hero3.jpg" width="483" height="245" border="0" alt="mymuesli"></a>', 
	'<a href="/befr/business/profiles/booksandlivres/"><img src="http://images.apple.com/befr/business/images/index_hero2.jpg" width="483" height="245" border="0" alt="Books &amp; Livres"></a>', 
	'<a href="/befr/business/profiles/guidogebhardt/"><img src="http://images.apple.com/befr/business/images/index_hero1.jpg" width="483" height="245" border="0" alt="Guido Gebhardt"></a>'
	
];
var imgLoader = new Image();
for(i=0; i<heroPromos.length; i++) {
	imgLoader.src = heroPromos[i].substring(heroPromos[i].indexOf('images/index_hero'), heroPromos[i].indexOf('index_hero')+25);
}

var randomizeWhyMac = [
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_leopard20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;1&nbsp;: travaillez plus, peinez moins.</h4>\r<p>En un rien de temps, vos coll&egrave;gues et vous-m&ecirc;me travaillerez plus sereinement et plus efficacement que jamais. <a href="/befr/business/macatwork/" class="more">En&nbsp;savoir&nbsp;plus</a></p>',	
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_iwork_20090210.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;2&nbsp;: exprimez votre cr&eacute;ativit&eacute;.</h4>Ne laissez pas tout le plaisir aux seuls cr&eacute;ateurs. D&eacute;couvrez l\'artiste qui sommeille en vous, avec iLife et iWork. <a href="/befr/business/macatwork/#creativity" class="more">En&nbsp;savoir&nbsp;plus</a></p>',
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_edit20090210.png" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;3&nbsp;: des suppl&eacute;ments sans suppl&eacute;ment.</h4>\r<p>Les Mac sont simples et sobres. Pourtant, &agrave; peine sortis de l\'emballage, ils sont plus actifs et polyvalents qu\'on ne pourrait s\'y attendre. <a href="/befr/business/macatwork/#extras" class="more">En&nbsp;savoir&nbsp;plus</a></p>', 
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_office20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;4&nbsp;:  Mac agile, Mac rapide.</h4>\r<p>Tout ce que n&eacute;cessite votre activit&eacute; peut &ecirc;tre fait sur un Mac. <a href="/befr/business/macatwork/#nimble" class="more">En&nbsp;savoir&nbsp;plus</a></p>', 
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_print20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;5&nbsp;: Mac est le champion de l\'ouverture.</h4>\r<p>Vous utilisez un Mac en plein univers PC&nbsp;? Ne vous inqui&eacute;tez pas : la plupart des applications courantes pour Mac et PC exploitent les m&ecirc;mes formats de fichiers. <a href="/befr/business/macatwork/#playwell" class="more">En&nbsp;savoir&nbsp;plus</a></p>',
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_applecare20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;6&nbsp;: vous n\'&ecirc;tes jamais &agrave; court de soutien.</h4>\r<p>Avec un syst&egrave;me intuitif, vous aurez rarement besoin d\'aide. <a href="/befr/business/macatwork/#help" class="more">En&nbsp;savoir&nbsp;plus</a></p>',
	'<img src="http://images.apple.com/befr/business/images/index_macatwork_imac20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Raison n&deg;&nbsp;7&nbsp;: prenez le rythme avec Mac.</h4>\r<p>En mati&egrave;re de vitesse et de s&eacute;curit&eacute;, les Mac ont deux armes secr&egrave;tes. <a href="/befr/business/macatwork/#pace" class="more">En&nbsp;savoir&nbsp;plus</a></p>'
];
var randomizePromoTop = [
	'<a href="/befr/macbookair/"><img src="http://images.apple.com/befr/business/images/index_heropromo_macbookair.gif" width="73" height="60" border="0" alt="MacBook air"></a>\r<h3><a href="/befr/macbookair/">Voici MacBook Air.</a></h3>\r<p>Le portable le plus fin du monde. <a href="/befr/macbookair/" class="more">En&nbsp;savoir&nbsp;plus</a></p>',				 
	'<a href="/befr/macosx/"><img src="http://images.apple.com/befr/business/images/index_heropromo_leopard.gif" width="73" height="60" border="0" alt="Leopard"></a>\r<h3><a href="/befr/macosx/">Leopard.</a></h3>\r<p>La version de Mac OS X la plus impressionnante &agrave; ce jour. <a href="/befr/macosx/" class="more">En&nbsp;savoir&nbsp;plus</a></p>', 
	'<a href="/befr/iwork/"><img src="http://images.apple.com/befr/business/images/index_heropromo_iwork.gif" width="73" height="60" border="0" alt="iWork"></a>\r<h3><a href="/befr/iwork/">Nouvel iWork&nbsp;\'08.</a></h3>\r<p>Un traitement de texte simple, de superbes pr&eacute;sentations et, maintenant, des tableurs. <a href="/befr/iwork/" class="more">En&nbsp;savoir&nbsp;plus</a></p>'
];
var randomizePromoBottom = [
	'<a href="/befr/macosx/applications/office/"><img src="http://images.apple.com/befr/business/images/index_heropromo_office.gif" width="68" height="60" border="0" alt="Office 2008 pour Mac"></a>\r<h3><a href="/befr/macosx/applications/office/">Office 2008 pour Mac.</a></h3>\r<p>Plus d\'outils et une compatibilit&eacute; accrue avec MS Office 2007 pour Windows. <a href="/befr/macosx/applications/office/" class="more">En&nbsp;savoir&nbsp;plus</a></p>',
	'<a href="/befr/timecapsule/"><img style="margin-top:8px;" src="http://images.apple.com/befr/business/images/index_heropromo_timecapsule.gif" width="73" height="60" border="0" alt="Time Capsule"></a>\r<h3 style="padding-top:12px;"><a href="/befr/timecapsule/">Time Capsule.</a></h3>\r<p>Un pas de g&eacute;ant pour la sauvegarde. <a href="/befr/timecapsule/" class="more">En&nbsp;savoir&nbsp;plus</a></p>'			 
];

Event.onDOMReady(function() {
	new AC.CrossfadeQueue(heroPromos, 'hero-promo');
	// quicktip movie
	//new QuickTip('qt-movie', 'qt-controller', 'qt-trigger', 'qt-endstate');
	
	// solutions swqp
	new AC.ContentSwap('swapnav', 'swapcontent', 'click');

	
	// Why Mac and hero promo randomizers
	if ($('random-tips')) {
		var randNum = Math.floor(Math.random() * (randomizeWhyMac.length));
		$('random-tips').innerHTML = randomizeWhyMac[randNum];
	}
	// 	if ($('index-heropromo-top')) {
	// 		var randNum = Math.floor(Math.random() * (randomizePromoTop.length));
	// 		$('index-heropromo-top').innerHTML = randomizePromoTop[randNum];
	// 	}
	// if ($('index-heropromo-bottom')) {
	//	var randNum = Math.floor(Math.random() * (randomizePromoBottom.length));
	//	$('index-heropromo-bottom').innerHTML = randomizePromoBottom[randNum];
	//  }
	
	// insert profiles
	if($('profiles')) new ShowProfiles($('profiles'));
});
