Была когда-то такая штука популярна - агент Микрософт. Сейчас попытался использовать, но не работает в Opera выдает ошибку Cannot convert 'AgentControl.Characters' to object
Возможно, кто-нибудь подскажет причину.
var Agent
var AgentID;
var AgentACS;
var AgentLoaded;
var LoadReq;
var HideReq;
var AgentLeftX, AgentCenterX, AgentRightX;
var AgentTopY, AgentCenterY, AgentBottomY;
AgentID = "Agent";
AgentACS = "merlin.acs";
AgentLoaded = false;
function Window_OnLoad()
{
AgentControl.Connected = true;
AgentLoaded = LoadLocalAgent(AgentID, AgentACS);
if (AgentLoaded)
{
SetCharObj();
}
CheckLoadStatus();
}
function GetScreenPositions()
{
var ScreenWidth = window.screen.width;
var ScreenHeight = window.screen.height;
if ((ScreenWidth == 0) || (ScreenHeight == 0))
{
ScreenWidth = 800;
ScreenHeight = 600;
}
AgentLeftX = 0;
AgentCenterX = (parseInt(ScreenWidth / 2) - parseInt(Agent.Width / 2));
AgentRightX = (ScreenWidth - Agent.Width);
AgentTopY = 0;
AgentCenterY = (parseInt(ScreenHeight / 2) - parseInt(Agent.Height / 2));
AgentBottomY = (ScreenHeight - Agent.Height);
}
function LoadLocalAgent(CharID, CharACS)
{
AgentControl.RaiseRequestErrors = false;
LoadReq = AgentControl.Characters.Load(CharID, CharACS);
AgentControl.RaiseRequestErrors = true;
if (LoadReq.Status != 1)
{
return(true);
}
AgentACS = "merlin.acs";
AgentControl.RaiseRequestErrors = false;
LoadReq = AgentControl.Characters.Load(CharID, AgentACS);
AgentControl.RaiseRequestErrors = true;
if (LoadReq.Status != 1)
{
return(true);
}
return(false);
}
function SetCharObj()
{
Agent = AgentControl.Characters.Character(AgentID);
Agent.LanguageID = 0x409;
}
function CheckLoadStatus()
{
if (!AgentLoaded)
{
return(false);
}
window.status = "";
GetScreenPositions();
AgentIntro();
return(true);
}
function AgentIntro()
{
Agent.Show(0);
Agent.Play("GetAttention");
Agent.Hide(0);
}
function Get_Cookie(Name)
{
var search = Name + "=";
var returnvalue = "";
if (document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function PlayOrNot()
{
if (Get_Cookie('SessionSet')=='')
{
PlayIt();
document.cookie='SessionSet=yes';
}
}
function PlayIt()
{
Window_OnLoad();
}
// set to 1 to just play on first page load, set to 0 to always play
var once_per_session=1;
if (once_per_session==0)
PlayIt();
else
PlayOrNot();