/*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="\/at\/business\/profiles\/nymphestrandhotel\/"><img src="\/at\/business\/images\/index_hero5.jpg" width="483" height="245" border="0" alt="nymphe strandhotel"><\/a>',
	'<a href="\/at\/business\/profiles\/carrouxcoffee\/"><img src="\/at\/business\/images\/index_hero4.jpg" width="483" height="245" border="0" alt="Carroux Coffee"><\/a>',
	'<a href="\/at\/business\/profiles\/mymuesli\/"><img src="\/at\/business\/images\/index_hero3.jpg" width="483" height="245" border="0" alt="mymuesli"><\/a>',
	'<a href="\/at\/business\/profiles\/booksandlivres\/"><img src="\/at\/business\/images\/index_hero1.jpg" width="483" height="245" border="0" alt="Books &amp; Livres"><\/a>', 
	'<a href="\/at\/business\/profiles\/guidogebhardt\/"><img src="\/at\/business\/images\/index_hero2.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="\/at\/business\/images\/index_macatwork_leopard20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 1: Mit weniger M&uuml;he mehr erreichen<\/h4>\r<p>Innerhalb k&uuml;rzester Zeit werden Sie und Ihre Kollegen zufriedener und effizienter als je zuvor arbeiten. <a href="\/at\/business\/macatwork\/" class="more">Weitere&nbsp;Infos<\/a><\/p>',	
	'<img src="\/at\/business\/images\/index_macatwork_iwork_20090210.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 2: Lassen Sie Ihrer Kreativit&auml;t freien Lauf<\/h4>\r<p>Warum die kreativen Aufgaben nur Designern &uuml;berlassen? Entdecken Sie Ihr kreatives Potenzial mit iLife und iWork. <a href="\/at\/business\/macatwork\/#creativity" class="more">Weitere&nbsp;Infos<\/a><\/p>',
	'<img src="\/at\/business\/images\/index_macatwork_edit20090210.png" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 3: Keine Zusatzkosten f&uuml;r Extras<\/h4>\r<p>Macs &uuml;berzeugen durch ihre Einfachheit und k&ouml;nnen direkt nach dem Auspacken bereits mehr als Sie erwarten. <a href="\/at\/business\/macatwork\/#extras" class="more">Weitere&nbsp;Infos<\/a><\/p>', 
	'<img src="\/at\/business\/images\/index_macatwork_office20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 4:  Rasant schnell<\/h4>\r<p>Alle anfallenden gesch&auml;ftlichen Aufgaben lassen sich auf einem Mac erledigen. <a href="\/at\/business\/macatwork\/#nimble" class="more">Weitere&nbsp;Infos<\/a><\/p>', 
	'<img src="\/at\/business\/images\/index_macatwork_print20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 5: Guter Austausch mit anderen Systemen<\/h4>\r<p>Sie arbeiten mit einem Mac in einer PC-Umgebung? Kein Problem. Die meisten g&auml;ngigen Programme f&uuml;r Mac und PC verwenden die gleichen Dateiformate. <a href="\/at\/business\/macatwork\/#playwell" class="more">Weitere&nbsp;Infos<\/a><\/p>',
	'<img src="\/at\/business\/images\/index_macatwork_applecare20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 6: N&uuml;tzliche Hilfe ist schnell zur Hand<\/h4>\r<p>Bei einem derart intuitiven System werden Sie sicher nicht oft Hilfe brauchen. <a href="\/at\/business\/macatwork\/#help" class="more">Weitere&nbsp;Infos<\/a><\/p>',
	'<img src="\/at\/business\/images\/index_macatwork_imac20071031.jpg" width="100" height="114" alt="Leopard" class="right">\r<h4>Grund 7: Arbeiten schneller erledigen mit einem Mac<\/h4>\r<p>Der Mac besitzt zwei Geheimwaffen f&uuml;r Schnelligkeit und Geschwindigkeit. <a href="\/at\/business\/macatwork\/#pace" class="more">Weitere&nbsp;Infos<\/a><\/p>'
];
var randomizePromoTop = [
	'<a href="\/at\/macbookair\/"><img src="\/at\/business\/images\/index_heropromo_macbookair.gif" width="73" height="60" border="0" alt="MacBook air"><\/a>\r<h3><a href="\/at\/macbookair\/">MacBook Air.<\/a><\/h3>\r<p>Das d&uuml;nnste Notebook der Welt <a href="\/at\/macbookair\/" class="more">Weitere&nbsp;Infos<\/a><\/p>',				 
	'<a href="\/at\/macosx\/"><img src="\/at\/business\/images\/index_heropromo_leopard.gif" width="73" height="60" border="0" alt="Leopard"><\/a>\r<h3><a href="\/at\/macosx\/">Leopard.<\/a><\/h3>\r<p>Erleben Sie die bisher eindrucksvollste Mac OS X Version. <a href="\/at\/macosx\/" class="more">Weitere&nbsp;Infos<\/a><\/p>', 
	'<a href="\/at\/iwork\/"><img src="\/at\/business\/images\/index_heropromo_iwork.gif" width="73" height="60" border="0" alt="iWork"><\/a>\r<h3><a href="\/at\/iwork\/">Das neue iWork \'08.<\/a><\/h3>\r<p>Verbesserte Textverarbeitung, beeindruckende Pr&auml;sentationen und jetzt auch Tabellenkalkulationen. <a href="\/at\/iwork\/" class="more">Weitere&nbsp;Infos<\/a><\/p>'
];
var randomizePromoBottom = [
	'<a href="\/at\/macosx\/applications\/office\/"><img src="\/at\/business\/images\/index_heropromo_office.gif" width="68" height="60" border="0" alt="Office 2008 f&uuml;r Mac"><\/a>\r<h3><a href="\/at\/macosx\/applications\/office\/">Office 2008 f&uuml;r Mac.<\/a><\/h3>\r<p>Mehr Werkzeuge und bessere Kompatibilit&auml;t mit MS Office 2007 f&uuml;r Windows. <a href="\/at\/macosx\/applications\/office\/" class="more">Weitere&nbsp;Infos<\/a><\/p>',
	'<a href="\/at\/timecapsule\/"><img style="margin-top:8px;" src="\/at\/business\/images\/index_heropromo_timecapsule.gif" width="73" height="60" border="0" alt="Time Capsule"><\/a>\r<h3 style="padding-top:12px;"><a href="\/at\/timecapsule\/">Time Capsule.<\/a><\/h3>\r<p>Ein Riesenschritt f&uuml;r die Datensicherung. <a href="\/at\/timecapsule\/" class="more">Weitere&nbsp;Infos<\/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'));
});
