/////////////////////////// QUICK HELPER FUNCTIONS /////////////////////////////// // quick IE browser detection function isMSIE() { return (/MSIE (\d+\.\d+);/.test(navigator.userAgent)); } // get a reference to a flash movie function getFlashMovie(id) { var movie = null; if (isMSIE()) { movie = window[id]; } else { movie = document[id]; } return movie; }; /////////////////////////////// OPEN WINDOW /////////////////////////////// function popBlankOrSelf(url) { // if it's the podcast url or mailto return self if (url.indexOf("itpc://") > -1 || url.indexOf("mailto:") > -1) return "_self"; var fileExtension = getFileExtension(url); // if there's a file extension and it's a typical browser recognized extension, load it in self if (fileExtension.length > 0 && (fileExtension == "html" || fileExtension == "htm" ) ) return "_self"; // otherwise return blank return "_blank"; } function getFileExtension(filename) { var fileExtension = ""; if (filename.lastIndexOf(".") > 0 && filename.lastIndexOf(".") < filename.length - 1) { fileExtension = filename.substr(filename.lastIndexOf(".") + 1); } return fileExtension; } function popWin(url, features, target) { var didWindowOpen = false; var hasFeatures = false; if (typeof features == 'object') { for (var feature in features) { // check that the key is actually on this object if (features.hasOwnProperty(feature)) { hasFeatures = true; } } } else if (typeof features == 'string' && features.length > 0) { hasFeatures = true; } // this is the format for possible features: toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=500,height=500 features = (hasFeatures) ? features : "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1"; //features = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1"; var windowtarget = target || popBlankOrSelf(url); didWindowOpen = window.open(url, windowtarget, features); if (!didWindowOpen) { alert("It looks like this window couldn't open. Please disable your popup blocker and try again."); } } function popWinSimple(url, width, height) { // detect google chrome and add 50px of height (because Chrome mistakenly counts height as outerHeight) if (Boolean(window.chrome)) height += 50; var didWindowOpen = window.open(url, '_blank', 'toolbar=0,location=1,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=' + width + ',height=' + height); if (!didWindowOpen) { alert("It looks like this window couldn't open. Please disable your popup blocker and try again."); } } ///////////////////////////////// Donation ///////////////////////////////// var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/; function showDonation(html, width, height, downloadLink, isInDemo, isInGreenhouse) { if (downloadLink.length > 0) height -= 15; resizeDonationBox(width, height); centerDonationBox(width + 20, height + 20); // add 20px because the real width and height is 20px larger (counting the padding) if (IE6) document.getElementById('donationBox').className = 'donationBox-ie6'; document.getElementById('donationBox').style.visibility = 'visible'; document.getElementById('donationBox').innerHTML += ''; $iframe = $(html).appendTo($("#donationBox")); if (downloadLink.length > 0) { var additionalPath = isInDemo ? "../../" : (isInGreenhouse ? "../" : ""); document.getElementById('donationBox').innerHTML += '\
'; } // if the window height is less than the site height, fit the embed form to the screen - subtract the padding if ($(window).height() < height) { $iframe.load(function() { $iframe.attr("height", $(window).height() - 80); }); } // hack to fix scrolling in an iframe using safari // http://kb.tableausoftware.com/articles/issue/scroll-bars-in-embedded-views-do-not-work-in-safari $("#donationBox iframe").on("mousewheel", function() {} ); return false; } function hideDonation() { // hack to fix scrolling in an iframe using safari $("#donationBox iframe").off("mousewheel", function() {} ); document.getElementById('donationBox').style.visibility = 'hidden'; document.getElementById('donationBox').innerHTML = ''; } function closeDonationScreen() { getFlashMovie('main_flash').closeDonationScreen(); // call the function in flash to remove and hide the video } function resizeDonationBox(width, height) { document.getElementById('donationBox').style.width = width + "px"; // if the window height is less than the site height, fit the embed form to the screen - subtract the padding if ($(window).height() < height) { $("#donationBox").height($(window).height() - 80); } else { $("#donationBox").height(height); } } function centerDonationBox(width, height) { document.getElementById('donationBox').style.marginLeft = (-1 * width / 2) + "px"; if ($(window).height() < height) { document.getElementById('donationBox').style.marginTop = (-1 * $(window).height() / 2) + 40 + "px"; } else { document.getElementById('donationBox').style.marginTop = (-1 * height / 2) + "px"; } } ///////////////////////////////// VIDEO ///////////////////////////////// var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/; function showVideo(html, width, height, downloadLink, isInDemo, isInGreenhouse) { if (downloadLink.length > 0) height -= 15; resizeVideoBox(width, height); centerVideoBox(width + 20, height + 20); // add 20px because the real width and height is 20px larger (counting the padding) if (IE6) document.getElementById('videoBox').className = 'videoBox-ie6'; document.getElementById('videoBox').style.visibility = 'visible'; document.getElementById('videoBox').innerHTML += ''; document.getElementById('videoBox').innerHTML += html; if (downloadLink.length > 0) { var additionalPath = isInDemo ? "../../" : (isInGreenhouse ? "../" : ""); document.getElementById('videoBox').innerHTML += '\ '; } // hack to fix scrolling in an iframe using safari // http://kb.tableausoftware.com/articles/issue/scroll-bars-in-embedded-views-do-not-work-in-safari $("#videoBox iframe").on("mousewheel", function() {} ); return false; } function hideVideo() { // hack to fix scrolling in an iframe using safari $("#videoBox iframe").off("mousewheel", function() {} ); document.getElementById('videoBox').style.visibility = 'hidden'; document.getElementById('videoBox').innerHTML = ''; } function closeVideoScreen() { getFlashMovie('main_flash').closeVideoScreen(); // call the function in flash to remove and hide the video } function resizeVideoBox(width, height) { document.getElementById('videoBox').style.width = width + "px"; document.getElementById('videoBox').style.height = height + "px"; } function centerVideoBox(width, height) { document.getElementById('videoBox').style.marginLeft = (-1 * width / 2) + "px"; document.getElementById('videoBox').style.marginTop = (-1 * height / 2) + "px"; } function showMediaPlayerEmbedVideo(html, width, height, localIsInGreenhouse) { isInGreenhouse = localIsInGreenhouse; document.getElementById('mediaPlayerContainer').innerHTML = '\