            // set global language text 
            globalTxt_Share = "Share";
            globalTxt_Watch = "Watch";
            globalTxt_Player = "Player Only"
            global_bSkinSwitch = true;
            
            if (parent.location.href.indexOf("index_cbn_espanol_tv.aspx") >=0) {
                globalTxt_Share = "Compartir";
                globalTxt_Watch = "Ver Video";
                globalTxt_Player = "Player";
                global_bSkinSwitch = false;
            }
            
            function WTsdcLog(resource)
            {
            if (WT){
                    if (!(navigator.appName=="Microsoft Internet Explorer"&&parseInt(navigator.appVersion)<4)){
	                DCS.dcsref=gI18n?dcsEscape(window.document.url, I18NRE):window.document.url;
                    }

                    DCSext.resource=resource;

                    var sdcData = new ajaxdata(dcsGetUrl());
                    sdcData.getData(); 
                   
                }
            }

            function ChangeSettings_v2() { 
	             //f_player.document.location.href = "/media/videowindow.aspx?c=t&s=" + document.getElementById("source").value + "&a=" + document.getElementById("audio").value + "&title=" + escape(document.getElementById("vidtitle").value);
	             loadvideo(document.getElementById("source").value,'',document.getElementById("audio").value);
            } 

            function StoreLink_v2(source,audio,title) { 
                document.getElementById("source").value=source; 
                if (audio) document.getElementById("audio").value=audio; 
                if (title) document.getElementById("vidtitle").value=title; 
            } 
            
            function SendToFriend(video, title, image) {
			    url = "/media/sendtofriend.aspx?v=" + video + "&title=" + title + "&image=" + image;
			    wSendtofriend = window.open(url, "SendToFriend","status,height=400,width=700,scrollbars=yes,toolbar=no,status=no");
                // if the current window still has focus, shift focus to the sendtofriend window
                if (window.focus && wSendtofriend) {wSendtofriend.focus()}
            }
            
            function downloadVideo(video) {
                url = "/media/download.aspx?file=" + video;
                 wDownloadVideo = window.open(url, "DownloadVideo","status,height=400,width=700,scrollbars=yes,toolbar=no,status=no");
                // if the current window still has focus, shift focus to the sendtofriend window
                if (window.focus && wDownloadVideo) {wDownloadVideo.focus()}
              
            }
            
            function sendFeedback(language) {
                url = "/media/player_feedback"
                if (language != "") {
                    url = url + "_" + language;
                }
                url = url + ".aspx";
                wFeedbackWin = window.open(url, "FeedbackWindow","status,height=400,width=710,scrollbars=yes,toolbar=no,status=no");
                // if the current window still has focus, shift focus to the sendtofriend window
                if (window.focus && wFeedbackWin) {wFeedbackWin.focus()}
              
            }
            
            // loading indicator functions
            function showLoading() {
                toggleBox("loading", 1);
            }
            function hideLoading() {
                toggleBox("loading", 0);
            }

            function loadmediawithinfo(s,b,a,ad){
                if (!b) b='';
                if (!a) a='';
                if (!ad) ad='';
                // store source for any future clicks on the info tab
                StoreLink_v2(s,a);
                // switch to info tab
				switchToInfo(s);
				// load the video
                loadvideo(s,b,a,ad);
            }          

			function updatePlayerOptions(source,download,audio,title, imagelink) {
				
				// update the option bar beneath the video
				var po = document.getElementById("playeroptions");
				sTarget = "";
				if (po) {
					sHTML = "<table cellpadding=0 cellspacing=0 border=0 align=center><tr>"; // use a table instead of div in order to center the options
					// link to full screen (we need access to the actual path to the currently playing 
					if (URL){
                       // trim the asx file location and querystring info to 
                       // allow playing in WMP directly without loading in player frame on FireFox
                        if (URL.toLowerCase().indexOf('videopath=') >=0) {
                           URL=URL.substring(URL.toLowerCase().indexOf('videopath=')+10);
                           if (URL.indexOf('&')>=0) {
                       	       URL= URL.substring(0,URL.indexOf('&'));
					       }
					   } 
					   sHTML += "<td class='layout_player_options_fullscreen'><a href='" + URL + "'><img src='/images/vod/spacer.gif' height='28' width='28' border=0 alt='" + globalTxt_Player + "' title='" + globalTxt_Player + "' align='top'></a>&nbsp;<a href='" + URL + "' " + sTarget + " class='layout_player_options_link'>" + globalTxt_Player + "</a> &nbsp;</td>";
					}	
					// link to download			 
					if (download != "") {
						sHTML += "<td class='layout_player_options_download'><a href='#' onClick=\"downloadVideo('" + download + "'); return false;\"><img src='/images/vod/spacer.gif' height='28' width='28' border=0 alt='Download' title='Download' align='top'></a>&nbsp;<a href='#' onClick=\"downloadVideo('" + download + "'); return false;\" class='layout_player_options_link'>Download</a> &nbsp;</td>";
					}
					// link to audio / video
					if (audio != "") { 
					    // toggle between audio and video version
					    if (URL.indexOf('.wma') == -1) {
						   sHTML += "<td class='layout_player_options_audio'><a href='javascript: parent.loadmediawithinfo(\"" + audio + "\",\"\",\"t\");'><img src='/images/vod/spacer.gif' height='28' width='28' border=0 alt='Audio' title='Audio' align='top'></a>&nbsp;<a href='javascript: parent.loadmediawithinfo(\"" + audio + "\",\"\",\"t\");'  class='layout_player_options_link'>Audio</a> &nbsp;</td>";
						} else {
						   sHTML += "<td class='layout_player_options_play'><a href='javascript: parent.loadmediawithinfo(\"" + source + "\",\"\",\"\");'><img src='/images/vod/spacer.gif' height='28' width='28' border=0 alt='" + globalTxt_Watch + "' title='" + globalTxt_Watch + "' align='top'></a>&nbsp;<a href='javascript: parent.loadmediawithinfo(\"" + source + "\",\"\",\"\");'  class='layout_player_options_link'>" + globalTxt_Watch + "</a> &nbsp;</td>";
						}
					}
					// link to share
					title = title.replace(/'/gi,"&#39");
					title = title.replace(/\"/gi,"");
					sHTML += "<td class='layout_player_options_email'><a href='#' onClick='SendToFriend(\"" + source + "\",\"" + title + "\",\"" + imagelink + "\");return false;' class='layout_player_options_link'><img src='/images/vod/spacer.gif' height='28' width='28' border=0 alt='" + globalTxt_Share + "' title='" + globalTxt_Share + "' align='top'></a>&nbsp;<a href='#' onClick ='SendToFriend(\"" + source + "\",\"" + title + "\",\"" + imagelink + "\"); return false;' class='layout_player_options_link'>" + globalTxt_Share + "</a></td>";
					sHTML += "</tr></table>";
				
					// update the option bar div				
					po.innerHTML= sHTML;
				}
			}		

            
            function changeOption (sDivName,iNumHighlight,iNumDivs) {
                // sDivName - name of div containing the option selected
                // iNumHighlight - the number of the div to highlight
                // iNumDivs - the number of total divs for this option
                
                // here - loop through and highlight correct div
                for (i=1; i<=iNumDivs; i++) {
                    sCurrentDiv = sDivName + "_" + i.toString();
                    oDiv = MM_findObj(sCurrentDiv);
                    if (oDiv) {
                        // retrieve current div class 
                        sDivClass= oDiv.className;
                        // default the div to normal unless it is the selected tab
                        if (i==iNumHighlight) { 
                            sDivClass = sDivClass.replace("normal","highlight");
                        } else {    
                             // remove any highlights 
                            sDivClass = sDivClass.replace("highlight","normal");
                        }
                        // assign new class to the tab
                        oDiv.className = sDivClass;
                    }
                }
            }

            function loadSubmenu(sMenu) {
                // load the sub menu for a specified category
                f_nav_browse.location.href = "/media/vod_submenu.aspx?menu=" + sMenu;
                // highlight the correct tab
                highlightSubmenuTab(sMenu);
                return false;
                    
            }

		    function setOptions () {
		        // highlight the currently selected text size option
		        optionNum = 2;
		        textsize = getCookie("TextSize");
                if (textsize) {
                    switch (textsize)
                    {
                        case "small":
                            optionNum = 3;
                            break;
                            
                        case "large":
                            optionNum = 1;
                            break;
                        
                        default:
                            optionNum = 2;
                            break;
                    }
                }
                changeOption('optionSize',optionNum,3);
                
                if (global_bSkinSwitch) {
                    // highlight the currently selected color scheme option
		            optionNum = 2;
		            currentskin = getCookie("SkinName");
                    if (currentskin) {
                            switch (currentskin)
                            {
                                case "light":
                                    optionNum = 1;
                                    break;
                                    
                                default:
                                    optionNum = 2;
                                    break;
                            }
                    } 
                    changeOption('optionColor',optionNum,2);
                }
                                
                // highlight the currently selected connection speed
		        optionNum = 2;
	            currentspeed = getCookie("PlayerSettings");
                if (currentspeed) {
                        switch (currentspeed)
                        {
                            case "l":
                                optionNum = 3;
                                break;
                            case "h":
                                optionNum = 1;
                                break;
                            default:
                                optionNum = 2;
                                break;
                        }
                } 
                changeOption('optionSpeed',optionNum,3);
		    }
		    
		    function changeTabs (sTabName,iNumHighlight,iNumTabs) {
                // sTabName - name of objects containing tabs
                // iNumHighlight - the number of the tab to highlight
                // iNumTabs - the number of total tabs
               
                // here - loop through and highlight correct tabs
                for (i=1; i<=iNumTabs; i++) {
                    sCurrentTab = sTabName + "_" + i.toString();
                    oTabText = document.getElementById(sCurrentTab).firstChild;
                    if (oTabText && oTabText.className && oTabText.className.indexOf('linktext_tab')==0) {
                        // retrieve current tab class 
                        sTabClass= oTabText.className;
                        // remove any highlights from previously highlighted tabs
                        sTabClass = sTabClass.replace("_highlight","");
                        // default the tab to normal unless it is the selected tab
                        if (i==iNumHighlight) { 
                            sTabClass = sTabClass + "_highlight";
                        }
                        // assign new class to the tab
                        oTabText.className = sTabClass;
                    }
                    
                }
            }
            
            function changeTabBg (sTabName,iNumHighlight,iNumTabs) {
                // sTabName - name of objects containing tabs
                // iNumHighlight - the number of the tab to highlight
                // iNumTabs - the number of total tabs
                
                // here - loop through and highlight correct tabs
                for (i=1; i<=iNumTabs; i++) {
                    sCurrentTab = sTabName + "_" + i.toString();
                    oTab = MM_findObj(sCurrentTab);
                    if (oTab) {
                        // retrieve current tab class 
                        sTabClass= oTab.className;
                        // remove any corner highlights from tabs adjacent to previously highlighted tabs
                        sTabClass = sTabClass.replace("_corner","");
                        // default the tab to normal unless it is the selected tab
                        if (i==iNumHighlight) { 
                            sTabClass = sTabClass.replace("normal","highlight");
                        } else {    
                             // remove any highlights 
                            sTabClass = sTabClass.replace("highlight","normal");
                            if (i==(iNumHighlight+1)) {
                                // highlight the adjacent tab's top left corner
                                sTabClass = sTabClass.replace("normal","normal_corner");
                            }
                        }
                        // assign new class to the tab
                        oTab.className = sTabClass;
                    }
                }
            }


            function connectionSwitch(sSpeed){
                // sSpeed = h/m/l
               
                changebandwidth(sSpeed);
                //var switchbutton=document.getElementById("switchbutton");
            }
            
            
            function getSearchResults() {
                // retrieve the search results
                f_nav_browse.location.href = "/media/results.aspx?search=" + MM_findObj('txtSearch').value; 
            }            

            // live and vod functions
            
            function switchToLive(iChannel) {
                // dependencies:
                //      iNumTabs_Info - number of tabs for the info panel
                
                // load info tab
                f_info.document.location.href = 'cbn_live_playlist.aspx?channel=' + iChannel;
                changeTabs('tabInfo',1,iNumTabs_Info);
                // load live video
                var sourceLink = "cbnlive-" + iChannel;
                StoreLink_v2(sourceLink,"","CBN Live"); 
                // load the video (use global highorlow variable)
                loadvideo(sourceLink,highorlow,'','');
            }

            /*
            function switchToVod() {
                StoreLink_v2('http://www.cbn.com/media/playlist_main_features.asx',"","Features");
                newvideo('http://www.cbn.com/media/playlist_main_features.asx');
                f_info.document.location.href = "features.aspx";
                changeTabs('tabInfo',2,iNumTabs_Info);
            }
            */
            
            function switchToInfo (sSource) {
                 // dependencies:
                 //      iNumTabs_Info - number of tabs for the info panel
                
                
                // load the currently playing clip info into the info window
                // if parameter is not passed, retrieve last recorded played clip
                if (sSource == "") {
                    sSource = MM_findObj('source').value;
                } 
                // load info page
                sLink = "/media/infowindow.aspx?s=" + sSource;
                f_info.document.location.href = sLink;
                // update page tab
                changeTabs('tabInfo',4,iNumTabs_Info);
            }      
            
	
            function loadInfo(sPageURL, iTabToHighlight) {
                // dependencies:
                //      iNumTabs_Info - number of tabs for the info panel
                
                // load the specified page into the Info Window
                f_info.document.location.href = sPageURL;
                // highlight the specified info tab
                changeTabs('tabInfo',iTabToHighlight,iNumTabs_Info);
            }
            
