var registered = false;
var Popup = new Class({

	Implements: [Events, Options],

	options: {
		duration: 200,
		transition: 'quad:in'
	},
	
	initialize: function(door, title, description, content, status, options){
		this.setOptions(options);
		this.opened = false;
		
		this.overlay = new Element('div').setStyles({
			'background-color': '#000000',
			'opacity': 0,
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'width': '100%',
			'height': '100%',
			'z-index': 1001
		}).addEvent('click', function(e){
			new Event(e).stop();
			this.close();
		}.bind(this));
		
		this.container = new Element('div').addClass('popup').setStyles({
			'opacity': 0,
			'position': 'absolute',
			'top': 0,
			'left': 0,
			'z-index': 1002,
			'width': 640
		});
		
		if (Cookie.read('registered') == null && registered == false) {
			if (pageTracker) {
				pageTracker._trackEvent('Calendar', 'Registration', 'Request');
			}
			this.title = new Element('h1').addClass('title').set('text', 'Opus Arte / Royal Opera House Advent Calendar').inject(this.container);
			this.description = new Element('p').addClass('description').set('text', 'To view the advent calendar content we hope you don\'t mind answering a few quick questions about yourself. You\'ll receive special offers and updates and we will not pass this information on to any third parties.').inject(this.container);
			this.error = new Element('p').addClass('error').setStyles({
				'opacity': 0
			}).inject(this.container);
			this.form = new Element('div').addClass('form').inject(this.container);
			this.label_firstname = new Element('label').set('text', 'First Name:').setProperties({
				'for': 'firstname'
			}).inject(this.form);
			this.firstname = new Element('input').setProperties({
				'type': 'text',
				'name': 'firstname',
				'id': 'firstname'
			}).inject(this.form);
			this.label_lastname = new Element('label').set('text', 'Last Name:').setProperties({
				'for': 'lastname'
			}).inject(this.form);
			this.lastname = new Element('input').setProperties({
				'type': 'text',
				'name': 'lastname',
				'id': 'lastname'
			}).inject(this.form);
			this.label_email = new Element('label').set('text', 'Email:').setProperties({
				'for': 'email'
			}).inject(this.form);
			this.email = new Element('input').setProperties({
				'type': 'text',
				'name': 'email',
				'id': 'email'
			}).inject(this.form);
			this.label_agree = new Element('label').addClass('agree').set('text', 'I agree to be contacted by Opus Arte and the Royal Opera House with future offers and updates. Your details will not be shared with any third parties.').setProperties({
				'for': 'agree'
			}).inject(this.form);
			this.agree = new Element('input').setProperties({
				'type': 'checkbox',
				'name': 'agree',
				'id': 'agree',
				'checked': 'checked'
			}).inject(this.label_agree, 'top');
			this.button = new Element('input').addClass('button').setProperties({
				'type': 'image',
				'src': '/images/button.gif'
			}).addEvent('click', function(e){
				new Event(e).stop();
				this.error.fade('out');
				if (this.agree.checked) {
					var request = new Request({
						url: '/index.php',
						onComplete: function(text){
							if (text != '') {
								if (pageTracker) {
									pageTracker._trackEvent('Calendar', 'Registration', 'Error');
								}
								this.error.set('html', text).fade('in');
								this.link.setStyle('display', 'block');
							} else {
								if (pageTracker) {
									pageTracker._trackEvent('Calendar', 'Registration', 'Registered');
								}
								Cookie.write('registered', (this.email.getProperty('value') == '' ? '*' : this.email.getProperty('value')), {duration: 365});
								registered = true;
								this.close();
								open_popup(door);
							}
						}.bind(this)
					}).post({
						'firstname': this.firstname.getProperty('value'),
						'lastname': this.lastname.getProperty('value'),
						'email': this.email.getProperty('value')
					});
				} else {
					this.agree.checked = true;
					this.error.set('html', 'Are you sure you do not want to receive updates and special offers from us?').fade('in');
					this.link.setStyle('display', 'block');
				}
			}.bind(this)).inject(this.form);
			this.link = new Element('a').addClass('link').setProperties({
				'href': '#'
			}).setStyles({
				'display': 'none'
			}).set('text', 'No thanks, take me to the calendar').addEvent('click', function(e){
				new Event(e).stop();
				if (pageTracker) {
					pageTracker._trackEvent('Calendar', 'Registration', 'Skipped');
				}
				Cookie.write('registered', (this.email.getProperty('value') == '' ? '*' : this.email.getProperty('value')), {duration: 365});
				registered = true;
				this.close();
				open_popup(door);
			}.bind(this)).inject(this.container);
		} else {
			if (pageTracker) {
				pageTracker._trackEvent('Calendar', 'Viewed', door+'');
			}
			this.content = new Element('div').setStyles({
				'width': 640,
				'height': 368
			}).set('html', content).inject(this.container);
			if (this.content.getElement('img')) {
				this.content.getElement('img').addEvent('load', function(){
					this.content.setStyles({
						'width': this.content.getElement('img').getSize().x,
						'height': this.content.getElement('img').getSize().y
					})
					this.move();
				}.bind(this));
			}
			this.title = new Element('h1').addClass('title').set('text', title).inject(this.container);
			
			this.share = new Element('p').addClass('share').set('html', 'Share via ').inject(this.container);
			this.twitter = new Element('img').setProperties({
				'src': '/images/twitter.gif',
				'alt': 'Twitter'
			}).addEvent('click', function(){
				window.open('http://www.twitter.com/home?status='+status.replace(/ /g, '+'));
			}).inject(this.share);
			this.facebook = new Element('img').setProperties({
				'src': '/images/facebook.gif',
				'alt': 'Twitter'
			}).addEvent('click', function(){
				window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent('http://www.opusarte-adventcalendar.com/index.php?day='+door));
			}).inject(this.share);
			
			this.description = new Element('p').addClass('description').set('text', description).inject(this.container);
			
			var date = get_date();
			var links = 'Choose another day to view: ';
			for (var i = 1; i <= 24; i++) {
				if (i <= date.getDate() && date.getMonth()+1 == 12 && date.getFullYear() == 2009) {
					if (i == door) {
						links += '<a href="#" class="selected">'+i+'</a>';
					} else {
						links += '<a href="#">'+i+'</a>';
					}
				} else {
					links += i;
				}
				if (i < 24) {
					links += ' . ';
				}
			}
			this.links = new Element('p').addClass('links').set('html', links).inject(this.container).getElements('a').each(function(a, i){
				a.addEvent('click', function(){
					this.close();
					open_popup(i+1);
				}.bind(this));
			}.bind(this));
		}
		
		this.close_button = new Element('div').addClass('close').setStyles({
			'cursor': 'pointer'
		}).addEvent('click', function(e){
			new Event(e).stop();
			this.close();
		}.bind(this)).inject(this.container);
		
		window.addEvent('scroll', function(){
			if (this.opened) {
				this.move();
			}
		}.bind(this)).addEvent('resize', function(){
			if (this.opened) {
				this.move();
			}
		}.bind(this));
		
		this.open();
	},
	
	move: function(){
		this.overlay.setStyles({
			'top': window.getScroll().y,
			'left': window.getScroll().x
		});
		this.container.setStyles({
			'left': (($(document.body).getSize().x - this.container.getSize().x) > 0) ? (($(document.body).getSize().x - this.container.getSize().x) / 2)+$(document.body).getScroll().x : 0,
			'top': (($(document.body).getSize().y - this.container.getSize().y) > 0) ? (($(document.body).getSize().y - this.container.getSize().y) / 2)+10+$(document.body).getScroll().y : 10
		});
	},
	
	open: function(){
		this.overlay.inject(document.body);
		this.container.inject(document.body);
		this.move();
		this.opened = true;
		new Fx.Tween(this.overlay, {
			wait: false,
			duration: this.options.duration,
			transition: this.options.transition,
			onComplete: function(){
				new Fx.Tween(this.container, {
					wait: false,
					duration: this.options.duration,
					transition: this.options.transition
				}).start('opacity', 1);
			}.bind(this)
		}).start('opacity', 0.8);
		
	},
	
	close: function(){
		new Fx.Tween(this.container, {
			wait: false,
			duration: this.options.duration,
			transition: this.options.transition,
			onComplete: function(){
				this.container.dispose();
				new Fx.Tween(this.overlay, {
					wait: false,
					duration: this.options.duration,
					transition: this.options.transition,
					onComplete: function(){
						this.overlay.dispose();
						this.opened = false;
					}.bind(this)
				}).start('opacity', 0);
			}.bind(this)
		}).start('opacity', 0);
	}

});
window.addEvent('domready', function(){
	var date = get_date();
	var src = '/images/0.jpg';
	if (date.getMonth()+1 == 12 && date.getFullYear() == 2009) {
		if (date.getDate() > 24) {
			src = '/images/24.jpg';
		} else {
			src = '/images/'+date.getDate()+'.jpg';
		}
	} else if (date.getFullYear() > 2009) {
		src = '/images/24.jpg';
	}
	$('calendar').addEvent('click', function(e){
		var date = get_date();
		var door = get_door(e.page);
		if (door <= date.getDate() && date.getMonth()+1 == 12 && date.getFullYear() == 2009) {
			open_popup(door);
		}
	}).addEvent('mousemove', function(e){
		var date = get_date();
		var door = get_door(e.page);
		if (door <= date.getDate() && date.getMonth()+1 == 12 && date.getFullYear() == 2009) {
			if (door > 0) {
				$('calendar').setStyle('cursor', 'pointer');
			} else {
				$('calendar').setStyle('cursor', 'default');
			}
		}
	}).getElement('img').setProperty('src', src);
});
function get_date(){
	return new Date();
}
function get_door(pos) {
	var p = $('calendar').getPosition();
	var door = 0;
	var areas = [
		[42,46,140,104],
		[227,410,325,468],
		[227,134,325,192],
		[596,225,694,283],
		[596,46,694,104],
		[227,46,325,104],
		[42,313,140,371],
		[411,410,509,468],
		[42,225,140,283],
		[781,313,879,371],
		[781,134,879,192],
		[412,46,510,104],
		[596,134,694,192],
		[42,134,140,192],
		[781,225,879,283],
		[227,225,325,283],
		[781,410,879,468],
		[596,313,694,371],
		[411,134,509,192],
		[227,313,325,371],
		[781,46,879,104],
		[42,410,140,468],
		[596,410,694,468],
		[393,261,527,341]
	];
	areas.each(function(area, i) {
		if ((pos.x - p.x) >= area[0] && (pos.x - p.x) <= area[2] && (pos.y - p.y) >= area[1] && (pos.y - p.y) <= area[3]) {
			door = i+1;
		}
	});
	return door;
}
function open_popup(door) {
	var title = '';
	var description = '';
	var content = '';
	var status = '';
	switch (door) {
		case 1:
			title = 'Clockwork Dolls';
			description = 'Herr Drosselmeyer brings to life two clockwork dolls to entertain guests at the Stahlbaums\' Christmas party.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/1_Clockwork_dolls_1.swf"><param name="quality" value="high"><embed src="/assets/1_Clockwork_dolls_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 1 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 2:
			title = 'Dancing Toy Soldiers';
			description = 'Herr Drosselmeyer magically produces two lifesize dancing toy soldiers.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/3_Dancing_toy_solders_1.swf"><param name="quality" value="high"><embed src="/assets/3_Dancing_toy_solders_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 2 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 3:
			title = 'The Sugar Plum Fairy and the Prince';
			description = 'Alexandra Ansanelli and Valeri Hristov as the Sugar Plum Fairy and the Prince.';
			content = '<img src="/assets/aa_and_vh.jpg" alt="" />';
			status = 'Have just viewed the day 3 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 4:
			title = 'Christmas Party';
			description = 'Christmas party at the Stahlbaums.';
			content = '<img src="/assets/children.jpg" alt="" />';
			status = 'Have just viewed the day 4 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 5:
			title = 'Clockwork Dolls';
			description = 'Brian Maloney and Sian Murphy as Harlequin and Columbine, the dancing clockwork dolls.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/2_Clockwork_dolls_1.swf"><param name="quality" value="high"><embed src="/assets/2_Clockwork_dolls_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 5 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 6:
			title = 'Herr Drosselmeyer';
			description = 'Gary Avis as Herr Drosselmeyer';
			content = '<img src="/assets/drosselmeyer.jpg" alt="" />';
			status = 'Have just viewed the day 6 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 7:
			title = 'The Sugar Plum Fairy and the Prince';
			description = 'The Sugar Plum Fairy and her Prince dance for Clara and the Soldier Prince.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/14_suger_plum_1.swf"><param name="quality" value="high"><embed src="/assets/14_suger_plum_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 7 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 8:
			title = 'Clara and the Soldier Prince';
			description = 'Iohna Loots\' Clara and Ricardo Cervera\'s Soldier Prince.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/7_Clara_and_Soldier_Prince_1.swf"><param name="quality" value="high"><embed src="/assets/7_Clara_and_Soldier_Prince_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 8 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 9:
			title = 'The Nutcracker';
			description = 'The Nutcracker';
			content = '<img src="/assets/nutcracker_poster.jpg" alt="" />';
			status = 'Have just viewed the day 9 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 10:
			title = 'Chinese Dance';
			description = 'Liam Scarlett, Andrej Uspenski, Jonathan Watkins and James Wilkie perform the Chinese (Tea) Dance.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/11_Tea_1.swf"><param name="quality" value="high"><embed src="/assets/11_Tea_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 10 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 11:
			title = 'Giving the Nutcracker to Clara';
			description = 'Herr Drosselmeyer gives Clara a toy nutcracker as a gift and her brother Fritz is jealous.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/4_giving_the_nutcracker_to_Clara_1.swf"><param name="quality" value="high"><embed src="/assets/4_giving_the_nutcracker_to_Clara_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 11 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 12:
			title = 'Russian Dance';
			description = 'Kevin Emerton, Richard Ramsey & Ricardo Cervera perform the Russian (Trepak) Dance.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/12_Russian_1.swf"><param name="quality" value="high"><embed src="/assets/12_Russian_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 12 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 13:
			title = 'Snowflakes';
			description = 'Snowflakes.';
			content = '<img src="/assets/snowflakes.jpg" alt="" />';
			status = 'Have just viewed the day 13 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 14:
			title = 'Spanish Dance';
			description = 'Francesca Filipi, José Martin, Kristen McNally, Thomas Whitehead, Sian Murphy & Brian Maloney perform the Spanish (Chocolate) Dance.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/9_Spanish_1.swf"><param name="quality" value="high"><embed src="/assets/9_Spanish_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 14 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 15:
			title = 'The Sugar Plum Fairy';
			description = 'Alexandra Ansanelli as the Sugar Plum Fairy.';
			content = '<img src="/assets/aa.jpg" alt="" />';
			status = 'Have just viewed the day 15 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 16:
			title = 'Arabian Dance';
			description = 'Cindy Jourdain, David Pickering, Fernando Montaño & Johannes Stepanek perform the Arabian (Coffee) Dance.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/10_Arabian_1.swf"><param name="quality" value="high"><embed src="/assets/10_Arabian_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 16 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 17:
			title = 'Angels';
			description = 'Christmas Angels.';
			content = '<img src="/assets/angels.jpg" alt="" />';
			status = 'Have just viewed the day 17 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 18:
			title = 'The Soldier Prince';
			description = 'The Nutcracker is transformed into a Soldier Prince.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/6_the_soldier_prince_1.swf"><param name="quality" value="high"><embed src="/assets/6_the_soldier_prince_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 18 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 19:
			title = 'Clara dancing with the Nutcracker';
			description = 'Clara is overjoyed to have received a toy nutcracker as her gift.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/5_Clara_dancing_with_the_Nutcracker_1.swf"><param name="quality" value="high"><embed src="/assets/5_Clara_dancing_with_the_Nutcracker_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 19 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 20:
			title = 'Ricardo Cervera';
			description = 'Ricardo Cervera (The Nutcracker).';
			content = '<img src="/assets/cervera.jpg" alt="" />';
			status = 'Have just viewed the day 20 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 21:
			title = 'Waltz of the Snowflakes';
			description = 'Excerpt from the Waltz of the Snowflakes.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/8_Snowflakes_1.swf"><param name="quality" value="high"><embed src="/assets/8_Snowflakes_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 21 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 22:
			title = 'Clara';
			description = 'Iohna Loots as Clara.';
			content = '<img src="/assets/clara.jpg" alt="" />';
			status = 'Have just viewed the day 22 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 23:
			title = 'Waltz of the Flowers';
			description = 'Excerpt from the Waltz of the Flowers.';
			content = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="640" height="368"><param name=movie value="/assets/13_Waltz_of_Flowers_1.swf"><param name="quality" value="high"><embed src="/assets/13_Waltz_of_Flowers_1.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="640" height="368"></embed></object>';
			status = 'Have just watched the day 23 video on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
		case 24:
			title = 'Christmas Tree';
			description = 'Christmas Tree Transformation.';
			content = '<img src="/assets/christmas_tree.jpg" alt="" />';
			status = 'Have just viewed the day 24 content on the Royal Opera House and Opus Arte Nutcracker Suite Advent Calendar http://bit.ly/8oeXiy';
			break;
	}
	if (door > 0) {
		var popup = new Popup(door, title, description, content, status);
	}
}