
/////////////////////////// functions called by HTML ///////////////////

// These functions represent the external interface to the HTML page.

function StartVideo()			{ main ? main.htmlStartVideo() 								: false; }
function StopVideo() 			{ main ? main.htmlStopVideo() 								: false; }
function PlayVideo() 			{ main ? main.htmlPlayVideo() 								: false; }
function PlayTrack(nIndex) 	    { main ? main.htmlPlayTrack(nIndex) 						: false; }
function StartGallery() 		{ main ? main.htmlStartGallery() 							: false; }
function PauseResumeSlideShow() { main ? main.htmlPauseResumeSlideShow()                    : false; }
function PrevSlide()			{ main ? main.htmlPrevSlide()								: false; }
function NextSlide()			{ main ? main.htmlNextSlide()								: false; }

function StartVideoNoAudio() { main ? main.htmlStartVideoNoAudio() : false; }
function StopVideoNoAudio()  { main ? main.htmlStopVideoNoAudio()  : false; }
function PlayVideoNoAudio()  { main ? main.htmlPlayVideoNoAudio()  : false; }

function GetState() 		    { if(main){ return main.htmlGetState(); }else{false;} }

/////////////////////////// end //////////////////////////////////


///////////////////////// main /////////////////////////////////

var main;
var ahtmlVars;

function MainControlSetup() {
	
	flashfix();
	
	main = new mainControl();
	
	aHtmlVars = new Array();
	try { aHtmlVars.push(cMediaFolder); } 		catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(cImageFolder); } 		catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(cImageHolderID); } 	catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(aSoundTracks); } 		catch(err) { aHtmlVars.push([]); } ;
	try { aHtmlVars.push(nInitialTrack); } 	    catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(cVideoName); } 		catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(aImages); } 			catch(err) { aHtmlVars.push([]); } ;	
	try { aHtmlVars.push(aMontages); } 			catch(err) { aHtmlVars.push([]); } ;	
	try { aHtmlVars.push(cMontageHolderID); }   catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(cSectionName); }       catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(nSlideShowWidth); }    catch(err) { aHtmlVars.push(""); } ;
	try { aHtmlVars.push(nSlideShowHeight); }   catch(err) { aHtmlVars.push(""); } ;
	main.init(aHtmlVars);
	
	
	if ( window.cVideoName ) {  PlayVideoNoAudio(); }

//	if( aImages.length > 1 ){	PauseResumeSlideShow(); }

	/*var cHeight1;
	var cHeight2;
	if ( typeof cSectionName == "undefined" )
	{
		cHeight1 = document.getElementById("divMainBody").offsetHeight + 700 + "px";
		cHeight2 = document.getElementById("divMainBody").offsetHeight + 692 + "px";
	}
	else
	{
		if ( cSectionName != null && cSectionName == "Portfolio" )
		{
			cHeight1 = document.getElementById("divPortfolioDesc").offsetHeight + 700 + "px";
			cHeight2 = document.getElementById("divPortfolioDesc").offsetHeight + 692 + "px";
		}
		else
		{
			cHeight1 = document.getElementById("divMainBody").offsetHeight + 700 + "px";
			cHeight2 = document.getElementById("divMainBody").offsetHeight + 692 + "px";
		}
	}
	
	document.getElementById("divOuterLHS").style.height        = cHeight1;
	document.getElementById("divOuterRHS").style.height        = cHeight1;
	document.getElementById("divLHS").style.height             = cHeight1;
	document.getElementById("divRHS").style.height             = cHeight2;
	document.getElementById("divInnerRepeatArea").style.height = cHeight2;*/
	
	
}


function flashfix(){
	window.status = "Begin Fix Flash || (c) 2006 CCL || www.companioncomputers.co.uk "
	var aOs =document.getElementsByTagName("object");
	for( var i=0;i<aOs.length;i++ ){	aOs[i].outerHTML = aOs[i].outerHTML;}
	window.status = "Fixed " + aOs.length + " Flash Element(s) || (c) 2006 CCL || www.companioncomputers.co.uk "
	
}




