// Constants var WIDGET_WIDTH = 660; var CHAT_WIDTH_MIN = 290; var CHAT_WIDTH_MAX = 310; var WIDGET_PADDING = 10; var HEADER_HEIGHT = 60; var HEADER_HEIGHT_MINI = 40; var FLASH_HEIGHT = 490; // Variables var swFullScreen = false; var newspaperMode = false; var widgetMode = false; var iFrameMode = false; var showWidgetChat = false; var widgetFrameParameters = {}; var musicFrameParameters = {}; var widgetBackgroundMaxWidth = 0; // Window Event methods // -------------------------------------------- function windowOpen() { // exit fullscreen mode in certain cases url = window.location.href; if (isInEmbedMode() || (url.indexOf("/home") == -1 && url.indexOf("/space") == -1)) { //exitFullscreen(); } else { //enterFullscreen(); } // backwards compatibility with old-style urls var url = window.location.href; if(url.indexOf("#/home") >= 0) { var oldStyle = url.substr(url.lastIndexOf("#/home") + 1); window.location = "http://www.smallworlds.com" + oldStyle; } if(url.indexOf("#/space") >= 0) { var oldStyle = url.substr(url.lastIndexOf("#/space") + 1); window.location = "http://www.smallworlds.com" + oldStyle; } } function windowClose() { var flashObject = document.getElementById("Main"); if (flashObject && flashObject.windowClose) { flashObject.windowClose(); } } function windowResize() { if (swFullScreen && !isInEmbedMode() && !newspaperMode) enterFullscreen(); // keep full swf side else if (widgetMode) { showHideWidgetChat(); if (iFrameMode) { resizeIFrame(); resizeMusicIFrame(); resizeHeaderHeight(); } } else if (newspaperMode) { resizeHeaderHeight(); } } function removeFlashBorders() { var theObjects = document.getElementsByTagName("object"); for (var i = 0; i < theObjects.length; i++) { theObjects[i].outerHTML = theObjects[i].outerHTML; } } // Sizing methods // -------------------------------------------- /** Switch header height depending on window size. **/ function resizeHeaderHeight() { // only shrink header when smallworlds is embedded if ("" != "true") return; // in-world header id is different from index page header id if (iFrameMode) { var headerContent = document.getElementById("widgetheadercontent"); var widgetContent = document.getElementById("widgetcontent"); } else if (newspaperMode) { var headerContent = document.getElementById("widgetheadercontent"); var closeButton = document.getElementById("closebutton"); } else var headerContent = document.getElementById("headercontent"); if (headerContent == null) return; // shrink if viewing window is less than 660 pixels if (document.documentElement.clientHeight < 660) { headerContent.style.height = HEADER_HEIGHT_MINI + "px"; if (widgetContent != null) widgetContent.style.top = "40px"; if (closeButton != null) closeButton.style.top = "50px"; } else { headerContent.style.height = HEADER_HEIGHT + "px"; if (widgetContent != null) widgetContent.style.top = "60px"; if (closeButton != null) closeButton.style.top = "70px"; } } /** Switch client into fullscreen mode. **/ function enterFullscreen() { // if client is embedded, pop out to fullscreen instead if (isInEmbedMode()) return; // adjust site layout var firefoxBar = document.getElementById("firefoxbar"); var bottomContent = document.getElementById("bottomcontent"); var pageHeight = document.body.clientHeight; if (firefoxBar == null || bottomContent == null) return; // enable bottom gap in FireFox (fix for tab bar website height issue) var firefoxFix = usingFirefox() && !isInEmbedMode(); if (firefoxFix) firefoxBar.style.display = "block"; else firefoxBar.style.display = "none"; // only disable the webcontent if smallworlds is standalone (ie. not embedded) if (!isInEmbedMode()) bottomContent.style.display = "none"; // size the client if (firefoxFix && pageHeight > FLASH_HEIGHT + HEADER_HEIGHT) { newSwfHeight = (pageHeight - 25) + "px"; newDivHeight = (pageHeight - 25) + "px"; } else if (pageHeight <= FLASH_HEIGHT + HEADER_HEIGHT) { newSwfHeight = FLASH_HEIGHT + HEADER_HEIGHT + "px"; newDivHeight = "100%"; } else { newSwfHeight = "100%"; newDivHeight = "100%"; } // set a timeout on the resize, Chrome doesn't like changing dimentions right away setTimeout("resizeClient('"+newSwfHeight+"', '"+newDivHeight+"')", 100); swFullScreen = true; } /** Embed mode functionality for fullscreen mode (pop out to new window). **/ function enterFullscreenEmbedMode() { if (!isInEmbedMode()) return; // pop out to new window removing embed-related querystrings var url = window.location.href.toString(); url = url.replace(/webcontent=false/ig, ""); url = url.replace(/embed=true/ig, ""); openURL(url, "_blank"); } /** Switch client out of fullscreen mode (filling the remaining space with bottomcontent). **/ function exitFullscreen() { // adjust site layout var firefoxBar = document.getElementById("firefoxbar"); var bottomContent = document.getElementById("bottomcontent"); // size to preset non-fullscreen height newHeight = FLASH_HEIGHT + HEADER_HEIGHT + "px"; // set a timeout on the resize, Chrome doesn't like changing dimentions right away setTimeout("resizeClient('"+newHeight+"', '"+newHeight+"')", 100); if (firefoxBar != null) firefoxBar.style.display = "none"; // enable bottom web content if allowed if (!disableBottomContent() && bottomContent != null) bottomContent.style.display = "block"; swFullScreen = false; } /** Specialised method to resize the client (called by timeouts). **/ function resizeClient(newSwfHeight, newDivHeight) { var main = document.getElementById("Main"); var swContent = document.getElementById("swcontent"); if (main == null || swContent == null) return; main.style.height = newSwfHeight; swContent.style.height = newDivHeight; } // Login methods // -------------------------------------------- /** Login from Header SWF. **/ function flashLogin(destination) { showFlash("loggedIn", true, destination); } /** Redirect to destination after login. **/ function showFlash(newLoadState, tellFlash, destination) { // check for destination if (destination == "") destination = "home/rajeshpatkar/"; // redirect there or to index if (tellFlash) { if (destination) window.location = appendQuerystrings("http://www.smallworlds.com" + "/" + destination ), "_self"; else window.location = appendQuerystrings("http://www.smallworlds.com" ), "_self"; } } // Logout methods // -------------------------------------------- /** Logout from Header SWF. **/ function logoutLinkClick(destination) { showLogin(destination); } /** Logout via session expiry in client. **/ function sessionExpired(destination) { if(window.location.href.indexOf(destination) == -1) { showLogin(destination); } } /** Redirect to destination after logout. **/ function showLogin(destination) { // preserve necessary querystrings var newLocation = appendQuerystrings( 'http://www.smallworlds.com/' + destination ); // redirect to destination window.location = newLocation, '_self'; } // In-world content swap methods // -------------------------------------------- /** Switch to in-world newspaper. **/ function enterNewspaper() { enterContent(""); } /** Switch to in-world payment system. **/ function enterPayment(params) { enterContent("http://www.smallworlds.com/payment/package-list.html" + params); } /** Switch to in-world payment system. **/ function enterPaymentURL(url) { enterContent(url); } /** Switch to in-world content. **/ function enterContent(url) { var main = document.getElementById('Main'); var widgetHeaderContent = document.getElementById("widgetheadercontent"); var swContent = document.getElementById('swcontent'); var inWorldNewspaper = document.getElementById('inworldnewspaper'); var newspaperFrame = document.getElementById('newspaperframe'); var IFrameConnector = document.getElementById('IFrameConnector'); var firefoxBar = document.getElementById('firefoxbar'); var bottomContent = document.getElementById('bottomcontent'); // hide client and show header-only view main.style.height = "0px"; swContent.style.height = "0px"; swContent.style.minHeight = "0px"; widgetHeaderContent.style.display = "block"; setTimeout("showHeader()", 100); // set a timeout on the show, Chrome doesn't like creating swfs right away setTimeout("enterRestrictedWidth()", 500); // show content iframe newspaperFrame.src = url; inWorldNewspaper.style.display = 'block'; // hide things we don't want if (firefoxBar != null) firefoxBar.style.display = 'none'; if (bottomContent != null) bottomContent.style.display = 'none'; // now in in-world content mode newspaperMode = true; } /** Switch header into restricted width mode. **/ function enterRestrictedWidth() { var base = document.getElementById('Base'); base.enterRestrictedWidth() } /** Switch from in-world content back to in-world. **/ var inworldAvatarChanged = false; function exitNewspaper() { if (inworldAvatarChanged) { // avatar was changed in newspaper content, display reload confirmation openLightbox(); } else { var widgetHeaderContent = document.getElementById("widgetheadercontent"); var inWorldNewspaper = document.getElementById('inworldnewspaper'); var newspaperFrame = document.getElementById('newspaperframe'); var IFrameConnector = document.getElementById('IFrameConnector'); // hide in-world content newspaperFrame.src = ""; inWorldNewspaper.style.display = 'none'; // hide single header widgetHeaderContent.style.display = 'none'; widgetHeaderContent.innerHTML = '
'; // resize client according to fullscreen preference if (swFullScreen) enterFullscreen(); else exitFullscreen(); // left in-world content mode newspaperMode = false; } } function closePaymentPages() { // If we are in-world mode close iframe if(newspaperMode) exitNewspaper(); else window.location = appendQuerystrings("http://www.smallworlds.com" ), "_self"; } /** Event callback from newspaper avatar selector to inform on avatar change. **/ function onAvatarSelect(avatarId, avatarName, petId, petActive, isInitialAvatar) { try { if (window.parent.newspaperMode) { window.parent.inworldAvatarChanged = !isInitialAvatar; } } catch (e) { // catch possible permission error, which means out-of-world newspaper embedded // don't need to do anything } } /** Event callback from newspaper avatar selector to inform on avatar change. * True if the avatar has changed * False if the user has switched back to their original selection **/ function selectedAvatarChanged(value) { if (newspaperMode) inworldAvatarChanged = value; } // Lightbox methods // -------------------------------------------- /** Open confirmation box if avatar changed in in-world newspaper. **/ function openLightbox() { var lb_background = document.getElementById('lb_background'); var lb_window = document.getElementById('lb_window'); // show lightbox lb_background.style.display = 'block'; lb_window.style.display = 'block'; lb_window.style.left = (document.body.clientWidth / 2) - (lb_window.clientWidth / 2) + 'px'; } /** Handle decision from user on confirmation box. **/ function closeLightbox(result) { var lb_background = document.getElementById('lb_background'); var lb_window = document.getElementById('lb_window'); // remove lightbox lb_background.style.display = 'none'; lb_window.style.display = 'none'; // reload page if clicked yes if (result) window.location.reload(); } /** Open warning box if cookies are disabled in a user's browser. **/ function openCookieLightbox() { var lb_window = document.getElementById('lb_window_cookies'); // show lightbox lb_window.style.display = 'block'; lb_window.style.left = (document.body.clientWidth / 2) - (lb_window.clientWidth / 2) + 'px'; } /** Handle decision from user on cookie warning box. **/ function closeCookieLightbox() { var lb_window = document.getElementById('lb_window_cookies'); // remove lightbox lb_window.style.display = 'none'; } // Bottom Content methods // -------------------------------------------- /** Change content in bottomcontent area according to parameters specified. * Changes via recreating the iframe element to avoid Firefox navigation problems. **/ function updateBottomContent(layout, area, state) { var wrapper = document.getElementById('wrapper'); var bottomContentIFrame = document.getElementById('bottomcontentiframe'); if (wrapper != null && bottomContentIFrame != null) wrapper.removeChild(bottomContentIFrame); var newBottomContentIFrame = document.createElement("iframe"); newBottomContentIFrame.id = "bottomcontentiframe"; newBottomContentIFrame.width = "100%"; newBottomContentIFrame.height = "250"; newBottomContentIFrame.setAttribute("frameborder", "0"); newBottomContentIFrame.setAttribute("marginheight", "0"); newBottomContentIFrame.setAttribute("marginwidth", "0"); newBottomContentIFrame.scrolling = "no"; wrapper.appendChild(newBottomContentIFrame); newBottomContentIFrame.src = "http://www.smallworlds.com/bottomcontent/bottomcontent_" + layout + ".php?area=" + area + "&state=" + state; } // Widget mode methods // -------------------------------------------- /* Open widget mode (with valid url for iframe if desired). */ function openWidget(url, parameters) { // entered widget mode widgetMode = true; // check if we need to display chat underneath widget showHideWidgetChat(); // if url is set, open iframe with that destination if (url != null) openIFrame(url, parameters); } /* Open special iframe widget mode for iMeem music player. */ function openMusicWidget(url, parameters) { // entered widget mode widgetMode = true; // check if we need to display chat underneath widget showHideWidgetChat(); // if url is set, open iframe with that destination if (url != null) openMusicIFrame(url, parameters); } function openIFrame(url, parameters) { if (!widgetMode || url == null) return; var widgetHeaderContent = document.getElementById("widgetheadercontent"); var widgetContent = document.getElementById("widgetcontent"); var widgetFrame = document.getElementById("widgetframe"); // apply the parameters as the styles of the iframe if (parameters != null) { widgetFrameParameters = parameters; for (var key in widgetFrameParameters) { try { widgetFrame.style[key] = parameters[key]; } catch(error) { } } } // set the layout to show the widget iframe widgetHeaderContent.style.display = "block"; setTimeout("showHeader()", 100); // set a timeout on the show, Chrome doesn't like creating swfs right away setTimeout("resizeIFrame()", 100); // set timeouts on resizing as well, Opera has timing issues due to the above timeout setTimeout("resizeHeaderHeight()", 100); widgetContent.style.display = "block"; widgetFrame.src = url; // entered iframe mode iFrameMode = true; } function openMusicIFrame(url, parameters) { if (!widgetMode || url == null) return; var widgetHeaderContent = document.getElementById('widgetheadercontent'); var musicContent = document.getElementById('musiccontent'); var musicFrame = document.getElementById('musicframe'); // apply the parameters as the styles of the game iframe if (parameters != null) { musicFrameParameters = parameters; for (var key in musicFrameParameters) { try { musicFrame.style[key] = parameters[key]; } catch(error) { } } } // set the layout to show the music iframe widgetHeaderContent.style.display = 'block'; setTimeout("showHeader()", 100); // set a timeout on the show, Chrome doesn't like creating swfs right away setTimeout("resizeMusicIFrame()", 100); // set timeouts on resizing as well, Opera has timing issues due to the above timeout musicContent.style.display = 'block'; musicContent.style.visibility = 'visible'; musicFrame.style.visibility = 'visible'; musicContent.style.left = '0px'; musicContent.style.width = '660px'; musicContent.style.height = '490px'; musicFrame.style.width = '660px'; musicFrame.style.height = '490px'; // entered iframe mode iFrameMode = true; } function resizeIFrame() { if (!widgetMode) return; var swContent = document.getElementById("swcontent"); var main = document.getElementById("Main"); var widgetContent = document.getElementById("widgetcontent"); var leftTexture = document.getElementById("lefttexture"); // size and position things correctly swContent.style.height = FLASH_HEIGHT + "px"; main.style.height = FLASH_HEIGHT + "px"; if (showWidgetChat) { var paddingWidth = Math.floor((swContent.clientWidth - WIDGET_WIDTH) / 2); main.style.width = Math.max(0, paddingWidth) + 'px'; var widgetContentWidth = swContent.clientWidth - paddingWidth; widgetContent.style.width = Math.max(0, widgetContentWidth) + 'px'; leftTexture.style.width = Math.max(0, Math.min(widgetContentWidth - WIDGET_WIDTH, widgetBackgroundMaxWidth)) + 'px'; } else { var paddingTotal = swContent.clientWidth - (WIDGET_WIDTH + CHAT_WIDTH_MIN + WIDGET_PADDING); var mainWidth = Math.min(paddingTotal + CHAT_WIDTH_MIN, CHAT_WIDTH_MAX); var paddingRemaining = paddingTotal + CHAT_WIDTH_MIN - mainWidth; mainWidth = Math.floor(mainWidth + paddingRemaining / 2); main.style.width = mainWidth + 'px'; var widgetContentWidth = swContent.clientWidth - mainWidth; widgetContent.style.width = widgetContentWidth + 'px'; leftTexture.style.width = Math.min(widgetContentWidth - WIDGET_WIDTH, widgetBackgroundMaxWidth) + 'px'; } } function resizeMusicIFrame() { if (!widgetMode) return; var swContent = document.getElementById("swcontent"); var main = document.getElementById("Main"); var musicContent = document.getElementById("musiccontent"); var leftMusicTexture = document.getElementById("leftmusictexture"); // size and position things correctly swContent.style.height = FLASH_HEIGHT + "px"; main.style.height = FLASH_HEIGHT + "px"; if (showWidgetChat) { var paddingWidth = Math.floor((swContent.clientWidth - WIDGET_WIDTH) / 2); main.style.width = Math.max(0, paddingWidth) + 'px'; var musicContentWidth = swContent.clientWidth - paddingWidth; musicContent.style.width = Math.max(0, musicContentWidth) + 'px'; leftMusicTexture.style.width = Math.max(0, Math.min(musicContentWidth - WIDGET_WIDTH, widgetBackgroundMaxWidth)) + 'px'; } else { var paddingTotal = swContent.clientWidth - (WIDGET_WIDTH + CHAT_WIDTH_MIN + WIDGET_PADDING); var mainWidth = Math.min(paddingTotal + CHAT_WIDTH_MIN, CHAT_WIDTH_MAX); var paddingRemaining = paddingTotal + CHAT_WIDTH_MIN - mainWidth; mainWidth = Math.floor(mainWidth + paddingRemaining / 2); main.style.width = mainWidth + 'px'; var musicContentWidth = swContent.clientWidth - mainWidth; musicContent.style.width = musicContentWidth + 'px'; leftMusicTexture.style.width = Math.min(musicContentWidth - WIDGET_WIDTH, widgetBackgroundMaxWidth) + 'px'; } } /* Close the widget mode. */ function closeWidget() { // resize client according to fullscreen preference if (swFullScreen) enterFullscreen(); else exitFullscreen(); // hide widget chat mode if necessary hideWidgetChat(); // close the iframe too if necessary closeIFrame(); // left widget mode widgetMode = false; } /* Close the widget iframe, remaining in widget mode. */ function closeIFrame(optionalParameters) { if (!widgetMode || !iFrameMode) return; var widgetHeaderContent = document.getElementById('widgetheadercontent'); var swContent = document.getElementById("swcontent"); var main = document.getElementById('Main'); var widgetContent = document.getElementById('widgetcontent'); var widgetFrame = document.getElementById('widgetframe'); var musicContent = document.getElementById('musiccontent'); var musicFrame = document.getElementById('musicframe'); // remove the parameters as the styles of the iframe if (widgetFrameParameters != null) { for (var key in widgetFrameParameters) { try { widgetFrame.style[key] = ''; } catch(error) { } } } // set the layout to hide the widget iframes widgetHeaderContent.style.display = 'none'; widgetHeaderContent.innerHTML = '
'; widgetContent.style.display = 'none'; musicContent.style.visibility = 'hidden'; musicFrame.style.visibility = 'hidden'; musicContent.style.left = '-50000px'; musicContent.style.width = '1px'; musicContent.style.height = '0px'; musicFrame.style.width = '1px'; musicFrame.style.height = '0px'; // resize and notify client main.style.width = '100%'; main.style.height = FLASH_HEIGHT + HEADER_HEIGHT + "px"; swContent.style.height = FLASH_HEIGHT + HEADER_HEIGHT + "px"; main.iframeClose(optionalParameters); // Unload the url widgetFrame.src = null; // left iframe mode iFrameMode = false; } function showHideWidgetChat() { if (!widgetMode) return; var main = document.getElementById("Main"); var swContent = document.getElementById("swcontent"); var squeakBox = document.getElementById("squeakbox"); // whether or not the squeak box should be shown var smallWidth = swContent.clientWidth < WIDGET_WIDTH + CHAT_WIDTH_MIN + WIDGET_PADDING; // update the showing/hidden state of the squeak box if (smallWidth != showWidgetChat) { showWidgetChat = smallWidth; if (showWidgetChat) { squeakBox.style.display = "block"; setTimeout("openSqueakbox()", 500); // set a timeout on the show, Chrome doesn't like creating swfs right away main.squeakBoxShow(); } else { squeakBox.innerHTML = "
"; squeakBox.style.display = "none"; main.squeakBoxHide(); } } } function hideWidgetChat() { var main = document.getElementById("Main"); var swContent = document.getElementById("swcontent"); var squeakBox = document.getElementById("squeakbox"); squeakBox.innerHTML = "
"; squeakBox.style.display = "none"; main.squeakBoxHide(); showWidgetChat = false; } /* [flex] Set the background texture of the html content */ function setWidgetBackground(texture, width) { document.getElementById('lefttexture').style.background = 'url('+texture+') repeat'; document.getElementById('leftmusictexture').style.background = 'url('+texture+') repeat'; widgetBackgroundMaxWidth = width; //layoutWidgetMode(); } /* Set the background texture width of the html content */ function setWidgetBackgroundWidth(width) { widgetBackgroundMaxWidth = width; //layoutWidgetMode(); } /* Minimise the squeak box view. */ function minimiseSqueakBox() { var squeakBox = document.getElementById('squeakbox'); squeakBox.style.height = '70px'; } /* Maximise the squeak box view. */ function maximiseSqueakBox() { var squeakBox = document.getElementById('squeakbox'); squeakBox.style.height = '300px'; } // Navigation methods // -------------------------------------------- function getClientAddress() { var url = window.location.href; var rootUrl = url.match('http://www.smallworlds.com') + ''; var address = url.slice(rootUrl.length); if (address.indexOf('?') > -1) { address = address.slice(0, address.indexOf('?')); // strip away ?debug=true for developers } if (address.indexOf('/home') == 0) return address; else if (address.indexOf('/space') == 0) return address; else if (address.indexOf('/settings') == 0) return address; else if (address.indexOf('/community') == 0) return address; else if (address.indexOf('/worlds') == 0) return address; else return null; } function setClientAddress(address) { var newLocation = appendQuerystrings('http://www.smallworlds.com' + address); window.location.href = newLocation, '_self'; } function setHeaderAddress(address, newWindow) { // preserve necessary querystrings var newLocation = appendQuerystrings(address); if (newWindow == true) { // try opening a new window, else same if (!openURL(newLocation, '_blank')) { window.location.href = newLocation, '_self'; } } else { window.location.href = newLocation, '_self'; } } function setGlobalAddress(address) { // preserve necessary querystrings window.location.href = appendQuerystrings(address), '_self'; } function flashRedirect(address, target) { // redirect to location preserving querystrings if (target == "_parent") window.parent.location.href = appendQuerystrings(address); else window.location.href = appendQuerystrings(address), target; } function setFirstTimeAddress(address) { // preserve necessary querystrings window.parent.location = appendQuerystrings(address); } function preserveQuerystrings() { return ''; } function appendQuerystrings(url) { if (preserveQuerystrings() == "") return url; if( url.indexOf('?') < 0 ) { return url + '?' + preserveQuerystrings(); } else { return url + '&' + preserveQuerystrings(); } } function setPageTitle(t) { if (!t || t == '') document.title = 'SmallWorlds'; else document.title = 'SmallWorlds: ' + t; } function browserBack() { history.go(-1); } function openURL(url, target) { try { var popup = window.open(url, target); if (popup == null) return false; if (window.opera) if (!popup.opera) return false; } catch(err) { return false; } return true; } function unloadSWF() { closeWidget(); var flashDiv = document.getElementById('swcontent'); if (flashDiv) flashDiv.innerHTML = '

SmallWorlds has loaded in another view.


'; } // Tracking methods // -------------------------------------------- function pingGoogleAnalytics(address) { if( 'true' == 'true' && pageTracker ) pageTracker._trackPageview(address); } // Preloading methods // -------------------------------------------- function setClientLoadPercent(percent) { var flashObject = document.getElementById('Base'); if ( flashObject ) { flashObject.setClientLoadPercent(percent); } } function setClientLoaded() { var flashObject = document.getElementById('Base'); if ( flashObject ) { flashObject.setClientLoaded(); } } // Plaxo methods // -------------------------------------------- function retrievePlaxoContacts() { return showPlaxoABChooser('smallworlds/common/plaxo/plaxo_cb.html'); } function onABCommComplete(data) { getMovie('Main').returnPlaxoContacts(data); } function getMovie(movieName) { if (navigator.appName.indexOf('Microsoft') != -1) { return window[movieName]; } else if (document[movieName].length != undefined) { return document[movieName][1]; } else { return document[movieName]; } } // Conditional methods // --------------------------------------------- function cookiesEnabled() { document.cookie = "test=success"; var enabled = false; var cookies = document.cookie.split(";"); for (i = 0; i < cookies.length; i++) { var cookie = cookies[i].split("="); var name = cookie[0].replace(/^\s+|\s+$/g, ""); // trim whitespace if (name == "test") { var value = cookie[1]; if (value == "success") { enabled = true; } } } return enabled; } function disableBottomContent() { return ('' == 'false'); } function isInEmbedMode() { return ('' == 'true'); } function usingFirefox() { return (navigator.userAgent.indexOf('Firefox') > 0); } // Stereo Iframes // --------------------------------------------- //Used to populate the music iframe with content and hacks for browsers to start playing the tracks if needed function setMusicSource(musicUrl) { var musicContent = document.getElementById('musiccontent'); var musicFrame = document.getElementById('musicframe'); if( !iFrameMode ){ // Hack to automatically load track for some browsers. If not the player would not play until visible on screen musicContent.style.display = 'block'; musicContent.style.visibility = 'visible'; musicFrame.style.visibility = 'visible'; // Hide the player when in world musicContent.style.left = '-50000px'; musicContent.style.width = '1px'; musicContent.style.height = '0px'; musicFrame.style.width = '1px'; musicFrame.style.height = '0px'; } musicFrame.src = musicUrl; }