﻿        
        var postbackElement;
        var m_sATPHExpandPanel=null;
        

        var myVar;		
        var myTimeoutID;	
        var myNode, myData;	
        var m_oPodWindow=null;    // Reference to the window's object
        var m_sPodWindowFeatures='location=1,menubar=1,status=1,resizable=1,scrollbars=1,width=750,height=600';
        var m_sPodWindowName='_blank';
        var m_controlToFocus=null;
        	
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded);

        function beginRequest(sender, args) {
            
            postbackElement = args.get_postBackElement();
            
            //alert("PostBackElement: " + postbackElement.id + " __EVENTTARGET: " + document.getElementById("__EVENTTARGET").value + " __EVENTARGUMENT: " + document.getElementById("__EVENTARGUMENT").value);
            document.body.style.cursor = "wait";
              
            eventargument = document.getElementById("__EVENTARGUMENT").value;
            
            if (typeof(postbackElement) === "undefined") {
                return;
            } 
            //else if (postbackElement.id.toLowerCase().indexOf('external') > -1) {
            else if (postbackElement.id == "PodcastMenu") 
            {    
            //Only set opacity if it is NOT an add podcast
                if ((eventargument.indexOf("add") == -1))
                {
                    setStoryGridOpacity(eventargument);
                }  
            }
            else if (postbackElement.id.indexOf("PodcastMenu") > -1)
            { 
                
                if ((eventargument.indexOf("\\subscribe;") > -1) || (eventargument.indexOf("show;") > -1) || (eventargument.indexOf("edit;") > -1) || (eventargument.indexOf("refresh;") > -1) || (eventargument.indexOf("share;") > -1) || (eventargument.indexOf("view;") > -1))
                {
                    setStoryGridOpacity(eventargument);
                }
                else if ((eventargument.indexOf("subscribe;") > -1) && (eventargument.indexOf("\\") < 0))
                {                
                    //Here if this is only a subscribe menu item and no other options
                    setStoryGridOpacity(eventargument);
                }
            }
            else if (postbackElement.id.indexOf("StoryGridView") > -1)
            {
                    setStoryGridOpacity(eventargument);
            }
            else if (postbackElement.id.indexOf("StorySearchImage") > -1)
            {
                    setStoryGridOpacity("StorySearchImage");
            }
            // 2008/12/15 MH Removed PDWSubscribeButton since we have already updated the story panel
            //else if ((postbackElement.id.indexOf("PDSubscribeButton") > -1) || (postbackElement.id.indexOf("PDWSubscribeButton") > -1))
            else if ((postbackElement.id.indexOf("PDSubscribeButton") > -1))
            {
                    setStoryGridOpacity(eventargument);
            }
            else if ((postbackElement.id.indexOf("RelPodShowStories") > -1) || (postbackElement.id.indexOf("RelPodSubscribe") > -1) || (postbackElement.id.indexOf("RelPodShare") > -1))
            {
                    setStoryGridOpacity("X");
            }
            else if ((postbackElement.id.indexOf("PDFinishButton") > -1))
            {
                    if (document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_PodcastDetailPodcastKey").innerHTML == document.getElementById("StoryGridPodcastKey").innerHTML)
                    {
                    //alert("PodcastDetailPodcastKey: " + document.getElementById("PodcastDetailPodcastKey").innerHTML);
                        setStoryGridOpacity(document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_PodcastDetailPodcastKey").innerHTML);
                    }
            }

            //alert('Postback :' + postbackElement + ' ID: ' + postbackElement.id + ' Value: ' + postbackElement.value + 'Event arg: ' + document.forms[0].__EVENTARGUMENT.value);

            //alert('beginRequest Called ' + postbackElement);
        }
        
        function pageLoaded(sender, args) {
            
            var updatedPanels = args.get_panelsUpdated();
            if (typeof(postbackElement) === "undefined") {
                return;
            } 
            
            //alert('updated Panels' + updatedPanels.length);
            
            for (upi=0; upi < updatedPanels.length; upi++) {
                //alert('Updated Panel ID ' + (upi+1) + ' of ' + updatedPanels.length + ' : ' + updatedPanels[upi].id);
                //if (updatedPanels[upi].id.toLowerCase().indexOf('menuupdatepanel') > -1) {
                if (updatedPanels[upi].id == "MenuUpdatePanel") {
                    //alert('Podcast Panel Updated ' + updatedPanels[upi].id);
                    //alert('Podcast Panel Updated Text ' + updatedPanels[upi].innerHTML.substring(updatedPanels[upi].innerHTML.indexOf("SubscribePodcastMenun33")));
                    //PodcastMenu_Load_MouseOver(); //MH 2008/07/23 removed to speed Mouseover
                    SubscribePodcastMenu_Load_MouseOver();
                }
                else if (updatedPanels[upi].id == "SubscribeURLPanelUpdatePanel") {
                     //alert('Podcast Panel Updated ' + updatedPanels[upi].id);
                     urltolaunch = document.getElementById("SubscribePodcastURL");
                     launchPodcatcher(urltolaunch.href);
                     //alert('URL ' + urltolaunch.href);
                }
                else if (updatedPanels[upi].id == "ATPHUpdatePanel") {
                     //alert('ATPHUpdatePanel ' + updatedPanels[upi].id);
                     m_sATPHExpandPanel = document.getElementById("ATPHExpandPanel");
                     if (m_sATPHExpandPanel.value.indexOf("expand") >= 0) {
                        //alert('Outside expand ATPHExpandPanel.value ' + m_sATPHExpandPanel.value);
                        //var tabNumber = m_sATPHExpandPanel.value.substring("expand".length+1,"expand".length+2);
                        var tabNumber = m_sATPHExpandPanel.value.substring(7,8);
                        //alert('tabNumber = ' + tabNumber + ' substring ' + m_sATPHExpandPanel.value.substring(7,8));
                        if ((+tabNumber) >= 0) {
                            var tabctrl = $find("ActionsTabContainer");
                            //alert('Inside expand ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                            tabctrl.set_activeTabIndex((+tabNumber));
                        }
                        try
                        { 
                            $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
                        }
                        catch (e)
                        {
                            //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
                        }
                        //alert('ATPHExpandPanel.value for expand ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                     }
                     if (m_sATPHExpandPanel.value.indexOf("focus") >= 0) {
                        m_controlToFocus = m_sATPHExpandPanel.value.substring(m_sATPHExpandPanel.value.indexOf("focus")+"focus".length+1);                      
                        //alert("Setting focus on " + m_controlToFocus);
                        // Set the focus on the appropriate control.  Give it time to render first.  
                        //myTimeoutID=setTimeout("try { document.getElementById(m_controlToFocus).focus();} catch (e) {myTimeoutID=setTimeout('alert(m_controlToFocus);try { document.getElementById(m_controlToFocus).focus();} catch (e1) {}',3500)}",50);
                        //myTimeoutID=setTimeout("try { document.getElementById(m_controlToFocus).focus();} catch (e) {}",3000);
                        //myTimeoutID=setTimeout("try { document.getElementById(m_controlToFocus).focus();} catch (e) {myTimeoutID=setTimeout('try { document.getElementById(m_controlToFocus).focus();} catch (e) {alert();}',3000)}",1000);
                        myTimeoutID=setTimeout("try { document.getElementById(m_controlToFocus).focus();} catch (e) {}",4000);
                     }
                     else if (m_sATPHExpandPanel.value.indexOf("collapse") >= 0) {
                        var tabNumber = m_sATPHExpandPanel.value.substring("collapse".length+1);
                        if ((+tabNumber) >= 0) {
                            var tabctrl = $find("ActionsTabContainer");
                            //alert('Inside collapse ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                            tabctrl.set_activeTabIndex((+tabNumber));
                        }
                        try
                        { 
                            $find("ActionsCollapsiblePanelExtenderBehavior").collapsePanel();
                        }
                        catch (e)
                        {
                            //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior collapsePanel()\n\n" + e.number + "\n" + e.message +  "\n");
                        }
                        //alert('ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                     }
                }
                else if (updatedPanels[upi].id == "StoriesHeaderPanelUpdatePanel") 
                {
                     ///alert('StoriesHeadingPanelUpdatePanel Updated ' + updatedPanels[upi].id);
                     headmsg = document.getElementById("StoryHeadingMessage");
                     //alert('HeadingMessage: ' + headmsg.innerHTML);
                     headmsg.style.visibility="hidden";
                     document.getElementById("StoryGridProgress").style.visibility="hidden";
                }
                else if (updatedPanels[upi].id == "VisuallyImpairedUpdatePanel") 
                {
                     ActionMenuUpdate();
                }
            }
           
            document.body.style.cursor = "default";

        }
        
//        function onClickTabContainerHandler(sender, e)
//        {             
//            try
//            { 
//                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
//            }
//            catch (e)
//            {
//                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
//            }
//            //alert('OnClickTab Tab expanded ' + m_sATPHExpandPanel.value + ' sender ' + sender + ' \n tab index ' + sender.get_activeTabIndex() + ' \n tab header text ' + sender.get_activeTab().get_headerText() + ' \n tab header tab ' + sender.get_activeTab().get_headerTab() + ' \n tab header tab ' + sender.get_activeTab().get_owner() );
//            //alert('OnClickTab Tab expanded ');
//        }
        //function onClickCloseTab(tabid, stepid)
        function onClickCloseTab(sender, e)
        {
            //alert('Tab ' + tabid + ' Step ' + stepid);
            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").collapsePanel();
            }
            catch (e)
            {
                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior collapsePanel()\n\n" + e.number + "\n" + e.message +  "\n");
            }
            m_sATPHExpandPanel = document.getElementById("ATPHExpandPanel");
            var tabctrl = $find("ActionsTabContainer");
            m_sATPHExpandPanel.value = "collapse|" + tabctrl.get_activeTabIndex();
            //alert('OnClickCloseTab Tab collapsed ' + m_sATPHExpandPanel.value + ' control name' + m_sATPHExpandPanel + ' \n tab ' + tabctrl.get_activeTabIndex());
            __doPostBack("ATPHExpandPanel", '');
        } 
        
        function hideCurrentTab(sender, e)
        {
            m_sATPHExpandPanel = document.getElementById("ATPHExpandPanel");
            var tabctrl = $find("ActionsTabContainer");
            var tabnum = tabctrl.get_activeTabIndex();
            tabctrl.set_activeTabIndex(0);
            tabctrl.get_tabs()[tabnum].set_enabled(false);
        } 

        function checkActionPanelExpanded()
        {
            m_sATPHExpandPanel = document.getElementById("ATPHExpandPanel");
            //alert('checkActionPanelExpanded -' + m_sATPHExpandPanel + '- value -' + m_sATPHExpandPanel.value);
            if (m_sATPHExpandPanel.value.indexOf("expand") >= 0) {
                var tabNumber = m_sATPHExpandPanel.value.substring("expand".length+1);
                if ((+tabNumber) >= 0) {
                    //alert('Inside checkActionPanelExpanded ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                    var tabctrl = $find("ActionsTabContainer");
                    //alert('Inside 2 checkActionPanelExpanded tabctrl ' + tabctrl + ' Tab ' + tabNumber);
                    tabctrl.set_activeTabIndex((+tabNumber));
                }            
                try
                { 
                    $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
                }
                catch (e)
                {
                    //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
                }
                //alert('After checkActionPanelExpanded ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
           }
           else if (m_sATPHExpandPanel.value.indexOf("collapse") >= 0) {
                var tabNumber = m_sATPHExpandPanel.value.substring("collapse".length+1);
                if ((+tabNumber) >= 0) {
                    //alert('Inside checkActionPanelExpanded COLLAPSE ATPHExpandPanel.value ' + m_sATPHExpandPanel.value + ' Tab ' + tabNumber);
                    var tabctrl = $find("ActionsTabContainer");
                    //alert('Inside 2 checkActionPanelExpanded COLLAPSE tabctrl ' + tabctrl + ' Tab ' + tabNumber);
                }
                //We assume the panel is collapsed so don't call collapse
                try
                { 
                    $find("ActionsCollapsiblePanelExtenderBehavior").collapsePanel();
                }
                catch (e)
                {
                    //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior collapsePanel()\n\n" + e.number + "\n" + e.message +  "\n");
                }
           }
        }
        
        //function reportActionPanelStatus(panelStatus)
        //{
            //Must be called After a new tab is set
            
            //m_sATPHExpandPanel = document.getElementById("ATPHExpandPanel");
            //var tabctrl = $find("ActionsTabContainer");
            //var tabnum = tabctrl.get_activeTabIndex();
            //var controltabNumber = m_sATPHExpandPanel.value.substring("expand".length+1);
            
            //alert('pre reportActionPanelStatus ' + m_sATPHExpandPanel.value + ' control name' + m_sATPHExpandPanel + ' \n tab ' + tabctrl.get_activeTabIndex());
            
//            if ((m_sATPHExpandPanel.value.indexOf(panelStatus) < 0) || (+tabnum != +controltabNumber))
//            {
//                //alert('reportActionPanelStatus ' + m_sATPHExpandPanel.value + ' control name' + m_sATPHExpandPanel + ' \n tab ' + tabctrl.get_activeTabIndex());
//                m_sATPHExpandPanel.value = panelStatus + "|" + tabnum;
//                __doPostBack("ATPHExpandPanel", '');
//            }
            
            //m_sATPHExpandPanel.value = "collapse|" + tabctrl.get_activeTabIndex();
            //alert('OnClickCloseTab Tab collapsed ' + m_sATPHExpandPanel.value + ' control name' + m_sATPHExpandPanel + ' \n tab ' + tabctrl.get_activeTabIndex());
        //}
                        
        function onClickLoginButton()
        {
                        
            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
            }

            var tabctrl = $find("ActionsTabContainer");
            tabctrl.get_tabs()[3].set_enabled(true);
            
            tabctrl.set_activeTabIndex(3);
            
            //if (navigator.appName!="Netscape")    
            myTimeoutID=setTimeout("try { document.getElementById('ActionsTabContainer_LoginPanelTab_LoginView1_Login1_UserName').focus();} catch (e) {}",2000);
            //try
            //{ 
                //document.getElementById("ActionsTabContainer_LoginPanelTab_LoginView1_Login1_UserName").focus();
            //}
                //catch (e)
            //{
            //}
                //alert('Username');
            //}
        }
        
        function onClickAccountButton()
        {
                        
            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
            }

            var tabctrl = $find("ActionsTabContainer");
            tabctrl.get_tabs()[5].set_enabled(true);
            
            tabctrl.set_activeTabIndex(5);
            
            //myTimeoutID=setTimeout("try { document.getElementById('ActionsTabContainer_LoginPanelTab_LoginView1_Login1_UserName').focus();} catch (e) {}",2000);

        }
        
        function onClickCreateUserLink()
        {
            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior \n\n" + e.number + "\n" + e.message +  "\n" + $find("ActionsCollapsiblePanelExtenderBehavior"));
            }

            var tabctrl = $find("ActionsTabContainer");
            
            tabctrl.set_activeTabIndex(0);
        }
        
        function onChangePodcastDetail(truefalse)
        {
            //alert(' Value: ' + Boolean(truefalse));
            //Enable the Save and Cancel Buttons
            document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDCancelButton").disabled=Boolean(truefalse);
            document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDFinishButton").disabled=Boolean(truefalse);
            //alert('Client Changed: ' +  id + ' Value: ' + y);
            
        }
        
        function JumpToPodcastDetail()
        {
            //alert("Hello");        
            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
                //alert("Failed to find ActionsCollapsiblePanelExtenderBehavior expandPanel()\n\n" + e.number + "\n" + e.message +  "\n");
            }
            var tabctrl = $find("ActionsTabContainer");
            tabctrl.get_tabs()[2].set_enabled(true);
            
            tabctrl.set_activeTabIndex(2);
            
            //window.location = "#StoriesInCurrentPodcastHeading";
            window.location = "#PodcastDetailActionTabHeading";
            
            //reportActionPanelStatus("expand");
            
            //myTimeoutID=setTimeout("try { document.getElementById('ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_HeaderContainer_ActionsHeaderPanelImage2').focus();} catch (e) {}",2000);
            //myTimeoutID=setTimeout("try { document.getElementById('BetaComment').focus();} catch (e) {}",3000);
            //myTimeoutID=setTimeout("try { document.getElementById('PodcastDeatilTableHeader').focus();} catch (e) {}",3000);
            
        }
        
        function JumpToPreferences()
        {

            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
            }
            var tabctrl = $find("ActionsTabContainer");
            tabctrl.get_tabs()[1].set_enabled(true);
            
            tabctrl.set_activeTabIndex(1);
            
            window.location = "#PersonalPreferencesActionTabHeading";
   
        }
        function JumpToSharePodcast()
        {

            try
            { 
                $find("ActionsCollapsiblePanelExtenderBehavior").expandPanel();
            }
            catch (e)
            {
            }
            
            var tabctrl = $find("ActionsTabContainer");
            tabctrl.get_tabs()[4].set_enabled(true);
            
            tabctrl.set_activeTabIndex(4);
                        
            window.location = "#ShareItTabHeading";
            
            myTimeoutID=setTimeout("try { document.getElementById('ActionsTabContainer_ShareItTab_RecipientName').focus();} catch (e) {}",2000);

//            try
//            {
//                document.getElementsByID("ActionsTabContainer_ShareItTab_RecipientName").focus();
//            }
//            catch (e)
//            {
//                alert('ActionsTabContainer_ShareItTab_RecipientName ' + e);
//            }
   
        }
        function JumpToPodcastMenu(menuName)
        {
        
            var item = document.getElementById(menuName);

            var x = item.getElementsByTagName("a");
            
            try
            {
                if (menuName.indexOf("SubscribePodcastMenu2") < 0)
                {
                    x[1].focus();
                }  
                else
                {
                    x[0].focus();
                }
            }
            catch (e)
            {
                //alert('Not Found x[1].innerHTML ' + x[1].innerHTML);
            }
        }
        
        function JumpToLocation(location)
        {
            window.location = "#StoriesInCurrentPodcastHeading";
               //window.location = location;

        }
        
//        function JumpToPodcastSubMenu(menuName)
//        {
//        
//            var item = document.getElementById(menuName);

//            var x = item.getElementsByTagName("a");
//            
//            try
//            {
//                x[1].focus();
//            }
//            catch (e)
//            {
//                //alert('Not Found x[1].innerHTML ' + x[1].innerHTML);
//            }
//        }
        //SubscribePodcastMenu2
        
        function ActionMenuUpdate()
        {
            var item = document.getElementById("ActionMenu");
            //alert("ActionMenu " + item.id);
            
            var x = item.getElementsByTagName("a");
            
            for(i=0;i<x.length;++i){
                if (x[i].accessKey != null) {
                     x[i].onfocus=function anonymous() {SetActionMenuVisible();}
                     //alert("Action Menu [" + i + "].onfocus = " + x[i].onfocus + " Action Menu [].accesskey = " + x[i].accessKey);
                     return;
               }
            }
            
//            alert("Action Menu [0].onclick = " + x[0].onclick + "Action Menu [0].accesskey = " + x[0].accessKey );
//            alert("Action Menu [0].onfocus = " + x[0].onfocus + "Action Menu [1].innerHTML = " + x[0].innerHTML );

//            x = item.getElementsByTagName("tr");
//            
//            alert("x.length tr " + x.length);
//            alert("x[0] " + x[0] + " innerhtml " + x[0].innerHTML + " onmouseover " + x[0].onmouseover);
//            alert("x[1] " + x[1] + " innerhtml " + x[1].innerHTML + " onmouseover " + x[1].onmouseover);
//            alert("x[2] " + x[2] + " innerhtml " + x[2].innerHTML + " onmouseover " + x[2].onmouseover);
//            
//            x[0].onclick=function anonymous() {alert("Hello tr");};
//            x[0].onmouseover=function anonymous() {alert("Hello Mouse tr");};
//            x[0].onfocus=function anonymous() {alert("Hello tr");};
//            x[1].onfocus=function anonymous() {alert("Hello tr");};
//            x[1].onmouseover=function anonymous() {alert("Hello Mouse tr");};
//            x[1].onfocus=function anonymous() {alert("Hello tr");};
//            
//            alert("after x[0] " + x[0] + " onmouseover " + x[0].onmouseover);
//            alert("after x[1] " + x[1] + " onmouseover " + x[1].onmouseover);


        }
        
        function SetActionMenuVisible()
        {
            var item = document.getElementById("VisualImpaired");
            //alert("VisualImpaired " + item.id);
            
            var cascadeMenu = getCookie("CascadeMenu");
            
            //alert("getCookie = " + cascadeMenu + " all cookies = " + document.cookie);
            //If they display this menu then turn Cascade menus off if no cookie or it is on.
            
            //if (cascadeMenu == null || (cascadeMenu != "ON" && cascadeMenu != "ONALWAYS"))
            if (cascadeMenu == null || (cascadeMenu != "ONALWAYS"))
            {                
                setCookie("CascadeMenu","OFF", 1000);
                                
//                __doPostBack("ActionMenu","CascadeMenu;OFF");

                document.getElementById("hiddenCascadeMenuOffButton").click();
                                
                item.style.left = "6px";

                return true;            
                //alert("After setCookie = " + cascadeMenu + " all cookies = " + document.cookie);
            }
            else
            {                
                setCookie("CascadeMenu","ON", 1000);
                
                cascadeMenu = getCookie("CascadeMenu");
            
                //alert(cascadeMenu + " all cookies = " + document.cookie);

            }
            item.style.left = "6px";
            
            return false;
        }
        
        function DisablePodcastDetailButtons(truefalse)
        {
            //Enable the Save and Cancel Buttons
            document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDCancelButton").disabled=Boolean(truefalse);
            document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDFinishButton").disabled=Boolean(truefalse);
            if(!Boolean(truefalse))
            {
                try
                {
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_PDMessage").style.visibility="hidden";
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDCancelButton").style.color="#2d2a72";
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDFinishButton").style.color="#2d2a72";
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDSubscribeButton").style.color="#2d2a72";
                }
                catch (e) {}
            }
            else
            {
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDCancelButton").style.color="#ACA899";
                document.getElementById("ActionsTabContainer_PodcastDetailTab_PodcastDetailWizard_StartNavigationTemplateContainerID_PDFinishButton").style.color="#ACA899";
            }
        }
        function DisablePreferencesButtons(truefalse)
        {
            //Enable the Save and Cancel Buttons
            document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_StepNextButton").disabled=Boolean(truefalse);
            document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_CancelButton").disabled=Boolean(truefalse);
            if(!Boolean(truefalse))
            {
                document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_PrefMessage").style.visibility="hidden";
                document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_StepNextButton").style.color="#2d2a72";
                document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_CancelButton").style.color="#2d2a72";
            }
            else
            {
                document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_StepNextButton").style.color="#ACA899";
                document.getElementById("ActionsTabContainer_PreferencesTab_PreferencesWizard_StepNavigationTemplateContainerID_CancelButton").style.color="#ACA899"; 
            }
        }
        function DisableShareItButtons(truefalse)
        {
            //Enable the Save Buttons
            document.getElementById("ActionsTabContainer_ShareItTab_ShareItSendButton").disabled=Boolean(truefalse);
            if(!Boolean(truefalse))
            {
                document.getElementById("ActionsTabContainer_ShareItTab_ShareItSendButton").style.color="#2d2a72";
            }
            else
            {
                document.getElementById("ActionsTabContainer_ShareItTab_ShareItSendButton").style.color="#ACA899";
            }
        }
        function DisableAccountButtons(truefalse)
        {
            //Enable the Save Buttons
            document.getElementById("ActionsTabContainer_AccountTab_AccountSaveButton").disabled=Boolean(truefalse);
            if(!Boolean(truefalse))
            {
                document.getElementById("ActionsTabContainer_AccountTab_AccountSaveButton").style.color="#2d2a72";
            }
            else
            {
                document.getElementById("ActionsTabContainer_AccountTab_AccountSaveButton").style.color="#ACA899";
            }
        }

        function PodcastMenu_HoverStatic(item) {
            var x = item.id.replace(/PodcastMenu/, "SubscribePodcastMenu");
            //alert("At MH Hover Menu" + item.id + " Typeofitem.id " + typeof(item.id) + "x " + x);
            other = document.getElementById(x);
            //alert("Other " + other.id);
            Menu_HoverRoot(other);
            Menu_HoverStatic(item);
        }
        function PodcastMenu_Unhover(item) {
            var x = item.id.replace(/PodcastMenu/, "SubscribePodcastMenu");
            other = document.getElementById(x);
            Menu_Unhover(other);
            Menu_Unhover(item);
        }
        
        function SubscribePodcastMenu_HoverStatic(item) {
        
            var x = item.id.replace(/SubscribePodcastMenu/, "PodcastMenu");
            other = document.getElementById(x);
            Menu_HoverRoot(other);
                        
            var node = Menu_HoverRoot(item);    
            var data = Menu_GetData(item);      
            myNode=node;                        
            myData=data;                        
            if (!data) return;                  
   			
            myVar = item;
            //alert('node = ' + myNode + ' data = ' + myData);                      		
            myTimeoutID=setTimeout("My_DelayExpandMenu(myNode,myData)",150);     
        }
        
        // 2008/10/24 not used
        function SubscribePodcastMenu_Focus(item) {
            if (item && item.focus) {
                var pos = WebForm_GetElementPosition(item);
                var parentContainer = Menu_FindParentContainer(item);
                alert('parentContainer ' + parentContainer);                       

//                if (!parentContainer.offset) {
//                    parentContainer.offset = 0;
//                }
//                var posParent = WebForm_GetElementPosition(parentContainer);
//                var delta;
//                if (pos.y + pos.height > posParent.y + parentContainer.offset + parentContainer.clippedHeight) {
//                    delta = pos.y + pos.height - posParent.y - parentContainer.offset - parentContainer.clippedHeight;
//                    PopOut_Scroll(parentContainer, delta);
//                }
//                else if (pos.y < posParent.y + parentContainer.offset) {
//                    delta = posParent.y + parentContainer.offset - pos.y;
//                    PopOut_Scroll(parentContainer, -delta);
//                }
//                PopOut_HideScrollers(parentContainer);
//                item.focus();
            } 
            alert('item ' + item);                       
            var node = Menu_HoverRoot(item);    
            var data = Menu_GetData(item);      
            myNode=node;                        
            myData=data;                        
            if (!data) return;                  
   			
            myVar = item;
            alert('node = ' + myNode + ' data = ' + myData);                      		
            myTimeoutID=setTimeout("My_DelayExpandMenu(myNode,myData)",150);     
        }
        
        
        function SubscribePodcastMenu_Unhover(item) {
            clearTimeout(myTimeoutID);      
            var x = item.id.replace(/SubscribePodcastMenu/, "PodcastMenu");

            other = document.getElementById(x);

            Menu_Unhover(item);
            //Code below comes from MS .NET Menu_Unhover but remove the Menu_Collapse
            //Field, otherwise it flashes.
            
            var node = (other.tagName.toLowerCase() == "td") ?
            other:
            other.cells[0];
            var nodeTable = WebForm_GetElementByTagName(node, "table");
            if (nodeTable.hoverClass) {
                WebForm_RemoveClassName(nodeTable, nodeTable.hoverClass);
            }
            node = nodeTable.rows[0].cells[0].childNodes[0];
            if (node.hoverHyperLinkClass) {
                WebForm_RemoveClassName(node, node.hoverHyperLinkClass);
            }
            //Menu_Collapse(node);
       }
       
        function My_DelayExpandMenu(node, data)
        {	
            __disappearAfter = 100;  //data.disappearAfter;
            Menu_Expand(node, data.horizontalOffset, data.verticalOffset);
        }
  	
        function My_Menu_Unhover(item)
        {		
            clearTimeout(myTimeoutID);
            Menu_Unhover(item);
        }
        
        function PodcastMenu_Load_MouseOver() {
       
            var item = document.getElementById("PodcastMenu");
            var x = item.getElementsByTagName("tr");
//            alert("Podcast Menu Item = " + item + "Var X = " + x + " Number of items = " + x.length);
            for(i=0;i<x.length;++i){
//                alert("x[" + i + "].onmouseover=" + x[i].onmouseover);
//                var z = x[i].onmouseover;
//                alert("z " + z + " onmouseover type " + typeof(x[i].onmouseover));
                if (x[i].onmouseover != null) {
                    //var y = String(x[i].onmouseover).search(/Menu_HoverStatic/);
                    //alert("found at " + y);
                    if (String(x[i].onmouseover).search(/Menu_HoverStatic/) >=0) {
                        x[i].onmouseover = function anonymous() {
                            PodcastMenu_HoverStatic(this);
                            }
                    }
                    //w = String(x[i].onmouseover).replace("Menu_HoverStatic", "MH_Menu_HoverStatic");
                    //alert("w = " + w + "searching length = " + w.length);
                    //x[i].onmouseover = String(x[i].onmouseover).replace("Menu_HoverStatic", "MH_Menu_HoverStatic");;
                    //alert("after replacement x[" + i + "].onmouseover=" + x[i].onmouseover);
                }
                if (x[i].onmouseout != null) {
                    if (String(x[i].onmouseout).search(/Menu_Unhover/) >=0) {
                        x[i].onmouseout = function anonymous() {
                            PodcastMenu_Unhover(this);
                            }
                    }
                }    
            }
        }
        
        function SubscribePodcastMenu_Load_MouseOver() {
              
            var item = document.getElementById("SubscribePodcastMenu");
            var x = item.getElementsByTagName("tr");
            for(i=0;i<x.length;++i){
                if (x[i].onmouseover != null) {
                    if (String(x[i].onmouseover).search(/Menu_HoverStatic/) >=0) {
                        x[i].onmouseover = function anonymous() {
                            SubscribePodcastMenu_HoverStatic(this);
                            }
                    }
                }
                if (x[i].onmouseout != null) {
                    if (String(x[i].onmouseout).search(/Menu_Unhover/) >=0) {
                        x[i].onmouseout = function anonymous() {
                            SubscribePodcastMenu_Unhover(this);
                            }
                    }
                }    
            }
            
//            x = item.getElementsByTagName("a");
//            for(i=0;i<x.length;++i){
//                //alert('x[' + i +'] = ' + x[i]);
//                //if (x[i]) {
//                if (x[i] > ' ') {
//                        //alert('x[' + i +'].onfocus = ' + x[i].onfocus);
//                        x[i].onfocus = function anonymous() {
//                            SubscribePodcastMenu_Focus(this);
//                            }
//                        //alert('x[' + i +'].onfocus = ' + x[i].onfocus);
//                            //MH 2008/10/24 added focus hides submenu
//                        x[i].onblur = function anonymous2() {
//                            SubscribePodcastMenu_Unhover(this);
//                            }
//               }
//            }
            
        }
        
        // The following snippet works around a problem where FloatingBehavior
        // doesn't allow drops outside the "content area" of the page - where "content
        // area" is a little unusual for our sample web pages due to their use of CSS
        // for layout.
        
        //MH - Should fix Modal Popup drag behavior (doesn't!!!)
        
        function setBodyHeightToContentHeight() {
            document.body.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
        setBodyHeightToContentHeight();
        $addHandler(window, "resize", setBodyHeightToContentHeight);  
        }//MH 2008/07/31 moved this so it includes 2 lines above.
        
        function launchPodcatcher(PodcastURL) {
            try
            {
                m_oPodWindow = window.open(PodcastURL, m_sPodWindowName, m_sPodWindowFeatures);
                
                if (m_oPodWindow == null)
                {
                    alert("Failed to Launch Podcatcher.\nCheck to see if Pop-ups are disabled and try again.\n");
                }
            }
            catch(e)
            {
                alert("Failed to Launch Podcatcher.\nCheck to see if Pop-ups are disabled and try again.\n"+ e.number+ "\n" + e.message);
            }
        }
        
        function copytoclipboard(sender) {
            //alert ('Item to copy ' + sender); 
            
            var text2copy = "";
            
            try {
                var element = document.getElementById(sender);
                text2copy = element.href;
                //alert ('Element href to copy ' + text2copy);
            }
            catch(err) {
                if (typeof(sender) == 'object') {
                    text2copy = sender.href;
                    //alert ('Sender is object' + text2copy);
                }
                else if (typeof(sender) == 'string') {
                    text2copy = sender;
                    //alert ('Sender is string' + text2copy);
                }
                else {
                    text2copy = sender.toString();
                    //alert ('Sender is Number/boolean ' + text2copy);
                }
            }
            
            
            //alert ('Text to copy ' + text2copy);
            
            if (window.clipboardData) {
                window.clipboardData.setData("Text",text2copy);
                alert ('Link has been copied to your clipboard');

            } else {
                var flashcopier = 'flashcopier';
                if(!document.getElementById(flashcopier)) {
                    var divholder = document.createElement('div');
                    divholder.id = flashcopier;
                    document.body.appendChild(divholder);
                }
                document.getElementById(flashcopier).innerHTML = '';
                var divinfo = '<embed src="images/_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
                document.getElementById(flashcopier).innerHTML = divinfo;
                alert ('Link has been copied to your clipboard');
            }
        }

// Set an opacity level for an element
// (where level is a number 0-100)

        function setOpacity(elem, level ) 
        {    
            // If filters exist, then this is IE, so set the Alpha filter
	        if (elem.filters)
		        elem.style.filter = 'alpha(opacity=' + level + ')';
		        //elem.style.filters.alpha.opacity = level;
            // Otherwise use the W3C opacity property
	        else
		        elem.style.opacity = level / 100;
        }
        
        function setStoryGridOpacity(PodcastKey) 
        { 
                headmsg = document.getElementById("StoryHeadingMessage");
                
                if (PodcastKey.indexOf(document.getElementById("StoryGridPodcastKey").innerHTML) > -1)
                {
                    headmsg.innerHTML = "Refreshing&nbsp;&nbsp;&nbsp;";
                    headmsg.style.visibility="visible";
                    document.getElementById("StoryGridProgress").style.visibility="visible";
                }
                //This is not a simple StoryGrid Page command
                else if (PodcastKey > ' ' && PodcastKey.indexOf("Page") < 0 && PodcastKey.indexOf("StoryPages") < 0)
                {
                    if (PodcastKey.indexOf("StorySearchImage") > -1)
                    {
                        headmsg.innerHTML = "Searching&nbsp;&nbsp;&nbsp;";
                        document.getElementById("StoryHeading").innerHTML = "&nbsp;";
                    }
                    else
                    {
                        headmsg.innerHTML = "Retrieving&nbsp;&nbsp;&nbsp;";
                        document.getElementById("StoryHeading").innerHTML = "Podcast&nbsp;";
                    }
                    headmsg.style.visibility="visible";
                    document.getElementById("StoryGridProgress").style.visibility="visible";
                }
                setOpacity(document.getElementById("PodcastStoryGridDiv"),60);
        }
          
        function ShareStory(sharetype,partnerkey,sitekey,providerkey,hl1)
        {
            var storyinfo =  sharetype + '|' + partnerkey + '|' + sitekey + '|' + providerkey + '|' + hl1;
            //alert('ShareStory: ' + storyinfo);
            __doPostBack("ATShareStory", storyinfo);
            
            return false;
        }
        
        function RelatedPodcastShowStories(podcastKey)
        {
        //no longer used
            //alert('RelatedPodcastShowStories: ' + podcastKey)
            __doPostBack("ATRelatedPodcastShowStories", podcastKey);
            
            return false;
        }
        
        function RelatedPodcastSubscribePodcast(podcastKey)
        {
        //no longer used
            //alert('RelatedPodcastSubscribePodcast: ' + podcastKey)
            __doPostBack("ATRelatedPodcastSubscribePodcast", podcastKey);
            
            return false;
        }
        
        function BrowserCompatibility()
        {
        
            //alert('Sys.Browser.name: ' + Sys.Browser.name + 'Sys.Browser.version: ' + Sys.Browser.version + ' userAgent ' + navigator.userAgent );
        
            if ((Sys.Browser.name =='Microsoft Internet Explorer' && Sys.Browser.version >= 7) || (Sys.Browser.name =='Firefox' && Sys.Browser.version >= 3) || (Sys.Browser.name =='Safari' && Sys.Browser.version >= 525))
            {
            }
            else
            {
                document.write("<span >NewsworthyAudio works best with: <br /> Internet Explorer v7 " + 
                "<a href='http://www.microsoft.com/windows/downloads/ie/getitnow.mspx' target='_blank' style='font-weight: normal;'>(download)</a>" +
                "<br />FireFox v3 " +
                "<a href='http://www.mozilla.com/en-US/products/download.html?product=firefox-3.0.1&os=win&lang=en-US' target='_blank' style='font-weight: normal;'>(download)</a>" +
                " and " + " <br />Safari v3.1.2 WebKit 525 " + 
                "<a href='http://www.apple.com/safari/download/' target='_blank' style='font-weight: normal;'>(download)</a>" +
                "<br />You are running:<br />" + Sys.Browser.name + " Version: " + Sys.Browser.version + "</span>");
            //document.write("<div class='podcast_static_menu_panel_msg'><span >NewsworthyAudio works best with <br /> IE 7 <br />FireFox v3 and <br />Safari v5</span></div>");
            }        
        }

        function hideBrowserCompatibilityItems()
        {
            if (Sys.Browser.name =='Firefox' || Sys.Browser.name =='Safari')
            {
                 document.getElementById("StoryExpander").style.visibility="hidden";
                 document.getElementById("StoriesHeaderPanelImage").style.visibility="hidden";
            }
        }
               
        function clearSearch()
        {
            id = document.getElementById("RelPodcastSearch");
            if (id.value == "Podcast Search")
            {
                id.value = "";
            }
            
            id.style.textAlign = "left";
//            else
//            {
//                id.style.textAlign = "center";
//            }
        }
             
        function clearStorySearch()
        {
            id = document.getElementById("StorySearch");
            if (id.value == "Story Search")
            {
                id.value = "";
            }
            
            id.style.textAlign = "left";
        }
        
        function NWAClick2Listen(PartnerKey,ArticleGUID,ArticleURL,PartnerSpecificParam,SiteKey,UserName,Environment,Debug)
        {
            if (ArticleURL == "")
            {
                nwamp3 = "true";
                SetC2LVisibility(PartnerKey,SiteKey,ArticleGUID);
            }
            
            //var s = PartnerKey + '-' + ArticleGUID + '-' + ArticleURL + '-' + PartnerSpecificParam + '-' + SiteKey + '-' + UserName + '-' + Environment + '-' + Debug;
            //alert(s);
            
            OpenC2LWindow(PartnerKey,ArticleGUID,ArticleURL,PartnerSpecificParam,SiteKey,UserName,Environment);
            
        }
        
        function setCookie(c_name,value,expiredays)
        {
        
            //alert("In setCookie " + c_name + "," + value + "," + expiredays);
            
            var exdate=new Date();
            exdate.setDate(exdate.getDate()+expiredays);
            document.cookie= c_name+ "=" +escape(value)+ 
                                ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) + "; path=/";
	        //document.cookie = name+"="+value+expires+"; path=/";
        }

        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 unescape(document.cookie.substring(c_start,c_end));
                } 
              }
            return "";
        }

        function deleteCookie(c_name) 
        {
	        setCookie(c_name,"",-1);
        }

        function deleteAllCookies()
        {
            var c=document.cookie.split(";");
            for(var i=0;i<c.length;i++)
            {
                var e=c[i].indexOf("=");
                var n=(e>-1?c[i].substr(0,e):c[i]);
                alert(n);
                //deleteCookie(n);
                document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT" + "; path=NewsworthyAudio.com";
                document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT" + "; path=/";
                document.cookie=n+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
            }
        }

        
        function LoadingPage()
        {
        
        document.write("NewsworthyAudio is loading...");
        
        }

