
	var domReady = false;

	function positionSlideshow()
	{
		if(!domReady) return;
		// adjust main container position
		$('SLIDELEFT').position({
			relativeTo : $('leftFlags'),
			edge : 'upperRight',
			position: 'lowerRight',
			offset: {x:-10,y:37}
		});
		$('SLIDERIGHT').position({
			relativeTo : $('rightFlags'),
			edge : 'upperLeft',
			position: 'lowerLeft',
			offset: {x:10,y:37}
		});
	}
	
	function startSlideshow()
	{
		if(!domReady) return;
		// calculate the image box sizes
		var offsetWidth = 12; // little extra less width
		var bodyWidth = 655; // width of body area
		var browserWidth = window.getSize().x; // browser window width

		// if webkit browser (Safari, Chrome), subtract scrollbar width if
		// the page scrolls. Mootools incorrectly detects scrollbars for this engine.
		if(Browser.Engine.webkit)
		{
			if(window.getScrollSize().y > window.innerHeight)
			{
				browserWidth -= window.scrollbarWidth;
			}
		}

		// calculate it all up
		var wScale = Math.max((((browserWidth - bodyWidth) / 2) - offsetWidth), 125);
		var w = Math.min(wScale, 200);	

		// adjust size and set slideshow
		var data1 = {
'http://fightacademymma.com/plogger/thumbs/lrg-10-arm_bar.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-188-100_0208.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-129-img_1926.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-131-img_2224.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-133-img_2076.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-194-img_2208.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-205-img_3213.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-207-img_3215.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-209-img_3219.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-215-100_0135.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-217-img_2387.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-219-img_2271.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-224-100_0282.JPG':{caption:''}}
		var data2 = {
'http://fightacademymma.com/plogger/thumbs/lrg-102-touch_gloves.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-220-img_3200.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-103-img_1926.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-109-img_1895.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-130-kids_flyer_pic__1_.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-184-100_0273.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-195-img_2190.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-199-100_0115.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-200-100_0117.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-206-img_3214.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-208-img_3217.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-210-img_3222.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-216-IMG_2190__1_.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-218-img_2304.JPG':{caption:''}}
		var myShow1 = new Slideshow('show1', data1, {controller: false, overlap:false, resize:'length', height: w, center:true, hu: '', thumbnails: false, width: w});
		var myShow2 = new Slideshow('show2', data2, {controller: false, overlap:false, resize:'length', height: w, center:true, hu: '', thumbnails: false, width: w});
	}


	window.addEvents({
	
		'resize' : function()
		{
			startSlideshow();
			positionSlideshow();
		},
	
		'domready' : function()
		{
			(function(){
				/*
				This function calculates window.scrollbarWidth and window.scrollbarHeight
				This must be called
				“onload” to work correctly (or on “DOM ready”, if you're using
				a framework that provides such an event)
				*/
				var i = document.createElement('p');
				i.style.width = '100%';
				i.style.height = '200px';
				var o = document.createElement('div');
				o.style.position = 'absolute';
				o.style.top = '0px';
				o.style.left = '0px';
				o.style.visibility =
				'hidden';
				o.style.width = '200px';
				o.style.height = '150px';
				o.style.overflow = 'hidden';
				o.appendChild(i);
				document.body.appendChild(o);
				var w1 = i.offsetWidth;
				var
				h1 = i.offsetHeight;
				o.style.overflow = 'scroll';
				var w2 = i.offsetWidth;
				var h2 = i.offsetHeight;
				if (w1 == w2) w2 = o.clientWidth;
				if (h1 == h2) h2 = o.clientWidth;
				document.body.removeChild(o);
				window.scrollbarWidth = w1-w2;
				window.scrollbarHeight = h1-h2;
			})();
			
			domReady = true;
			startSlideshow();
			positionSlideshow();
		}
		
	});
