// Scripts for the Steven Scott web site
// Copyright (c)2002 ReGo. All rights reserved.
// Must be included after stevenscott.js


function PlayShow2() {
	currentIdx = -1;
	nextIdx = 0;
	showIsPaused = false;

	SSSetupScript2();
	SSPlaceGrid2();
	WriteControl();

	PlayShow22();
}

function PlayShow22() {
	currentIdx = nextIdx++;
	if(nextIdx == script2.scenes.length)
		nextIdx = script2.loopAtEnd;
	if(currentIdx >= script2.scenes.length || currentIdx < 0)
		currentIdx = 0;
	if(nextIdx >= 0) {
		playTimer = setTimeout('PlayShow22()', script2.scenes[currentIdx].totalTime);
	}

	PlayScene(script2.scenes[currentIdx]);
}


function SSSetupScript2() {
	script2 = new SSScript('script2', -1);	// -1=stop after last scene, 0, 1, ... = Scene index


	var scene26 = new SSScene();
	scene26.AddAction(new SSAction('hidessinfo2', '', 0, 0));
	scene26.AddAction(new SSAction('Full', 'gfx/sq26r.jpg', 8, 0, 'gfx/txt_facade.jpg', 0, 'gfx/txt_26b.jpg', 0));
	script2.AddScene(scene26);

	var scene27 = new SSScene();
	scene27.AddAction(new SSAction('Full', 'gfx/sq26r.jpg', 0, 0, 'gfx/txt_facade.jpg', 0, 'gfx/txt_26b.jpg', 0));

	scene27.AddAction(new SSAction('Full', 'gfx/sq27.jpg', 15, 1, 'gfx/txt_27a.jpg', 1, 'gfx/txt_27b.jpg', 1));
	script2.AddScene(scene27);

	var scene28 = new SSScene();
	scene28.AddAction(new SSAction('Full', 'gfx/sq27.jpg', 0, 0, 'gfx/txt_27a.jpg', 0, 'gfx/txt_27b.jpg', 0));

	scene28.AddAction(new SSAction('Full', 'gfx/sq28.jpg', 15, 1, 'gfx/txt_28a.jpg', 1, 'gfx/txt_28b.jpg', 1));
	script2.AddScene(scene28);

	var scene29 = new SSScene();
	scene29.AddAction(new SSAction('At', 'gfx/sq28r1.jpg', 0, 0, 'gfx/txt_28a.jpg', 0, 'gfx/txt_28b.jpg', 0));
	scene29.AddAction(new SSAction('Ct', 'gfx/sq28r2.jpg', 0, 0));
	scene29.AddAction(new SSAction('Et', 'gfx/sq28r3.jpg', 0, 0));
	scene29.AddAction(new SSAction('hideFull', '', 0, 0, 0));

	scene29.AddAction(new SSAction('At', 'gfx/sq30c.jpg', 0, 1));
	scene29.AddAction(new SSAction('Ct', 'gfx/sq29b.jpg', 0, 1));
	scene29.AddAction(new SSAction('Et', 'gfx/sq30c.jpg', 20, 1, 'gfx/txt_29a.jpg', 1, 'gfx/txt_29b.jpg', 1));
	script2.AddScene(scene29);

	var scene30 = new SSScene();
	scene30.AddAction(new SSAction('At', 'gfx/sq30c.jpg', 0, 0, 'gfx/txt_29a.jpg', 0, 'gfx/txt_29b.jpg', 0));
	scene30.AddAction(new SSAction('Ct', 'gfx/sq29b.jpg', 0, 0));
	scene30.AddAction(new SSAction('Et', 'gfx/sq30c.jpg', 0, 0));

	scene30.AddAction(new SSAction('At', 'gfx/sq30a.jpg', 10, 1, 'gfx/txt_30a.jpg', 1, 'gfx/txt_30b.jpg', 1));
	script2.AddScene(scene30);

	var scene31 = new SSScene();
	scene31.AddAction(new SSAction('At', 'gfx/sq30a.jpg', 0, 0, 'gfx/txt_30a.jpg', 0, 'gfx/txt_30b.jpg', 0));
	scene31.AddAction(new SSAction('Ct', 'gfx/sq29b.jpg', 0, 0));
	scene31.AddAction(new SSAction('Et', 'gfx/sq30c.jpg', 0, 0));

	scene31.AddAction(new SSAction('Et', 'gfx/sq31.jpg', 10, 1, 'gfx/txt_31a.jpg', 1, 'gfx/txt_31b.jpg', 1));
	script2.AddScene(scene31);

	var scene32 = new SSScene();
	scene32.AddAction(new SSAction('At', 'gfx/sq30a.jpg', 0, 0, 'gfx/txt_31a.jpg', 0, 'gfx/txt_31b.jpg', 0));
	scene32.AddAction(new SSAction('Ct', 'gfx/sq29b.jpg', 0, 0));
	scene32.AddAction(new SSAction('Et', 'gfx/sq31.jpg', 0, 0));

	scene32.AddAction(new SSAction('At', 'gfx/sq32a.jpg', 0, 1));
	scene32.AddAction(new SSAction('Et', 'gfx/sq32c.jpg', 12, 1, 'gfx/txt_32a.jpg', 1, 'gfx/txt_32b.jpg', 1));
	script2.AddScene(scene32);

	var scene33 = new SSScene();
	scene33.AddAction(new SSAction('Full', 'gfx/sq32r.jpg', 0, 0, 'gfx/txt_32a.jpg', 0, 'gfx/txt_32b.jpg', 0));
	scene33.AddAction(new SSAction('hideAt', '', 0, 0));
	scene33.AddAction(new SSAction('hideCt', '', 0, 0));
	scene33.AddAction(new SSAction('hideEt', '', 0, 0));

	scene33.AddAction(new SSAction('Full', 'gfx/sq33.jpg', 15, 1, 'gfx/txt_33a.jpg', 1, 'gfx/txt_33b.jpg', 1));
	script2.AddScene(scene33);

	var scene34 = new SSScene();
	scene34.AddAction(new SSAction('Full', 'gfx/sq33.jpg', 0, 0, 'gfx/txt_33a.jpg', 0, 'gfx/txt_33b.jpg', 0));

	scene34.AddAction(new SSAction('Full', 'gfx/sq34.jpg', 12, 1, 'gfx/txt_34a.jpg', 1, 'gfx/txt_34b.jpg', 1));
	script2.AddScene(scene34);

	var scene35 = new SSScene();
	scene35.AddAction(new SSAction('A2t', 'gfx/sq34r1.jpg', 0, 0, 'gfx/txt_34a.jpg', 0, 'gfx/txt_34b.jpg', 0));
	scene35.AddAction(new SSAction('Et', 'gfx/sq34r2.jpg', 0, 0));
	scene35.AddAction(new SSAction('hideFull', '', 0, 0));

	scene35.AddAction(new SSAction('A2t', 'gfx/sq35a.jpg', 0, 1));
	scene35.AddAction(new SSAction('Et', 'gfx/sq35b.jpg', 12, 1, 'gfx/txt_35a.jpg', 1, 'gfx/txt_35b.jpg', 1));
	script2.AddScene(scene35);

	var scene36 = new SSScene();
	scene36.AddAction(new SSAction('A2t', 'gfx/sq35a.jpg', 0, 0, 'gfx/txt_35a.jpg', 0, 'gfx/txt_35b.jpg', 0));
	scene36.AddAction(new SSAction('Et', 'gfx/sq35b.jpg', 0, 0));

	scene36.AddAction(new SSAction('Et', 'gfx/sq36.jpg', 10, 1, 'gfx/txt_36a.jpg', 1, 'gfx/txt_36b.jpg', 1));
	script2.AddScene(scene36);

	var scene37 = new SSScene();
	scene37.AddAction(new SSAction('A2t', 'gfx/sq35a.jpg', 0, 0, 'gfx/txt_36a.jpg', 0, 'gfx/txt_36b.jpg', 0));
	scene37.AddAction(new SSAction('Et', 'gfx/sq36.jpg', 0, 0));

	scene37.AddAction(new SSAction('A2t', 'gfx/sq37.jpg', 10, 1, 'gfx/txt_37a.jpg', 1, 'gfx/txt_37b.jpg', 1));
	script2.AddScene(scene37);

	var scene38 = new SSScene();
	scene38.AddAction(new SSAction('Full', 'gfx/sq37r.jpg', 0, 0, 'gfx/txt_37a.jpg', 0, 'gfx/txt_37b.jpg', 0));
	scene38.AddAction(new SSAction('hideA2t', '', 0, 0));
	scene38.AddAction(new SSAction('hideEt', '', 0, 0));

	scene38.AddAction(new SSAction('Full', 'gfx/sq38.jpg', 20, 1, 'gfx/txt_38a.jpg', 1, 'gfx/txt_38b.jpg', 1));
	script2.AddScene(scene38);

// MOSAIK
	var scene39 = new SSScene();
	scene39.AddAction(new SSAction('hidessinfo2', '', 0));
	scene39.AddAction(new SSAction('X1', 'gfx/sq39a.jpg', 0, 0, 'gfx/txt_38a.jpg', 0, 'gfx/txt_38b.jpg', 0), 1);
	scene39.AddAction(new SSAction('X2', 'gfx/sq39b.jpg', 0, 0), 2);
	scene39.AddAction(new SSAction('X3', 'gfx/sq39c.jpg', 0, 0), 3);
	scene39.AddAction(new SSAction('X4', 'gfx/sq39d.jpg', 0, 0), 4);
	scene39.AddAction(new SSAction('Y1', 'gfx/sq39e.jpg', 0, 0), 5);
	scene39.AddAction(new SSAction('Y2', 'gfx/sq39f.jpg', 0, 0), 6);
	scene39.AddAction(new SSAction('Y3', 'gfx/sq39g.jpg', 0, 0), 7);
	scene39.AddAction(new SSAction('Y4', 'gfx/sq39h.jpg', 0, 0), 8);
	scene39.AddAction(new SSAction('Z1', 'gfx/sq39i.jpg', 0, 0), 9);
	scene39.AddAction(new SSAction('Z2', 'gfx/sq39j.jpg', 0, 0), 10);
	scene39.AddAction(new SSAction('Z3', 'gfx/sq39k.jpg', 0, 0), 11);
	scene39.AddAction(new SSAction('Z4', 'gfx/sq39l.jpg', 0, 0), 12);
	scene39.AddAction(new SSAction('hideFull', '', 10, 0, 'gfx/txt_39a.jpg', 0, 'gfx/txt_39b.jpg', 0));
	scene39.allowLink = 1;
	script2.AddScene(scene39);

// Info
	var sceneInfo2 = new SSScene();
	sceneInfo2.AddAction(new SSAction('ssinfo2', '', 20, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
	script2.AddScene(sceneInfo2);

	if(scriptHide)
		delete scriptHide;
	if(sceneHide)
		delete sceneHide;

	scriptHide = new SSScript('scriptHide', -1);
	sceneHide = new SSScene();
	sceneHide.AddAction(new SSAction('hideAt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideCt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideEt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideA2t', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideFull', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideX1', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideX2', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideX3', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideX4', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideY1', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideY2', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideY3', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideY4', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideZ1', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideZ2', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideZ3', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideZ4', '', 0, 0));
	scriptHide.AddScene(sceneHide);

	currentLength = script2.scenes.length;
}

function SSPlaceGrid2() {

	var x=0, y=0;
	var i, j, h, w, lyr, name, name2;

	w = gridCols*gridWidth;
	h = Math.floor((gridRows*gridHeight) / 3);


	// third-height rows (or whatever)
	y = gridOffsetY;
	for(i=0 ; i<3 ; i++) {
		name = rowNames[i*2] + 't';
		name2 = 'g' + name;
		h = (i == 1 ? (gridThirdH-1) : gridThirdH);

		theThirds[i] = new lib_obj(name);
		theThirds[i].css.height = h-2*gridLine;
		theThirds[i].css.width = gridFullW-2*gridLine;
		theThirds[i].moveIt(gridOffsetX+gridLine, y+gridLine);

		theThirdsG[i] = new lib_obj(name2);
		theThirdsG[i].css.height = h;
		theThirdsG[i].css.width = gridFullW;
		theThirdsG[i].moveIt(gridOffsetX, y);

		for(j=0 ; j<gridCols ; j++) {
			name = xyzNames[i] + colNames[j];
			name2 = 'g' + name;
			x = gridOffsetX + j*gridWidth - j*gridLine;

			theXYZG[i][j] = new lib_obj(name2);
			theXYZG[i][j].css.width = gridWidth;
			theXYZG[i][j].css.height = h;
			theXYZG[i][j].moveIt(x, y);

			theXYZ[i][j] = new lib_obj(name);
			theXYZ[i][j].css.width = pictureWidth;
			theXYZ[i][j].css.height = h-2*gridLine;
			theXYZ[i][j].moveIt(x+gridLine, y+gridLine);
		}

		y += h - gridLine;
	}

	// Two-third row
	theTwoThirdG = new lib_obj('gA2t');
	theTwoThirdG.moveIt(gridOffsetX, gridOffsetY);
	theTwoThirdG.css.width = gridFullW;
	theTwoThirdG.css.height = gridThirdH2;

	theTwoThird = new lib_obj('A2t');
	theTwoThird.moveIt(gridOffsetX+gridLine, gridOffsetY+gridLine);
	theTwoThird.css.width = gridFullW-2*gridLine;
	theTwoThird.css.height = gridThirdH2-2*gridLine;

	// 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;

	theInfo2 = new lib_obj('ssinfo2');
	theInfo2.moveIt(gridOffsetX, gridOffsetY);
	theInfo2.css.width = gridFullW;
	theInfo2.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);
}

