/*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="/nl/business/profiles/virtualaviation/"><img src="http://images.apple.com/nl/business/images/index_hero7.jpg" width="483" height="245" border="0" alt="Virtual Aviation"></a>',
	'<a href="/nl/business/profiles/cityinn/"><img src="http://images.apple.com/nl/business/images/index_hero6.jpg" width="483" height="245" border="0" alt="City Inn"></a>',
	'<a href="/nl/business/profiles/nymphestrandhotel/"><img src="http://images.apple.com/nl/business/images/index_hero5.jpg" width="483" height="245" border="0" alt="nymphe strand hotel"></a>', 
	'<a href="/nl/business/profiles/carrouxcoffee/"><img src="http://images.apple.com/nl/business/images/index_hero4.jpg" width="483" height="245" border="0" alt="Carroux Coffee"></a>', 
	'<a href="/nl/business/profiles/mymuesli/"><img src="http://images.apple.com/nl/business/images/index_hero3.jpg" width="483" height="245" border="0" alt="mymuesli"></a>', 
	'<a href="/nl/business/profiles/booksandlivres/"><img src="http://images.apple.com/nl/business/images/index_hero2.jpg" width="483" height="245" border="0" alt="Books &amp; Livres"></a>', 
	'<a href="/nl/business/profiles/guidogebhardt/"><img src="http://images.apple.com/nl/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/nl/business/images/index_macatwork_leopard20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 1: Met minder moeite meer doen</h4>\r<p>Je zult zien dat jij en je collega\'s in een mum van tijd met meer plezier &eacute;n een stuk effici&euml;nter werken. <a href="/nl/business/macatwork/" class="more">Meer&nbsp;info</a></p>',	
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_iwork_20090210.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 2: Ruimte voor creativiteit</h4>\r<p>Waarom zou het leuke werk alleen voorbehouden zijn aan ontwerpers en vormgevers? Je kunt zelf ook creatief aan de slag met iLife en iWork. <a href="/nl/business/macatwork/#creativity" class="more">Meer&nbsp;info</a></p>',
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_edit20090210.png" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 3: De extra\'s kosten niets extra\'s</h4>\r<p>Alle Macs zijn gestroomlijnd vormgegeven en eenvoudig in het gebruik. Toch zul je versteld staan van wat je er allemaal mee kunt. <a href="/nl/business/macatwork/#extras" class="more">Meer&nbsp;info</a></p>', 
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_office20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 4:  Macs zijn snel en multifunctioneel</h4>\r<p>Wat voor software je ook nodig hebt voor je bedrijf, je kunt er op de Mac gewoon mee aan de slag. <a href="/nl/business/macatwork/#nimble" class="more">Meer&nbsp;info</a></p>', 
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_print20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 5: Macs en pc\'s gaan prima samen.</h4>\r<p>Ben je een Mac-gebruiker in een pc-wereld? Ook dan hoef je je geen zorgen te maken. De meeste populaire programma\'s gebruiken zowel op de Mac als op de pc dezelfde bestandsstructuur. <a href="/nl/business/macatwork/#playwell" class="more">Meer&nbsp;info</a></p>',
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_applecare20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 6: Hulp is altijd dichtbij</h4>\r<p>Met een intu&iuml;tief systeem zult u hiervan echter niet vaak gebruikmaken. <a href="/nl/business/macatwork/#help" class="more">Meer&nbsp;info</a></p>',
	'<img src="http://images.apple.com/nl/business/images/index_macatwork_imac20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Reden 7: Een hogere versnelling, op de Mac-manier</h4>\r<p>De Mac heeft twee geheime wapens op het gebied van snelheid en veiligheid. <a href="/nl/business/macatwork/#pace" class="more">Meer&nbsp;info</a></p>'
];
var randomizePromoTop = [
	'<a href="/nl/macbookair/"><img src="http://images.apple.com/nl/business/images/index_heropromo_macbookair.gif" width="73" height="60" border="0" alt="MacBook air"></a>\r<h3><a href="/nl/macbookair/">Nieuw: MacBook Air.</a></h3>\r<p>De dunste notebook ter wereld. <a href="/nl/macbookair/" class="more">Meer&nbsp;info</a></p>',				 
	'<a href="/nl/macosx/"><img src="http://images.apple.com/nl/business/images/index_heropromo_leopard.gif" width="73" height="60" border="0" alt="Leopard"></a>\r<h3><a href="/nl/macosx/">Leopard.</a></h3>\r<p>Bekijk de meest indrukwekkende Mac OS X-versie tot nu toe. <a href="/nl/macosx/" class="more">Meer&nbsp;info</a></p>', 
	'<a href="/nl/iwork/"><img src="http://images.apple.com/nl/business/images/index_heropromo_iwork.gif" width="73" height="60" border="0" alt="iWork"></a>\r<h3><a href="/nl/iwork/">Het nieuwe iWork \'08.</a></h3>\r<p>Gestroomlijnde tekstverwerking, prachtige presentaties en nu ook spreadsheets. <a href="/nl/iwork/" class="more">Meer&nbsp;info</a></p>'
];
var randomizePromoBottom = [
	'<a href="/nl/macosx/applications/office/"><img src="http://images.apple.com/nl/business/images/index_heropromo_office.gif" width="68" height="60" border="0" alt="Office 2008 voor de Mac."></a>\r<h3><a href="/nl/macosx/applications/office/">Office 2008 voor de Mac.</a></h3>\r<p>Meer functionaliteit en een grotere compatibiliteit met MS Office 2007 voor Windows. <a href="/nl/macosx/applications/office/" class="more">Meer&nbsp;info</a></p>',
	'<a href="/nl/timecapsule/"><img style="margin-top:8px;" src="http://images.apple.com/nl/business/images/index_heropromo_timecapsule.gif" width="73" height="60" border="0" alt="Time Capsule"></a>\r<h3 style="padding-top:12px;"><a href="/nl/timecapsule/">Time Capsule.</a></h3>\r<p>Futuristisch back-ups maken. <a href="/nl/timecapsule/" class="more">Meer&nbsp;info</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'));
});
