
	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-118-l_d81e58431ec004b585e9482c7b77e06a.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-42-2007_championship.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-43-gdb0074.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-46-kirk.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-126-touch_gloves.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-127-img_2076.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-187-img_3087.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-192-img_2044.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-198-img_0092.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-211-img_3224.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-222-100_0279.JPG':{caption:''}}
		var data2 = {
'http://fightacademymma.com/plogger/thumbs/lrg-122-l_41d6d7a370437789148350c72c1ab43d.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-70-new_camera_038.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-71-p8712.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-123-m_9443bfd3640d47e39139fd06c599081e.jpg':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-128-img_1895.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-181-100_0261.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-183-100_0272.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-196-img_2024.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-212-img_3225_2.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-223-100_0284.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();
		}
		
	});
