glow.onDomReady(function() {

var arrH3Emphasized = glow.dom.get("h3.emphasised");
	arrH3Emphasized.each(function(i) {

		// Add a <span/> tag to the H3 - this is needed to add an additional background image
		glow.dom.get(arrH3Emphasized[i]).html("<span></span>" + glow.dom.get(arrH3Emphasized[i]).html());

		// Add an event to capture mouse clicks - this will check for the existance of the class 'show' and act accordingly
		glow.events.addListener(glow.dom.get(arrH3Emphasized[i]), 'click', function(){

			if ( glow.dom.get(this).hasClass("show") )
			{
				// Close the accordian
					// Update the class
					glow.dom.get(this).removeClass("show");
					// Set the height of the promo using an animation
					glow.anim.css(
						glow.dom.get(this).parent().parent(), 
						0.75,
						{
							"height" : {to: 13}
						},
						{tween:glow.tweens.bounceOut()}
					).start();
			}
			else
			{
				// Open the accordian
					// Update the class
					glow.dom.get(this).addClass("show");
					// Prepare to set the height of the promo using an animation
					var accordian_height = (glow.dom.get(this).parent().parent().children().height());
					var myAnim = glow.anim.css(
						glow.dom.get(this).parent().parent(), 
						0.75,
						{
							"height" : {to: accordian_height }
						},
						{tween:glow.tweens.bounceOut()}
					);
					// When the animation has ran tidy up the height of the promo by setting it to 'auto'
					var obj = glow.dom.get(this).parent().parent();
					glow.events.addListener(myAnim, "complete", function(){
						obj.css("height", "auto");
					});
					// State the animation
					myAnim.start();
			}

		});

		// Finally, add the 'show' class to the promo to give it a default position ('open')
		glow.dom.get(arrH3Emphasized[i]).addClass("show");

		// Close the accordian
			// Update the class
			glow.dom.get(this).removeClass("show");
			// Set the height of the promo using an animation
			glow.anim.css(
				glow.dom.get(this).parent().parent(), 
				0.75,
				{
					"height" : {to: 13}
				},
				{tween:glow.tweens.bounceOut()}
			).start();
			

	});

});