Tuesday, 6 May 2008

your trusted tradesmrn

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(1==1){ vh_mc.LoadMovie(0,showURL); }else{ useFlashLC("loadMovie", showURL+"~_level0"); } vh_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(1==1){ if(!vh_mc) return; vh_mc.LoadMovie(0,tempShowURL); }else{ useFlashLC("loadMovie", tempShowURL+"~_level0"); } vh_mc = null; curSpot = spot; } function domainOfPage() { domainName = document.location.hostname; if(domainName.length<=0) domainName = 'not_found'; return domainName; } var isOverlay = false; function AC_VHost_Embed_353331 (height, width, bgcolor, firstslide, loading, ss, sl, transparent, minimal, embedId, flashVersion, overlayStr) { flashVersion = 8; objWidth = width; objHeight = height; lc_name = '1210111628144'; embedId = embedId==''?'nothing':embedId; domString = '&pageDomain='+domainOfPage(); tokenString = '&token=0c4a4b6ac8e19a12124dcdecba31855f'; getShow = 'http%3A%2F%2Fvhost.oddcast.com%2Fgetshow.php%3Facc%3D353331'+escape('&ss='+ss+'&sl='+sl+'&embedid='+embedId+'&fs='+firstslide+domString+tokenString); url = 'http://vhost.oddcast.com/vhsssecure.php?doc='+getShow+'&edit=0&acc=353331&firstslide='+firstslide+'&loading='+loading+'&minimal='+minimal+'&bgcolor=0x'+bgcolor+domString+tokenString+'&lc_name='+lc_name+'&fv='+flashVersion+'&is_ie=1'; showURL = url; loading = 1; // done after request not to allow admin not to have a loader if (overlayStr && overlayStr != "_OVERLAYSTR_") {isOverlay = true;} 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', 'allowScriptAccess', 'always'); }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', 'allowScriptAccess', 'always', 'wmode','transparent'); } if (isOverlay) {initOverlay(overlayStr);} } function AC_VHost_Embed_353331_dbg (height, width, bgcolor, firstslide, loading, ss, sl, transparent, minimal, embedId, flashVersion, overlayStr) { flashVersion = 8; objWidth = width; objHeight = height; lc_name = '1210111628144'; embedId = embedId==''?'nothing':embedId; domString = '&pageDomain='+domainOfPage(); tokenString = '&token=0c4a4b6ac8e19a12124dcdecba31855f'; getShow = 'http%3A%2F%2Fvhost.oddcast.com%2Fgetshow_dbg.php%3Facc%3D353331'+escape('&ss='+ss+'&sl='+sl+'&embedid='+embedId+'&fs='+firstslide+domString+tokenString); url = 'http://vhost.oddcast.com/vhss_v3_dbg.swf?doc='+getShow+'&edit=0&acc=353331&firstslide='+firstslide+'&loading='+loading+'&minimal='+minimal+'&bgcolor=0x'+bgcolor+domString+tokenString+'&lc_name='+lc_name+'&fv='+flashVersion+'&is_ie=1'; showURL = url; loading = 1; // done after request not to allow admin not to have a loader if (overlayStr && overlayStr != "_OVERLAYSTR_") {isOverlay = true;} 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', 'allowScriptAccess', 'always'); }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', 'allowScriptAccess', 'always', 'wmode','transparent'); } if (isOverlay) {initOverlay(overlayStr);} } 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 = ' \n'); document.write('on error resume next \n'); document.write('Sub VHSS_FSCommand(ByVal command, ByVal args)\n'); document.write(' call VHSS_DoFSCommand(command, args)\n'); document.write('end sub\n'); document.write(' \n'); } function stopSpeech(){ if(!vh_mc) return; vh_mc.TCallLabel("/", "stopSpeech"); } function sayText(ttsText, voice, lang, engine, fx_type, fx_level){ if(!vh_mc) return; vh_mc.SetVariable("lang_js",lang); vh_mc.SetVariable("voice_js",voice); vh_mc.SetVariable("text_js",escape(ttsText)); vh_mc.SetVariable("engine_js",engine); vh_mc.SetVariable("fx_type_js", fx_type); vh_mc.SetVariable("fx_level_js", fx_level); vh_mc.TCallLabel("/", "sayText"); } function sayAIResponse(ttsText, voice, lang, engine, botid, fx_type, fx_level){ if(!vh_mc) return; vh_mc.SetVariable("botid_js", botid); vh_mc.SetVariable("lang_js",lang); vh_mc.SetVariable("voice_js",voice); vh_mc.SetVariable("text_js",escape(ttsText)); vh_mc.SetVariable("engine_js",engine); vh_mc.SetVariable("fx_type_js", fx_type); vh_mc.SetVariable("fx_level_js", fx_level); vh_mc.TCallLabel("/", "sayAIResponse"); } function sayAudio(audioName, stTime){ if(!vh_mc) return; vh_mc.SetVariable("startTime", stTime); vh_mc.SetVariable("audioName",audioName); vh_mc.TCallLabel("/", "sayByName"); } function loadText(ttsText, voice, lang, engine, fx_type, fx_level){ if(!vh_mc) return; vh_mc.SetVariable("lang_js",lang); vh_mc.SetVariable("voice_js",voice); vh_mc.SetVariable("text_js",escape(ttsText)); vh_mc.SetVariable("engine_js",engine); vh_mc.SetVariable("fx_type_js", fx_type); vh_mc.SetVariable("fx_level_js", fx_level); vh_mc.TCallLabel("/", "loadText"); } function loadAudio(audioName){ if(!vh_mc) return; vh_mc.SetVariable("sayMC.cacheIt", 1); sayAudio(audioName); } function loadShow(showIndex){ if(!vh_mc) return; vh_mc.SetVariable("api_showIndex", showIndex); vh_mc.TCallLabel("/", "loadShow"); } function loadScene(sceneIndex){ loadShow(sceneIndex); } function setBackground(bgName){ if(!vh_mc) return; vh_mc.SetVariable("bg_name_js", bgName); vh_mc.TCallLabel("/", "setBackground"); } function replay(_val){ if(!vh_mc) return; vh_mc.SetVariable("replayParam", _val); vh_mc.TCallLabel("/", "replay"); } function setInterruptMode(_mode){ if(!vh_mc) return; vh_mc.SetVariable("interruptMode", _mode); } function setStatus(interruptMode, audioProgress, lookSpeed, randomMvmt){ if (!vh_mc) return; vh_mc.setVariable("js_val1", interruptMode); vh_mc.setVariable("js_val2", audioProgress); vh_mc.setVariable("js_val3", lookSpeed); vh_mc.setVariable("js_val4", randomMvmt); vh_mc.TCallLabel("/", "setStatus"); } function saySilent(init_time){ if(!vh_mc) return; vh_mc.SetVariable("saySilent_time", init_time); vh_mc.TCallLabel("/", "saySilent"); } function setPlayerVolume(in_vol){ if(!vh_mc) return; vh_mc.SetVariable("ip_hostVol", in_vol); vh_mc.TCallLabel("/", "setPlayerVolume"); } function followCursor(newMouseMode){ if(!vh_mc) return; if (newMouseMode == 2) mousemoveCapture(); else mousemoveRelease(); vh_mc.SetVariable("followCursorBool",newMouseMode); vh_mc.TCallLabel("/", "followCursor"); } function recenter(){ if(!vh_mc) return; vh_mc.TCallLabel("/", "recenter"); } function setGaze(deg, dur, rad, pageReq){ if(!vh_mc) return; vh_mc.SetVariable("gazeDeg", deg); vh_mc.SetVariable("gazeDur", dur); vh_mc.SetVariable("gazeRad", rad); vh_mc.SetVariable("pageReq", pageReq); vh_mc.TCallLabel("/", "setLook"); } function freezeToggle(){ if(!vh_mc) return; vh_mc.TCallLabel("/", "freezeToggle"); } function setColor(part_js, clr_js){ if(!vh_mc) return; vh_mc.SetVariable("part_js", part_js); vh_mc.SetVariable("color_js", clr_js); vh_mc.TCallLabel("/", "setColor"); } // --- Embed Overlay api --- function overlayOpen(_min, _play){ if (window.showVhost != null){ if (_min == "min"){ minimizeVhost(); }else{ if (isMinimized) { maximizeVhost(_play); } else { showVhost(_play); } } } } function overlayClose(){ if (window.closeVhost != null) closeVhost(); } function overlayMaximize(_play){ //if (window.maximizeVhost != null) maximizeVhost(_play); } function overlayMinimize(){ if (window.minimizeVhost != null) minimizeVhost(); } // --- End Embed Overlay api --- function setLink(href, targetName){ if(!vh_mc) return; vh_mc.SetVariable("link_href",href); vh_mc.SetVariable("link_targ",targetName); vh_mc.TCallLabel("/", "setLink"); } function SetLink (href, targetName){ 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(); } function sayAIResponseExported(ttsText,voice,lang,engine,account){ if(!vh_mc) return; vh_mc.SetVariable("isExport", 1); vh_mc.SetVariable("acc", account); sayAIResponse(ttsText,voice,lang,engine); } function sayAudioExported(audioName, stTime, account){ if(!vh_mc) return; vh_mc.SetVariable("isExport", 1); vh_mc.SetVariable("acc", account); sayAudio(audioName, stTime); } function sayTextExported(ttsText,voice,lang,engine,account){ if(!vh_mc) return; vh_mc.SetVariable("isExport", 1); vh_mc.SetVariable("acc", account); sayText(ttsText,voice,lang,engine); } function sayTextEmo(ttsText,voice,lang,engine,emo){ if(!vh_mc) return; vh_mc.SetVariable("tts.emotion", emo); sayText(ttsText,voice,lang,engine); } function hostSleep(_state){ if(!vh_mc) return; vh_mc.SetVariable("sleepState", _state); vh_mc.TCallLabel("/", "sleep"); } 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; iobj.x && tempX<(obj.x+objWidth)) && (tempY>obj.y && tempY<(obj.y+objHeight))){ return true; } 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; setGaze(deg, 1, radius, 1); return true } function setNextSceneIndex(slideRange){ if(!vh_mc) return; vh_mc.SetVariable("in_slideNumber",slideRange); vh_mc.TCallLabel("/", "setNextSlide"); } function gotoScene(slideIndex){ if(!vh_mc) return; vh_mc.SetVariable("in_slideNumber",slideIndex); vh_mc.TCallLabel("/", "gotoSlide"); } function gotoNextScene (){ if(!vh_mc) return; vh_mc.TCallLabel("/", "nextSlide"); } function gotoPrevScene(){ if(!vh_mc) return; vh_mc.TCallLabel("/", "prevSlide"); } //embed overlay code var eo_width, eo_height, eo_vhostX, eo_vhostY, eo_horzRef, eo_vertRef, eo_scroll, eo_closeBtn, eo_drag, eo_minimize, eo_customThumb, eo_thumb, eo_thumbnail, eo_tooltip, eo_loadMin, eo_minimizeTo, eo_appear, eo_hide, eo_hideAfter, eo_contentWinWidth; var dv, dvHTML, re, positionVhostOn, dragObj, contentWidth, leftMarg, margOffset, showMargOffset, thumbWidth, thumbHeight, isMinimized; function getElementStyle(IEStyleProp, CSSStyleProp) { var elem = document.body; if (elem.currentStyle) { return elem.currentStyle[IEStyleProp]; } else if (window.getComputedStyle) { var compStyle = window.getComputedStyle(elem, ""); return compStyle.getPropertyValue(CSSStyleProp); } return ""; } function checkIt(string) { var place = navigator.userAgent.toLowerCase().indexOf(string) + 1; return place; } function initOverlay(overlayStr) { var cssMarg = parseInt(getElementStyle('marginLeft','margin-left')); var htmlMarg = parseInt(document.body.getAttribute('leftMargin')); if (isNaN(htmlMarg)) {htmlMarg = 0;} leftMarg = cssMarg + htmlMarg; if(checkIt('msie')) { margOffset = leftMarg/2; } else { margOffset = 0; } dv = document.getElementById('divVHSS'); dv.style.display = "none"; dv.style.position = "absolute"; dv.style.zIndex = 1000; dvHTML = dv.innerHTML; positionVhostOn = true; showMargOffset = true; isMinimized = false; var eo_properties = overlayStr.split("|"); eo_width = parseInt(eo_properties[0]); eo_height = parseInt(eo_properties[1]); eo_vhostX = parseInt(eo_properties[2]); eo_vhostY = parseInt(eo_properties[3]); eo_horzRef = eo_properties[4]; eo_vertRef = eo_properties[5]; if (eo_properties[6] == "false") eo_scroll = false; else eo_scroll = true; eo_drag = parseInt(eo_properties[7]); eo_closeBtn = parseInt(eo_properties[8]); eo_minimize = parseInt(eo_properties[9]); eo_customThumb = parseInt(eo_properties[10]); eo_thumb = unescape(eo_properties[11]); eo_tooltip = unescape(eo_properties[12]); eo_loadMin = parseInt(eo_properties[13]); eo_minimizeTo = eo_properties[14]; eo_appear = parseInt(eo_properties[15]); eo_hide = parseInt(eo_properties[16]); eo_hideAfter = parseInt(eo_properties[17]); eo_contentWinWidth = parseInt(eo_properties[18]); var tables = document.getElementsByTagName('table'); var divs = document.getElementsByTagName('div'); if(tables[0]) { contentWidth = parseInt(tables[0].offsetWidth); } else { contentWidth = parseInt(divs[0].offsetWidth); } eo_thumbnail = new Image(); eo_thumbnail.src = eo_thumb; if (eo_customThumb && eo_thumbnail.width != 0) { thumbWidth = eo_thumbnail.width; thumbHeight = eo_thumbnail.height; } else { thumbWidth = 50; thumbHeight = 50; } if (eo_drag) {createDrag();} if (eo_minimize) {createMinimize();} if (eo_closeBtn) {createClose();} positionVhost(); re = window.setInterval('positionVhost()', 10); if (eo_loadMin && eo_appear > -1) { minimizeVhost(); } else { if (eo_appear == -1) { dv.style.display = "none"; } else { dv.style.display = "block"; } } } function overlay_talkEnded_internal() { if (eo_hide) { if (eo_hide == 1) { window.setTimeout('dv.style.display = "none";', eo_hideAfter * 1000); } else if (eo_hide == 2) { if(!document.getElementById("maximize")) { var maximize = makeMaximize(); document.body.appendChild(maximize); } minimizeVhost(); } } } //positioning functions function getWinWidth() { if (self.innerWidth) { return self.innerWidth; } else if (document.documentElement.clientWidth) { return document.documentElement.clientWidth; } else { return document.body.clientWidth; } } function getWinHeight() { if (self.innerHeight) { return self.innerHeight; } else if (document.documentElement.clientHeight) { return document.documentElement.clientHeight; } else { return document.body.clientHeight; } } function detectScroll(dimension) { if (eo_scroll) return 0; var eo_scrollY, eo_scrollX; if (document.documentElement) { eo_scrollX = document.documentElement.scrollLeft + document.body.scrollLeft; eo_scrollY = document.documentElement.scrollTop + document.body.scrollTop; } if (window.scrollX) { eo_scrollX = window.scrollX; eo_scrollY = window.scrollY; } if (dimension == 'X') { return eo_scrollX; } else if (dimension == 'Y') { return eo_scrollY; } else { return 0; } } function positionVhost() { if(!showMargOffset) margOffset = 0; if(positionVhostOn) { switch (eo_horzRef) { case "C": if (eo_scroll) { if (parseInt(getWinWidth()) > contentWidth) { dv.style.left = (parseInt(getWinWidth())/2) + eo_vhostX + margOffset + "px"; } else { dv.style.left = (contentWidth/2) + eo_vhostX + margOffset + "px"; } } else { dv.style.left = (parseInt(getWinWidth())/2) + eo_vhostX + detectScroll('X') + margOffset + "px"; } break; case "R": dv.style.left = parseInt(getWinWidth()) + eo_vhostX + detectScroll('X') + "px"; break; default: // case "L" dv.style.left = eo_vhostX + detectScroll('X') + "px"; break; } switch (eo_vertRef) { case "B": if (isMinimized) { document.getElementById("maximize").style.top = parseInt(getWinHeight()) + eo_vhostY + detectScroll('Y') + "px"; break; } else { dv.style.top = parseInt(getWinHeight()) + eo_vhostY + detectScroll('Y') + "px"; break; } case "M": dv.style.top = (parseInt(getWinHeight())/2) + eo_vhostY + detectScroll('Y') + "px"; break; default: // case "T" if (isMinimized) { document.getElementById("maximize").style.top = eo_vhostY + detectScroll('Y') + "px"; break; } else { dv.style.top = eo_vhostY + detectScroll('Y') + "px"; break; } } } } function resetPosition(newX,newY) { var winWidth = parseInt(getWinWidth()); var winHeight = parseInt(getWinHeight()); switch (eo_horzRef) { case "C": eo_vhostX = newX - (winWidth/2); break; case "R": eo_vhostX = newX - winWidth; break; default: // case "L" eo_vhostX = newX; break; } switch (eo_vertRef) { case "B": eo_vhostY = newY - winHeight - detectScroll('Y'); break; case "M": eo_vhostY = newY - (winHeight/2) - detectScroll('Y'); break; default: // case "T" eo_vhostY = newY - detectScroll('Y'); break; } } //drag bar functions function createDrag() { dragObj = new Object(); dragObj.zIndex = 10; if(!document.getElementById("dragBar")) { var dragBar = makeDragBar(); dv.appendChild(dragBar); } else { var dragBar = document.getElementById("dragBar"); } dragBar.onmousedown = function (e) {dragStart(e,'divVHSS');} eo_vhostY = eo_vhostY + 21; } function createMinimize() { if(!document.getElementById("dragBar")) { var dragBar = makeDragBar(); dv.appendChild(dragBar); } else { var dragBar = document.getElementById("dragBar"); } var minimize = makeMinimize(); dragBar.appendChild(minimize); var maximize = makeMaximize(); document.body.appendChild(maximize); minimize.onclick = minimizeVhost; } function createClose() { if(!document.getElementById("dragBar")) { var dragBar = makeDragBar(); dv.appendChild(dragBar); } else { var dragBar = document.getElementById("dragBar"); } var closeBtn = makeCloseBtn(); dragBar.appendChild(closeBtn); closeBtn.onclick = closeVhost; } function makeDragBar() { var dragBar = document.createElement('div'); dragBar.id = "dragBar"; dragBar.style.position = "absolute"; dragBar.style.left = "0px"; dragBar.style.top = "-21px"; dragBar.style.height = "19px"; dragBar.style.width = eo_width - 2 + "px"; dragBar.style.zIndex = 1000; dragBar.style.padding = "0px"; dragBar.style.backgroundImage = "url(http://vhost.oddcast.com/admin/images/overlay_dragbar_back.gif)"; dragBar.style.backgroundRepeat = "repeat-x"; dragBar.style.borderTop = "1px solid #636363"; dragBar.style.borderLeft = "1px solid #636363"; dragBar.style.borderRight = "1px solid #212121"; dragBar.style.borderBottom = "1px solid #212121"; dragBar.style.cursor = "move"; dragBar.style.textAlign = "right"; return dragBar; } function makeCloseBtn() { var closeBtn = document.createElement('a'); closeBtn.innerHTML = ""; closeBtn.style.width = "18px"; closeBtn.style.height = "19px"; closeBtn.style.backgroundColor = "#3e3e3e"; closeBtn.style.cursor = "pointer"; return closeBtn; } function makeMinimize() { var minimize = document.createElement('a'); minimize.innerHTML = ""; minimize.style.width = "18px"; minimize.style.height = "19px"; minimize.style.backgroundColor = "#3e3e3e"; minimize.style.cursor = "pointer"; return minimize; } function makeMaximize() { var maximize = document.createElement('div'); maximize.id = "maximize"; maximize.innerHTML = ""; maximize.style.position = "absolute"; maximize.style.border = "1px solid black"; maximize.style.width = thumbWidth + "px"; maximize.style.height = thumbHeight + "px"; maximize.style.cursor = "pointer"; maximize.style.zIndex = 1000; maximize.style.display = "none"; maximize.style.overflow = "hidden"; return maximize; } function showVhost(play) { if(!isOverlay) return; if(isMinimized) return; dv.style.display = "block"; if(play == 0) { stopSpeech(); overlay_sceneLoaded_internal = function () { stopSpeech(); } } else if (play == 1) { replay(); overlay_sceneLoaded_internal = null; } else { overlay_sceneLoaded_internal = null; } } function closeVhost() { if(!isOverlay) return; stopSpeech(); dv.style.display = "none"; } function maximizeVhost(play) { if(!isOverlay) return; if(!isMinimized) return; if(!document.getElementById('maximize')) return; var maximize = document.getElementById('maximize'); if (eo_minimizeTo == "T") { var newX = parseInt(maximize.style.left, 10); var newY = parseInt(maximize.style.top, 10) + 21; } else { var newX = parseInt(maximize.style.left, 10) - (eo_width / 2) + (thumbWidth/2); var newY = parseInt(maximize.style.top, 10) - (eo_height / 2) + (thumbHeight/2) + 21; } if (newX < 0) {newX = 0;} if (newY < 21) {newY = 21;} resetPosition(newX,newY); dv.style.left = newX + "px"; dv.style.top = newY + "px"; maximize.style.display = "none"; dv.style.display = "block"; isMinimized = false; if(play == 0) { stopSpeech(); overlay_sceneLoaded_internal = function () { stopSpeech(); } } else if (play == 1) { replay(); overlay_sceneLoaded_internal = null; } else { overlay_sceneLoaded_internal = null; } } function minimizeVhost() { if(!isOverlay) return; if(isMinimized) return; if(!document.getElementById('maximize')) { var maximize = makeMaximize(); document.body.appendChild(maximize); } else { var maximize = document.getElementById('maximize'); } if (eo_minimizeTo == "T") { var newX = parseInt(dv.style.left, 10); var newY = parseInt(dv.style.top, 10) - 21; } else { var newX = parseInt(dv.style.left, 10) + (eo_width / 2) - (thumbWidth/2); var newY = parseInt(dv.style.top, 10) + (eo_height / 2) - (thumbHeight/2) - 21; } if (newX < 0) {newX = 0;} if (newY < 21) {newY = 21;} resetPosition(newX,newY); maximize.style.left = newX + "px"; maximize.style.top = newY + "px"; dv.style.display = "none"; maximize.style.display = "block"; maximize.onmousedown = function (e) {dragStart(e,'maximize');} maximize.ondblclick = function () {maximizeVhost();} isMinimized = true; stopSpeech(); } //drag functions var mouseX, mouseY; function getMousePos(e) { if(!e) e = window.event; if (e.srcElement) { mouseX = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft; mouseY = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop; } if (e.target) { mouseX = e.clientX + window.scrollX; mouseY = e.clientY + window.scrollY; } } function dragStart(e, id) { if(!e) e = window.event; positionVhostOn = false; showMargOffset = false; var el; if(!dragObj) dragObj = new Object(); // If an element id was given, find it. Otherwise use the element being clicked on. if (id) { dragObj.elNode = document.getElementById(id); } else { if (e.srcElement) {dragObj.elNode = window.event.srcElement;} if (e.target) {dragObj.elNode = event.target;} // If this is a text node, use its parent element. if (dragObj.elNode.nodeType == 3) {dragObj.elNode = dragObj.elNode.parentNode;} } // Get cursor position with respect to the page. getMousePos(e); // Save starting positions of cursor and element. dragObj.cursorStartX = mouseX; dragObj.cursorStartY = mouseY; dragObj.elStartLeft = parseInt(dragObj.elNode.style.left, 10); dragObj.elStartTop = parseInt(dragObj.elNode.style.top, 10); if (isNaN(dragObj.elStartLeft)) dragObj.elStartLeft = 0; if (isNaN(dragObj.elStartTop)) dragObj.elStartTop = 0; // Update element's z-index. dragObj.elNode.style.zIndex = ++dragObj.zIndex; // Capture mousemove and mouseup events on the page. if (e.srcElement) { document.attachEvent("onmousemove", dragGo); document.attachEvent("onmouseup", dragStop); window.event.cancelBubble = true; window.event.returnValue = false; } if (e.target) { document.addEventListener("mousemove", dragGo, true); document.addEventListener("mouseup", dragStop, true); e.preventDefault(); } } function dragGo(event) { // Get cursor position with respect to the page. getMousePos(event); // Move drag element by the same amount the cursor has moved. dragObj.elNode.style.left = (dragObj.elStartLeft + mouseX - dragObj.cursorStartX) + "px"; dragObj.elNode.style.top = (dragObj.elStartTop + mouseY - dragObj.cursorStartY) + "px"; dragObj.elNode.style.zIndex = 1000; if (event.srcElement) { window.event.cancelBubble = true; window.event.returnValue = false; } if (event.target) { event.preventDefault(); } } function dragStop(event) { // Stop capturing mousemove and mouseup events. if (event.srcElement) { document.detachEvent("onmousemove", dragGo); document.detachEvent("onmouseup", dragStop); } if (event.target) { document.removeEventListener("mousemove", dragGo, true); document.removeEventListener("mouseup", dragStop, true); } var newX = parseInt(dragObj.elNode.style.left, 10); var newY = parseInt(dragObj.elNode.style.top, 10); dragObj.elNode.style.zIndex = 1000; resetPosition(newX,newY); positionVhostOn = true;

No comments: