var subscriptionPage = "/subscribe"; var homepageVersion = 10144; var isFeedbackOn = false; function showFeedback(variation) { if(!isFeedbackOn) { isFeedbackOn = true; var marginLeft = (document.body.clientWidth - 404)/2; document.getElementById("fbbox").style.left = marginLeft + 'px'; document.getElementById("fbbox").style.display = ''; document.getElementById("fbbox").src = '/feedback/' + variation; new PopupCover(); } } function inArray(needle, haystack) { var length = haystack.length; for(straw in haystack) { if(haystack[straw] == needle) return true; } return false; } function closeFeedback() { isFeedbackOn = false; document.getElementById("fbbox").style.display = 'none'; document.getElementById("fbbox").src = ''; PopupCover.close(); } function showLoginBox() { document.getElementById('loginBox').src = '/loginbox'; document.getElementById('loginBox').style.display = ""; if("innerHeight" in window) { marginLeft = 4*(window.innerWidth-492)/5; marginTop = (window.innerHeight-268)/10; } else { marginLeft = 4*(document.documentElement.clientWidth-492)/5; marginTop = (document.documentElement.clientHeight-268)/10; } if(marginTop < 5) { marginTop = 5; } document.getElementById("loginBox").style.position = "fixed"; document.getElementById("loginBox").style.left = marginLeft+"px"; document.getElementById("loginBox").style.top = marginTop+"px"; } function closeLoginBox() { document.getElementById('loginBox').style.display = 'none'; document.getElementById('loginBox').src = ''; PopupCover.close(); } function showAffiliatesPopup(linkTag) { if(!linkTag) { linkTag = "CommissionJnction"; affiliateLinkTag = "affiliateLinkTag=Default"; } else { affiliateLinkTag = "affiliateLinkTag=" + linkTag; } track("affiliateskClick", affiliateLinkTag); var marginLeft = (document.body.clientWidth - 531)/2; document.getElementById("affiliatesPopup").style.left = marginLeft + "px"; document.getElementById("affiliatesPopup").style.display = "block"; document.getElementById("affiliateTextLink").innerHTML = "http://www.abcmouse.com/" + linkTag; new PopupCover(); } function closeAffiliatesPopup() { document.getElementById("affiliatesPopup").style.display = "none"; PopupCover.close(); } function onVideoLinkClick(getPos, file, hideSignup, videoPlayerId, tracking) { if(/\.swf$/.test(file)) { var pos = {x: 0, y: 0};//videoPos(file); if(!getPos) { var wWidth, wHeight; if("innerHeight" in window) { wWidth = window.innerWidth; wHeight = window.innerHeight; } else { wWidth = document.documentElement.clientWidth; wHeight = document.documentElement.clientHeight; } var x = VideoPlayer.META_DATA.width; var y = VideoPlayer.META_DATA.height; if(videoPlayerId == 1) { x = 1005; y = 610; } pos.x = wWidth / 2 - x / 2; pos.y = wHeight / 2 - y / 2; //document.getElementById('seeallvideos').style.display = "none"; } new VideoPlayer(pos.x, pos.y, videoPlayerId).start(file, !getPos, (hideSignup == null) ? 0 : hideSignup, 0); new PopupCover(); } else { var config = {}; if(file == 'phonics_webinar_12fps.f4v' || hideSignup == true) { config.showSignUpBtn = false; } videoPlayer = new FlowVideoPlayer(); videoPlayer.page = tracking; videoPlayer.play(file, config); new PopupCover(); } } function PopupCover() { //PopupCover.coverCount++; if(PopupCover.activeCover != null) return; PopupCover.activeCover = this; //if(PopupCover.activeCover != null) return; var cover = document.createElement("div"); cover.className = "popupcover"; this.close = function() { cover.parentNode.removeChild(cover); PopupCover.activeCover = null; }; document.body.appendChild(cover); //cover.setAttribute('onclick', closePopup()); } PopupCover.activeCover = null; PopupCover.close = function() { if(PopupCover.activeCover != null) { PopupCover.activeCover.close(); } }; function gotoRegistration(type) { if(type == "videoPlayerSignUpButton") { track("regclick", "src=" + type, subscriptionPage + "/video_sign_up_button"); } else if(type == "mouseAndPointerTutorial") { track("regclick", "src=" + type, subscriptionPage + "/mouse_and_pointer_sign_up"); } else { var extraTracking = ""; if(/video:/.test(type)) extraTracking = "/" + type.slice("video:".length); track("regclick", "src=" + type, subscriptionPage + extraTracking); } } function track(tag, kvp, redirectUrl) { var vars = {tag: tag, kvp: kvp}; if(redirectUrl != null) { ajax('/xml/track.php', vars, function(){ if(typeof(redirectUrl) == 'function') { redirectUrl.call(); } else { location.href = redirectUrl; } }); } else { ajax('/xml/track.php', vars, function(){}); } } function showPopup(url, width, height, stylePosition, parent_div, position) { var position = position || getCenteredPosition(width, height, (stylePosition) ? stylePosition : ""); var popupIframe = createElement("div", {id: "abcmouse-popup-iframe"}); //var popupIframe = document.getElementById("popup"); //popupIframe.src = url; popupIframe.innerHTML = ''; // //popupIframe.contentWindow.location.replace(url); popupIframe.style.zIndex = "100"; popupIframe.width = width + "px"; popupIframe.height = height + "px"; popupIframe.style.position = (stylePosition) ? stylePosition : "fixed"; popupIframe.style.top = position.y + "px"; popupIframe.style.left = position.x + "px"; popupIframe.style.display = "block"; if(parent_div) { if(typeof parent_div == "string") parent_div = document.getElementById(parent_div); if(parent_div) parent_div.appendChild(popupIframe); } else { document.body.appendChild(popupIframe); } new PopupCover(); //trace('parent_div: '); } function closePopup() { var popupIframe = document.getElementById("abcmouse-popup-iframe"); if(popupIframe == null) return; //popupIframe.src = ""; popupIframe.style.display = "none"; //popupIframe.contentWindow.innerHTML = ""; popupIframe.parentNode.removeChild(popupIframe); PopupCover.close(); } function closeTestimonialBox() { closePopup(); } function getCenteredPosition(width, height, stylePosition) { var wWidth, wHeight; if("innerHeight" in window) { wWidth = window.innerWidth; wHeight = window.innerHeight; } else { wWidth = document.documentElement.clientWidth; wHeight = document.documentElement.clientHeight; } var position = {x: 0, y: 0}; position.x = (wWidth - width) / 2; position.y = (wHeight - height) / 2; position.x = (position.x < 0) ? 0 : position.x; position.y = (position.y < 0) ? 0 : position.y; if(stylePosition == "absolute") { var scrollingPosition = getScrollXY(); position.x += scrollingPosition.x; position.y += scrollingPosition.y; } return position; } function getScrollXY() { var scrOfX = 0, scrOfY = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant scrOfY = window.pageYOffset; scrOfX = window.pageXOffset; } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) { //DOM compliant scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft; } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) { //IE6 standards compliant mode scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft; } return {x: scrOfX, y: scrOfY}; } function showSurveyPopup(videoPlayerId) { return; var source = "unknown"; if((getCookie("survey-completed") == "" && homepageVersion != 88 && homepageVersion != 89 && homepageVersion != 134 && homepageVersion != 151) || videoPlayerId == -10) { if((getCookie("survey-popup") != "09.19.18") || videoPlayerId == -10 || videoPlayerId == -20) { if(videoPlayerId >= 0) { source = "videoClose-Other"; } else if(videoPlayerId == -1) { source = "autopop"; } else if(videoPlayerId == -10) { source = "faqs"; } else if(videoPlayerId == -20) { source = "offerviewer"; } else { source = "videoClose"; } showPopup('/survey-popup/' + source,591,1300, "absolute"); setCookie("survey-popup","09.19.18",365); new PopupCover(); return true; } } else if((homepageVersion == 175 || homepageVersion >= 186) && getCookie("firstMonthFree") != "" && videoPlayerId == -20) { showFirstMonthFreePopup(); } return false; } function closeSurveyPopup() { closePopup(); PopupCover.close(); if(document.getElementById("surveyPopup")) { document.getElementById("surveyPopup").style.display = "none"; document.getElementById("holidayOfferPopupCover").style.display = "none"; } } function closeInfoPopup() { if(typeof closePopup == "function") { closePopup(); } } function showSurveyErrorMessage() { if(document.getElementById("errorsPopup") != null) return; var errorMessage = '
' + '
' + '
' + 'Oops!' + '
' + '
' + '
' + '
' + '
Please answer all 3 survey questions to continue.
' + '
' + '' + '
' + '
' + '
' + '
'; var errorsDiv = document.createElement("div"); errorsDiv.innerHTML = errorMessage; var position = getCenteredPosition(560, 233); errorsDiv.style.position = "fixed"; errorsDiv.style.zIndex = "500"; errorsDiv.style.left = position.x + "px"; errorsDiv.style.top = position.y + "px"; document.body.appendChild(errorsDiv); } function closeSurveyErrorMessage() { var error = document.getElementById("errorsPopup"); if(error) error.parentNode.removeChild(error); } function gotoURL(url) { if(/MSIE/i.test(navigator.userAgent)) { window.location = url; } else { window.location.replace(url); } } function setCookie(c_name, value, expiredays) { var exdate = new Date(); exdate.setDate(exdate.getDate() + expiredays); document.cookie = c_name+ "=" + encodeURI(value) + ";domain=abcmouse.com;path=/" + ((expiredays==null) ? "" : ";expires=" + exdate.toUTCString()); } function getCookie(c_name) { if (document.cookie.length>0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) c_end = document.cookie.length; return decodeURIComponent(document.cookie.substring(c_start,c_end)); } } return ""; } function deleteCookie(name, path, domain) { if (getCookie(name) != "") document.cookie = name + "=" + ( ( path ) ? ";path=" + path : "") + ( ( domain ) ? ";domain=" + domain : "" ) + ";expires=Thu, 01-Jan-1970 00:00:01 GMT"; } function showElement(element, useVisibility) { element = document.getElementById(element); if(element == null) return; useVisibility = (useVisibility) ? useVisibility : false; element.style.display = "block"; if(useVisibility) { element.style.visibility = "visible"; } } function hideElement(element, useVisibility) { element = document.getElementById(element); if(element == null) return; useVisibility = (useVisibility) ? useVisibility : false; if(useVisibility) { element.style.visibility = "hidden"; } else { element.style.display = "none"; } } //function that replaces window.onload function onLoad(func) { var old_onload; if(window.addEventListener) { window.addEventListener("load", func); } else if(window.attachEvent) { window.attachEvent("onload", func); } else { old_onload = window.onload; window.onload = function() { if(typeof old_onload == "function") old_onload(); func(); }; } } function ABCmousePopup(config) { this.title = config.title || "ABCmouse.com"; this.className = config.className || ""; this.text = config.text || ""; this.buttons = config.buttons || []; this.popup = null; } ABCmousePopup.prototype.show = function() { var popup_header, popup_body, popup_text, popup_title, popup_buttons, popup_button, button, close_icon, position, self = this; this.popup = createElement("div", { className: "store_popup " + this.className}); close_icon = createElement("div", { className: "close_icon"}); close_icon.onclick = function() { self.close(); } popup_title = createElement("div", { className: "store_popup_title"}); popup_title.innerHTML = this.title; popup_header = createElement("div", { className: "store_popup_header"}); popup_header.appendChild(popup_title); popup_header.appendChild(close_icon); this.popup.appendChild(popup_header); popup_body = createElement("div", { className: "store_popup_body" }); popup_text = createElement("div", { className: "store_popup_text" }); popup_text.innerHTML = this.text; popup_buttons = createElement("div", { className: "store_popup_buttons" }); for(var index in this.buttons) { button = this.buttons[index]; popup_button = createElement("img", { className: button.className || "popup_btn", src: button.src }); popup_button.onclick = (function(button) { return function() { if(button.closeButton === true) { self.close(); } else if(typeof button.onclick == "function") { button.onclick(self); } }; }(button)); popup_buttons.appendChild(popup_button); } popup_body.appendChild(popup_text); popup_body.appendChild(popup_buttons); this.popup.appendChild(popup_body); this.popup.appendChild(createElement("div", { className: "store_popup_footer" })); position = getCenteredPosition(this.popup.offsetWidth || 576, this.popup.offsetHeight || 303); this.popup.style.top = position.y + "px"; this.popup.style.left = position.x + "px"; document.body.appendChild(this.popup); new PopupCover(); }; ABCmousePopup.prototype.close = function() { this.popup.parentNode.removeChild(this.popup); PopupCover.close(); };