/*!

**********************************************************************

@file progress.js



Copyright 2003-2008 Adobe Systems Incorporated.                     

All Rights Reserved.                                                

                                                                    

NOTICE: All information contained herein is the property of Adobe   

Systems Incorporated.                                                                                                                    



/***********************************************************************

functions here now

*/

function WaitForBootstrapperToBegin()

{

	return true;

}



function PollBootstrapper()

{

}



function UpdateProgressBar(progressPercentage)

{

	// Update the UI

	var totalProgress = this.getElementById("progressBarStatus");

	

	totalProgress.style.width = progressPercentage;

	totalProgress.alt = totalProgress.style.width;



	this.wizardControl.session.LogDebug("Update going on");

	return (true);

}



function WaitForSystemCheckToBegin()

{

	// Attempt to load systemcheck code

	var pageName = "systemCheck";

	var workflowMode = "Install";//All are the same, so just choose "Install"

	var pagePath = this.session.GetResourcesPath() + "/pages/" + workflowMode + "/" + pageName + "/" + pageName + ".js";

 	

 	var defaultProperties = inInstallerSession.GetDefaultProperties();

 	var platformName = defaultProperties["platform"];

 	if ("Win32" == platformName)

 	{

 		inInstallerSession.LogDebug("updating path to Win32");

		pagePath = pagePath.replace(/\/+/g, "\\");

		pagePath = pagePath.replace(/\\{2,}/g, "\\");

 	}

	this.session.LogDebug("WizardControl: loading page \"" + pageName + "\" from " + pagePath);



	try

	{

		var pageDataObj = this.session.LoadFile(pagePath);

		var pageData = pageDataObj.data;

		

		if (pageData && pageData != '')

		{

			// Eval the file's code.  This should return a string

			// identifying the class defined in the file.

			var pageClass = eval(pageData);

			if ("string" != typeof pageClass)

				throw pageName + " did not return a class name string";



			// Construct a new object

			var newPage = eval("new " + pageClass + "(this)");

			if (!newPage)

				throw pageName + " constructor failed";

		}

		else

		{

			this.session.LogDebug("WizardControl: no content in " + pagePath);		

		}

	}

	catch (e)

	{

		alert("Unable to load file :: "+pageName+" ::: "+pagePath);

		this.session.LogError("Unable to load file");

		this.session.LogError(e);

	}

}



function Init()

{

	var begin=WaitForBootstrapperToBegin();

	if(begin)

	{

		var complete=false;

		while(!complete)

		{

			var bootstrapper_progress_percentage = PollBootstrapper();

			var overall_progress_percentage = bootstrapper_progress_percentage/2;

			UpdateProgressBar(overall_progress_percentage);

		}

	}

	else

	{

		this.wizardControl.session.LogDebug("Bootstrapper Problem, Did Not Begin Properly!");

	}

	/***************************50% Bootstrapper, 50% SystemCheck*************************************/

	begin=WaitForSystemCheckToBegin();

	if(begin)

	{

		var complete=false;

		while(!complete)

		{

			var bootstrapper_progress_percentage = PollBootstrapper();

			var overall_progress_percentage = bootstrapper_progress_percentage/2;

			UpdateProgressBar(overall_progress_percentage);

		}

	}

	else

	{

		this.wizardControl.session.LogDebug("SystemCheck Problem, Did Not Begin Properly!");

	}

}

