

var ftrStretch = new Element('div', {
			id: 'ftrStretch',
			styles: {
				width: window.getSize().x,
				height: $('footerInner').getSize().y
			}
		}).adopt([
			new Element('div', {
				id: 'ftrTopBar',
				styles: { height: $('footer_access').getSize().y - 2 }
			}),
			new Element('div', {
				id: 'ftrBtmBar',
				styles: { height: $$('#footerInner p')[1].getSize().y }
			})
		]).inject('footerInner', 'before');


function roundCorners() {
	var br = new Element('div', { 'class': 'cnr' });
	return [
		br.clone().addClass('tl').set('html', '<img src="http://www.ltscotland.org.uk/journeytoexcellence/graphics/cornerTransTL.gif" width="11" height="11" />'),
		br.clone().addClass('tr').set('html', '<img src="http://www.ltscotland.org.uk/journeytoexcellence/graphics/cornerTransTR.gif" width="11" height="11" />'),
		br.clone().addClass('bl').set('html', '<img src="http://www.ltscotland.org.uk/journeytoexcellence/graphics/cornerTransBL.gif" width="11" height="11" />'),
		br.addClass('br').set('html', '<img src="http://www.ltscotland.org.uk/journeytoexcellence/graphics/cornerTransBR.gif" width="11" height="11" />')
	];
}


		var Gradients = (function() {
			//variables for caching
			var bInit, bNative, sProperty, sValue, sVendor, bCanvas, bToDataUrl, elCanvas;

			return new Class({
				initialize: function(sFromColor, sToColor, els) {
					//do this for the first initialized gradient and cache results
					if (!bInit) {
						bInit = true;

						//create test div element for native support testing
						var elDiv = new Element('div'),
						aVendors = ['-webkit-', '-moz-', '-o-', '-ms-', 'Microsoft'],
						sCommon = 'left top,left bottom,from({fromColor}),to({toColor})',
						oValues = new Hash({
							' ': 'background-image:gradient(linear,' + sCommon + ')',
							'-webkit-': 'background-image:-webkit-gradient(linear,' + sCommon + ')',
							'-o-': 'background-image:-o-gradient(linear,' + sCommon + ')',
							'-ms-': 'background-image:-ms-gradient(linear,' + sCommon + ')',
							'-moz-': 'background-image:-moz-linear-gradient(' + sCommon + ')',
							'Microsoft': 'filter:progid:DXImageTransform.Microsoft.gradient(startColorStr=#FF{fromColor},endColorStr=#FF{toColor})'
						});

						//set test div css to above css rules
						elDiv.style.cssText = oValues.getValues().join(';').substitute({ fromColor: sFromColor, toColor: sToColor }).replace(/#FF#/g, '#FF');

						//see if any css rules were applied by checking for the existance of background-image or filter
						sProperty = elDiv.style.backgroundImage.indexOf('gradient') > -1 ? 'background-image' : (elDiv.style.filter || '').indexOf('gradient') > -1 ? 'filter' : '';

						//if background-image or filter is found native support is true
						if (bNative = !!sProperty) {
							//find out what vendor specific rule was applied
							sVendor = elDiv.getStyle(sProperty).match(aVendors.join('|'));

							//get the css value part of the rule, this will be applied to our element(s)
							sValue = oValues[sVendor || ' '].split(sProperty + ':')[1];
						} else {
							//no native support! try and use canvas

							//create a canvas element, this will be reused amongst gradients
							elCanvas = new Element('canvas');

							//check if canvas is actually supported
							bCanvas = !!elCanvas.getContext;

							//check if canvas supports toDataURL as we need this for setting element backgrounds
							//todo: opera 9.62 supports toDataURL but it doesn't work, need additional check.
							bToDataURL = !!elCanvas.toDataURL;
						}

						//test div no longer required
						elDiv.dispose();
					}

					//apply gradient to elements depending on support
					if (bNative) {
						els.each(function(el) {
							this.applyNative(sFromColor, sToColor, el);
						} .bind(this));
					} else if (bCanvas && bToDataURL) {
						//canvas based gradients will need to be rebuilt if the element's dimensions change
						//we will fire this event straight away to initialize all gradients
						window.addEvent('resize', function() {
							els.each(function(el) {
								this.applyCanvas(elCanvas, sFromColor, sToColor, el);
							} .bind(this));
						} .bind(this)).fireEvent('resize', [], 300);
					} else if (bCanvas) {
						//create canvas elements and place behind gradient elements for non toDataURL support
						//we will fire this event straight away to initialize all gradients
						els.each(function(el) {
							var elCanvas = new Element('canvas', { 'class': 'ltsGradient' }),
								aBorderWidths = el.getStyle('border-width').split(' '),
								iBorderCompensateH = parseInt(aBorderWidths[0]) + parseInt(aBorderWidths[2]),
								iBorderCompensateW = parseInt(aBorderWidths[1]) + parseInt(aBorderWidths[3]);

							el.setStyles({
								'background-color': 'transparent',
								'z-index': '1'
							});

							if (el.getStyle('position') === 'static') {
								el.setStyle('position', 'relative');
							}

							window.addEvent('resize', function() {
								this.buildCanvas(elCanvas, sFromColor, sToColor, el, false).setStyles({
									height: (el.getSize().y - iBorderCompensateH) + 'px',
									width: (el.getSize().x - iBorderCompensateW) + 'px',
									padding: '0px',
									'position': 'absolute',
									'z-index': '-1',
									top: 0,
									left: 0
								}).inject(el, 'top');
							} .bind(this)).fireEvent('resize');
						} .bind(this));
					}
				},
				applyNative: function(sFromColor, sToColor, el) {
					el.setStyle(sProperty, sValue.substitute({ fromColor: this.formatColor(sFromColor), toColor: this.formatColor(sToColor) }));
					//ensure IE hasLayout is triggered
					if (sProperty === 'filter') { el.setStyle('zoom', 1); }
				},
				applyCanvas: function(elCanvas, sFromColor, sToColor, el) {
					el.setStyle('background', 'url("' + this.buildCanvas(elCanvas, sFromColor, sToColor, el, true).toDataURL() + '") repeat-x');
				},
				buildCanvas: function(elCanvas, sFromColor, sToColor, el, bToDataUrl) {
					//create gradient via canvas
					var iWidth = elCanvas.width = bToDataUrl ? 1 : el.getSize().x,
					iHeight = elCanvas.height = el.getSize().y,
					ctx = elCanvas.getContext('2d'),
					lingrad = ctx.createLinearGradient(0, 0, 0, iHeight);

					lingrad.addColorStop(0, sFromColor);
					lingrad.addColorStop(1, sToColor);
					ctx.fillStyle = lingrad;
					ctx.fillRect(0, 0, iWidth, iHeight);
					return elCanvas;
				},
				//IE can't use the full hex code with its "filter", remove it.
				formatColor: function(sColor) {
					return sProperty == 'filter' ? sColor.replace(/#/, '') : sColor;
				}
			});
		})();

new Gradients('#FFFFFF', '#EDEDED', $$('.bgOn, .pagetint, #Interactive h2, #HMIeOuterBox'));