// Custom script
var currentScene = "green_slope";
var timer;

infoArray = new Array();
infoArray[1] = "<span class='large'>01</span> <p>Tensar<i>tech</i> TR2 Wall Systems are used when the design life of the structure is relatively short and where aesthetics are a secondary consideration such as in this temporary bridge abutment.</p>";
infoArray[2] = "<span class='large'>02</span> <p>The facing units are delivered and stored flat typically in 4.8m x 2.4m sheets.</p>";
infoArray[3] = "<span class='large'>03</span><p>The sheets should be cut on site in to 2.4m x 2.4m sheets and fixed into position along the line of the structure face ensuring the thicker 10mm diameter bars are vertical.  For stability, the face units should be wired to the 16mm diameter ‘L’ shaped support bars (supplied).  Fit the plastic safety caps to the exposed ends of the vertical bars.</p>";
infoArray[4] = "<span class='large'>04</span><p>When constructing a bridge abutment or wall with an angled return end, the facing units should be fixed in to position also.</p>";
infoArray[5] = "<span class='large'>05</span><p>The face lining geotextile supplied should be place inside the face up to the level of the first layer of geogrid reinforcement as indicated by the design.  Allow enough material to lap back in to the fill by about 200mm top and bottom.  Place and compact fill material taking care to use only appropriate lightweight plant within 2m of the face.</p>";
infoArray[6] = "<span class='large'>06</span><p>Cut the appropriate length of uniaxial geogrid from the roll and fold the ends back to form the loop necessary to anchor the geogrid at the face.  Fix the geogrid back on to itself using the polymer bodkin provided.</p>";
infoArray[7] = "<span class='large'>07</span><p>Offer the looped end of the geogrid up to the vertical bars of the face so the loops are now on the outside face.  The 12mm diameter anchor bar may now be inserted through the loop.</p>";
infoArray[8] = "<span class='large'>08</span><p>Using the tensioning beam supplied, the geogrid may now be tensioned so as to remove all slack from the connection loops at the face.  Temporarily hold the tension in the geogrid using some steel pins.</p>";
infoArray[9] = "<span class='large'>09</span><p>Line the face of the structure up to the level of the next layer of geogrid reinforcement allowing for the 200mm lap back.  Where there are return ends on the structure, layers of geogrid need to be fixed here also.  These geogrids will often be offset in vertical spacing by 200mm so the perpendicular grids don’t lie directly on top of each other.</p>";
infoArray[10] = "<span class='large'>10</span><p>Place and compact structural fill material in suitable layer thickness’ up to the level of the next layer of geogrid.  Fold down the face liner and then cut and fix the geogrid reinforcement to the faces as before.  Proceed up to within 400mm (two apertures) of the top of the first lift of facing and fix the next lift inside the face of the one below using tying wire. </p>";
infoArray[11] = "<span class='large'>11</span><p>Proceed to line the face of the next lift with the geotextile supplied.  Place fill and compact fill up to the level of the next geogrid layer.</p>"
infoArray[12] = "<span class='large'>12</span><p>Continue to place face liner, fix and tension geogrids and place fill material as seen in the previous steps to the top of the structure.</p>";
infoArray[13] = "<span class='large'>13</span><p>When the structure is complete on all sides the contractor may proceed to construct all that is necessary to complete the bridge structure.</p>";
infoArray[14] = "<span class='large'>14</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[15] = "<span class='large'>15</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[16] = "<span class='large'>16</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[17] = "<span class='large'>17</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[18] = "<span class='large'>18</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[19] = "<span class='large'>19</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[20] = "<span class='large'>20</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[21] = "<span class='large'>21</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[22] = "<span class='large'>22</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[23] = "<span class='large'>23</span><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce id libero. Curabitur semper porttitor nunc. Mauris sapien sem, tincidunt et, gravida eget, ullamcorper hendrerit, ipsum.</p>";
infoArray[51] = "<span class='large'>01</span><p>Hydraseeding</p>";
infoArray[61] = "<span class='large'>01</span><p>Irrigation</p>";
infoArray[62] = "<span class='large'>01</span><p>Irrigation - Close up on system</p>";


function viewSingle() {
	clearTimeout(timer);
	
	if(currentScene != "green_slope") loadScene("green_slope");
	
	swapping = true;
	Restart();
	setInfo(1);	
}

// Sets information bar
function setInfo(num) {
	element('info').innerHTML = infoArray[num];
}

function playStage(theStage) {
	// element('TNTCtrl').src = "tnt/animate.tnt";
	swapping = true;	
	clearTimeout(timer);
	switch(theStage) {
		case 1:
			from = '0';
			to = '100';	
			setInfo(1);
		break
		case 2:
			from = '100';
			to = '250';			
			setInfo(2);			
		break
		case 3:
			from = '250';
			to = '800';			
			setInfo(3);			
		break
		case 4:
			from = '800';
			to = '875';			
			setInfo(4);				
		break		
		case 5:
			from = '875';
			to = '1610';			
			setInfo(5);				
		break
		case 6:
			from = '1610';
			to = '2140';			
			setInfo(6);				
		break
		case 7:
			from = '2140';
			to = '2400';			
			setInfo(7);				
		break
		case 8:
			from = '2400';
			to = '2710';			
			setInfo(8);				
		break
		case 9:
			from = '2710';
			to = '3335';			
			setInfo(9);				
		break
		case 10:
			from = '3335';
			to = '3815';			
			setInfo(10);				
		break
		case 11:
			from = '3815';
			to = '4040';			
			setInfo(11);				
		break
		case 12:
			from = '4040';
			to = '5135';			
			setInfo(12);				
		break
		case 13:
			from = '5135';
			to = '5510';			
			setInfo(13);				
		break
	}
	TNTDoCommand('Objects("*").PlayAnimation('+from+','+to+',false,20)');
}

var swapping = false;
function playAll() {
	
	clearTimeout(timer);
	
	resetSlider();
	
	swapping = true;
	
	TNTDoCommand('Objects("*").PlayAnimation(0,5510,false,20)');
	
	getFrame();
}

// recursive function to get current frame number
function getFrame() {
	clearTimeout(timer);
	frmcnt = TNTDoCommand('Objects("*").GetFrame()');
	reportStage(frmcnt);
	timer = setTimeout("getFrame()",1000);	
}

// called by getFrame() to display the current stage number
function reportStage(theFrame) {
	// 1
	if(theFrame >= 1 && theFrame < 100) {
		setStatus('1');
		currentStage = 1;
	}
	// 2
	if(theFrame >= 100 && theFrame < 250) {
		setStatus('2');	
		currentStage = 2;
	}
	// 3
	if(theFrame >= 250 && theFrame < 800) {
		setStatus('3');
		currentStage = 3;
	}
	// 4
	if(theFrame >= 800 && theFrame < 875) {
		setStatus('4');	
		currentStage = 4;
	}
	// 5
	if(theFrame >= 875 && theFrame < 1610) {
		setStatus('5');	
		currentStage = 5;
	}
	// 6
	if(theFrame >= 1610 && theFrame < 2140) {
		setStatus('6');	
		currentStage = 6;
	}
	// 7
	if(theFrame >= 2140 && theFrame < 2400) {
		setStatus('7');	
		currentStage = 7;
	}
	// 8
	if(theFrame >= 2400 && theFrame < 2710) {
		setStatus('8');	
		currentStage = 8;		
	}
	// 9
	if(theFrame >= 2710 && theFrame < 3335) {
		setStatus('9');	
		currentStage = 9;		
	}
	// 10
	if(theFrame >= 3335 && theFrame < 3815) {
		setStatus('10');
		currentStage = 10;		
	}	
	// 11
	if(theFrame >= 3815 && theFrame < 4040) {
		setStatus('11');
		currentStage = 11;		
	}	
	// 12
	if(theFrame >= 4040 && theFrame < 5135) {
		setStatus('12');
		currentStage = 12;		
	}
	// 13
	if(theFrame >= 5135 && theFrame < 5510) {
		setStatus('13');
		currentStage = 13;		
	}	
}
// Sets status message
function setStatus(message) {
	setInfo(message);
	window.status = message;
	
}
