
	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-214-100_0039.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-201-100_0080.JPG':{caption:''}}
		var data2 = {
'http://fightacademymma.com/plogger/thumbs/lrg-186-img_3085.JPG':{caption:''},
'http://fightacademymma.com/plogger/thumbs/lrg-202-img_1925.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();
		}
		
	});
