var serverServices = "http://www.wazee.org/bg_transport/"; var songPacketSRC = serverServices + "currSong.php"; var ratingsSRC = serverServices + "rateSong.php"; var songHistSRC = serverServices + "songHist.php"; var listenerCountSRC = serverServices + "num_listeners.php"; var internalTimer = false; var timer; var songPacketHttpObj; var BoxHttpConnection; var BoxConnectionHandled = false; var badPacketCount = 0; var connectionFrequency = 0; var currSongSong = ""; var currSongTextSong = ""; var currSongArtist = ""; var currSongRating = 0; var currSongAlbumSRC; var currSongProductLink; var currSongAlbumTitle; var currSongHistory; var currSongLastSpin; var currSongLength; var oldSongSong = ""; var oldSongArtist = ""; var oldSongRating = ""; var alreadyPlayedSecs = 0; var messageTimeout = false; var topBoxWidth = 0; var titleBoxHeight = 17; var titleTimeoutHandler = null; var currArtistTimeoutHandler = null; var currTitleTimeoutHandler = null; var BoxActiveTimeout = new Array(); var AutoCloseTimeout; var progressPillTicker = null; var initTitleLeft = 0; var initTitleTop = 0; var initArtistLeft = 15; var initArtistTop = 0; var titleDirection = -1; var artistDirection = -1; var BoxOpen = false; var BoxClosing = false; var BoxAnimActive = false; var BoxResizeHold = -1; var albumImages = new Array(); albumImages[0] = new Image(130, 130); albumImages[1] = new Image(130, 130); function listenerCount(){ listenerCountHttpObj = XMLHttpObject(); if(listenerCountHttpObj !== false){ listenerCountHttpObj.onreadystatechange = function() { if(listenerCountHttpObj.readyState == 4 && listenerCountHttpObj.responseText){ getRawObject("listenerCount").innerHTML = listenerCountHttpObj.responseText; } } clientTimeString = "?clientTime=" + Math.round(new Date().getTime() / 1000); listenerCountHttpObj.open("GET", listenerCountSRC + clientTimeString, true); listenerCountHttpObj.send(null); } } function mainLoop() { if(connectionFrequency < 5){ connectionFrequency++; flashStatus("Starting connection sequence for song data"); //load new song packet songPacketHttpObj = XMLHttpObject(); if(songPacketHttpObj !== false){ songPacketHttpObj.onreadystatechange = handleSongPacket; clientTimeString = "?clientTime=" + Math.round(new Date().getTime() / 1000); songPacketHttpObj.open("GET", songPacketSRC + clientTimeString, true); songPacketHttpObj.send(null); } } else { flashStatus("Connections per minute cap reached. Connect request ignored."); } } function newData(){ if(currSongSong.length > 0 || currSongArtist.length > 0){ if(currSongSong != oldSongSong){ return true; } if(currSongArtist != oldSongArtist){ return true; } } return false; } function handleSongPacket(){ if(songPacketHttpObj.readyState == 4){ var packet = songPacketHttpObj.responseText; if(packet.length > 0 && songPacketHttpObj.status == 200){ oldSongSong = currSongSong; oldSongArtist = currSongArtist; currSongID = fetchPacketParam("msid", packet); currSongSong = fetchPacketParam("song", packet); currSongTextSong = fetchPacketParam("textSong", packet); currSongArtist = fetchPacketParam("artist", packet); currSongRating = fetchPacketParam("rating", packet); currSongHistory = fetchPacketParam("history", packet); currSongLastSpin = fetchPacketParam("lastSpin", packet); currSongAlbumSRC = fetchPacketParam("albumSRC", packet); currSongProductLink = fetchPacketParam("productLink", packet); currSongAlbumTitle = fetchPacketParam("albumTitle", packet); currSongLength = fetchPacketParam("length", packet); displayTime = fetchPacketParam("displayTime", packet); } else if(badPacketCount < 4){ //no data in packet -- immediately try to get a new packet. timer = .5; internalTimer = true; badPacketCount++; } else { //server's probably down or experiencing a serious error, don't bug it for 4 minutes. timer = 60 * 4; internalTimer = true; } if(internalTimer == true && badPacketCount < 4){ //check to see if we should release timing back to the server: if(newData()){ internalTimer = false; } else { if (timer < 60) { timer = timer * 2; } if (timer > 60) { timer = 60; } } } if(!internalTimer){ timer = fetchPacketParam("nextPacket", packet); if(timer < 4){ timer = 4; } if(!newData()){ internalTimer = true; timer = 4; } } if(newData()){ triggerSongUpdate(displayTime); } /* introduce random variation to reduce server load. Does not apply to internal timer, which needs to be able to request quick retries. Random variation will have been introduced anyway before the internal timer gets utilized. This client may connect up to [flexibility] seconds after the server has new data available, but it will still update the song display exactly on time. */ if(!internalTimer){ flexibility = fetchPacketParam("flexibility", packet); if(flexibility >= 9){ flexibility -= 4; } waitTime = (parseInt(timer)) + Math.round(Math.random() * flexibility); //waitTime = timer; flashStatus("New song packet received: " + currSongArtist + " - " + currSongTextSong); } else { waitTime = timer; if(badPacketCount < 4){ flashStatus("No new data from server or connection error, retrying in " + waitTime + " seconds."); } else { flashStatus("Cannot update current song: Bad data from server."); } } //finally, wait this amount of time before starting a new cycle. window.setTimeout(mainLoop, waitTime * 1000); } } function connectionFrequencyMonitor(){ if(connectionFrequency > 0) connectionFrequency--; } function flashStatus(msg){ if(messageTimeout !== false){ window.clearTimeout(messageTimeout); } window.status = msg; messageTimeout = window.setTimeout("window.status = ''", 4 * 1000); } function triggerSongUpdate(inSeconds){ prepareUpdate(); if(inSeconds == Math.abs(inSeconds)){ alreadyPlayedSecs = 0; window.setTimeout("updateDisplay()", inSeconds * 1000); } else { alreadyPlayedSecs = -(inSeconds); updateDisplay(); //window.alert("inSeconds=" + inSeconds + "; alreadyPlayedSecs=" + alreadyPlayedSecs); } } function createCookie(name,value,days) { name = escape(name); value = escape(value); if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function fetchPacketParam(param, packet) { name = escape(param); var nameEQ = name + "="; var out = ""; var ca = packet.split(';'); for(var i=0;i < ca.length;i++){ var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) out = c.substring(nameEQ.length,c.length); } return unescape(out); } function rateSong(msid) { if(BoxOpen == false){ standbyBox(); } runBoxConnection("GET", ratingsSRC + "?msid=" + msid, null, null, null); return false; } function songHist() { if(BoxOpen == false){ standbyBox(); } runBoxConnection("GET", songHistSRC, null, null, null); return false; } function logIn(msid){ if(typeof msid == 'undefined'){ msid = 'current'; } var username = getRawObject("YaBB_username").value; var password = getRawObject("YaBB_password").value; var postString = escape("YaBB_username") + "=" + escape(username) + "&" + escape("YaBB_password") + "=" + escape(password); runBoxConnection("POST", ratingsSRC + "?msid=" + msid, postString, null, null); return true; } function runBoxConnection(method, resource, connBody, headerNames, headerValues){ //window.alert("running " + method + " connection for " + resource); BoxHttpConnection = XMLHttpObject(); if(BoxHttpConnection !== false){ window.clearTimeout(AutoCloseTimeout); if(!BoxAnimActive) getRawObject("boxTitle").innerHTML = "Communicating..."; BoxHttpConnection.onreadystatechange = handleBoxConnection; var clientTimeString = "clientTime=" + Math.round(new Date().getTime() / 1000); if(resource.indexOf("?") > 0){ //url already has query variables clientTimeString = "&" + clientTimeString; } else { clientTimeString = "?" + clientTimeString; } BoxHttpConnection.open(method, resource + clientTimeString, true); if(method.toLowerCase() == "post"){ BoxHttpConnection.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); } if(headerNames instanceof Array){ for(var i = 0; i < headerNames.length; i++){ BoxHttpConnection.setRequestHeader(headerNames[i], headerValues[i]); } } BoxHttpConnection.send(connBody); BoxConnectionHandled = false; return true; } else { return false; } } function handleBoxConnection(){ if(document.getElementById("boxOuter")){ if(BoxHttpConnection.readyState == 4 && ! BoxConnectionHandled){ BoxConnectionHandled = true; BoxTitle = BoxHttpConnection.getResponseHeader("X-Item-Title"); if(BoxHttpConnection.getAllResponseHeaders().indexOf("X-Transaction-Complete") != -1){ AutoCloseTimeout = window.setTimeout("closeBox()", 5500); } //pre-render the received content to find its dimensions var boxStagingObj = getRawObject("boxContent"); hide(boxStagingObj); boxStagingObj.innerHTML = ""; BoxContent = BoxHttpConnection.responseText; boxStagingObj.innerHTML = BoxContent; if(! isIE4) boxStagingObj.style.position = "relative"; boxStagingObj.innerHTML = BoxContent; //get the content's width and height var newWidth = getObjectWidth(boxStagingObj) + 4; //a little padding var newHeight = getObjectHeight(boxStagingObj) + 22; //the title bar and padding if(! isIE4) boxStagingObj.style.position = "absolute"; //send box resize request - contents of BoxContent are displayed automatically setBoxSize(newWidth, newHeight, .6, true); if(BoxHttpConnection.getAllResponseHeaders().indexOf("X-Rating") != -1){ if(typeof currSongID != 'undefined' && BoxHttpConnection.getResponseHeader("X-Song-ID") == currSongID){ currSongRating = BoxHttpConnection.getResponseHeader("X-Rating"); updateRatingDisplay(); } } } } else { window.setTimeout("handleBoxconnection()", 1000); } } function XMLHttpObject(){ //code below adapted from http://jibbering.com/2002/4/httprequest.html var xmlhttp=false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } @end @*/ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } if(!xmlhttp){ window.status = "Your browser does not support some site features. Try Firefox, Netscape 6, or Internet Explorer w/activeX."; } return xmlhttp; } /* *********************************************************** Example 4-3 (DHTMLapi.js) "Dynamic HTML:The Definitive Reference" 2nd Edition by Danny Goodman Published by O'Reilly & Associates ISBN 1-56592-494-0 http://www.oreilly.com Copyright 2002 Danny Goodman. All Rights Reserved. ************************************************************ */ // DHTMLapi.js custom API for cross-platform // object positioning by Danny Goodman (http://www.dannyg.com). // Release 2.0. Supports NN4, IE, and W3C DOMs. // This API has been modified from its original version for wazee.org. // Unused methods were removed and setSize was added. // Global variables var isCSS, isW3C, isIE4, isNN4; // initialize upon load to let all browsers establish content objects function initDHTMLAPI() { if (document.images) { isCSS = (document.body && document.body.style) ? true : false; isW3C = (isCSS && document.getElementById) ? true : false; isIE4 = (isCSS && document.all) ? true : false; isNN4 = (document.layers) ? true : false; isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false; } } // Seek nested NN4 layer from string name function seekLayer(doc, name) { var theObj; for (var i = 0; i < doc.layers.length; i++) { if (doc.layers[i].name == name) { theObj = doc.layers[i]; break; } // dive into nested layers if necessary if (doc.layers[i].document.layers.length > 0) { theObj = seekLayer(document.layers[i].document, name); } } return theObj; } // Convert object name string or object reference // into a valid element object reference function getRawObject(obj) { var theObj; if (typeof obj == "string") { if (isW3C) { theObj = document.getElementById(obj); } else if (isIE4) { theObj = document.all(obj); } else if (isNN4) { theObj = seekLayer(document, obj); } } else { // pass through object reference theObj = obj; } return theObj; } // Convert object name string or object reference // into a valid style (or NN4 layer) reference function getObject(obj) { var theObj = getRawObject(obj); if (theObj && isCSS) { theObj = theObj.style; } return theObj; } // Position an object at a specific pixel coordinate function shiftTo(obj, x, y) { var theObj = getObject(obj); if (theObj) { if (isCSS) { // equalize incorrect numeric value type var units = (typeof theObj.left == "string") ? "px" : 0 theObj.left = x + units; theObj.top = y + units; } else if (isNN4) { theObj.moveTo(x,y) } } } // Move an object by x and/or y pixels function shiftBy(obj, deltaX, deltaY) { var theObj = getObject(obj); if (theObj) { if (isCSS) { // equalize incorrect numeric value type var units = (typeof theObj.left == "string") ? "px" : 0 theObj.left = getObjectLeft(obj) + deltaX + units; theObj.top = getObjectTop(obj) + deltaY + units; } else if (isNN4) { theObj.moveBy(deltaX, deltaY); } } } // Set the z-order of an object function setZIndex(obj, zOrder) { var theObj = getObject(obj); if (theObj) { theObj.zIndex = zOrder; } } //set the size of a positionable object function setSize(obj, w, h){ var theObj = getObject(obj); theObj.width = w; theObj.height = h; } // Set the visibility of an object to visible function show(obj) { var theObj = getObject(obj); if (theObj) { theObj.visibility = "visible"; } } // Set the visibility of an object to hidden function hide(obj) { var theObj = getObject(obj); if (theObj) { theObj.visibility = "hidden"; } } // Retrieve the x coordinate of a positionable object function getObjectLeft(obj) { var elem = getRawObject(obj); var result = 0; if (document.defaultView) { var style = document.defaultView; var cssDecl = style.getComputedStyle(elem, ""); result = cssDecl.getPropertyValue("left"); } else if (elem.currentStyle) { result = elem.currentStyle.left; } else if (elem.style) { result = elem.style.left; } else if (isNN4) { result = elem.left; } return parseInt(result); } // Retrieve the y coordinate of a positionable object function getObjectTop(obj) { var elem = getRawObject(obj); var result = 0; if (document.defaultView) { var style = document.defaultView; var cssDecl = style.getComputedStyle(elem, ""); result = cssDecl.getPropertyValue("top"); } else if (elem.currentStyle) { result = elem.currentStyle.top; } else if (elem.style) { result = elem.style.top; } else if (isNN4) { result = elem.top; } return parseInt(result); } // Retrieve the rendered width of an element function getObjectWidth(obj) { var elem = getRawObject(obj); var result = 0; if (elem.offsetWidth) { result = elem.offsetWidth; } else if (elem.clip && elem.clip.width) { result = elem.clip.width; } else if (elem.style && elem.style.pixelWidth) { result = elem.style.pixelWidth; } return parseInt(result); } // Retrieve the rendered height of an element function getObjectHeight(obj) { var elem = getRawObject(obj); var result = 0; if (elem.offsetHeight) { result = elem.offsetHeight; } else if (elem.clip && elem.clip.height) { result = elem.clip.height; } else if (elem.style && elem.style.pixelHeight) { result = elem.style.pixelHeight; } return parseInt(result); } function init(){ initDHTMLAPI(); mainLoop(); window.setInterval("scrollTitles()", 5500); window.setInterval("listenerCount()", 35000); window.setInterval("connectionFrequencyMonitor()", 30 * 1000); MM_preloadImages('thumbrate_r2_c2_f2.gif','1.gif','thumbrate_r2_c4_f2.gif','2.gif','thumbrate_r2_c6_f2.gif','3.gif','thumbrate_r2_c8_f2.gif','4.gif','thumbrate_r2_c10_f2.gif','5.gif','thumbrate_r2_c12_f2.gif','6.gif'); } window.onload = init; //init(); function scrollTitles(){ if(! BoxAnimActive){ //for some reason firefox may mess up when both are running at the same time var titleObj = document.getElementById("currTitle"); var titleHeight = getObjectHeight(titleObj); if(titleHeight > titleBoxHeight){ scrollTitle(); } var titleObj = document.getElementById("currArtist"); var titleHeight = getObjectHeight(titleObj); if(titleHeight > titleBoxHeight){ scrollArtist(); } } } function scrollTitle(){ var objIdentifier = getRawObject("currTitle"); titleDirection = selectDirection(objIdentifier, titleDirection); currTitleTimeoutHandler = window.setInterval("titleScrollStep('currTitle', " + titleDirection + ")", 30); } function scrollArtist(){ var objIdentifier = getRawObject("currArtist"); artistDirection = selectDirection(objIdentifier, artistDirection); currArtistTimeoutHandler = window.setInterval("titleScrollStep('currArtist', " + artistDirection + ")", 30); } function selectDirection(obj, currDirection){ var newDirection; var objy = getObjectTop(obj); var objHeight = getObjectHeight(obj); if(objy == 0){ newDirection = -1; } else if((objHeight - Math.abs(objy)) <= titleBoxHeight){ newDirection = currDirection * -1; } else { newDirection = currDirection; } return newDirection; } function titleScrollStep(objName, direction){ if(isIE4){ //animations are safe. shiftBy(getRawObject(objName), 0, direction); if(getObjectTop(getRawObject(objName)) % titleBoxHeight == 0){ window.clearInterval(eval(objName + "TimeoutHandler")); } } else { //other browsers are slow and don't always clearInterval, causing an endless loop. shiftBy(getRawObject(objName), 0, titleBoxHeight * direction); window.clearInterval(eval(objName + "TimeoutHandler")); } } /* function artistScrollStep(){ //parameterless method for use in setInterval calls shiftBy(getRawObject("currArtist"), 0, artistDirection); if(getObjectTop(getRawObject("currArtist")) % titleBoxHeight == 0){ window.clearInterval(currArtistTimeoutHandler); } } */ function resetTitleScroll(){ window.clearInterval(currArtistTimeoutHandler); window.clearInterval(currTitleTimeoutHandler); var titleObj = getRawObject("currTitle"); shiftTo(titleObj, parseInt(initTitleLeft), parseInt(initTitleTop)); var titleObj = getRawObject("currArtist"); shiftTo(titleObj, parseInt(initArtistLeft), parseInt(initArtistTop)); } function prepareUpdate(){ albumImages[0].src = currSongAlbumSRC; } function updateDisplay(){ if(document.getElementById("currTitle")) document.getElementById("currTitle").innerHTML = currSongSong; if(document.getElementById("currArtist")) document.getElementById("currArtist").innerHTML = currSongArtist; if(document.getElementById("history")) document.getElementById("history").innerHTML = currSongHistory; if(document.getElementById("lastSpin")) document.getElementById("lastSpin").innerHTML = currSongLastSpin; if(document.getElementById("currTitle") && document.getElementById("currArtist")) resetTitleScroll(); resetProgressPill(); updateRatingDisplay(); //albumImages[0].src = albumImages[1].src; if(document.getElementById("albumArt")) document.getElementById("albumArt").src = albumImages[0].src; if(document.getElementById("productLink")) document.getElementById("productLink").href = currSongProductLink; if(document.getElementById("productLink")) document.getElementById("productLink").title = currSongAlbumTitle; if(document.getElementById("iTunesLink")) document.getElementById("iTunesLink").href = "/cgi-bin/itms.pl?song=" + escape(currSongSong) + "&artist=" + escape(currSongArtist); if(document.getElementById("amazonLink")) document.getElementById("amazonLink").href = currSongProductLink; if(document.getElementById("googleLink")) document.getElementById("googleLink").href = "http://www.google.com/search?q=" + escape('"' + currSongArtist + '" ' + currSongTextSong); } function updateRatingDisplay(){ getRawObject("rating").innerHTML = currSongRating; } function resetProgressPill(){ window.clearInterval(progressPillTicker); if(topBoxWidth == 0){ //get width of the bar topBoxWidth = getObjectWidth("topbox"); } //find position advancement frequency var progressionFrequency = currSongLength / (topBoxWidth - 30); //find & move to start position var startPos = Math.floor((topBoxWidth - 32) * (alreadyPlayedSecs / currSongLength)); if(startPos <= topBoxWidth) { //window.alert("topBoxWidth=" + topBoxWidth + "; alreadyPlayedSecs=" + alreadyPlayedSecs + "; currSongLength=" + currSongLength + "; startPos=" + startPos); shiftTo("progresspill", startPos, 0); show("progresspill"); //start the pill a marchin' progressPillTicker = window.setInterval("advanceProgressPill()", progressionFrequency * 1000); } } function advanceProgressPill(){ //either advance 1px right or terminate the interval call if((getObjectLeft("progresspill") + 33) >= topBoxWidth){ //we're at the end. stop. window.clearInterval(progressPillTicker); } else { shiftBy("progresspill", 1, 0); } } function setBoxSize(w, h, animLength, afterResize){ window.clearTimeout(BoxActiveTimeout[0]); window.clearTimeout(BoxActiveTimeout[1]); BoxOpen = true; var widthChange = w - getObjectWidth("boxOuter"); var heightChange = h - getObjectHeight("boxOuter"); var widthAcceleration = (-2 * widthChange) / (animLength * animLength); // px/sec/sec var heightAcceleration = (-2 * heightChange) / (animLength * animLength); var widthVelocity = -(widthAcceleration * animLength); var heightVelocity = -(heightAcceleration * animLength); BoxWidthDone = (widthVelocity == 0) ? true : false; BoxHeightDone = (heightVelocity == 0) ? true : false; if(heightChange || widthChange){ getRawObject("boxOuter").style.MozOpacity = 1; } else { boxResized(afterResize); } if(heightChange) changeBoxSize(false, getObjectTop("boxOuter"), 0, heightVelocity, heightAcceleration, getObjectHeight("boxOuter"), afterResize); if(widthChange) changeBoxSize(true, getObjectLeft("boxOuter"), 0, widthVelocity, widthAcceleration, getObjectWidth("boxOuter"), afterResize); } function changeBoxSize(changeWidth, initialPos, totalTime, initialVelocity, acceleration, initialDim, afterResize){ var secsPerFrame = .0417; var velocity = initialVelocity + acceleration * totalTime; if((velocity > 0 && acceleration < 0) || (velocity < 0 && acceleration > 0)){ BoxAnimActive = true; var deltaX = (initialVelocity * totalTime) + .5*(acceleration * totalTime * totalTime); var resizeTo = initialDim + Math.round(deltaX); if(changeWidth){ var newWidth = resizeTo; var newHeight = getObjectHeight("boxOuter"); } else { var newWidth = getObjectWidth("boxOuter"); var newHeight = resizeTo; } BoxActiveTimeout[(changeWidth == true) ? 1 : 0] = window.setTimeout("changeBoxSize(" + changeWidth + ", " + initialPos + ", " + (totalTime + secsPerFrame) + ", " + initialVelocity + ", " + acceleration + ", " + initialDim + ", " + afterResize + ")", secsPerFrame * 1000); setSize("boxOuter", newWidth, newHeight); var lastTime = totalTime - secsPerFrame; if(lastTime >= 0){ var oldDeltaX = (initialVelocity * lastTime) + .5*(acceleration * lastTime * lastTime); } else { var oldDeltaX = deltaX; } if(changeWidth && newWidth == getObjectWidth("boxOuter") && deltaX != oldDeltaX){ var shiftToPos = -(Math.round(deltaX) - Math.round(oldDeltaX)); shiftBy("boxOuter", shiftToPos, 0); } } else { if(changeWidth){ BoxWidthDone = true; } else { BoxHeightDone = true; } if(BoxWidthDone && BoxHeightDone) boxResized(afterResize); } } function boxResized(action){ BoxAnimActive = false; if(action == false){ //perform final box close steps hide("boxContent"); hide("boxOuter"); BoxClosing = false; BoxOpen = false; } else { //display something in the resized box. handleBoxConnection(); //if data was received while box was resizing, process received data now. if(! BoxAnimActive){ getRawObject("boxOuter").style.MozOpacity = .91; shiftTo("boxContent", getObjectLeft("boxOuter") + 2, getObjectTop("boxOuter") + 17); window.setTimeout('show("boxContent")', 50); //it looks better with a short delay. } getRawObject("boxTitle").innerHTML = BoxTitle; } } function standbyBox(){ //make box at least 206 by 36 //var width = (getObjectWidth("boxOuter") < 206) ? 206 : getObjectWidth("boxOuter"); //var height = (getObjectHeight("boxOuter") < 36) ? 36 : getObjectHeight("boxOuter"); var width = 260; var height = 242; //show the box show("boxOuter"); //write standby content BoxContent = "
Accessing database -- please wait
"; BoxTitle = "Communicating..."; //perform resize setBoxSize(width, height, 1.5, true); //content layer is displayed automatically when resize is complete } function closeBox(){ if(typeof BoxHttpConnection != "undefined"){ BoxHttpConnection.abort(); } window.clearInterval(BoxResizeHold); BoxTitle = ""; BoxContent = ""; getRawObject("boxTitle").innerHTML = ""; getRawObject("boxContent").innerHTML = ""; hide("boxContent"); BoxClosing = true; setBoxSize(25, 25, .4, false); } //Macromedia generated functions function MM_displayStatusMsg(msgStr) { //v3.0 flashStatus(msgStr); document.MM_returnValue = true; } function MM_findObj(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i < d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i < d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src="/" + a[i+2];} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0; a&&i < a.length&&(x=a[i])&&x.oSrc; i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i < a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src="/" + a[i];}} } // WMD window handling functions function songWindow(url){ handle = window.open(url, "music", "status,HEIGHT=530,WIDTH=540,scrollbars") handle.focus() if(handle){ return false; } } function albumWindow(url){ handle = window.open(url, "albums", "HEIGHT=470,WIDTH=540,scrollbars") handle.focus() if(handle){ return false; } } function sendToOpener(windowObj, url){ if(windowObj.location == url){ windowObj.focus() } else { windowObj.location.href = url } //the idea with that is to load the new page into the parent window while allowing the user to control which window gets focus. //if the user clicks the link again, assume it's because they can't see the parent window and are hammering on the link trying //to get it to load, in which case bring the parent window to the front for them. return false; }