// Scripts for the Steven Scott web site
// Copyright (c)2002 ReGo. All rights reserved.
// Must be included after stevenscott.js


function PlayShow3() {
	currentIdx = -1;
	nextIdx = 0;
	showIsPaused = false;

	SSSetupScript3();
	SSPlaceGrid3();
	WriteControl();

	PlayShow23();
}

function PlayShow23() {
	currentIdx = nextIdx++;
	if(nextIdx == script3.scenes.length)
		nextIdx = script3.loopAtEnd;
	if(currentIdx >= script3.scenes.length || currentIdx < 0)
		currentIdx = 0;
	if(nextIdx >= 0) {
		playTimer = setTimeout('PlayShow23()', script3.scenes[currentIdx].totalTime);
	}

	PlayScene(script3.scenes[currentIdx]);
}


function SSSetupScript3() {
	script3 = new SSScript('script3', -1);	// -1=stop after last scene, 0, 1, ... = Scene index

	var scene40 = new SSScene();
	scene40.AddAction(new SSAction('hidessinfo3', '', 0, 0));
	scene40.AddAction(new SSAction('Lh', 'gfx/sq40a.jpg', 0, 0));
	scene40.AddAction(new SSAction('Rh', 'gfx/sq40b.jpg', 8, 0, 'gfx/txt_40a.jpg', 0, 'gfx/txt_40b.jpg', 0));
	script3.AddScene(scene40);

	var scene41 = new SSScene();
	scene41.AddAction(new SSAction('Lh', 'gfx/sq40a.jpg', 0, 0));
	scene41.AddAction(new SSAction('Rh', 'gfx/sq40b.jpg', 0, 0, 'gfx/txt_40a.jpg', 0, 'gfx/txt_40b.jpg', 0));

	scene41.AddAction(new SSAction('Lh', 'gfx/sq41a.jpg', 0, 1));
	scene41.AddAction(new SSAction('Rh', 'gfx/sq41b.jpg', 12, 1, 'gfx/txt_41a.jpg', 1, 'gfx/txt_41b.jpg', 1));
	script3.AddScene(scene41);

	var scene42 = new SSScene();
	scene42.AddAction(new SSAction('Lh', 'gfx/sq41a.jpg', 0, 0, 'gfx/txt_41a.jpg', 0, 'gfx/txt_41b.jpg', 0));
	scene42.AddAction(new SSAction('Rh', 'gfx/sq41b.jpg', 0, 0));

	scene42.AddAction(new SSAction('Lh', 'gfx/sq42a.jpg', 0, 1));
	scene42.AddAction(new SSAction('Rh', 'gfx/sq42b.jpg', 12, 1, 'gfx/txt_42a.jpg', 1, 'gfx/txt_42b.jpg', 1));
	script3.AddScene(scene42);

	var scene43 = new SSScene();
	scene43.AddAction(new SSAction('Lh', 'gfx/sq42a.jpg', 0, 0, 'gfx/txt_42a.jpg', 0, 'gfx/txt_42b.jpg', 0));
	scene43.AddAction(new SSAction('Rh', 'gfx/sq42b.jpg', 0, 0));

	scene43.AddAction(new SSAction('Lh', 'gfx/sq43a.jpg', 0, 1));
	scene43.AddAction(new SSAction('Rh', 'gfx/sq43b.jpg', 12, 1, 'gfx/txt_43a.jpg', 1, 'gfx/txt_43b.jpg', 1));
	script3.AddScene(scene43);

	var scene44 = new SSScene();
	scene44.AddAction(new SSAction('Lh', 'gfx/sq43a.jpg', 0, 0, 'gfx/txt_43a.jpg', 0, 'gfx/txt_43b.jpg', 0));
	scene44.AddAction(new SSAction('Rh', 'gfx/sq43b.jpg', 0, 0));

	scene44.AddAction(new SSAction('Lh', 'gfx/sq44a.jpg', 0, 1));
	scene44.AddAction(new SSAction('Rh', 'gfx/sq44b.jpg', 12, 1, 'gfx/txt_44a.jpg', 1, 'gfx/txt_44b.jpg', 1));
	script3.AddScene(scene44);

	var scene45 = new SSScene();
	scene45.AddAction(new SSAction('Lh', 'gfx/sq44a.jpg', 0, 0, 'gfx/txt_44a.jpg', 0, 'gfx/txt_44b.jpg', 0));
	scene45.AddAction(new SSAction('Rh', 'gfx/sq44b.jpg', 0, 0));

	scene45.AddAction(new SSAction('Lh', 'gfx/sq45a.jpg', 12, 1, 'gfx/txt_45a.jpg', 1, 'gfx/txt_45b.jpg', 1));
	script3.AddScene(scene45);

	var scene46 = new SSScene();
	scene46.AddAction(new SSAction('Lh', 'gfx/sq45a.jpg', 0, 0, 'gfx/txt_45a.jpg', 0, 'gfx/txt_45b.jpg', 0));
	scene46.AddAction(new SSAction('Rh', 'gfx/sq44b.jpg', 0, 0));

	scene46.AddAction(new SSAction('Lh', 'gfx/sq46a.jpg', 0, 1));
	scene46.AddAction(new SSAction('Rh', 'gfx/sq46b.jpg', 20, 1, 'gfx/txt_46a.jpg', 1, 'gfx/txt_46b.jpg', 1));
	script3.AddScene(scene46);

	var scene47 = new SSScene();
	scene47.AddAction(new SSAction('Lt', 'gfx/sq46r1.jpg', 0, 0, 'gfx/txt_46a.jpg', 0, 'gfx/txt_46b.jpg', 0));
	scene47.AddAction(new SSAction('Mt', 'gfx/sq46r2.jpg', 0, 0));
	scene47.AddAction(new SSAction('Rt', 'gfx/sq46r3.jpg', 0, 0));
	scene47.AddAction(new SSAction('hideLh', '', 0, 0));
	scene47.AddAction(new SSAction('hideRh', '', 0, 0));

	scene47.AddAction(new SSAction('Lt', 'gfx/sq47a.jpg', 0, 1));
	scene47.AddAction(new SSAction('Mt', 'gfx/sq47b.jpg', 0, 1));
	scene47.AddAction(new SSAction('Rt', 'gfx/sq47c.jpg', 20, 1, 'gfx/txt_47a.jpg', 1, 'gfx/txt_47b.jpg', 1));
	script3.AddScene(scene47);

// MOSAIK
	var scene48 = new SSScene();
	scene48.AddAction(new SSAction('hidessinfo3', '', 0));
	scene48.AddAction(new SSAction('V1', 'gfx/sq48a.jpg', 0, 0), 0);
	scene48.AddAction(new SSAction('V2', 'gfx/sq48b.jpg', 0, 0), 1);
	scene48.AddAction(new SSAction('V3', 'gfx/sq48c.jpg', 0, 0), 2);
	scene48.AddAction(new SSAction('V4', 'gfx/sq48d.jpg', 0, 0), 3);
	scene48.AddAction(new SSAction('W1', 'gfx/sq48e.jpg', 0, 0), 4);
	scene48.AddAction(new SSAction('W2', 'gfx/sq48f.jpg', 0, 0), 5);
	scene48.AddAction(new SSAction('W3', 'gfx/sq48g.jpg', 0, 0), 6);
	scene48.AddAction(new SSAction('W4', 'gfx/sq48h.jpg', 0, 0), 7);
	scene48.AddAction(new SSAction('hideLt', '', 0, 0));
	scene48.AddAction(new SSAction('hideMt', '', 0, 0));
	scene48.AddAction(new SSAction('hideRt', '', 10, 0, 'gfx/txt_48a.jpg', 0, 'gfx/txt_48b.jpg', 0));
	scene48.allowLink = 1;
	script3.AddScene(scene48);

// Info
	var sceneInfo3 = new SSScene();
	sceneInfo3.AddAction(new SSAction('ssinfo3', '', 20, 0, 'gfx/txt_blanka.jpg', 0, 'gfx/txt_blankb.jpg', 0));
	script3.AddScene(sceneInfo3);


	if(scriptHide)
		delete scriptHide;
	if(sceneHide)
		delete sceneHide;

	scriptHide = new SSScript('scriptHide', -1);
	sceneHide = new SSScene();
	sceneHide.AddAction(new SSAction('hideLt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideMt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideRt', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideLh', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideRh', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideV1', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideV2', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideV3', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideV4', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideW1', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideW2', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideW3', '', 0, 0));
	sceneHide.AddAction(new SSAction('hideW4', '', 0, 0));
	scriptHide.AddScene(sceneHide);

	currentLength = script3.scenes.length;
}


function SSPlaceGrid3() {

	var x=0, y=0;
	var i, j, h, w, lyr, name, name2;

	w = gridCols*gridWidth;
	h = Math.floor((gridRows*gridHeight) / 3);

	// Half-width cols
	theHHalfG[0] = new lib_obj('gLh');
	theHHalfG[0].moveIt(gridOffsetX, gridOffsetY);
	theHHalfG[0].css.width = gridHHalfW;
	theHHalfG[0].css.height = gridFullH;
	theHHalf[0] = new lib_obj('Lh');
	theHHalf[0].moveIt(gridOffsetX+gridLine, gridOffsetY+gridLine);
	theHHalf[0].css.width = gridHHalfW-2*gridLine;
	theHHalf[0].css.height = gridFullH-2*gridLine;

	theHHalfG[1] = new lib_obj('gRh');
	theHHalfG[1].moveIt(gridOffsetX+gridHHalfW - gridLine, gridOffsetY);
	theHHalfG[1].css.width = gridHHalfW;
	theHHalfG[1].css.height = gridFullH;
	theHHalf[1] = new lib_obj('Rh');
	theHHalf[1].moveIt(gridOffsetX+gridHHalfW, gridOffsetY+gridLine);
	theHHalf[1].css.width = gridHHalfW-2*gridLine;
	theHHalf[1].css.height = gridFullH-2*gridLine;

	// Third-width cols
	y = gridOffsetY;
	x = gridOffsetX;
	for(i=0 ; i<3 ; i++) {
		name = thColNames[i] + 't';
		name2 = 'g' + name;
		w = (i == 1 ? (gridHThirdW+1) : gridHThirdW);

		theHThirds[i] = new lib_obj(name);
		theHThirds[i].css.height = gridFullH-2*gridLine;
		theHThirds[i].css.width = w-2*gridLine;
		theHThirds[i].moveIt(x+gridLine, gridOffsetY+gridLine);

		theHThirdsG[i] = new lib_obj(name2);
		theHThirdsG[i].css.height = gridFullH;
		theHThirdsG[i].css.width = w;
		theHThirdsG[i].moveIt(x, gridOffsetY);

		x += w - gridLine;
	}

	// Half-height grid
	for(i=0 ; i<vwNames.length ; i++) {
		y = gridOffsetY + i*gridHalfH - i*gridLine;
		h = (i == 1 ? gridHalfH+1 : gridHalfH);

		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);
		}
	}

	theInfo3 = new lib_obj('ssinfo3');
	theInfo3.moveIt(gridOffsetX, gridOffsetY);
	theInfo3.css.width = gridFullW;
	theInfo3.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);
}
