/**
* Autor: Jordi Cuadros
* Functions to launch the Vlab in the same html page
*/

// applet vars
var _appletArchive="vlab.jar,logclient.jar,xalan.jar,jce-1.2.2.jar,sunjce_provider.jar";
var _appletCodebase="/repository/webcontent/intro_chem-palucka-2.0/_u1_stoichiometry/webcontent/vlab/java";
var _appletLanguage="";
var _appletProperties="";
var _appletHeight="550";
var _appletWidth="780";
var _appletRedirect="";
var _appletRepositoryIndex="";
var _appletRepositoryName="";
var _appletUnknowns="";

/**
* Write the HTML required to launch the specified problem in the Vlab
* @param
*		problemName
*
*/
function launchProblem(problemName) {
	_appletProperties=problemName;
	launchVLab();
}

/**
* Write the HTML required to launch the specified problem in the Vlab
* @param
*		problemName
*
*/
function launchProblem(problemName) {
	_appletProperties=problemName;
	launchVLab();
}

/**
* Write the HTML required to launch the specified problem in the Vlab
* sending a string of unknowns values
*
* @param
*		problemName
*		unknownsString
*/
function launchProblemWithUnknowns(problemName, unknownsString) {
	_appletProperties=problemName;
	_appletUnknowns=unknownsString;
	launchVLab();
}

/**
* Launch the VLab with the actual parameters using an applet tag
*/
function launchVLab() {
	document.writeln("<applet code='irydium.vlab.VLApplet.class' archive='"+_appletArchive+"' codebase='"+_appletCodebase+"' width='"+_appletWidth+"' height='"+_appletHeight+"' >");
	
	if (_appletUnknowns!="") document.writeln("<PARAM name='unknowns' value='"+_appletUnknowns+"' \/>");
	if (_appletProperties!="") document.writeln("<PARAM name='properties' value='"+_appletProperties+"' \/>");
	if (_appletLanguage!="") document.writeln("<PARAM name='language' value='"+_appletLanguage+"' \/>");
	if (_appletRedirect!="") document.writeln("<PARAM name='redirect' value='"+_appletRedirect+"' \/>");
	if (_appletRepositoryIndex!="") document.writeln("<PARAM name='repositoryIndex' value='"+_appletRepositoryIndex+"' \/>");
	if (_appletRepositoryName!="") document.writeln("<PARAM name='repositoryName' value='"+_appletRepositoryName+"' \/>");
	document.writeln("<PARAM name='sessionID' value='"+session_id+"' \>");
	document.writeln("<PARAM name='userID' value='"+user_id+"' \>");
	document.writeln("<PARAM name='authToken' value='"+auth_token+"' \>");
	document.writeln("<PARAM name='logService=' value='"+log_service_url+"' \>");	
	
	document.writeln("There's no JVM installed in this system.<\/applet>");

}

