????
| Current Path : /home2/morganrand/backup.morganrand.com/0tools/images/ |
| Current File : /home2/morganrand/backup.morganrand.com/0tools/images/vhost_embed_functions.php.html |
var lc_name;
var showURL;
var objWidth;
var objHeight;
var curSpot=0;
function goToShow(showId, firstslide, forcePlayback){
var newRegExp = new RegExp("ss%3D[0-9]{1,}%","g");
showURL = showURL.replace(newRegExp,"ss%3D"+showId+"%");
var newRegExp = new RegExp("sl%3D[0-9]{1,}%","g");
showURL = showURL.replace(newRegExp,"sl%3D0%");
if(forcePlayback>0){
var newRegExp = new RegExp("3Facc%3D","g");
showURL = showURL.replace(newRegExp,"3FforcePlayback=1%26acc%3D");
}
if(firstslide>0){
var newRegExp = new RegExp("\&firstslide=[0-9]{1,}\&","g");
showURL = showURL.replace(newRegExp,"&firstslide="+firstslide+"&");
}
if(2==1){
mc.LoadMovie(0,showURL);
}else{
useFlashLC("loadMovie", showURL+"~_level0");
}
mc = null;
}
function goToWorkshop(spot){
document.onmousemove = null;
if(curSpot==spot){
return;
}
var newRegExp = new RegExp("ss%3D","g");
tempShowURL = showURL.replace(newRegExp,"sp%3D"+spot+"%26ss%3D");
var newRegExp = new RegExp("&acc=","g");
tempShowURL = tempShowURL.replace(newRegExp,"&stretch=1&acc=");
var newRegExp = new RegExp("getshow","g");
tempShowURL = tempShowURL.replace(newRegExp,"getworkshop");
if(2==1){
if(!mc) return;
mc.LoadMovie(0,tempShowURL);
}else{
useFlashLC("loadMovie", tempShowURL+"~_level0");
}
mc = null;
curSpot = spot;
}
function domainOfPage() {
domainName = document.location.hostname;
if(domainName.length<=0)
domainName = 'not_found';
return domainName;
}
function AC_VHost_Embed_15695 (height, width, bgcolor, firstslide, loading, ss, sl, transparent, minimal, embedId, flashVersion) {
flashVersion = flashVersion ? flashVersion : 6;
objWidth = width;
objHeight = height;
lc_name = '1156693077553885';
embedId = embedId==''?'nothing':embedId;
domString = '&pageDomain='+domainOfPage();
tokenString = '&token=6151e65f3ff676c81869dfda843d88e4';
getShow = 'http%3A%2F%2Fvhost.oddcast.com%2Fgetshow.php%3Facc%3D15695'+escape('&ss='+ss+'&sl='+sl+'&embedid='+embedId+'&fs='+firstslide);
url = 'http://vhost.oddcast.com/vhsssecure.php?doc='+getShow+'&edit=0&acc=15695&firstslide='+firstslide+'&loading='+loading+'&minimal='+minimal+'&bgcolor=0x'+bgcolor+domString+tokenString+'&lc_name='+lc_name+'&fv='+flashVersion+'&is_ie=0';
showURL = url;
loading = 1; // done after request not to allow admin not to have a loader
if (transparent != 1){
AC_RunFlContentX( 'height',height,'swliveconnect','true','src',url,'scale','noborder','id','VHSS','width',width,'bgcolor','#'+bgcolor,'quality','high','movie',url,'name','VHSS','codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+',0,0,0');
}else{
AC_RunFlContentX( 'height',height,'swliveconnect','true','src',url,'scale','noborder','id','VHSS','width',width,'bgcolor','#'+bgcolor,'quality','high','movie',url,'name','VHSS','codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+',0,0,0', 'wmode','transparent' );
}
}
function AC_VHost_Embed_15695_dbg (height, width, bgcolor, firstslide, loading, ss, sl, transparent, minimal, embedId, flashVersion) {
flashVersion = flashVersion ? flashVersion : 6;
objWidth = width;
objHeight = height;
lc_name = '1156693077553931';
embedId = embedId==''?'nothing':embedId;
domString = '&pageDomain='+domainOfPage();
tokenString = '&token=6151e65f3ff676c81869dfda843d88e4';
getShow = 'http%3A%2F%2Fvhost.oddcast.com%2Fgetshow_dbg.php%3Fdbg%3D1%26acc%3D15695'+escape('&ss='+ss+'&sl='+sl+'&embedid='+embedId+'&fs='+firstslide+domString+tokenString);
url = 'http://vhost.oddcast.com/vhsssecure_dbg.php?dbg=1&doc='+getShow+'&edit=0&acc=15695&firstslide='+firstslide+'&loading='+loading+'&minimal='+minimal+'&bgcolor=0x'+bgcolor+domString+tokenString+'&lc_name='+lc_name+'&fv='+flashVersion+'&is_ie=0';
showURL = url;
loading = 1; // done after request not to allow admin not to have a loader
if (transparent != 1){
AC_RunFlContentX( 'height',height,'swliveconnect','true','src',url,'scale','noborder','id','VHSS','width',width,'bgcolor','#'+bgcolor,'quality','high','movie',url,'name','VHSS','codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+',0,0,0');
}else{
AC_RunFlContentX( 'height',height,'swliveconnect','true','src',url,'scale','noborder','id','VHSS','width',width,'bgcolor','#'+bgcolor,'quality','high','movie',url,'name','VHSS','codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+',0,0,0', 'wmode','transparent' );
}
}
function AC_RunFlContentX(){
var codebase = AC_GetCodebase
( "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="
, "7,0,0,0", arguments
);
AC_GenerateObj
( "AC_RunFlContentX()", true, "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
, codebase
, "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
, "application/x-shockwave-flash", arguments
);
}
var MSG_EvenArgs = 'The %s function requires an even number of arguments.'
+ '\nArguments should be in the form "atttributeName","attributeValue",...';
var MSG_SrcRequired = "The %s function requires that a movie src be passed in as one of the arguments.";
function AC_GetCodebase(baseURL, defaultVersion, args){
var codebase = baseURL + defaultVersion;
for (var i=0; i < args.length; i=i+2) {
currArg = args[i].toLowerCase();
if (currArg == "codebase" && args.length > i+1) {
if (args[i+1].indexOf("http://") == 0) {
codebase = args[i+1];
}else{
codebase = baseURL + args[i+1];
}
}
}
return codebase;
}
function AC_sprintf(str){
for (var i=1; i < arguments.length; i++){
str = str.replace(/%s/,arguments[i]);
}
return str;
}
function AC_checkArgs(args,callingFn){
var retVal = true;
if (parseFloat(args.length/2) != parseInt(args.length/2)){
alert(sprintf(MSG_EvenArgs,callingFn));
retVal = false;
}
return retVal;
}
function AC_GenerateObj(callingFn, useXHTML, classid, codebase, pluginsPage, mimeType, args){
if (!AC_checkArgs(args,callingFn)){
return;
}
var tagStr = '';
var currArg = '';
var closer = (useXHTML) ? '/>' : '>';
var srcFound = false;
var embedStr = '<embed';
var paramStr = '';
var embedNameAttr = '';
var objStr = '<object classid="' + classid + '" codebase="' + codebase + '"';
for (var i=0; i < args.length; i=i+2){
currArg = args[i].toLowerCase();
if (currArg == "src"){
if (callingFn.indexOf("RunSW") != -1){
paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n';
embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
srcFound = true;
}else if (!srcFound){
paramStr += '<param name="movie" value="' + args[i+1] + '"' + closer + '\n';
embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
srcFound = true;
}
}else if (currArg == "movie"){
if (!srcFound){
paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n';
embedStr += ' src="' + args[i+1] + '"';
srcFound = true;
}
}else if ( currArg == "width"
|| currArg == "height"
|| currArg == "align"
|| currArg == "vspace"
|| currArg == "hspace"
|| currArg == "class"
|| currArg == "title"
|| currArg == "accesskey"
|| currArg == "tabindex"){
objStr += ' ' + args[i] + '="' + args[i+1] + '"';
embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
}else if (currArg == "id"){
objStr += ' ' + args[i] + '="' + args[i+1] + '"';
if (embedNameAttr == "")
embedNameAttr = ' name="' + args[i+1] + '"';
}else if (currArg == "name"){
objStr += ' ' + args[i] + '="' + args[i+1] + '"';
embedNameAttr = ' ' + args[i] + '="' + args[i+1] + '"';
}else if (currArg == "codebase"){
}else{
paramStr += '<param name="' + args[i] + '" value="' + args[i+1] + '"' + closer + '\n';
embedStr += ' ' + args[i] + '="' + args[i+1] + '"';
}
}
if (!srcFound){
alert(AC_sprintf(MSG_SrcRequired,callingFn));
return;
}
if (embedNameAttr)
embedStr += embedNameAttr;
if (pluginsPage)
embedStr += ' pluginspage="' + pluginsPage + '"';
if (mimeType)
embedStr += ' type="' + mimeType + '"';
objStr += '>\n';
embedStr += '></embed>\n';
tagStr = objStr + paramStr + embedStr + "</object>\n";
document.write(tagStr);
}
function VHSS_DoFSCommand(eventName, args) {
if (eventName == "onSlideBegin" || eventName == "sceneLoaded" || eventName == "vh_sceneLoaded") {
if (window.vh_sceneLoaded != null){
vh_sceneLoaded(args);
}
}
else if (eventName=="hostLoaded" || eventName=="vh_hostLoaded") {
if (window.vh_hostLoaded != null) vh_hostLoaded();
}
else if (eventName=="talkStarted" || eventName=="vh_talkStarted") {
if (window.vh_talkStarted != null) vh_talkStarted();
}
else if (eventName=="talkEnded" || eventName=="vh_talkEnded") {
if (window.vh_talkEnded != null) vh_talkEnded();
}
else if (eventName=="audioLoaded" || eventName=="vh_audioLoaded"){
if (window.vh_audioLoaded != null) vh_audioLoaded(args);
}
else if (eventName == "ttsLoaded" || eventName == "vh_ttsLoaded"){
if (window.vh_ttsLoaded != null) vh_ttsLoaded(args);
}
else if (eventName=="aiResponse" || eventName=="vh_aiResponse"){
if (window.vh_aiResponse != null) vh_aiResponse(unescape(args));
}
else if (eventName == "audioProgress" || eventName == "vh_audioProgress"){
if (window.vh_audioProgress !=null) vh_audioProgress(args);
}
}
// --- End VHSS player events ---
function setStatus(interruptMode, audioProgress){
useFlashLC("setStatus", interruptMode+"~"+audioProgress);
}
// --- Speech Functions ---
function sayText(ttsText,voice,lang,engine){
useFlashLC("sayText", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine+"~js");
}
function sayAIResponse(ttsText,voice,lang,engine,botid){
useFlashLC("sayAIResponse", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine+"~"+botid);
}
function sayAudio(audioName, stTime){
useFlashLC("sayAudio", audioName+"~"+stTime);
}
function loadText(ttsText,voice,lang,engine){
useFlashLC("loadText", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine);
}
function loadAudio(audioName){
useFlashLC("loadAudio", audioName);
}
function loadShow(showIndex){
useFlashLC("loadShow", showIndex);
}
function loadScene(sceneIndex){
loadShow(sceneIndex);
}
function setInterruptMode(_mode){
useFlashLC("setInterruptMode", _mode);
}
function replay(_val){
useFlashLC("replay", _val);
}
function stopSpeech(){
useFlashLC("stopSpeech");
}
function saySilent(init_time){
useFlashLC("saySilent", init_time);
}
function setPlayerVolume(in_vol){
useFlashLC("setPlayerVolume", in_vol);
}
// --- End Speech Functions ---
// --- Look Functions ---
function followCursor(newMouseMode){
if (newMouseMode == 1)
mousemoveCapture();
else
mousemoveRelease();
useFlashLC("followCursor", newMouseMode+"~");
}
function recenter(){
useFlashLC("recenter");
}
function setGaze(deg, dur, rad, pageReq){
useFlashLC("setGaze", deg+"~"+dur+"~"+rad+"~"+pageReq);
}
function freezeToggle(){
useFlashLC("freezeToggle");
}
// --- End Look Functions ---
// --- Host Appearance Functions ---
function setColor(part, clr){
useFlashLC("setColor", part+"~"+clr);
}
// --- End Host Appearance Functions ---
// --- Slide Functions ---
/*
*deprecated
*/
function SetLink(href, targetName){
setLink(href, targetName);
}
function SetTarget(targetName){
useFlashLC("SetTarget", targetName);
}
/*
*deprecated
*/
function setLink(href, targetName){
useFlashLC("setLink", href+"~"+targetName);
}
function showTranscript(acc_id,ss_id,audioID,slidenum){
transWindow = window.open( "http://vhss.oddcast.com/transcript_frame.php?acc="+acc_id+"&ss="+ss_id+"&au="+audioID+"&sn="+slidenum,"transWindow","width=500,height=500,toolbar=no,resizable=no");
transWindow.focus();
}
// --- End Slide Functions ---
// --- Local connection queue and functions ---
var lc_busy = 0;
var lcQueue = new Array();
function vhss_lc_DoFSCommand(command, args) {
lcLoaded();
}
function lcLoaded(){
lc_busy =0;
checkQueue();
}
function useFlashLC(meth, args){
lcQueue[lcQueue.length]=meth;
lcQueue[lcQueue.length]=args;
checkQueue();
}
function checkQueue(){
if (lc_busy || lcQueue.length == 0) return;
var lc_temp1 = lcQueue[0];
var lc_temp2 = lcQueue[1];
var t_ar = new Array();
for (var act = 2; act<lcQueue.length; ++act){
t_ar[act-2] = lcQueue[act];
}
lcQueue = t_ar;
loadFromQueue(lc_temp1, lc_temp2);
}
function loadFromQueue(meth, args){
lc_busy = 1;
var divcontainer = "lc";
if(!document.getElementById(divcontainer)){
var divholder = document.createElement("DIV");
divholder.id = divcontainer;
document.body.appendChild(divholder);
}
document.getElementById(divcontainer).innerHTML = "";
var divinfo = "<embed src='http://vhost.oddcast.com/vhss_lc.swf' FlashVars='lc_name="+lc_name+"&methodNm="+meth+"&args="+escape(args)+"' width='0' height='0' type='application/x-shockwave-flash'></embed>";
document.getElementById(divcontainer).innerHTML = divinfo;
}
// --- End Local connection queue and functions ---
// --- hidden and in development functions ---
function sayAIResponseExported(ttsText,voice,lang,engine,account){
useFlashLC("sayAIResponseExported", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine+"~"+account);
}
function sayAudioExported(audioName, stTime, account){
useFlashLC("sayAudioExported", audioName+"~"+stTime+"~"+account);
}
function sayTextExported(ttsText,voice,lang,engine,account){
useFlashLC("sayTextExported", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine+"~"+account);
}
function sayTextEmo(ttsText,voice,lang,engine,emo){
useFlashLC("sayTextEmo", escape(ttsText)+"~"+voice+"~"+lang+"~"+engine+"~"+emo);
}
function hostSleep(_state){
useFlashLC("hostSleep", _state);
}
function getAnchorPosition(anchorname) {
var useWindow=false;
var coordinates=new Object();
var x=0,y=0;
var use_gebi=false, use_css=false, use_layers=false;
if (document.getElementById) { use_gebi=true; }
else if (document.all) { use_css=true; }
else if (document.layers) { use_layers=true; }
if (use_gebi && document.all) {
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
}
else if (use_gebi) {
var o=document.getElementById(anchorname);
x=AnchorPosition_getPageOffsetLeft(o);
y=AnchorPosition_getPageOffsetTop(o);
}
else if (use_css) {
x=AnchorPosition_getPageOffsetLeft(document.all[anchorname]);
y=AnchorPosition_getPageOffsetTop(document.all[anchorname]);
}
else if (use_layers) {
var found=0;
for (var i=0; i<document.anchors.length; i++) {
if (document.anchors[i].name==anchorname) { found=1; break; }
}
if (found==0) {
coordinates.x=0; coordinates.y=0; return coordinates;
}
x=document.anchors[i].x;
y=document.anchors[i].y;
}
else {
coordinates.x=0; coordinates.y=0; return coordinates;
}
coordinates.x=x;
coordinates.y=y;
return coordinates;
}
function AnchorPosition_getPageOffsetLeft (el) {
var ol=el.offsetLeft;
while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
return ol;
}
function AnchorPosition_getPageOffsetTop (el) {
var ot=el.offsetTop;
while((el=el.offsetParent) != null) { ot += el.offsetTop; }
return ot;
}
function mousemoveCapture() {
document.captureEvents(Event.MOUSEMOVE)
if (document.onmousemove == null) document.onmousemove = updateMousePosition;
}
function mousemoveRelease() {
document.releaseEvents(Event.MOUSEMOVE)
document.onmousemove = null;
}
var tempX = 0;
var tempY = 0;
var milSeconds = 200;
var lastCallTime = getMicroTime();
function getMicroTime(){
var d = new Date();
return d.getTime();
}
function updateMousePosition(e) {
tempX = e.pageX;
tempY = e.pageY;
if (tempX < 0){tempX = 0}
if (tempY < 0){tempY = 0}
obj = getAnchorPosition('VHSS');
hostX = obj.x + objWidth/2;
hostY = obj.y - objHeight/2;
w = tempX - hostX;
h = tempY - hostY;
radius = Math.sqrt(w*w + h*h);
deg = Math.atan(w/h)/0.017453293;
if(w>=0&&h<=0){
deg = Math.abs(deg);
}else if(w>=0&&h>0){
deg = 180 - deg;
}else if(w<0&&h>0){
deg = Math.abs(deg)+180;
}else if(w<0&&h<=0){
deg = 360 - deg;
}
if(radius>100) radius = 100;
if((getMicroTime()-lastCallTime)>milSeconds){
setGaze(deg, 1, radius, 1);
lastCallTime = getMicroTime();
}
return true
}
mousemoveCapture();
function setNextSceneIndex(sceneRange){
useFlashLC("setNextSceneIndex", sceneRange);
}
function gotoScene(sceneIndex){
useFlashLC("gotoScene", sceneIndex);
}
function gotoNextScene (){
useFlashLC("gotoNextScene");
}
function gotoPrevScene(){
useFlashLC("gotoPrevScene");
}