// ONLOAD CALLS
Event.observe(document,'dom:loaded',function() {

		// ADD "JS Enabled"
		$$('body')[0].addClassName('js-enabled');

		//Show/Hide Slide Info
		//slideInfo();
		
		// Treatments OnClick
		treatmentOnClick();

		// Toggle voucher descriptions on /vouchers/
		voucherToggle(); 

		

		// IE Rounded Corners
		// IECorners();
});



// Toggle voucher descriptions
function voucherToggle() {
	var voucherList = $('voucher-list');
		
	if (voucherList) {
		voucherList.select('.voucher').invoke('writeAttribute','title','Click to select voucher');
		
		voucherList.select('.voucher-details').invoke('hide').invoke('removeClassName','details-hidden');
		
		voucherList.select('.voucher-toggle').each(function(e) {
			e.observe('click', function(event) {
				Event.stop(event);
				Event.element(event).up('li.voucher').down('.voucher-details').toggle();
			});
		});
	}
}








// PAGE IMAGE SLIDESHOW
Event.observe(window, 'load', function(){
	if( $('slide-show') ) {
		var brandingSlides = new protoShow('page-imagery', {		
			buildNavigation		: true,
			buildControls		: false,
			captions			: false,
			selector			: ".slide-show-slide"
		});	
	}	
});








function treatmentOnClick() {
	if($$('ul.treatments')[0]) {
		$$('body')[0].observe('click', function(ele) {
			
			var tag = Event.element(ele);
			
			if (tag.hasClassName('treatment-block')) {
				var treatmentAnchor = tag.down('h4 a');
				var treatmentLink = treatmentAnchor.readAttribute('href');
				//console.log(treatmentLink);
				window.location = treatmentLink;
			}
		});	
	}	// end if
}













