/* ------------------------------ Timezone Selector Menu ------------------------------ */ // Sets the timezone selector id function setTimezoneSelectorCookie( pSelector ) { if ( null != pSelector ) { createCookie( "timezoneSelector", pSelector.id, 365 ); } } // Sets the timezone offset for the user as a cookie function setTimezoneCookie( pOffset ) { createCookie( "timezoneOffset", pOffset, 365 ); } function getTimezoneOffset() { return getCookieValue( "timezoneOffset" ); } function getTimezoneSelector() { return getCookieValue( "timezoneSelector" ); } function getCookieValue( pName ) { var dc = document.cookie; var prefix = pName + "="; var begin = dc.indexOf( "; " + prefix ); if ( begin == -1 ) { begin = dc.indexOf( prefix ); if ( begin != 0 ) return ""; } else { begin += 2; } var end = document.cookie.indexOf( ";", begin ); if ( end == -1 ) { end = dc.length; } return unescape( dc.substring( begin + prefix.length, end ) ); } function createCookie( name, value, days ) { if ( days ) { var date = new Date(); date.setTime( date.getTime() + ( days * 24 * 60 * 60 * 1000 ) ); var expires = "; expires=" + date.toGMTString(); } else { var expires = ""; } var ck = name + "=" + value + expires + "; path=/"; document.cookie = ck; } /* ------------------------------ Primetime Selector Menu ------------------------------ */ // Executes an AJAX call to get the primetime selector menu function FetchPrimetimeSelectorMenu() { // Concatenate the URL of the script we need to hit var fullPrimeTimeListingsURL= "/universalInclude/code/modules/programListingsExtraction/PrimeTimeSelectorMenuExtractor.asp" + "?table=" + "spacelistingsVerified"; // Instantiate the Ajax Executor and have it get the data from the other end var primeTimeListingsAjaxExec = new AjaxExecutor( fullPrimeTimeListingsURL, DisplayPrimeTimeSelector ); } // When the AJAX call is done it calls back to here and returns the data for display function DisplayPrimeTimeSelector ( pSelectorData ) { primeTimeSelector = "Program listings are unavailable at this time."; if ( pSelectorData != "" ) { primeTimeSelector = pSelectorData ; } var displayEl = document.getElementById( "selectorMenuDiv" ); if ( null != displayEl ) { displayEl.innerHTML = primeTimeSelector; } // This call needs to be implemented in all pages that use this script (aka: ugly hack) initTimezoneSelectors(); initPrimeTimeSelectors(); }