// Scripts for the Steven Scott web site
// Copyright (c)2003 ReGo. All rights reserved.
// Must be included after stevenscott.js

function PlayShowMontana() {
	currentIdx = -1;
	nextIdx = 0;
	showIsPaused = false;

	SSSetupScriptMontana();
	SSPlaceMontana();
	WriteControl();

	PlayShowMontana2();
}

function PlayShowMontana2() {
	currentIdx = nextIdx++;
	if(nextIdx == scriptMontana.scenes.length)
		nextIdx = scriptMontana.loopAtEnd;
	if(currentIdx >= scriptMontana.scenes.length || currentIdx < 0)
		currentIdx = 0;
	if(nextIdx >= 0) {
		playTimer = setTimeout('PlayShowMontana2()', scriptMontana.scenes[currentIdx].totalTime);
	}

	PlayScene(scriptMontana.scenes[currentIdx]);
}


function SSSetupScriptMontana() {
	scriptMontana = new SSScript('scriptMontana', -1);	// -1=stop after last scene, 0, 1, ... = Scene index


//	var sceneMontana0 = new SSScene();
//	sceneMontana0.AddAction(new SSAction('Montana', 'gfx/0.jpg', 5, 0));
//	scriptMontana.AddScene(sceneMontana0);

	var sceneMontana0s = new SSScene();
	sceneMontana0s.AddAction(new SSAction('hidessinfo5', '', 0, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
//	sceneMontana0s.AddAction(new SSAction('hideFull', '', 0, 0));
	sceneMontana0s.AddAction(new SSAction('hideABCDhl', '', 0, 0));
	sceneMontana0s.AddAction(new SSAction('hideABCDhr', '', 0, 0));

	sceneMontana0s.AddAction(new SSAction('A1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('A2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('A3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('A4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('B1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('B2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('B3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('B4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('C1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('C23', 'gfx/montana_text.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('C4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('D1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('D2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('D3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('D4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('E1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('E2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('E3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0s.AddAction(new SSAction('E4', 'gfx/blank.jpg', 15, 0));
	scriptMontana.AddScene(sceneMontana0s);

	var sceneMontana0 = new SSScene();
	sceneMontana0.AddAction(new SSAction('hideC23', '', 0, 0));

	sceneMontana0.AddAction(new SSAction('A1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('A2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('A3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('A4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('B1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('B2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('B3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('B4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('C1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('C2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('C3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('C4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('D1', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('D2', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('D3', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('D4', 'gfx/blank.jpg', 0, 0));
	sceneMontana0.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 3, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
	scriptMontana.AddScene(sceneMontana0);



	var sceneMontana1 = new SSScene();
	sceneMontana1.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));
	sceneMontana1.AddAction(new SSAction('ABCDhl', 'gfx/montana_grid.jpg', 0, 0));
	sceneMontana1.AddAction(new SSAction('ABCDhr', 'gfx/montana_grid.jpg', 2, 0));
	scriptMontana.AddScene(sceneMontana1);


	var sceneMontana2 = new SSScene();
	sceneMontana2.AddAction(new SSAction('ABCDhl', 'gfx/montana_grid.jpg', 0, 0));
	sceneMontana2.AddAction(new SSAction('ABCDhr', 'gfx/montana_grid.jpg', 0, 0));
	sceneMontana2.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana2.AddAction(new SSAction('ABCDhl', 'gfx/montana1s.jpg', 0, 1));
	sceneMontana2.AddAction(new SSAction('ABCDhr', 'gfx/montana2s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana2);

	var sceneMontana3 = new SSScene();
	sceneMontana3.AddAction(new SSAction('ABCDhl', 'gfx/montana1s.jpg', 0, 0));
	sceneMontana3.AddAction(new SSAction('ABCDhr', 'gfx/montana2s.jpg', 0, 0));
	sceneMontana3.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana3.AddAction(new SSAction('ABCDhl', 'gfx/montana2s.jpg', 0, 1));
	sceneMontana3.AddAction(new SSAction('ABCDhr', 'gfx/montana3s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana3);

	var sceneMontana4 = new SSScene();
	sceneMontana4.AddAction(new SSAction('ABCDhl', 'gfx/montana2s.jpg', 0, 0));
	sceneMontana4.AddAction(new SSAction('ABCDhr', 'gfx/montana3s.jpg', 0, 0));
	sceneMontana4.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana4.AddAction(new SSAction('ABCDhl', 'gfx/montana3s.jpg', 0, 1));
	sceneMontana4.AddAction(new SSAction('ABCDhr', 'gfx/montana4s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana4);

	var sceneMontana5 = new SSScene();
	sceneMontana5.AddAction(new SSAction('ABCDhl', 'gfx/montana3s.jpg', 0, 0));
	sceneMontana5.AddAction(new SSAction('ABCDhr', 'gfx/montana4s.jpg', 0, 0));
	sceneMontana5.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana5.AddAction(new SSAction('ABCDhl', 'gfx/montana4s.jpg', 0, 1));
	sceneMontana5.AddAction(new SSAction('ABCDhr', 'gfx/montana6s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana5);

	var sceneMontana6 = new SSScene();
	sceneMontana6.AddAction(new SSAction('ABCDhl', 'gfx/montana4s.jpg', 0, 0));
	sceneMontana6.AddAction(new SSAction('ABCDhr', 'gfx/montana6s.jpg', 0, 0));
	sceneMontana6.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana6.AddAction(new SSAction('ABCDhl', 'gfx/montana6s.jpg', 0, 1));
	sceneMontana6.AddAction(new SSAction('ABCDhr', 'gfx/montana7s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana6);

	var sceneMontana7 = new SSScene();
	sceneMontana7.AddAction(new SSAction('ABCDhl', 'gfx/montana6s.jpg', 0, 0));
	sceneMontana7.AddAction(new SSAction('ABCDhr', 'gfx/montana7s.jpg', 0, 0));
	sceneMontana7.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana7.AddAction(new SSAction('ABCDhl', 'gfx/montana7s.jpg', 0, 1));
	sceneMontana7.AddAction(new SSAction('ABCDhr', 'gfx/montana8s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana7);

	var sceneMontana8 = new SSScene();
	sceneMontana8.AddAction(new SSAction('hidessinfo5', '', 0, 0));
	sceneMontana8.AddAction(new SSAction('ABCDhl', 'gfx/montana7s.jpg', 0, 0));
	sceneMontana8.AddAction(new SSAction('ABCDhr', 'gfx/montana8s.jpg', 0, 0));
	sceneMontana8.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana8.AddAction(new SSAction('ABCDhl', 'gfx/montana8s.jpg', 0, 1));
	sceneMontana8.AddAction(new SSAction('ABCDhr', 'gfx/montana1s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana8);

/*	var sceneMontana9 = new SSScene();
	sceneMontana9.AddAction(new SSAction('hidessinfo5', '', 0, 0));
	sceneMontana9.AddAction(new SSAction('ABCDhl', 'gfx/montana8s.jpg', 0, 0));
	sceneMontana9.AddAction(new SSAction('ABCDhr', 'gfx/montana1s.jpg', 0, 0));
	sceneMontana9.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));

	sceneMontana9.AddAction(new SSAction('ABCDhl', 'gfx/montana1s.jpg', 0, 1));
	sceneMontana9.AddAction(new SSAction('ABCDhr', 'gfx/montana2s.jpg', 21, 1));
	scriptMontana.AddScene(sceneMontana9);
*/

// MOSAIK
	var sceneMontanaM = new SSScene();
	sceneMontanaM.AddAction(new SSAction('V1', 'gfx/montana1m.jpg', 0, 0), 4);
	sceneMontanaM.AddAction(new SSAction('V2', 'gfx/montana2m.jpg', 0, 0), 4);
	sceneMontanaM.AddAction(new SSAction('V3', 'gfx/montana3m.jpg', 0, 0), 5);
	sceneMontanaM.AddAction(new SSAction('V4', 'gfx/montana4m.jpg', 0, 0), 6);
	sceneMontanaM.AddAction(new SSAction('W1', 'gfx/montana5m.jpg', 0, 0), 7);
	sceneMontanaM.AddAction(new SSAction('W2', 'gfx/montana6m.jpg', 0, 0), 7);
	sceneMontanaM.AddAction(new SSAction('W3', 'gfx/montana7m.jpg', 0, 0), 8);
	sceneMontanaM.AddAction(new SSAction('W4', 'gfx/montana8m.jpg', 0, 0), 9);
	sceneMontanaM.AddAction(new SSAction('Er', 'gfx/montana_logo.jpg', 0, 0));
	sceneMontanaM.AddAction(new SSAction('hidessinfo5', '', 0));
	sceneMontanaM.AddAction(new SSAction('hideC23', '', 0, 0));
	sceneMontanaM.AddAction(new SSAction('hideABCDhl', '', 0, 0));
	sceneMontanaM.AddAction(new SSAction('hideABCDhr', '', 10, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
	sceneMontanaM.allowLink = 1;
	scriptMontana.AddScene(sceneMontanaM);


	var sceneInfo5 = new SSScene();
//	sceneInfo5.AddAction(new SSAction('hideABCDhl', '', 0, 0));
//	sceneInfo5.AddAction(new SSAction('hideABCDhr', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideEr', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideV1', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideV2', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideV3', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideV4', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideW1', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideW2', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideW3', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('hideW4', '', 0, 0));
	sceneInfo5.AddAction(new SSAction('ssinfo5', '', 20, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
	scriptMontana.AddScene(sceneInfo5);

	if(scriptHide)
		delete scriptHide;
	if(sceneHide)
		delete sceneHide;

	scriptHide = new SSScript('scriptHide', -1);
	sceneHide = new SSScene();
//	sceneHide.AddAction(new SSAction('hideFull', '', 0, 0));
	sceneHide.AddAction(new SSAction('hidessinfo5', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideABCD', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideEr', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideABCDhl', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideABCDhr', '', 0, 0));
	scriptHide.AddScene(sceneHide);

	currentLength = scriptMontana.scenes.length;
}


function SSPlaceMontana() {

	var x=0, y=0;
	var i, j, h, w, lyr, name, name2;

	w = gridCols*gridWidth;
	h = Math.floor((gridRows*gridHeight) / 3);

	for(i=0 ; i<gridRows ; i++) {
		y = gridOffsetY + i*gridHeight - i*gridLine;
		for(j=0 ; j<gridCols ; j++) {
			name = rowNames[i] + colNames[j];
			name2 = 'g' + name;
			x = gridOffsetX + j*gridWidth - j*gridLine;

			lyr = new lib_obj(name2);
			lyr.css.width = gridWidth;
			lyr.css.height = gridHeight;
			lyr.moveIt(x, y);
			lyr.showIt();

			theGrid[i][j] = new lib_obj(name);
			theGrid[i][j].css.width = pictureWidth;
			theGrid[i][j].css.height = pictureHeight;
			theGrid[i][j].moveIt(x+gridLine, y+gridLine);
			theGrid[i][j].showIt();

			if(i == 1 && j == 1) {
				theC23G = new lib_obj('gC23');
				theC23G.css.width = 2*gridWidth-gridLine;
				theC23G.css.height = 3*gridHeight-2*gridLine;
				theC23G.moveIt(x, y);

				theC23 = new lib_obj('C23');
				theC23.css.width = 2*pictureWidth+gridLine;
				theC23.css.height = 3*pictureHeight+2*gridLine;
				theC23.moveIt(x+gridLine, y+gridLine);
			}
		}

		// Place row
		name = rowNames[i] + 'r';
		name2 = 'g' + name;

		theRowsG[i] = new lib_obj(name2);
		theRowsG[i].css.width = gridFullW;
		theRowsG[i].css.height = gridHeight;
		theRowsG[i].moveIt(gridOffsetX, y);

		theRows[i] = new lib_obj(name);
		theRows[i].moveIt(gridOffsetX+gridLine, y+gridLine);
		theRows[i].css.width = gridFullW-2*gridLine;
		theRows[i].css.height = pictureHeight;
	}
//	theRows[theRows.length-1].showIt();
//	theRowsG[theRowsG.length-1].showIt();

	// Double-height grid
	h = 2*gridHeight-gridLine;
	y = gridOffsetY;
	for(i=0 ; i<vwNames.length ; i++) {
		for(j=0 ; j<gridCols ; j++) {
			name = vwNames[i] + colNames[j];
			name2 = 'g' + name;
			x = gridOffsetX + j*gridWidth - j*gridLine;

			theVWG[i][j] = new lib_obj(name2);
			theVWG[i][j].css.width = gridWidth;
			theVWG[i][j].css.height = h;
			theVWG[i][j].moveIt(x, y);

			theVW[i][j] = new lib_obj(name);
			theVW[i][j].css.width = pictureWidth;
			theVW[i][j].css.height = h - 2*gridLine;
			theVW[i][j].moveIt(x+gridLine, y+gridLine);
		}
		y += (h-gridLine);
	}

	// The upper 4/5th part
	theABCDG = new lib_obj('gABCD');
	theABCDG.moveIt(gridOffsetX, gridOffsetY);
	theABCDG.css.width = gridFullW;
	theABCDG.css.height = gridFullH-gridHeight+gridLine;

	theABCD = new lib_obj('ABCD');
	theABCD.moveIt(gridOffsetX+gridLine, gridOffsetY+gridLine);
	theABCD.css.width = gridFullW-2*gridLine;
	theABCD.css.height = gridFullH-3*gridLine-pictureHeight;

	// Full picture
/*	theFullG = new lib_obj('gFull');
	theFullG.moveIt(gridOffsetX, gridOffsetY);
	theFullG.css.width = gridFullW;
	theFullG.css.height = gridFullH;

	theFull = new lib_obj('Full');
	theFull.moveIt(gridOffsetX+gridLine, gridOffsetY+gridLine);
	theFull.css.width = gridFullW-2*gridLine;
	theFull.css.height = gridFullH-2*gridLine;
*/
	theInfo5 = new lib_obj('ssinfo5');
	theInfo5.moveIt(gridOffsetX, gridOffsetY);
	theInfo5.css.width = gridFullW;
	theInfo5.css.height = gridFullH;

	// Place the text layers
	y = gridOffsetY + gridRows*gridHeight - gridRows + 5;
	theBottomText = new lib_obj('bottom');
	theBottomText.moveIt(gridOffsetX, y);
	theBottomText.showIt();

	y = Math.floor((gridOffsetY - textHeight)/2);
	theTopText1 = new lib_obj('text1');
	theTopText1.css.width = textPartW;
	theTopText1.css.height = textHeight;
	theTopText1.moveIt(gridOffsetX, y);
	theTopText1.showIt();
	theTopText2 = new lib_obj('text2');
	theTopText2.css.height = textHeight;
	theTopText2.moveIt(gridOffsetX + textPartW, y);
	theTopText2.showIt();

	theTopText = new lib_obj('top');
	theTopText.moveIt(gridOffsetX, 0);



	theABCDhlG = new lib_obj('gABCDhl');
	theABCDhlG.moveIt(gridOffsetX, gridOffsetY);
	theABCDhlG.css.width  = 364;
	theABCDhlG.css.height = 415;
	theABCDhl = new lib_obj('ABCDhl');
	theABCDhl.moveIt(gridOffsetX+gridLine, gridOffsetY+gridLine);
	theABCDhl.css.width  = 359;
	theABCDhl.css.height = 409;

	theABCDhrG = new lib_obj('gABCDhr');
	theABCDhrG.moveIt(gridOffsetX+gridHHalfW - gridLine, gridOffsetY);
	theABCDhrG.css.width  = 364;
	theABCDhrG.css.height = 415;
	theABCDhr = new lib_obj('ABCDhr');
	theABCDhr.moveIt(gridOffsetX+gridHHalfW, gridOffsetY+gridLine);
	theABCDhr.css.width  = 359;
	theABCDhr.css.height = 409;

/*	var yy=gridOffsetY;
	var xx=gridOffsetX;

	xx += 364;
	theMontanaR = new lib_obj('gMontanaR');
	theMontanaR.moveIt(xx, yy);
	theMontanaR.css.width  = 359;
	theMontanaR.css.height = 409;

	yy += 364;
	xx -= 364;
	theMontanaLineL = new lib_obj('MontanaLineL');
	theMontanaLineL.moveIt(xx, yy);
	theMontanaLineL.css.width  = 728;
	theMontanaLineL.css.height = 26;
	theMontanaLineL.showIt();
*/

/*	yy += 26;
	theMontanaLogo = new lib_obj('MontanaLogo');
	theMontanaLogo.moveIt(xx, yy);
	theMontanaLogo.css.width  = 728;
	theMontanaLogo.css.height = 100;
	theMontanaLogo.showIt();
*/

/*	y = gridOffsetY + gridRows*gridHeight - gridRows + 5;
	theBottomText = new lib_obj('bottom');
	theBottomText.moveIt(gridOffsetX, y);
	theBottomText.showIt();
*/
}

