YAHOO.util.Event.onDOMReady(init); function removeChildren(node){ if (node.hasChildNodes()) { while (node.childNodes.length >= 1) { node.removeChild(node.firstChild); } } }; var highlightMonth = function(targetNode){ this.element = targetNode; var highLightElement = YAHOO.util.Dom.getElementsByClassName(this.element); for (i = 0; i < highLightElement.length; i++) { if (highLightElement[i].title != '') { var highLighThis = highLightElement[i].getElementsByTagName('span')[0]; var removeBackgroundImage = highLighThis.getElementsByTagName('a')[0]; removeBackgroundImage.style.backgroundImage = 'none'; var animation = new YAHOO.util.ColorAnim(highLightElement[i], { backgroundColor: { to: "#DD6800" } }, 2); animation.animate(); } } } var findSchedule = function(elem, url, title){ this.src = url; this.element = elem; this.title = title; var target = YAHOO.util.Dom.getElementsByClassName(this.element, 'a')[0]; var exists = YAHOO.util.Dom.getElementsByClassName('canada', 'div')[0]; if(exists){ if (exists.getElementsByTagName('div').length == '0') { target.onclick = function(){ var destination = YAHOO.util.Dom.getElementsByClassName('canada', 'div')[0]; var newDiv = document.createElement('div'); newDiv.className = elem + '-popup'; var newWindow = document.createElement('span'); newWindow.className = 'open-new-window'; newWindow.innerHTML = 'click to open in new window'; var closeSpan = document.createElement('span'); closeSpan.className = 'close-iframe'; closeSpan.title = 'Close Window'; var newFrame = document.createElement('iframe'); newFrame.className = elem + '-iframe clearFix'; newFrame.src = this.href; newFrame.title = this.title; newFrame.setAttribute('frameborder','0'); newFrame.frameBorder = 'no'; newFrame.scrolling = 'no'; newWindow.onclick = function(){ destination.removeChild(newDiv); window.open(target.href); } closeSpan.onclick = function(){ destination.removeChild(newDiv); } newDiv.appendChild(newWindow); newDiv.appendChild(closeSpan); newDiv.appendChild(newFrame); destination.appendChild(newDiv); return false; } } } } function injectStyle(cssLocation){ var headTag = document.getElementsByTagName("head")[0]; var newLink = document.createElement('link'); newLink.rel = 'stylesheet'; newLink.type = 'text/css'; newLink.href = realLocation + cssLocation; newLink.media = 'screen'; headTag.appendChild(newLink); } function injectScript(scriptLocation){ var getHeader = document.getElementsByTagName("head")[0]; var newScript = document.createElement('script'); newScript.type = "text/javascript"; newScript.src = realLocation + scriptLocation; getHeader.appendChild(newScript); } var ajax_http_mode = "GET"; var ajax_asynchronous = true; var ajax_loading = 1; var ajax_loaded = 2; var ajax_interactive = 3; var ajax_complete = 4; var OK = 200; function removeChildren(node){ if (node.hasChildNodes()) { while (node.childNodes.length >= 1) { node.removeChild(node.firstChild); } } } function ltrim(stringToTrim){ return stringToTrim.replace(/^\s+/, ""); } function viewScheduleBy(){ var byDay = YAHOO.util.Dom.getElementsByClassName('view-by-day')[0]; var byWeek = YAHOO.util.Dom.getElementsByClassName('view-by-week')[0]; var byMonth = YAHOO.util.Dom.getElementsByClassName('view-by-month')[0]; if (byDay != undefined && byWeek != undefined && byMonth != undefined) { var dayInput = document.createElement('a'); var dayspan = document.createElement('span'); dayspan.innerHTML = 'Day'; dayInput.className = 'radio'; dayInput.name = 'scheduleOptions'; dayInput.href = byDay.getAttribute('href'); byDay.parentNode.appendChild(dayInput); dayInput.appendChild(dayspan); var dayInput2 = document.createElement('a'); var dayspan2 = document.createElement('span'); dayspan2.innerHTML = 'Week'; dayInput2.className = 'radio'; dayInput2.name = 'scheduleOptions'; dayInput2.href = byWeek.getAttribute('href'); byWeek.parentNode.appendChild(dayInput2); dayInput2.appendChild(dayspan2); var dayInput3 = document.createElement('a'); var dayspan3 = document.createElement('span'); dayspan3.innerHTML = 'Month'; dayInput3.className = 'radio'; dayInput3.name = 'scheduleOptions'; dayInput3.href = byMonth.getAttribute('href'); byMonth.parentNode.appendChild(dayInput3); dayInput3.appendChild(dayspan3); byDay.parentNode.removeChild(byDay); byWeek.parentNode.removeChild(byWeek); byMonth.parentNode.removeChild(byMonth); dayInput.onclick = function(){ window.location.href = this.getAttribute('value') + '&monthOffset=0&'; }; dayInput2.onclick = function(){ window.location.href = this.getAttribute('value') + '&monthOffset=0&'; }; dayInput3.onclick = function(){ window.location.href = this.getAttribute('value') + '&monthOffset=0&'; } } }; var printFunction = function(e){ var header = document.getElementsByTagName('head')[0]; var exists = document.getElementById('printStyle'); var normalStyle = document.getElementById('styles'); if (exists) { exists.parentNode.removeChild(exists); var styleHREF = normalStyle.getAttribute('href'); normalStyle.href = styleHREF; this.innerHTML = 'print schedule'; this.className = 'schedule-print'; } else { var link = document.createElement('link'); link.type = 'text/css'; link.rel = 'stylesheet'; link.id = 'printStyle'; link.href = 'http://static.amctv.com/css/blogs/schedule/schedule-print.css'; header.appendChild(link); this.innerHTML = 'restore normal layout'; this.className = 'schedule-print wide'; setTimeout('window.print()', 800); } } function printCSS(){ var printButton = YAHOO.util.Dom.getElementsByClassName('schedule-print')[0]; YAHOO.util.Event.addListener(printButton, "click", printFunction); } function setMonthView(){ var targetHREF = 'schedule-mini-calendar.php'; var nextMonthContainer = YAHOO.util.Dom.getElementsByClassName('next-month'); var prevMonthContainer = YAHOO.util.Dom.getElementsByClassName('previous-month'); if (nextMonthContainer[0] != undefined) { nextMonth = nextMonthContainer[0].getElementsByTagName('a'); prevMonth = prevMonthContainer[0].getElementsByTagName('a'); nextMonth[0].onclick = function(){ var urlParam = this.getAttribute('title'); var timeStamp = new Date().getTime(); var parameters = urlParam + '×tamp=' + timeStamp; var ajaxURL = targetHREF + parameters; var AjaxObject = { handleSuccess: function(o){ var calDumpDiv = document.createElement('div'); var bodyTag = document.getElementsByTagName('body')[0]; var miniCalDaysContainer = YAHOO.util.Dom.getElementsByClassName('days-container'); var miniCalMonth = YAHOO.util.Dom.getElementsByClassName('current-month')[0]; var minicalMonthProperties = YAHOO.util.Dom.getElementsByClassName('month-properties')[0]; var miniCalSelf = miniCalDaysContainer[0]; var newDiv = document.createElement('div'); removeChildren(miniCalSelf); newDiv.innerHTML = o.responseText; var checkDump = document.getElementById('calDump'); if (checkDump != undefined) { var calDump = document.getElementById('calDump'); calDump.innerHTML = o.responseText; } else { var calDumpDiv = document.createElement('div'); calDumpDiv.id = 'calDump'; bodyTag.appendChild(calDumpDiv); calDumpDiv.innerHTML = o.responseText; } var checkDump = document.getElementById('calDump'); var newDays = YAHOO.util.Dom.getElementsByClassName('days-container')[1]; var newMonth = YAHOO.util.Dom.getElementsByClassName('current-month')[1]; var newProperties = YAHOO.util.Dom.getElementsByClassName('month-properties')[1]; newDiv.innerHTML = newDays.innerHTML; miniCalMonth.innerHTML = newMonth.innerHTML; minicalMonthProperties.innerHTML = newProperties.innerHTML; miniCalSelf.appendChild(newDiv); setTimeout('checkToday()', 800); }, handleFailure: function(o){ }, processResult: function(o){ }, startRequest: function(){ YAHOO.util.Connect.asyncRequest('GET', ajaxURL, callback); } }; var callback = { success: AjaxObject.handleSuccess, failure: AjaxObject.handleFailure, scope: AjaxObject }; AjaxObject.startRequest(); return false; }; prevMonth[0].onclick = function(){ var urlParam = this.getAttribute('title'); var timeStamp = new Date().getTime(); var parameters = urlParam + '×tamp=' + timeStamp; var ajaxURL = targetHREF + parameters; var AjaxObject = { handleSuccess: function(o){ var calDumpDiv = document.createElement('div'); var bodyTag = document.getElementsByTagName('body')[0]; var miniCalDaysContainer = YAHOO.util.Dom.getElementsByClassName('days-container'); var miniCalMonth = YAHOO.util.Dom.getElementsByClassName('current-month')[0]; var minicalMonthProperties = YAHOO.util.Dom.getElementsByClassName('month-properties')[0]; var miniCalSelf = miniCalDaysContainer[0]; var newDiv = document.createElement('div'); removeChildren(miniCalSelf); newDiv.innerHTML = o.responseText; var checkDump = document.getElementById('calDump'); if (checkDump != undefined) { var calDump = document.getElementById('calDump'); calDump.innerHTML = o.responseText; } else { var calDumpDiv = document.createElement('div'); calDumpDiv.id = 'calDump'; bodyTag.appendChild(calDumpDiv); calDumpDiv.innerHTML = o.responseText; } var checkDump = document.getElementById('calDump'); var newDays = YAHOO.util.Dom.getElementsByClassName('days-container')[1]; var newMonth = YAHOO.util.Dom.getElementsByClassName('current-month')[1]; var newProperties = YAHOO.util.Dom.getElementsByClassName('month-properties')[1]; newDiv.innerHTML = newDays.innerHTML; miniCalMonth.innerHTML = newMonth.innerHTML; minicalMonthProperties.innerHTML = newProperties.innerHTML; miniCalSelf.appendChild(newDiv); setTimeout('checkToday()', 800); }, handleFailure: function(o){ }, processResult: function(o){ }, startRequest: function(){ YAHOO.util.Connect.asyncRequest('GET', ajaxURL, callback); } }; var callback = { success: AjaxObject.handleSuccess, failure: AjaxObject.handleFailure, scope: AjaxObject }; AjaxObject.startRequest(); return false; } } } function setViewSelected(){ var viewType = ''; var viewInputsParent = YAHOO.util.Dom.getElementsByClassName('schedule-view-by'); if (viewInputsParent[0] != undefined) { var viewInputsChildren = viewInputsParent[0].getElementsByTagName('a'); if (viewType == 'day') { viewInputsChildren[0].className = 'radio day true'; } else if (viewType == 'week') { viewInputsChildren[1].className = 'radio week true'; } else if (viewType == 'month') { viewInputsChildren[2].className = 'radio month true'; } } } function hideCal(){ var showHideAction = YAHOO.util.Dom.getElementsByClassName('show-hide')[0]; var showHideElem = YAHOO.util.Dom.getElementsByClassName('mini-calender-show-hide')[0]; if (showHideElem != undefined) { var currHeight = showHideElem.offsetHeight; var hideElem = { height: { to: 33 } }; var showEm = new YAHOO.util.Anim(showHideElem, hideElem, 1.3, YAHOO.util.Easing.bounceOut); showEm.animate(); showHideAction.id = 'hide'; showHideAction.innerHTML = 'show'; var changeColor = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#fff" } }, .5); var changeColor2 = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#000" } }, .5); var changeColor3 = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#fff" } }, .5); var changeColor4 = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#000" } }, .5); showEm.onComplete.subscribe(function(){ changeColor.animate(); }); changeColor.onComplete.subscribe(function(){ changeColor2.animate(); }); changeColor2.onComplete.subscribe(function(){ changeColor3.animate(); }); changeColor3.onComplete.subscribe(function(){ changeColor4.animate(); }); } } function showHideCalender(){ var showHideAction = YAHOO.util.Dom.getElementsByClassName('show-hide')[0]; var showHideElem = YAHOO.util.Dom.getElementsByClassName('mini-calender-show-hide')[0]; if (showHideElem != undefined) { var currHeight = showHideElem.offsetHeight; var hideElem = { height: { to: 33 } }; var showelem = { height: { from: 33, to: currHeight } }; showHideAction.onclick = function(){ if (this.id == 'show') { YAHOO.util.Cookie.set("calenderPref", 'hide'); var hideEm = new YAHOO.util.Anim(showHideElem, hideElem, .5, YAHOO.util.Easing.backBoth); hideEm.animate(); this.id = 'hide'; this.innerHTML = 'show'; var changeColor = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#fff" } }, .5); var changeColor2 = new YAHOO.util.ColorAnim(showHideAction, { color: { to: "#000" } }, .5); hideEm.onComplete.subscribe(function(){ changeColor.animate(); }); changeColor.onComplete.subscribe(function(){ changeColor2.animate(); }); } else if (this.id == 'hide') { YAHOO.util.Cookie.set("calenderPref", 'show'); var showEm = new YAHOO.util.Anim(showHideElem, showelem, .9, YAHOO.util.Easing.backBoth); showEm.animate(); this.id = 'show'; this.innerHTML = 'hide'; var fixHeightVal = { height: { to: 100, unit: '%' } }; var fixHeight = new YAHOO.util.Anim(showHideElem, fixHeightVal, .5, YAHOO.util.Easing.backBoth); showEm.onComplete.subscribe(function(){ fixHeight.animate(); }); } } } setCalendarPreference(); } function setCalendarPreference(){ var preferenceValue = YAHOO.util.Cookie.get("calenderPref"); if (preferenceValue != null && typeof preferenceValue != 'undefined' && typeof preferenceValue != undefined && preferenceValue != 'null') { if (preferenceValue == 'hide') { hideCal(); } } } function checkToday(){ var jsToday = parseInt(''); var jsTodayCollection = YAHOO.util.Dom.getElementsByClassName('day-data'); for (var i = 0; i <= jsTodayCollection.length; i++) { if (jsTodayCollection[i] != undefined) { var getSpan = jsTodayCollection[i].getElementsByTagName('span')[0]; var getAnchorValue = getSpan.getElementsByTagName('a')[0]; if (getAnchorValue != undefined) { if (getAnchorValue.innerHTML == jsToday) { var classValue = getAnchorValue.parentNode.parentNode.className; getAnchorValue.parentNode.parentNode.className = classValue + ' active'; } } } } } function setActivePageStyle(){ var pageName = 'movies'; if (pageName == 'movies') { var scheduleTab = document.getElementById('mainNavSchedule'); var movieTab = document.getElementById('mainNavMovies'); scheduleTab.className = ''; movieTab.className = 'on'; var jsTodayCollection = document.getElementById('header-blog'); jsTodayCollection.className = 'movies'; var strongElem = document.createElement('strong'); var breadCrumb = document.getElementById('breadcrumbs'); var breadCrumbItem = breadCrumb.getElementsByTagName('li'); var breadCrumbItemAnchor = breadCrumbItem[2].getElementsByTagName('a')[0]; breadCrumbItemAnchor.href = 'movies-monthly.php'; strongElem.innerHTML = 'Movies'; breadCrumbItemAnchor.innerHTML = ''; breadCrumbItemAnchor.appendChild(strongElem); } else if (pageName == 'schedule') { var scheduleTab = document.getElementById('mainNavSchedule'); var breadCrumb = document.getElementById('breadcrumbs'); var breadCrumbItem = breadCrumb.getElementsByTagName('li'); var breadCrumbItemAnchor = breadCrumbItem[2].getElementsByTagName('a')[0]; breadCrumbItemAnchor.className = 'active'; } } function showCalendarHint(){ var calHeader = document.getElementById('show'); var newSpan = document.createElement('span'); newSpan.innerHTML = ''; } //genre   function setGenreNav(){ var pageType = 'shows';var movieNavigation = YAHOO.util.Dom.getElementsByClassName('schedule-navigation');var movieNavigationItems = movieNavigation[0].getElementsByTagName('li'); for(i=0; i < movieNavigationItems.length; i++){if(movieNavigationItems[i].className == pageType){movieNavigationItems[i].getElementsByTagName('a')[0].className = 'active';}}} function init(){ viewScheduleBy(); setViewSelected(); setMonthView(); printCSS(); checkToday(); showHideCalender(); setGenreNav(); var findAMC = new findSchedule('find-amc','Find AMCTV in your area!'); var canadianSchedule = new findSchedule('canadian-schedule','Canadian Schedule'); }