//
//
//		LIVINGACTOR JAVASCRIPT LIBRARY VERSION 1.6.0.0
//
//				copyrights La Cantoche Production
//					all rights reserved
//
//
//
var DEBUGMODE=false;
var DEBUGMODELOOP=false;
/////////////////////////////////////////////////////////////////////////////////////////
// Platform Detection
/////////////////////////////////////////////////////////////////////////////////////////
var AppName = navigator.appName.toLowerCase();
var AppVer = parseFloat(navigator.appVersion);
if (AppName.indexOf("microsoft internet") != -1)
	AppVer = parseFloat(navigator.appVersion.substring((navigator.appVersion.indexOf("MSIE") + 4)));
var WIN32 = (window.navigator.platform.indexOf("Win32")!= -1);
var WIN95 = navigator.appVersion.indexOf("95")!= -1;
var NAV4  = (AppName.indexOf("netscape") != -1 && AppVer >= 4.0 && AppVer <= 4.99);
var NAV6  = (AppName.indexOf("netscape") != -1 && AppVer >= 5.0 );
var IE4   = (AppName.indexOf("microsoft internet") != -1 && AppVer >= 4.0 && AppVer < 5.0);
var IE5   = (AppName.indexOf("microsoft internet") != -1 && AppVer >= 5.0);
var IE   = (AppName.indexOf("microsoft internet") != -1 && AppVer >= 4.0 );
var SP2 = (window.navigator.userAgent.indexOf("SV1") != -1);
/////////////////////////////////////////////////////////////////////////////////////////
// Event
/////////////////////////////////////////////////////////////////////////////////////////
var LA_OnDragStart = null;
var LA_OnDragEnd   = null;
var LA_OnBookmark  = null;
var LA_OnDialogID  = null;
var LA_OnSelect    = null;
/////////////////////////////////////////////////////////////////////////////////////////
// LivingActor Status
/////////////////////////////////////////////////////////////////////////////////////////
var E_UNINITIALIZED = 0;
var E_INITIALIZED = 1;
var E_INSTALLING = 2;
var E_LOADING_ACTOR = 3;
var E_STARTED = 4;
/////////////////////////////////////////////////////////////////////////////////////////
// Global Variable
/////////////////////////////////////////////////////////////////////////////////////////
var LA_PluginVersion = 1631;
var LA_GenericPlugin = null;
var LA_CurrentStatus = E_UNINITIALIZED;
var ACTOR = null;
var LA_ACTOR_URL = ""; //internal use
var LA_UserDefined = ""; //internal use
/////////////////////////////////////////////////////////////////////////////////////////
// Error
/////////////////////////////////////////////////////////////////////////////////////////
var E_NO_ERROR = 0;
var E_ACTOR_FILE_HAS_EXPIRED = 1;
var E_ACTOR_FILE_NOT_FOUND = 2;
var E_ACTOR_FILE_BAD_FORMAT = 3;
var E_NO_WIN32_PLATFORM_DETECTED = 4;
var E_NO_COMPATIBLE_BROWSER_DETECTED = 5;
var E_WIN95_DETECTED = 6;
var E_CANNOT_FIND_PLUGIN_VERSION_REQUESTED = 7;
var E_HIGH_SECURITY_OR_USER_SAY_NO = 8;
var E_INSTALL_ABORTED = 9;
var	E_INTERNET_INITIALIZATION_ERROR = 16;
var	E_CANT_CREATE_HTTP_CONNECTION_ERROR = 17;
var	E_HTTP_TRANSMISSION_ERROR = 18;
var	E_CANT_CREATE_TEMP_FILE_ERROR = 19;
var	E_DOWNLOAD_FAILED = 20;
var	E_CANT_WRITE_LIVINGACTOR_ERROR = 21;
var	E_REGISTRATION_ERROR = 22;
var E_JAVA_IS_DISABLED = 23;
var E_NETSCAPE_TRIGGER_IS_DISABLED = 24;
var CANNOT_START_PLUGIN_NETSCAPE = 25;
var CANNOT_INSTALL_XPI = 26;
/////////////////////////////////////////////////////////////////////////////////////////
// Toggle Enable / Disable
/////////////////////////////////////////////////////////////////////////////////////////
var TOGGLE_DOWNLOADING_DIALOGBOX = "1";
var TOGGLE_LOADING_DIALOG_DIALOGBOX = "2";
var TOGGLE_ACTOR_DIALOG = "3";
var TOGGLE_ANTIALIASING = "4";
var TOGGLE_SOUND = "5";
var TOGGLE_PAINTER = "7";
var TOGGLE_SYSTEM_ICON = "6";
/////////////////////////////////////////////////////////////////////////////////////////
// Internal Managment Netscape Plugin
/////////////////////////////////////////////////////////////////////////////////////////
var NS_CHK_NO_PLUGIN = 0;
var NS_CHK_NO_LA = 1;
var NS_CHK_OK = 2;

/////////////////////////////////////////////////////////////////////////////////////////
//Code de réponse de la fonction IE_CheckLivingActor
/////////////////////////////////////////////////////////////////////////////////////////
ERRNO =2 //OK
ERRUP =1 //Update
ERRNOINST =0 //Lancer installation
////////////////////////////////////////////////////////////////////////////////////////
// Wait Functions
////////////////////////////////////////////////////////////////////////////////////////

function ActorLoading()
{
	if(LA_GenericPlugin != null)
	{
		ManageStatus(E_LOADING_ACTOR);
		ACTOR = new Actor(LA_GenericPlugin);
		ACTOR.LoadActor(LA_ACTOR_URL);
		RunUntilLoaded();
	}
}
/////////////////////////////////////////////////////////////////////////////////////////
function RunUntilLoaded()
{
	if (ACTOR != null)
	{
		var LAStatus = parseInt(ACTOR.GetStatus());
		if (LAStatus == 0)
		{
			ManageStatus(E_STARTED);
			if(Main_LivingActor)
				Main_LivingActor(LA_UserDefined);
			
		}
		else if (LAStatus & 0x00000600) // Download OR Load
		{
			setTimeout("RunUntilLoaded()",300);
		}
		else
		{
			errorCode = (LAStatus>>24);
			if (errorCode == 1)
			{
				ManageError(E_ACTOR_FILE_HAS_EXPIRED);
			}
			else if(errorCode == 2)
			{
				ManageError(E_ACTOR_FILE_NOT_FOUND);
			}
			else if(errorCode == 3)
			{
				ManageError(E_ACTOR_FILE_BAD_FORMAT);
			}
		}
	}
}
/////////////////////////////////////////////////////////////////////////////////////////
// LivingActor Initialisation (platform & browser dependant function)
/////////////////////////////////////////////////////////////////////////////////////////
var IE_ChkLA;
function Init_LivingActor(anActorPath,userValue) {
	LA_ACTOR_URL = anActorPath;
	LA_UserDefined = userValue;
	
	if (!WIN32){
		ManageError(E_NO_WIN32_PLATFORM_DETECTED);
		return;
	}
	else if (WIN95){
		ManageError(E_WIN95_DETECTED);
		return;
	}
	else if(NAV4)	{
			ManageError(E_NO_COMPATIBLE_BROWSER_DETECTED);
	}
	else if(NAV6) {
			
		Moz_ChkP = Moz_CheckPlugin();
		
		if(Moz_ChkP ==0) {
			parent.content.ShowDiv();
		}
		
		else if(Moz_ChkP ==1){
			Moz_ChkA = Moz_CheckActiveX();
			if(DEBUGMODE){ alert("Moz is check "+Moz_ChkP+" "+Moz_ChkA)}
			switch(Moz_ChkA){
				case ERRNO:
					// we do have the plugin ..AND it's up to date.
					ActorLoading();
				break;
			
				case ERRUP:
					if(DEBUGMODE) alert("Update");
					setTimeout("Moz_LoopWaitingInstallerReady()",1000);
				break;
				
				case ERRNOINST:
					if(DEBUGMODE){ alert("Install")}
					parent.content.ShowDiv();		
				break;
			}
		}
		
	}
	else if (IE){
			IE_ChkLA = IE_CheckLivingActor()
			switch(IE_ChkLA){
			case ERRNO: 
				if(DEBUGMODE){ alert("ActoLoading")}
				ActorLoading(); 
			break;
			case ERRUP:
				if(DEBUGMODE){ alert("IE_Update")}
				ManageStatus(E_INSTALLING);
				IE_Install();
			break;
			case ERRNOINST:
				if(DEBUGMODE){ alert("IE_install")}
				// /!\ Ne marche pas lorsqu'il y a un antipopup-> Tester avec google /!\ //
				tryShowDiv();
					
			break;
			}
			
	}
	else{
			ManageError(E_NO_COMPATIBLE_BROWSER_DETECTED);
	}
}
/////////////////////////////////////////////////////////////////////////////////////////
// Stop & Quit LivingActor
/////////////////////////////////////////////////////////////////////////////////////////
function TerminateLivingActor()
{
	if(LA_GenericPlugin != null)
	{
		LA_GenericPlugin.Execute("Quit()");
	}
	ACTOR = null;
	LA_GenericPlugin = null;
}
/////////////////////////////////////////////////////////////////////////////////////////
// Event Management
/////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////
//  Polling Mode
/////////////////////////////////////////////////////////////////////////////////////////

function HandleEventPollMode()
{
if(ACTOR!=null){
  var abookmark="";
  var anevent="";
  abookmark=ACTOR.GetBookmark();
  anevent=ACTOR.GetDialogEvent();
  if(abookmark!="")
  { LA_OnEvent("ONBOOKMARK",abookmark);}
  if(anevent!="")
  { LA_OnEvent("ONDIALOGID",anevent);}
  }
  setTimeout("HandleEventPollMode()",300);
}


if (IE) {
 		 eval ("function LIVINGACTORPLUGIN::OnEvent(eventType,eventValue){LA_OnEvent(eventType,eventValue);}");
	}
/*
else if(NAV6) {
	function LIVINGACTORPLUGIN_OnEvent(aType,aValue){
		LA_OnEvent(aType,aValue);
	}
}
*/
//function LIVINGACTORPLUGIN::OnEvent(eventType,eventValue){LA_OnEvent(eventType,eventValue);}

function LA_OnEvent(eventType,eventValue)
{
	//alert(eventType);
	switch (eventType) 
	{ 
		case "ONDRAGSTART" : 
			if(LA_OnDragStart)
			{
				LA_OnDragStart();
			}
			break; 
		case "ONDRAGEND" : 
			if(LA_OnDragEnd)
			{
				ind = eventValue.lastIndexOf(',');
				var firstparam = eventValue.substr(0,ind);
				var x = firstparam * 1;
				var secondparam = eventValue.substr(ind+1,eventValue.length);
				var y = secondparam * 1;
				LA_OnDragEnd(x,y);
			}
			break; 
		case "ONBOOKMARK" : 
			if(LA_OnBookmark)
			{
				LA_OnBookmark(eventValue);
			}
			break; 
		case "ONDIALOGID" : 
			if(LA_OnDialogID)
			{
				LA_OnDialogID(eventValue);
			}
			break; 
		case "ONSELECT" : 
			if(LA_OnSelect)
			{
				ind = eventValue.lastIndexOf(',');
				var material = eventValue.substr(0,ind);
				var bone = eventValue.substr(ind+1,eventValue.length);
				LA_OnSelect(material,bone);
			}
			break; 
		default : 
	} 
	
}
/////////////////////////////////////////////////////////////////////////////////////////
// Error Management
/////////////////////////////////////////////////////////////////////////////////////////
function ManageError(errorCode)
{
    //if (typeof customManageError!="undefined") {
    //    customManageError(errorCode);
//    } else { 
	if((errorCode!=0)&& (errorCode!=1)&& (errorCode!=4)&& (errorCode!=5)&& (errorCode!=6)&& (errorCode!=22)&& (errorCode!=23)&& (errorCode!=24)&& (errorCode!=25) )
	{
	if(LA_OnSetupExeLaunchable)
		ShowDiv();
	}
	alert(eval("LA_ERROR_" + errorCode));
//    }
}
/////////////////////////////////////////////////////////////////////////////////////////
// Error Management
/////////////////////////////////////////////////////////////////////////////////////////
function ManageStatus(statusCode)
{
	LA_CurrentStatus = statusCode;
	//window.status = "Status Code = " + statusCode;
}



/////////////////////////////////////////////////////////////////////////////////////////
// Tools
/////////////////////////////////////////////////////////////////////////////////////////
function PathFor(anActorName)
{
	var path;
	var completePath = document.location.href;
	completePath = unescape(completePath);
	var LastSlashIndex = completePath.lastIndexOf("/");
	path = completePath.substr(0,LastSlashIndex+1);
	path += anActorName;
	
	if ( path.indexOf("file:///") >=0)
	{
		path = path.substr(8);
		if(path[1]=="|")
		{
			var leter = path[0];
			path = path.substr(2);
			path = leter + ":" + path;
		}
	}
	else if( path.indexOf("file://") >=0)
	{
		path = path.substr(7);
		if(path[1]=="|")
		{
			var leter = path[0];
			path = path.substr(2);
			path = leter + ":" + path;
		}
	}
	return path;
}
function GetCookie(NameOfCookie)
{  
	if (document.cookie.length > 0) 
	{     
		begin = document.cookie.indexOf(NameOfCookie+"="); 
		if (begin != -1)   
		{
			begin += NameOfCookie.length+1; 
			end = document.cookie.indexOf(";", begin);
			if (end == -1)
			{
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(begin, end)); 
		}
	}
	return null; 
}
function SetCookie(NameOfCookie, value, expiredays,path) 
{
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + 
			((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString())
			+ ((path==true) ? ";path=/" : "");
}
function DelCookie(NameOfCookie) 
{
	if (GetCookie(NameOfCookie))
	{
		document.cookie = NameOfCookie + "=" +"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}


function SetLACookie(NameOfCookie, value)
{
	if (IE && IE_ChkLA==ERRNO)
	{
		if(LA_GenericPlugin)
		document.LIVINGACTORPLUGIN.ClientData(NameOfCookie)=value;
		if(DEBUGMODELOOP) alert("SetLaCookie IE: "+NameOfCookie+"\nValue "+value+"\nValue cookie "+document.LIVINGACTORPLUGIN.ClientData(NameOfCookie));
	}
	else if(NAV6 && IE_ChkLA==ERRNO)
	{
		if(DEBUGMODE) alert("SetLaCookie NAV6 ENTER");
		if(document.getElementById('LIVINGACTORPLUGIN')){
			document.getElementById('LIVINGACTORPLUGIN').ClientData(NameOfCookie)=value;
			if(DEBUGMODELOOP) alert("SetLaCookie NAV6: "+NameOfCookie+"\nValue "+value+"\nValue cookie "+document.getElementById('LIVINGACTORPLUGIN').ClientData(NameOfCookie));
		}
	}
}


function GetLACookie(NameOfCookie)
{
	if (IE && IE_ChkLA==ERRNO)
	{
		if(DEBUGMODE) alert("GetLaCookie IE ENTER");
		if(LA_GenericPlugin){
		  if(DEBUGMODELOOP) alert("GetLaCookie IE\n"+NameOfCookie+"="+document.LIVINGACTORPLUGIN.ClientData(NameOfCookie));
		  return document.LIVINGACTORPLUGIN.ClientData(NameOfCookie);
		}
		else return "NOPLUGIN";
	}
	else if(NAV6 && IE_ChkLA==ERRNO)
	{
		if(DEBUGMODE) alert("GetLaCookie NAV6 ENTER");
		if(document.getElementById('LIVINGACTORPLUGIN')){
			if(DEBUGMODELOOP) alert("GetLaCookie NAV6\n"+NameOfCookie+"="+document.getElementById('LIVINGACTORPLUGIN').ClientData(NameOfCookie));
			return document.getElementById('LIVINGACTORPLUGIN').ClientData(NameOfCookie);
		}
		else return "NOPLUGIN";		
	}
}

/////////////////////////////////////////////////////////////////////////////////////////
// Javascript - LivingActor Mapping
/////////////////////////////////////////////////////////////////////////////////////////
function Actor(LivingActorPlugin)
{
	 this.LA_Plugin = LivingActorPlugin;
	 
	 this.GetLoadStatus = GenericGetLoadStatus;
	 
	 //BASIC COMMANDS
      	 this.Disable = GenericDisable;
      	 this.Enable = GenericEnable;
	 this.GestureAtPixel = GenericGestureAtPixel;
	 this.GestureAtScreen = GenericGestureAtScreen;
	 this.GetBookmark = GenericGetBookmark;
	 this.GetDialogEditText = GenericGetDialogEditText;	
	 this.GetDialogEvent = GenericGetDialogEvent;
      	 this.GetStatus = GenericGetStatus;
 	 this.Hide = GenericHide;      	 
	 this.LoadActor	= GenericLoadActor;
	 this.LookAtPixel = GenericLookAtPixel;
	 this.LookAtScreen = GenericLookAtScreen;
	 this.MenuAddItem = GenericMenuAddItem;
	 this.MenuClear = GenericMenuClear;	 
	 this.MenuRemoveItem = GenericMenuRemoveItem;	 
	 this.MoveToPixel = GenericMoveToPixel;	 
	 this.MoveToScreen = GenericMoveToScreen;
	 this.PlaceAtPixel = GenericPlaceAtPixel;
	 this.PlaceAtScreen = GenericPlaceAtScreen;
	 this.Play = GenericPlay;	 
      	 this.PlayScenario = GenericPlayScenario;
 	 this.PlaySound = GenericPlaySound;     	 
	 this.Resume = GenericResume;
	 this.SetBookmark = GenericSetBookmark;
	 this.SetDialogWidth = GenericSetDialogWidth;
    	 this.SetDialogSkin = GenericSetDialogSkin;
 	 this.SetExpression = GenericSetExpression;
 	 this.SetDefaultExpression = GenericSetExpression;
	 this.SetScale = GenericSetScale;	 
	 this.SetTTSID = GenericSetTTSID;	 
 	 this.Show = GenericShow;
	 this.Speak = GenericSpeak;
 	 this.Stop = GenericStop; 
 	 this.ClearScenario = GenericStop; 
	 this.Suspend = GenericSuspend;
   	 this.GetStatus = GenericGetStatus;
	 
	 //ADVANCED COMMANDS
	 this.DeleteActorPreferences = GenericDeleteActorPreferences;
	 this.GetActorHeight = GenericGetActorHeight;	 
	 this.GetActorPositionX = GenericGetActorPositionX;
	 this.GetActorPositionY = GenericGetActorPositionY;
	 this.GetActorPreference = GenericGetActorPreference;
	 this.GetActorWidth = GenericGetActorWidth;	 
	 this.GetAnimation = GenericGetAnimation;
	 this.GetAnimationCount = GenericGetAnimationCount;
	 this.GetError = GenericGetError;	 
	 this.GetErrorCount = GenericGetErrorCount;
	 this.GetExpression = GenericGetExpression;
	 this.GetExpressionCount = GenericGetExpressionCount;
	 
	 this.GetMaterialCount = GenericGetMaterialCount;
	 this.GetMaterialDiffuseBlue = GenericGetMaterialDiffuseBlue;
	 this.GetMaterialDiffuseGreen = GenericGetMaterialDiffuseGreen;
	 this.GetMaterialDiffuseRed = GenericGetMaterialDiffuseRed;
	 this.GetMaterial = GenericGetMaterial;

	 this.SaveActorPreferences = GenericSaveActorPreferences;
	 this.SetActorPreference = GenericSetActorPreference;	 
	 this.SetCameraPosition = GenericSetCameraPosition;
     	 this.SetDialogFont = GenericSetDialogFont;
	 this.SetImmediateScale = GenericSetImmediateScale;
	 this.SetLightColor = GenericSetLightColor;	 
	 this.SetLightPosition = GenericSetLightPosition;
	 this.SetTTSInfos = GenericSetTTSInfos;
	 this.SetTTSPitch = GenericSetTTSPitch;	 
	 this.SetTTSSpeed = GenericSetTTSSpeed;	 
}

/////////////////////////////////////////////////////////////////////////////////////////
// Generic Functions
/////////////////////////////////////////////////////////////////////////////////////////

//BASIC COMMANDS

function GenericGetLoadStatus() 
{
	return this.LA_Plugin.Execute("GetLoaded()");
}

function GenericDisable(Toggle)
{
	return this.LA_Plugin.Execute("Disable(" + Toggle + ")");
}
function GenericEnable(Toggle)
{
	return this.LA_Plugin.Execute("Enable(" + Toggle + ")");
}
function GenericGestureAtPixel(x,y)
{
	return this.LA_Plugin.Execute(("GestureAtPixel(" + x + "," + y + ")"));
}
function GenericGestureAtScreen(x,y)
{
	return this.LA_Plugin.Execute(("GestureAtScreen(" + x + "," + y + ")"));
}
function GenericGetBookmark() 
{
	return this.LA_Plugin.Execute("GetBookmark()");
}
function GenericGetDialogEditText(name)
{
	return this.LA_Plugin.Execute("GetDialogEditText(" + name +")");
}
function GenericGetDialogEvent() 
{
	return this.LA_Plugin.Execute("GetDialogEvent()");
}
function GenericGetStatus()
{
	return this.LA_Plugin.Execute("GetStatus()");
}
function GenericHide(seqname)
{
	if(GenericHide.arguments.length == 1)
	{
		return this.LA_Plugin.Execute("Hide2(" +seqname +" )");
	}
	else
	{
		return this.LA_Plugin.Execute("Hide()");
	}
}
function GenericLoadActor(ActorUrl)
{
	return this.LA_Plugin.LoadActor(ActorUrl);
}
function GenericLookAtPixel(x,y)
{
	return this.LA_Plugin.Execute(("LookAtPixel(" + x +"," + y +")"));
}
function GenericLookAtScreen(x,y)
{
	return this.LA_Plugin.Execute(("LookAtScreen(" + x +"," + y +")"));
}
function GenericMenuAddItem(item,id)
{
	return this.LA_Plugin.Execute(("MenuAddItem(" + (item) + "," + (id) + ")"));
}
function GenericMenuClear()
{
	return this.LA_Plugin.Execute(("MenuClear()"));
}
function GenericMenuRemoveItem(id)
{
	return this.LA_Plugin.Execute(("MenuRemoveItem("+ (id) + ")"));
}
function GenericMoveToPixel(x,y,speed)
{				
	if(GenericMoveToPixel.arguments.length == 3)
	{
		return this.LA_Plugin.Execute(("MoveToPixel(" + x + "," + y + "," + speed +")"));
	}
	else
	{
		return this.LA_Plugin.Execute(("MoveToPixel(" + x + "," + y +")"));
	}
}
function GenericMoveToScreen(x,y,speed)
{
	if(GenericMoveToScreen.arguments.length == 2)
	{
		return this.LA_Plugin.Execute(("MoveToScreen(" + x + "," + y +")"));
	}
	else if(GenericMoveToScreen.arguments.length == 3)
	{
		return this.LA_Plugin.Execute(("MoveToScreen(" + x + "," + y + "," + speed +")"));
	}
}
function GenericPlaceAtPixel(x,y)
{
	return this.LA_Plugin.Execute(("PlaceAtPixel(" + x + "," + y + ")"));
}
function GenericPlaceAtScreen(x,y)
{
	return this.LA_Plugin.Execute(/*(*/"PlaceAtScreen(" + x + "," + y + ")")/*)*/;
}
function GenericPlay(animation,seqname)
{	
	if(GenericPlay.arguments.length == 2)
	{
		return this.LA_Plugin.Execute("Play2("  + animation + "," + seqname+ ")");
	}
	else
	{
		return this.LA_Plugin.Execute("Play("  + animation + ")");
	}
}
function GenericPlayScenario(TextToScript)
{
	return this.LA_Plugin.Execute("PlayScenario(" + TextToScript + ")");
}
function GenericPlaySound(awave)
{
	return this.LA_Plugin.Execute("PlaySound(" + awave + ")");
}
function GenericResume()
{
	return this.LA_Plugin.Execute("Resume()");	
}
function GenericSetBookmark(x)
{
	return this.LA_Plugin.Execute(("SetBookmark(" + x + ")"));
}
function GenericSetDialogWidth(lineWidth)
{
	return this.LA_Plugin.Execute("SetDialogWidth(" + lineWidth + ")");
}
function GenericSetDialogSkin(skinName)
{
	return this.LA_Plugin.Execute("SetDialogSkin(" + skinName + ")");
}
function GenericSetExpression(exp,t)
{
	if(GenericSetExpression.arguments.length == 2)
	{
		return this.LA_Plugin.Execute("SetExpression(" + exp + "," +GenericSetExpression.arguments[1]+ ")");
	}
	else
	{
		return this.LA_Plugin.Execute("SetExpression(" + exp + ")");
	}
}
function GenericSetScale(x,t)
{
	if(GenericSetScale.arguments.length == 1)
	{
	return this.LA_Plugin.Execute(/*(*/ "SetScale(" + x + ")") /*)*/;	
	}
	else
	if(GenericSetScale.arguments.length == 2)	
	{
	return this.LA_Plugin.Execute(/*(*/ "SetScale(" + x + "," + t +")") /*)*/;
	}
}
function GenericSetTTSID(anID)
{
	return this.LA_Plugin.Execute("SetTTSID(" +anID+")");
}
function GenericShow(seqname)
{
	if(GenericShow.arguments.length == 1)
	{
		return this.LA_Plugin.Execute("Show2(" +seqname + ")");
	}
	else
	{
		return this.LA_Plugin.Execute("Show()");
	}
}
function GenericSpeak(sentence)
{
	return this.LA_Plugin.Execute('Speak("' + sentence  + '")');
}
function GenericStop()
{
	return this.LA_Plugin.Execute("Stop()");
}
function GenericSuspend(second)
{
	return this.LA_Plugin.Execute("Suspend(" + second + ")");	
}

//ADVANCED COMMANDS
function GenericDeleteActorPreferences()
{
	return this.LA_Plugin.Execute("DeleteActorPreferences()");
}
function GenericGetActorHeight()
{
	return this.LA_Plugin.Execute("GetActorHeight()");
}
function GenericGetActorPositionX()
{
	return this.LA_Plugin.Execute("GetActorPositionX()");
}
function GenericGetActorPositionY()
{
	return this.LA_Plugin.Execute("GetActorPositionY()");
}
function GenericGetActorPreference(type,name)
{
	return this.LA_Plugin.Execute("GetActorPreference(" + type+" ," +name+" ," + ")");
}
function GenericGetActorWidth()
{
	return this.LA_Plugin.Execute("GetActorWidth()");
}
function GenericGetAnimation(ind)
{
	return this.LA_Plugin.Execute("GetAnimation(" + ind + ")");
}
function GenericGetAnimationCount()
{
	return this.LA_Plugin.Execute("GetAnimationCount()");
}
function GenericGetError(num)
{
	return this.LA_Plugin.Execute("GetError(num)");
}
function GenericGetErrorCount()
{
	return this.LA_Plugin.Execute("GetErrorCount()");
}
function GenericGetExpression(ind)
{
	return this.LA_Plugin.Execute("GetExpression(" + ind + ")");
}
function GenericGetExpressionCount()
{
	return this.LA_Plugin.Execute("GetExpressionCount()");
}
function GenericGetMaterialCount()
{
	return this.LA_Plugin.Execute("GetMaterialCount()");
}
function GenericGetMaterialDiffuseBlue(name)
{
	return this.LA_Plugin.Execute("GetMaterialDiffuseBlue(" + name + ")");
}
function GenericGetMaterialDiffuseGreen(name)
{
	return this.LA_Plugin.Execute("GetMaterialDiffuseGreen(" + name + ")");
}
function GenericGetMaterialDiffuseRed(name)
{
	return this.LA_Plugin.Execute("GetMaterialDiffuseRed(" + name + ")");
}
function GenericGetMaterial(num)
{
	return this.LA_Plugin.Execute("GetMaterial(num)");
}
function GenericSaveActorPreferences()
{
	return this.LA_Plugin.Execute("SaveActorPreferences()");
}
function GenericSetActorPreference(type,name,value) 
{	       
	var tosend = "SetActorPreference(" +  (type) +"," + (name)+"," + "\"" +(value)+"\"" +")" ;
	return this.LA_Plugin.Execute(tosend);
}
function GenericSetCameraPosition(x,y,z)
{
	return this.LA_Plugin.Execute("SetCameraPosition(" + x+"," +y+","+z+")");
}
function GenericSetDialogFont(fontName)
{
	return this.LA_Plugin.Execute("SetDialogFont(" + fontName + ")");
}
function GenericSetImmediateScale(x)
{
	return this.LA_Plugin.Execute(("SetImmediateScale(" + x + ")"));
}
function GenericSetLightColor(x,y,z)
{
	return this.LA_Plugin.Execute("SetLightColor("+x+","+ y+","+ z+")");
}
function GenericSetLightPosition(x,y,z)
{
	return this.LA_Plugin.Execute("SetLightPosition("+x+","+ y+","+ z+")");
}
function GenericSetTTSInfos(gender,language)
{
	return this.LA_Plugin.Execute("SetTTSInfos("+gender+","+language+")");
}
function GenericSetTTSPitch(val)
{
//	return this.LA_Plugin.Execute("SetTTSPitch(" + val + ")");
	return this.LA_Plugin.Execute("SET_TTS_PITCH(" + val + ")");
}
function GenericSetTTSSpeed(val)
{
//	return this.LA_Plugin.Execute("SetTTSSpeed(" + val + ")");
	return this.LA_Plugin.Execute("SET_TTS_SPEED(" + val + ")");
}
function GenericGetStatus()
{
	return this.LA_Plugin.Execute("GetStatus()");
}
/////////////////////////////////////////////////////////////////////////////////////////
