function setFlashPan()
{
	var flashPanDiv = document.getElementById('flashPan');
	
	if(flashPanDiv)
	{
		var requiredMajorVersion = 9;		// Major version of Flash required
		var requiredMinorVersion = 0;		// Minor version of Flash required
		var requiredRevision = 16;			// Minor revision of Flash required

		switch(flashPanDiv.className)
		{
			case "rod-services" :
			flashVariables('fullcircle','false',
							'image','/images/panorama/rodpan.jpg',
							'heightscript','resizeHeight',
							'backgroundColor','#aaaaaa',
							'scrollArrowColor','#ff000000',
							'scrollArrowColorEnd','#ff000000',
							'scrollBackColor','#55f9f9f9',
							'scrollBackHover','#88f9f9f9',
							'scrollBackPress','#ccf9f9f9',
							'scrollBackEnd','#00000000',
							'loadingColor','#ffffffff',
							'cornerRadius', '10',
							'cornerColor', '#fff9f9f9');
			break;
			case "tubing-services" :
			flashVariables('fullcircle','false',
							'image','/images/panorama/tubepan.jpg',
							'heightscript','resizeHeight',
							'backgroundColor','#aaaaaa',
							'scrollArrowColor','#ff000000',
							'scrollArrowColorEnd','#ff000000',
							'scrollBackColor','#55f9f9f9',
							'scrollBackHover','#88f9f9f9',
							'scrollBackPress','#ccf9f9f9',
							'scrollBackEnd','#00000000',
							'loadingColor','#ffffffff',
							'cornerRadius', '10',
							'cornerColor', '#fff9f9f9');
			break;
			case "inspection-shop" :
			//alert('/images/panorama/rodshoppan.png');
			flashVariables('fullcircle','true',
							'image','/images/panorama/rodshoppan.jpg',
							'heightscript','resizeHeight',
							'backgroundColor','#aaaaaa',
							'scrollArrowColor','#ff000000',
							'scrollArrowColorEnd','#ff000000',
							'scrollBackColor','#55f9f9f9',
							'scrollBackHover','#88f9f9f9',
							'scrollBackPress','#ccf9f9f9',
							'scrollBackEnd','#00000000',
							'loadingColor','#ffffffff',
							'cornerRadius', '10',
							'cornerColor', '#fff9f9f9');
			break;
			case "tube-shop" :
			//alert('/images/panorama/rodshoppan.png');
			flashVariables('fullcircle','false',
							'image','/images/panorama/tubeshoppan.jpg',
							'heightscript','resizeHeight',
							'backgroundColor','#aaaaaa',
							'scrollArrowColor','#ff000000',
							'scrollArrowColorEnd','#ff000000',
							'scrollBackColor','#55f9f9f9',
							'scrollBackHover','#88f9f9f9',
							'scrollBackPress','#ccf9f9f9',
							'scrollBackEnd','#00000000',
							'loadingColor','#ffffffff',
							'cornerRadius', '10',
							'cornerColor', '#fff9f9f9');
			break;
			default :
			break;
		}
		flashSet( flashPanDiv, '/flash/panorama.swf', 'panorama', 'opaque','100%', '100%', requiredMajorVersion, requiredMinorVersion, requiredRevision );
	}
}

var timerID;
var t0 = 0;
var timeStep = 0.05;
var oldHeight;
var midHeight;
var destHeight;
var animatedDiv;


var resizeHeight = function (newHeight)
{
	/*$('#flashPan').animate(
		{height:newHeight},500
	);*/
	animatedDiv = document.getElementById('flashPan');
	t0 = 0;
	oldHeight = animatedDiv.offsetHeight;
	destHeight = newHeight;
	midHeight = (destHeight + oldHeight)/2;
	timerID = window.setInterval('animateHeight()', 30);
}

var animateHeight = function()
{
	t0 += timeStep;
	if(t0 >= 1)
	{
		animatedDiv.style.height = destHeight + 'px';
		clearTimeout(timerID);
		
		$( animatedDiv ).children( 'object' )
			.css( { height: destHeight });
	}
	else
	{
		var flashHeight = doubleBezier(oldHeight, midHeight, destHeight, t0)
		animatedDiv.style.height = flashHeight + 'px';
		$( animatedDiv ).children( 'object' )
			.css( { height: flashHeight });
	}
}

var doubleBezier = function(val1, val2, val3, paramT)
{
	var t1 = 0;
	var w0 = 0;
	var w1 = 0;
	var w2 = 0;
	var outputVal;
	if(paramT <= 0.5)
	{
		t1 = paramT*2;
		w0 = (1-t1)*(1-t1);
		w1 = 2*t1*(1-t1);
		w2 = t1*t1;
		outputVal = val1*w0 + val1*w1 + val2*w2;
	}
	else if(paramT < 1)
	{
		t1 = (paramT-0.5)*2;
		w0 = (1-t1)*(1-t1);
		w1 = 2*t1*(1-t1);
		w2 = t1*t1;
		outputVal = val2*w0 + val3*w1 + val3*w2;
	}
	else
	{
		outputVal = val3;
	}
	return outputVal;
}


// Generalized script for setting up a flash movie to play
// No changes should be made to this script
// All variables are set up in init() in init.js 
var flashVariableList = new Array();

function flashVariables()
{
	flashVariableList = arguments;
}

function flashSet( flashDiv, source, movieName, transparency, flashWidth, flashHeight, requiredMajorVersion, requiredMinorVersion, requiredRevision )
{
	var hasRequestedVersion = DetectFlashVer( requiredMajorVersion, requiredMinorVersion, requiredRevision ); // DetectFlashVer() in AC_RunActiveContent.js

	if ( hasRequestedVersion )
	{
		// change desired parameters here... 
		// add variables to end of argument list
		// writeFlash() in AC_RunActiveContent.js
		writeFlash( 
			'width',  flashWidth,
			'height', flashHeight,
			'src', source,
			'quality', 'high',
			'pluginspage', 'http://www.adobe.com/products/flashplayer/',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', transparency,
			'devicefont', 'false',
			'id', movieName,
			'name', movieName,
			'menu', 'false',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', source,
			'salign', '',
			'flashContainer', flashDiv,
			'addVariables', flashVariableList
			);
	}
}