Frame 1
function grabText(sNodeName) {
var _local1 = xml.firstChild.firstChild;
while (_local1 != null) {
if (_local1.nodeName.toString() == sNodeName) {
return(_local1.firstChild.toString());
}
_local1 = _local1.nextSibling;
}
return("error");
}
_global.MyAdd = _root._url.split("chat_with_elita.swf").join("");
var letters = new Object();
aXML = new XML();
aXML.ignoreWhite = true;
aXML.load(_global.MyAdd + "keywords.xml");
aXML.onLoad = function () {
var _local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_";
i = 0;
while (i < _local2.length) {
currletter = new XML();
var _local1 = aXML.firstChild;
while (_local1 != null) {
if (_local1.firstChild.nodeName.toString() == "pattern") {
n = _local1.firstChild.firstChild.toString().charAt(0);
if (n == "*") {
n = "_";
}
if (n == _local2.charAt(i).toUpperCase()) {
node = _local1.cloneNode(true);
currletter.appendChild(node);
}
}
_local1 = _local1.nextSibling;
}
letters[_local2.charAt(i)] = currletter;
i++;
}
};
_root.onKeyDown = function () {
if (Key.isDown(13)) {
play();
}
};
var l = new Object();
l.onSetFocus = function (oldFocus, newFocus) {
if (newFocus == _root.enterName) {
_root.enterName.text = "";
}
};
Selection.addListener(l);
var xml = new XML();
xml.ignoreWhite = true;
xml.load(_global.MyAdd + "events.xml");
xml.onLoad = function (info) {
_root.header.htmlText = grabText("header");
_root.link1.htmlText = grabText("link1");
_root.link2.htmlText = grabText("link2");
_root.text1.htmlText = grabText("text1");
_root.text2.htmlText = grabText("text2");
};
stop();
Frame 2
function processText() {
mytext = _root.hejsna.text;
if (mytext == "") {
return(undefined);
}
_root.hejsna.text = "";
_root.history.htmlText = _root.history.htmlText + formatToChat(myname, mytext);
_root.history.scroll = _root.history.maxscroll;
if (textqueue.length) {
_root.history.htmlText = _root.history.htmlText + formatToChat("Elita ", "User is currently away from the computer.");
return(undefined);
}
mytext = mytext.toUpperCase();
nodeFinder = {txt:mytext, rootNode:letters[mytext.charAt(0)], currNode:letters[mytext.charAt(0)].firstChild, nodeTimer:getTimer() + 100, processing:true, exact:false, result:0};
}
function makeVideoArea(sClip) {
video_ns.onStatus = function (info) {
switch (info.code) {
case "NetStream.Play.Stop" :
addtime = this.time * 1000;
restart = true;
break;
case "NetStream.Play.Start" :
currtime = currtime + addtime;
if (currtime >= 0) {
break;
}
currtime = 0;
}
};
video_ns.play(_global.MyAdd + sClip);
videoarea.attachVideo(video_ns);
}
function formatToChat(sName, sText) {
return(((((("<b>" + sName) + "(") + getCurrTime()) + "):</b> ") + sText) + newline);
}
function getCurrTime() {
var _local1 = new Date();
h = _local1.getHours();
a = ((h < 12) ? "AM" : "PM");
h = h % 12;
if (h == 0) {
h = 12;
}
m = _local1.getMinutes();
if (h < 10) {
h = "0" + h;
}
if (m < 10) {
m = "0" + m;
}
return((((h + ".") + m) + " ") + a);
}
function getElapsed() {
return(currtime + video_ns.time);
}
function getRandomVideo() {
return(randomvids[mRand(randomvids.length)]);
}
function getAnswerTime(sVideo) {
return(2000);
}
function explode(sString) {
r = new Array();
var _local1 = "";
i = 0;
while (i < sString.length) {
if (sString.charAt(i) == " ") {
r.push(_local1);
_local1 = "";
} else {
_local1 = _local1 + sString.charAt(i);
}
i++;
}
r.push(_local1);
return(r);
}
function findNode(sObj) {
var _local2 = sObj.currNode;
while (_local2 != null) {
word = _local2.firstChild.firstChild.toString();
if (match(sObj.txt, word, sObj.exact)) {
if (_local2.firstChild.nextSibling.nodeName.toString() == "srai") {
sObj.exact = true;
sObj.txt = _local2.firstChild.nextSibling.firstChild.toString();
sObj.rootNode = letters[sObj.txt.charAt(0)];
_local2 = sObj.rootNode.firstChild;
} else {
sObj.result = getReplyFromNode(_local2);
sObj.processing = false;
return(undefined);
}
}
if (getTimer() > sObj.nodeTimer) {
sObj.currNode = _local2.nextSibling;
return(undefined);
}
_local2 = _local2.nextSibling;
}
if (sObj.rootNode == letters._) {
sObj.result = getNonsenseReply();
sObj.processing = false;
} else {
sObj.rootNode = letters._;
sObj.currNode = letters._.firstChild;
}
}
function match(sText, sWord, sExact) {
if (sExact) {
return(sText == sWord);
}
if (matchAtomic(sText, sWord)) {
return(true);
}
switch (patternType(word)) {
case 1 :
if (matchAtomic(sText.substr(0, word.length - 1), word.substr(0, word.length - 1))) {
return(true);
}
break;
case 2 :
if (matchAtomic(sText.substr((-word.length) + 1, word.length), word.substr(1, word.length))) {
return(true);
}
break;
case 3 :
if (sText.indexOf(word.substr(1, word.length - 2)) > -1) {
return(true);
}
w = sText.indexOf(word.substr(1, 3));
if (w <= -1) {
break;
}
if (!matchAtomic(sText.substr(w, word.length - 2), word)) {
break;
}
return(true);
}
return(false);
}
function patternType(sPattern) {
if ((sPattern.charAt(sPattern.length - 1) == "*") && (sPattern.charAt(0) == "*")) {
return(3);
}
if (sPattern.charAt(0) == "*") {
return(2);
}
if (sPattern.charAt(sPattern.length - 1) == "*") {
return(1);
}
return(-1);
}
function isPostPattern(sWord) {
if (sWord.charAt(sWord.length - 1) == "*") {
return(true);
}
return(false);
}
function matchAtomic(sPattern, sWord) {
d = sWord.length / 5;
if (levdist(sPattern.toUpperCase(), sWord.toUpperCase(), 1, 1, 1) < d) {
return(true);
}
return(false);
}
function getTextReply(sNode) {
if (sNode.firstChild.nodeName == null) {
return(sNode.toString());
}
var _local2 = [];
var _local1 = sNode.firstChild;
while (_local1 != null) {
_local2.push(_local1.firstChild.toString());
_local1 = _local1.nextSibling;
}
return(_local2[mRand(_local2.length)]);
}
function getReplyFromNode(sNode) {
reply = new Object();
reply.txt = [];
reply.vid = [];
var _local2 = sNode.firstChild.nextSibling;
while (_local2 != null) {
switch (_local2.nodeName.toString()) {
case "answer" :
reply.txt.push({words:getTextReply(_local2.firstChild), answertime:parseInt(_local2.attributes.answertime)});
break;
case "randomvid" :
r = [];
var _local1 = _local2.firstChild;
while (_local1 != null) {
r.push(_local1.firstChild.toString());
_local1 = _local1.nextSibling;
}
reply.vid.push(r[mRand(r.length)]);
break;
case "vid" :
reply.vid.push(_local2.firstChild.toString());
}
_local2 = _local2.nextSibling;
}
if (reply.vid == []) {
reply.vid = [getRandomVideo()];
reply.answertime = getAnswerTime(reply.vid);
}
var _local3 = 0;
while (_local3 < reply.txt.length) {
reply.txt[_local3].answertime;
_local3++;
}
return(reply);
}
function mRand(sMax) {
return(Math.floor(Math.random() * sMax));
}
function levdist(s1, s2, cost_ins, cost_rep, cost_del) {
var _local3;
var _local4;
var _local15;
var _local8;
var _local11;
var _local7;
var _local1;
var _local2;
var _local5;
var _local6;
_local15 = s1.length;
_local8 = s2.length;
_local3 = Array(_local15);
_local4 = Array(_local8);
if (_local15 == 0) {
return(_local8 * cost_ins);
}
if (_local8 == 0) {
return(_local15 * cost_del);
}
_local1 = 0;
while (_local1 <= _local8) {
_local3[_local1] = _local1 * cost_ins;
_local1++;
}
_local7 = 0;
while (_local7 < _local15) {
_local4[0] = _local3[0] + cost_del;
_local1 = 0;
while (_local1 < _local8) {
_local2 = _local3[_local1] + ((s1.charAt(_local7) == s2.charAt(_local1)) ? 0 : (cost_rep));
_local5 = _local3[_local1 + 1] + cost_del;
if (_local5 < _local2) {
_local2 = _local5;
}
_local6 = _local4[_local1] + cost_ins;
if (_local6 < _local2) {
_local2 = _local6;
}
_local4[_local1 + 1] = _local2;
_local1++;
}
_local11 = _local3;
_local3 = _local4;
_local4 = _local11;
_local7++;
}
_local2 = _local3[_local8];
return(_local2);
}
function getNonsenseReply() {
rand = [];
rand.push("Yeah... whatever...");
rand.push("Duh?");
rand.push("Exactly WHAT do you mean?");
rand.push("Yada yada yada...");
rand.push("You know, I'm quite busy here... OK?");
rand.push("Well, spank my butt and call me Daisy!");
return({vid:[], txt:[{answertime:2000, words:rand[mRand(rand.length)]}]});
}
function grabText(sNodeName) {
var _local1 = xml.firstChild.firstChild;
while (_local1 != null) {
if (_local1.nodeName.toString() == sNodeName) {
return(_local1.firstChild.toString());
}
_local1 = _local1.nextSibling;
}
return("error");
}
var restart;
var queue = new Array();
var textqueue = new Array();
var entar = new Object();
var keywords = new Array();
var currtime = getTimer();
var addtime = 0;
var replytime;
var clicked;
var lockon = false;
var reply;
var randomvids = ["idle1.flv", "idle2.flv", "idle3.flv", "idle4.flv"];
var nodeFinder = new Object();
myname = myname + " ";
_root.history.htmlText = "";
_root.hejsna.text = "";
entar.onKeyDown = function () {
if (Key.isDown(13)) {
processText();
}
};
Key.addListener(entar);
_root.chatButton.onRelease = function () {
processText();
};
var video_nc = new NetConnection();
video_nc.connect(null);
var video_ns = new NetStream(video_nc);
makeVideoArea("clip25_enter.flv");
textqueue.push({answertime:10000 + getTimer(), words:"Hello! Anybody there?"});
_root.onEnterFrame = function () {
if (nodeFinder.processing) {
findNode(nodeFinder);
if (!nodeFinder.processing) {
var _local2 = 0;
while (_local2 < nodeFinder.result.txt.length) {
textqueue.push(nodeFinder.result.txt[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < nodeFinder.result.vid.length) {
queue.push(nodeFinder.result.vid[_local2]);
_local2++;
}
if (queue.length) {
restart = true;
}
addtime = 0;
currtime = (-video_ns.time) * 1000;
}
}
if (restart) {
if (queue.length) {
makeVideoArea(queue[0]);
queue.splice(0, 1);
} else {
makeVideoArea(getRandomVideo());
}
restart = false;
}
var _local2 = 0;
while (_local2 < textqueue.length) {
if ((currtime + (video_ns.time * 1000)) >= textqueue[_local2].answertime) {
_root.history.htmlText = _root.history.htmlText + formatToChat("Elita ", textqueue[_local2].words);
_root.history.scroll = _root.history.maxscroll;
textqueue.splice(_local2, 1);
}
_local2++;
}
};
var xml = new XML();
xml.ignoreWhite = true;
xml.load(_global.MyAdd + "events.xml");
xml.onLoad = function (info) {
_root.header.htmlText = grabText("header");
_root.link1.htmlText = grabText("link1");
_root.link2.htmlText = grabText("link2");
_root.text1.htmlText = grabText("text1");
_root.text2.htmlText = grabText("text2");
_root.ElitaURL = grabText("ElitaURL");
_root.PokerURL = grabText("PokerURL");
};
Selection.setFocus("_root.hejsna");
Frame 3
stop();
Frame 4
function grabText(sNodeName) {
var _local1 = xml.firstChild.firstChild;
while (_local1 != null) {
if (_local1.nodeName.toString() == sNodeName) {
return(_local1.firstChild.toString());
}
_local1 = _local1.nextSibling;
}
return("error");
}
var xml = new XML();
xml.ignoreWhite = true;
xml.load(_global.MyAdd + "events.xml");
xml.onLoad = function (info) {
_root.header.htmlText = grabText("header");
_root.link1.htmlText = grabText("link1");
_root.link2.htmlText = grabText("link2");
_root.text1.htmlText = grabText("text1");
_root.text2.htmlText = grabText("text2");
_root.ElitaURL = grabText("ElitaURL");
_root.PokerURL = grabText("PokerURL");
};
Frame 9
stop();
Frame 10
stop();
Frame 11
stop();
Symbol 7 Button
on (release) {
play();
}
Symbol 16 Button
on (release) {
if (_root.lockon == false) {
_root.lock.play();
_root.lockon = true;
} else if (_root.lockon == true) {
_root.lock.gotoAndPlay("Fadeout");
_root.lockon = false;
}
}
Symbol 21 Button
on (release) {
gotoAndStop ("messenger");
}
Symbol 22 Button
on (release) {
gotoAndStop ("Tell a friend");
}
Symbol 23 Button
on (release) {
gotoAndStop ("News and Events");
}
Symbol 24 Button
on (release) {
gotoAndStop ("Elita fanclub");
}
Symbol 25 Button
on (release) {
gotoAndStop ("Play poker");
}
Symbol 30 MovieClip Frame 20
stop();
if (_root.lockon == false) {
play();
} else if (_root.lockon == true) {
stop();
}
Symbol 30 MovieClip Frame 100
stop();
Symbol 44 Button
on (release) {
getURL (_root.PokerURL);
}
Symbol 47 MovieClip Frame 1
function rel() {
send_lv.firstname = _root.firstname.text;
send_lv.lastname = _root.lastname.text;
send_lv.email = _root.email.text;
send_lv.sendAndLoad("register.php", res_lv, "POST");
}
var send_lv = new LoadVars();
var res_lv = new LoadVars();
var clicked = false;
res_lv.onLoad = function (success) {
if (success) {
clicked = false;
send_lv.fromname = "";
send_lv.from = "";
send_lv.to = "";
_root.play();
}
};
this.onPress = function () {
gotoAndStop (2);
};
this.onRelease = function () {
if (clicked == false) {
clicked = true;
rel();
}
gotoAndStop (1);
};
this.onReleaseOutside = function () {
if (clicked == false) {
clicked = true;
rel();
}
gotoAndStop (1);
};
stop();
Symbol 57 MovieClip Frame 1
function rel() {
send_lv.fromname = _root.fromname.text;
send_lv.from = _root.from.text;
send_lv.to = _root.to.text;
send_lv.sendAndLoad("sendmail.php", res_lv, "POST");
}
var send_lv = new LoadVars();
var res_lv = new LoadVars();
var clicked = false;
res_lv.onLoad = function (success) {
if (success) {
clicked = false;
send_lv.fromname = "";
send_lv.from = "";
send_lv.to = "";
_root.play();
}
};
this.onPress = function () {
gotoAndStop (2);
};
this.onRelease = function () {
if (clicked == false) {
clicked = true;
rel();
}
gotoAndStop (1);
};
this.onReleaseOutside = function () {
if (clicked == false) {
clicked = true;
rel();
}
gotoAndStop (1);
};
stop();