﻿function funShowExpandCollapse()
{
    window.document.getElementById("spanExpCollapse").style.display = "block";
}

function funOpenMetaData(userName,memberId)
{
if (window.screen.availWidth == 800)
window.open('http://www.foxfast.com/FoxCentral/aspxfiles/Login.aspx?_L=' + userName + '&_M=' + memberId,'metadata',''); // 'width=700,height=500,status=yes,scrollbars=yes,resizable=yes,top=40,left=40,alwaysRaised=yes');
else
window.open('http://www.foxfast.com/FoxCentral/aspxfiles/Login.aspx?_L=' + userName + '&_M=' + memberId,'metadata',''); // 'width=900,height=600,status=yes,scrollbars=yes,resizable=yes,top=40,left=40,alwaysRaised=yes');
}

function funopenfoxflyer(logonname, email)
{
//    if (logonname != "")
//    {
//        logonname = logonname.replace(/~@@~/g, "'");
//    }
//    if (email != "") 
//    {
//        email = email.replace(/~@@~/g, "'");
//    }
    window.open("../aspxfiles/FoxFlyerEmail.aspx", "foxflyer", "");
}


function funShowSeriesNav(strTitleObjObjId)
{
     var vardate = new Date();
     var strResult;
     strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","TitObjObjId=" + strTitleObjObjId + "~"+ vardate + "&Type=SeriesNav");
    if(window.document.getElementById("ctl00_ctl00_Menu1_divSeriesNav"))
    {
         window.document.getElementById("ctl00_ctl00_Menu1_divSeriesNav").innerHTML = strResult;
    } 
    
    $(function() {
		$("#seriesNavList").treeview({
		});
		if(window.document.getElementById("ulseriesexpand"))
		{
		    $("#ulseriesexpand").removeAttr("style");				
		    $("#ulseriesexpand").attr("src","display:block");
		}
		if(window.document.getElementById("ulseasonexpand"))
		{
		    $("#ulseasonexpand").removeAttr("style");				
		    $("#ulseasonexpand").attr("src","display:block");
		}
	});
   
}
function funTitleDetailsHome(Id)
{
    window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitObjObjId").value = Id;
    window.document.forms[0].action="TitleDetailsList.aspx";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
}
function funMoreNav(Id,strPageName)
{
    if(strPageName == "TitleCastCrew.aspx")
    {
        var vardate = new Date();
        funGetHtmlFromJQuery("Xmlhttp.aspx", "TitObjObjId=" + Id + "~" + vardate + "&Type=otherassetrightslevel3");
    }
    window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitObjObjId").value = Id;
    window.document.forms[0].action = strPageName;
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
}

//function to trim leading and trailing white spaces
function Trim(str)
{
     return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function funCreateXmlhttpObj()
{
    var oXMLHTTP = false;

    try
    {
        // Firefox, Opera 8.0+, Safari
        oXMLHTTP=new XMLHttpRequest();
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            oXMLHTTP=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e)
        {
            try
            {
                oXMLHTTP=new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e)
            {
                funBuildAlterMsg("Your browser does not support AJAX!", "OK")
                toggleVis('saveSearchDialog');
             }
        }
    }
    
    return oXMLHTTP;
}

/*  Common Method for getting the CheckBox values appended with comma separator. */
function funGetCheckedValues(objCheckBox, strHiddenVariable)
{   
    if(objCheckBox.checked)
    {
        window.document.getElementById(strHiddenVariable).value += objCheckBox.value + ",";
        
    }
    else
    {
        window.document.getElementById(strHiddenVariable).value = window.document.getElementById(strHiddenVariable).value.replace(objCheckBox.value+",","");
        window.document.getElementById("chkProductCategoryAll").checked = false;
    } 
}


function funGetValues(objCheckBox, strHiddenVariable)
{   
    var Id = objCheckBox.id;
    if(objCheckBox.checked)
    {
        strHiddenVariable.value += Id + ",";
    }
    else
    {
        strHiddenVariable.value = strHiddenVariable.value.replace(Id+",","");
    } 
}

function funLogout()
{  
    window.document.forms[0].action = "Login.aspx";
    window.document.forms[0].method = "post";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
}
function funAdvancedSearch()
{  
    window.document.forms[0].action = "AdvancedSearch.aspx";
    window.document.forms[0].method = "post";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
}


function funGetHtmlFromJQuery(pageName, parameters)
{ 
    var html = $.ajax({
                 url: pageName,
                 data: parameters,                         
                 async: false
                }).responseText;
    html = html.replace(html.substring(html.indexOf("<!DOC")-2),"");        
    
    return html;
}
//This Function is used to Delete and Insert Title into Favourites using Jquery
function funInsTitleintoFav(strTitleId, TitleName, WprTitleId, TvdProductType, obj)
{
    var strResult; 
    var vardate = new Date();
    if(obj.className == "favoff")
    {
        obj.className = "favon";
        obj.title = "remove from favorites";
        strResult = funGetHtmlFromJQuery("Xmlhttp.aspx", "TitleId=" + strTitleId + "~" + vardate + "&Type=Favourites");
        funPBTrends(TitleName, WprTitleId, TvdProductType, "", "addtofavorites", "", "", "", "", "");  
    }
    else
    {
        obj.title = "add to favorites";  
        obj.className = "favoff";
        strResult = funGetHtmlFromJQuery("Xmlhttp.aspx", "TitleId=" + strTitleId + "~" + vardate + "&Type=DeleteFav");
        funPBTrends(TitleName, WprTitleId, TvdProductType, "", "removefromfavorites", "", "", "", "", "");
    }
    
    funSessionExpiryNav(strResult);    
}
//This Function is used to Delete and Insert Title into Cart using Jquery
function funInsTitleintoCart(strTitleId,obj)
{
    var vardate = new Date(); 
    var strResult;
    var lblTitleInCart = window.document.getElementById("ctl00_ctl00_MainMenu1_lblTitleInCart");
    
    if(obj.className == "cartoff")
    {
        obj.className = "carton";
        obj.title = "remove from cart"       
        strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","TitleId=" + strTitleId+"~"+ vardate + "&Type=Cart");
    }
    else
    {
         obj.title = "add to cart"      
         obj.className = "cartoff";   
         strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","TitleId=" + strTitleId +"~"+ vardate +"&Type=DeleteCart");
    }
    
    if(lblTitleInCart != null && strResult != null)
    {
        var strTitCartCount = Trim(strResult);
        lblTitleInCart.innerHTML = (strTitCartCount == "1") ? strTitCartCount + " title" : strTitCartCount + " titles";
    }
    
    funSessionExpiryNav(strResult); 
}

function funNavPage(strPageName,strMode) {
    strMode = funReplaceWithActualChar(strMode);
    if(strPageName.toLowerCase() != "titlecart.aspx")
    {
        if(strMode == "Licensed Titles")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = strMode;
        }
        else if(strMode == "Favorites")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = strMode;
        }    
        else if(strMode == "New")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = strMode;
        } 
        else if(strMode == "Recently Viewed")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = strMode;
        } 
        else if(strMode == "Saved Searches")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = strMode;
        }
        else
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "All";
//            if (window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId") != null) {
//                window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId").value = "";
//            }
        }
        /*Conditions added for clearing Parent-Child flags on 02-02-2009 by Manihari*/
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild").value = "";
        }
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitleDetailsForCast") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitleDetailsForCast").value = "";
        } 
        if(strPageName.toLowerCase() == "screeningroom.aspx")
        {
            if(window.document.getElementById("hdnScreenNavMode"))
            {
                window.document.getElementById("hdnScreenNavMode").value = "menu";            
            }   
        }
        window.document.forms[0].action = strPageName;
        window.document.forms[0].submit();  
    }
    else
    {
        funNavToTitleAssetCartScreen('TitleCart');
    }  
}
function funNavPage1(id)
{
    if(FlagCheckForVideoPlay)
    {
        FlagCheckForVideoPlay = "Y";
    }
    window.document.location.href = "TitleDetailsHome.aspx?TitleId="+ id + "&Type=ScrR";
    return false;
}

// Doing Asyncronous PostBack for the TitleList Page.
function funTitleListAsyncronouPostBack(strClearHiddenVar)
{
    // Clearing the ParentChild Flag Hiddev Varaible when not required.
    if(strClearHiddenVar != "N")
    {
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild").value = "";
        }
    }
    
    window.document.forms[0].__VIEWSTATE.name= "";
    window.__doPostBack("ctl00_ctl00_BodyContent_updPanelMain","");
}

//CheckAll functionality which uses ID of the div in which the Checkboxes reside and the ID of the CheckAll checkbox
function funCheckAllJQuery(parentId,childId)
{
    $( "#" + childId + " :checkbox").attr('checked', $("#" + parentId).is(':checked'));
}

function funBuildSaveSearchMsg(Heading, txtSave, txtCancel, ScriptFunNameForSave)
{
     window.document.getElementById("saveSearchDialog").innerHTML = "<div class='top'></div>"+
        "<div class='body'>"+
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");'><img src='../images/close.gif' border='0' /></a></div>"+
            "<div class='modalContent'>"+
            	//<!-- put prompt text within p tags -->
                "<p>"+
                Heading +//"Save new title search as:"+
                "<input type='text' class='smallModalInput' id='titleSearchTitle' name='titleSearchTitle'  />"+
                "</p>"+
                //<!-- use 'affirmative' and 'negative' link classes for responses (funAdvSrchEvents)-->
                "<a href='#' onclick='javascript:return "+ScriptFunNameForSave+";' class='affirmative'>"+txtSave+"</a>"+
                //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");' class='negative'>"+txtCancel+"</a>"+
            "</div>"+
        "</div>"+
      "<div class='bot'></div>";
}

function funBuildAlterMsg(Msg, txtOk)
{
    window.document.getElementById("saveSearchDialog").innerHTML = "<div class='top'></div>"+
        "<div class='body'>"+
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");'><img src='../images/close.gif' border='0' /></a></div>"+
            "<div class='modalContent'>"+
            	//<!-- put prompt text within p tags -->
                "<p>"+
                Msg +//"Save new title search as:"+
                "</p>"+
                //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");' class='affirmative'>" + txtOk + "</a>" +
            "</div>"+
        "</div>"+
      "<div class='bot'></div>";
}

function funBuildAlterMsgWithAction(Msg, txtOk, ScriptFunNameForOk)
{
    window.document.getElementById("saveSearchDialog").innerHTML = "<div class='top'></div>"+
        "<div class='body'>"+
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");'><img src='../images/close.gif' border='0' /></a></div>"+
            "<div class='modalContent'>"+
            	//<!-- put prompt text within p tags -->
                "<p>"+
                Msg +//"Save new title search as:"+
                "</p>"+
                //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='javascript:return " + ScriptFunNameForOk + ";' class='affirmative'>" + txtOk + "</a>" +
            "</div>"+
        "</div>"+
      "<div class='bot'></div>";
}

function funBuildConfirmationMsg(Msg, txtOk, txtCancel, ScriptFunNameForOk)
{
    window.document.getElementById("saveSearchDialog").innerHTML = "<div class='top'></div>"+
        "<div class='body'>"+
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");'><img src='../images/close.gif' border='0' /></a></div>"+
            "<div class='modalContent'>"+
            	//<!-- put prompt text within p tags -->
                "<p>"+
                Msg +//"Save new title search as:"+
                "</p>"+
                //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='javascript:return "+ScriptFunNameForOk+";' class='affirmative'>"+txtOk+"</a>&nbsp;"+
                "<a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");' class='negative'>"+txtCancel+"</a>"+
            "</div>"+
        "</div>"+
      "<div class='bot'></div>";
}

function funBuildConfirmationMsgWithAction(Msg, txtOk, txtCancel, ScriptFunNameForOk, ScriptFunNameForCancel)
{
    window.document.getElementById("divSoftwareUpdateAlterMsg").innerHTML = "<div class='topwider'></div>" +
        "<div class='bodywider'>" +
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"divSoftwareUpdateAlterMsg\");'><img src='../images/close.gif' border='0' /></a></div>" +
            "<div class='modalContent1'>"+
            	//<!-- put prompt text within p tags -->
                "<p>"+
                Msg +//"Save new title search as:"+
                "</p>"+
                //<!-- using close link here again to cancel out of the dialog -->
                "<div style='text-align: center;'><a href='javascript:void(0);' onclick='javascript:return "+ScriptFunNameForOk+";' class='affirmative'>"+txtOk+"</a>&nbsp;"+
                "<a href='javascript:void(0);' onclick='javascript:return "+ScriptFunNameForCancel+";' class='negative'>"+txtCancel+"</a></div>"+
            "</div>"+
        "</div>"+
      "<div class='botwider'></div>";
}

function funBuildTermsConditionButton(ScriptFunName)
{
    window.document.getElementById("divBtnTermsConditions").innerHTML = "<div class='button'>"+
            "<a href='javascript:"+ScriptFunName+";'>"+
                "<img src='../images/btnAgree.gif' border='0' /></a></div>"+
        "<div class='button'>"+
            "<a href='javascript:funDisAgreeTermsConditions();'>"+
                "<img src='../images/btnDisagree.gif' border='0' /></a></div>";
}

function funGetAdvnSrchforCast(talentId, titobjobjId, talentName, TitleName, WprTitleId, TvdProductType, Level3callYN)
{
    //For web trends tracking
    funPBTrends(TitleName, WprTitleId, TvdProductType, "BiosDescription", talentName, "", "", "", "", "");
    if (titobjobjId && titobjobjId != "")
    {
        window.document.getElementById("hdnCastTitleObjectObjectId").value = titobjobjId;
        if (Level3callYN == "Y")
        {
            var vardate = new Date();
            funGetHtmlFromJQuery("Xmlhttp.aspx", "TitObjObjId=" + titobjobjId + "~" + vardate + "&Type=otherassetrightslevel3");
        }
    }
    window.document.getElementById("hdnCastTalentObjectObjectId").value = talentId;
    
    window.document.forms[0].action="TitleBios.aspx";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
    return false;
}
function funGetCastTitles(talentId, talentName, TitleName, WprTitleId, TvdProductType)
{
    // Function call to update the All Filter Option in Session_member_preference_type table when request for titles in this mode.
    funLeftFilter_SessionMemberPreference_Update('All');
    if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId") != null)
    {
        window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId").value = "";
    } 
    if(window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu"))
    {
        window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "";
        window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "All";
    }
    //For web trends tracking
    funPBTrends(TitleName, WprTitleId, TvdProductType, "OtherFoxTitles", talentName, "", "", "", "", "");
    window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitleDetailsForCast").value = talentId;//+"~"+firstName+"~"+middleName+"~"+lastName;
    window.document.forms[0].action="TitlesList.aspx";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
    return false;
}

function funLeftFilter_SessionMemberPreference_Update(type)
{
    var vardate = new Date(); 
    var strResult;
    strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","Option=" + type +"~@$~"+ vardate +"&Type=updateleftfilsesmempref");
    return strResult;
}

function funFoxFastLogoClick()
{
    // Added for showing Loading wait.. Message.
    if(window.document.getElementById('divProgressDialog'))
    {
        toggleVis('divProgressDialog');
    }
    funLeftFilter_SessionMemberPreference_Update('ESE');
    window.location.href = "TitlesList.aspx";
}
function funFoxFastHomeClick()
{
    // Added for showing Loading wait.. Message.
    toggleVis('divProgressDialog');
    var strResult = funLeftFilter_SessionMemberPreference_Update('MP');
    strResult = strResult.substring(0,strResult.length-2);
    NavAsPerUserPreferences(strResult);
    
}
function NavAsPerUserPreferences(strResult)
{
    var strValues = strResult.split('~');
    
    if (strValues[1] == "ChangePwd")
    //if (strValues[1] == "UserPreferences")
    {
        window.document.forms[0].action = "ChangePwd.aspx";
        //window.document.forms[0].action = "UserPreferences.aspx";
        window.document.forms[0].method = "post";
        window.document.forms[0].__VIEWSTATE.name = "";
        window.document.forms[0].submit();
    }
    else if(strValues[1] == "savedsearches")
    {
        toggleVis('divProgressDialog');
        funGetAdvSrchTitleDetails(strValues[2] + "~" + strValues[3])
    }
    else if(strValues[1] == "screeningroom")
    {
        toggleVis('divProgressDialog');
        funNavScreeningRoom("All");
    }
    else
    {
        if(strValues[1] == "mytitles")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "All";
        }
        else if(strValues[1] == "new")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "New";
        }
        else if(strValues[1] == "favorites")
        {
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "Favorites";
        }
        else if(strValues[1] == "licensedtitles")
        {
            funLeftFilter_SessionMemberPreference_Update('EE');
            window.document.getElementById("ctl00_ctl00_MainMenu1_hdnTitleMenu").value = "Licensed Titles";
        }
        
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnGetParentChild").value = "";
        }
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitleDetailsForCast") != null)
        {
           window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnTitleDetailsForCast").value = "";
        }
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCategoryLinkId").value = "";
        }
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCurrentPageNo") != null)
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCurrentPageNo").value = "1";
        }
        if(window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnShowHierarchy"))
        {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnShowHierarchy").value = "Y";
        }
        window.document.forms[0].action = "TitlesList.aspx";
        window.document.forms[0].method = "post";
        window.document.forms[0].__VIEWSTATE.name = "";
        window.document.forms[0].submit();
    }
}

//Function to persist the spotlight expand/collapse mode.
function funSpotLight(condition)
{
    var vardate = new Date(); 
    var strResult;
    var Flag = "Y";
    if(condition == "hide")
    {
        Flag = "N";
    }
    strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","FlagYN=" + Flag +"~@$~"+ vardate +"&Type=setSpotLight");
    if(window.document.getElementById("QTBody"))
    {
        if(condition == "hide")
        {
            $("#QTBody").slideDown("fast");
            $("#screeningHead").removeClass('screeningHeadClosed');
            $("#screeningHead").addClass('screeningHeadOpen');
                if (navigator.appName.toLowerCase() == "netscape" && window.document.getElementById("QTPlayer") && window.document.getElementById("QTPlayer").style.display == 'block') {
                    funQuickTimeoverShowHide('hide');
                }
                funSetPlayeronSpotlight('show');
        }
        else
        {
            $("#QTBody").slideUp("fast");
            $("#screeningHead").removeClass('screeningHeadOpen');
            $("#screeningHead").addClass('screeningHeadClosed');
            funQuickTimeoverShowHide('show');
            funSetPlayeronSpotlight('hide');
            //funStopPlayingOtherPlayers('spotlight');
        } 
	}
    return false;
}
function funPlayVideoForFoxRetail(strIPAssetname,strTitleId,strTitleName,strRuntime,source,sourceurl2,strFileName,sourceurl1,strTitleObjObjId,strVideoType,strVideoAspectRatio,strFullScreen,strFileObjObjId,strWatchYN,strTitleType,strAssetName,strAssetType,strAssetFormatType,strFileSize) {
    toggleVideoLoadingMsg('');
    window.setTimeout("funPlayVideoForFoxRetail1('" + strIPAssetname+ "','" +strTitleId+ "','" +strTitleName+ "','" +strRuntime+ "','" +source+ "','" +sourceurl2+ "','" +strFileName+ "','" +sourceurl1+ "','" +strTitleObjObjId+ "','" +strVideoType+ "','" +strVideoAspectRatio+ "','" +strFullScreen+ "','" +strFileObjObjId+ "','" +strWatchYN+ "','" +strTitleType+ "','" +strAssetName+ "','" +strAssetType+ "','" +strAssetFormatType+ "','" +strFileSize+ "')", 1000);
    return false;
}
function funPlayVideoForFoxRetail1(strIPAssetname,strTitleId,strTitleName,strRuntime,source,sourceurl2,strFileName,sourceurl1,strTitleObjObjId,strVideoType,strVideoAspectRatio,strFullScreen,strFileObjObjId,strWatchYN,strTitleType,strAssetName,strAssetType,strAssetFormatType,strFileSize) {
    var FoxFastVideoPlayerType = "WMP";
    var GuidForPalyClick = "";
    try {
        GuidForPalyClick = guid();
    }
    catch (e) {
        GuidForPalyClick = guid();
    }
//    if(strTitleName && strTitleName != "")
//    {
//        strTitleName = strTitleName.replace("~@@~","'"); 
//    }
//    if(strFileName != "")
//    {
//        strFileName = strFileName.replace("~@@~","'"); 
//    }
//    if(strAssetName != "")
//    {
//        strAssetName = strAssetName.replace("~@@~","'");
//    }
//    if (sourceurl1 != "") {
//        sourceurl1 = sourceurl1.replace(/~@@~/g, "'");
//    }
    var vardate = new Date(); 
    var strResult;
    strResult = funGetHtmlFromJQuery("Xmlhttp.aspx","titleName=" + strTitleName +"~@$~"+ vardate +"&Type=getURLFromFoxRetail&sourceurl1=" + sourceurl1+"&sourceurl2=" + sourceurl2);
    strResult = Trim(strResult);
    var PBTitleName = strTitleName;
    if (strTitleName && strTitleName != "") {
        strTitleName = strTitleName.replace(/~@@~/g, "'");
    }
    if(strResult != "")
    {
        if (strRuntime == "" || strRuntime == "0")
        {
         var strPlayerHeader = strTitleName + "- " + strTitleId;
         }
         else
         {
         var strPlayerHeader = strTitleName + "- " + strTitleId + " (" + strRuntime + " Minutes)";
         
         }
        window.document.getElementById("WMVPlayer").style.display = "block";
        window.document.getElementById("QTPlayer").style.display = "none";
        window.document.getElementById("divDefaultPlayer").style.display = "none";
        
        funGetHtmlFromJQuery("Xmlhttp.aspx","FileObjObjId=" + strFileObjObjId +"~"+ vardate + "&Type=videowatch");
        funMediaPlayerObjec2("", "", strPlayerHeader, strResult, strVideoAspectRatio, strFullScreen, GuidForPalyClick);
    }
    funCloseVideoDialog();
    strAssetFormatType = strAssetFormatType + "~@$" + GuidForPalyClick;
    window.setTimeout("funPlayerPbTrends('" + PBTitleName + "','" + strTitleId + "','" + strTitleType + "','" + strVideoType + "','" + strAssetType + "','" + strAssetFormatType + "','" + strAssetName + "','" + strFileName + "','" + strFileSize + "','" + FoxFastVideoPlayerType + "')", 7000);
    toggleVideoLoadingMsg('none');
    return false;
}

function funDownloadVideoForEsprit(strTitleName,sourceurl1)
{
    if(strTitleName && strTitleName != "")
    {
        strTitleName = strTitleName.replace("~@@~","'"); 
    }
//    var vardate = new Date(); 
//    funGetHtmlFromJQuery("Xmlhttp.aspx","titleName=" + strTitleName +"~@$~"+ vardate +"&Type=sendmaileforspritdownload&sourceurl1=" + sourceurl1);
    
    var vardate = new Date();
    var varTime = vardate.getTime();
    url = "../aspxfiles/DownloadEspritValidatePopup.aspx?assetIDs="+sourceurl1+"&getToken=Y";
    
    //Openpopup(url, 300, 150, varTime, 'Y');
    Openpopup(url, 450, 500, varTime, 'N');
    
    return false;
}

function funDownloadVideoForOrigin(fileObjObjId)
{
    funStoreLicenseforDownload(fileObjObjId);
    
    var vardate = new Date();
    var varTime = vardate.getTime();
    url = "../aspxfiles/Download.aspx?fileObjObjId="+fileObjObjId+"&orginDwnld=Y";
    Openpopup(url, 300, 150, varTime, 'N');
}

function funCreateDRMLicense(sourceurl1)
{
    var vardate = new Date(); 
    var OSType = funGetOperatingSystem();
    var SilLightInstalFlag = isSilverlightInstalled();
    var Browser = funGetBrowserType();
    var strResult = funGetHtmlFromJQuery("Xmlhttp.aspx", "&Mode=" + vardate + "&Type=drmlicense&sourceurl1=" + sourceurl1 + "&OSType=" + OSType + "&SilLightInstalFlag=" + SilLightInstalFlag);
    if (strResult && Trim(strResult) == "session expired") {
        funSessionExpiryNav(strResult);
    }
    else if (strResult.toLowerCase() == "failed createsession call") {
    }
    else if (strResult.toLowerCase() == "failed registeruser call") {
    }
    else {
        if (window.document.getElementById('netobj') && strResult != "") {
            //Condition to check storelicense should be called only when os is windows and silverlight is not installed inthe client system.
            if (OSType.toLowerCase() == "windows" && SilLightInstalFlag.toLowerCase() == "n" && Browser.toLowerCase() != "netscape") {
                try {
                    window.document.getElementById('netobj').StoreLicense(strResult);
                }
                catch (e) {
                    if ($("#QTPlayer>#QTBody")) {
                        $("#QTPlayer>#QTBody").html("");
                    }
                    //window.alert("Sorry, we're having trouble acquiring a license to play this video.  Please visit our FAQ page for solutions regarding DRM License issues.");
                    //window.alert("Sorry, we are having trouble playing our video on your PC.  It is likely that you need to update your computer's software.  Please click on our Help page link - at the foot of all FoxFast pages - where quick installation links will be listed for your use.");
                    funBuildPswdPolicyAlterMsg("Sorry, we are having trouble playing video on your PC. It is likely that you need to update your computer’s software.  Please click <a href='../aspxfiles/Help.aspx' target='_blank' style='color:White'>here</a> to visit our Help page where quick installation links will be listed for your use.", "OK")
                    toggleVis('saveSearchDialog');
                }
            }
        }
    }
}
function funGetSystemInfo()
{
    if (window.ActiveXObject)
    {
        // IE
        try 
        {
            var DRM = document.getElementById('netobj');
            var ClientInfo = DRM.GetSystemInfo();
            document.getElementById("hdnClientInfo").value = escape(ClientInfo);       
        }
        catch(e) 
        {
            //window.alert(e.message);
        }
    }
    else if (window.GeckoActiveXObject)
    {
        // Firefox, Netscape 7>
        try 
        {
            var DRM = new GeckoActiveXObject('DRM.GetLicense.1');
            document.getElementById("hdnClientInfo").value = escape(DRM.GetSystemInfo());
        }
        catch(e) 
        {
        }
    }
    else 
    {
    }
}

function GetClientCurrentDate()
{
    if (window.document.getElementById("ctl00_ctl00_Login1_titleSearch")) 
    {
        window.document.getElementById("ctl00_ctl00_Login1_titleSearch").disabled = false;
    }
    var d = new Date();
    var curr_date = d.getDate();
    var curr_month = d.getMonth() + 1;
    var curr_year = d.getFullYear();
    if(document.getElementById("ctl00_ctl00_Login1_lblCurDate"))
    {
        document.getElementById("ctl00_ctl00_Login1_lblCurDate").innerHTML = (GetMonthName(curr_month) + " " + curr_date + ", " + curr_year);
    }
    else if(document.getElementById("lblCurDate"))
    {
        document.getElementById("lblCurDate").innerHTML = (GetMonthName(curr_month) + " " + curr_date + ", " + curr_year);
    }
}
function GetMonthName(month)
{
    var MonthName = '';
    switch(month)
    {
        case 1:
          MonthName = 'January';
          break;    
        case 2:
          MonthName = 'February';
          break;
        case 3:
          MonthName = 'March';
          break;
        case 4:
          MonthName = 'April';
          break;    
        case 5:
          MonthName = 'May';
          break;
        case 6:
          MonthName = 'June';
          break;
        case 7:
          MonthName = 'July';
          break;    
        case 8:
          MonthName = 'August';
          break;
        case 9:
          MonthName = 'September';
          break;
        case 10:
          MonthName = 'October';
          break;    
        case 11:
          MonthName = 'November';
          break;
        default:
          MonthName = 'December';
    }
    
    return MonthName;
}

function funOpenPopupforFooter(screenName)
{
    if(screenName.toLowerCase() == "takeatour")
    {
        window.open('http://www.20thcenturyfox-tvd.com/sites/FoxFastGuides/Fox---Tours.html',screenName, 'width=880,height=600,status=no,location=no,scrollbars=yes,resizable=yes,top=100,left=100,dependent=yes,alwaysRaised=yes');
    }
    else if(screenName.toLowerCase() == "contact")
    {
        window.open('../aspxfiles/'+screenName+'.aspx',screenName, 'width=880,height=600,status=no,location=no,scrollbars=yes,resizable=yes,top=100,left=70,dependent=yes,alwaysRaised=yes');				                        
    }
    else
    {
        window.open('../aspxfiles/'+screenName+'.aspx',screenName, 'width=800,height=600,status=no,location=no,scrollbars=yes,resizable=yes,top=100,left=100,dependent=yes,alwaysRaised=yes');				                        
    }   
}

function funGetOperatingSystem()
{
    var OSType ="";
    var agt = navigator.userAgent.toLowerCase();     
    if((agt.indexOf("mac")!=-1))
    {
        OSType = "macintosh";
    }
    else
    {
        OSType = "windows";
    }
    return OSType;   
}
function isSilverlightInstalled()
{
    var isSilverlightInstalled = "N";
    try
    {
        if(Silverlight.isInstalled("2.0.30923.0"))
        {
            isSilverlightInstalled = "Y";
        }   
    }
    catch (e)
    {
        //we don't want to leak exceptions. However, you may want
        //to add exception tracking code here.
    }
    return isSilverlightInstalled;
}

function funSetSpotlightObject() {
    var hdnspotlightXMLPath = "";
    var divSpotLight = window.document.getElementById("ctl00_ctl00_SpotLight1_divSpotLight");

    //    else
    //    {
    if (window.document.getElementById("ctl00_ctl00_SpotLight1_hdnspotlightXMLPath")) {
        hdnspotlightXMLPath = window.document.getElementById("ctl00_ctl00_SpotLight1_hdnspotlightXMLPath").value;
    }
    var hdnspotlightTemplate = "";
    if (window.document.getElementById("ctl00_ctl00_SpotLight1_hdnspotlightTemplate")) {
        hdnspotlightTemplate = document.getElementById("ctl00_ctl00_SpotLight1_hdnspotlightTemplate").value;
    }
//    if (window.document.getElementById("ctl00_ctl00_hdnLiveStreamMode") && window.document.getElementById("ctl00_ctl00_hdnLiveStreamMode").value == "Y" &&
//            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnPageName") && window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnPageName").value.toLowerCase() == "screeningroom") {
//        funLivestreamSpotlightObject();
//        window.document.getElementById("ctl00_ctl00_hdnLiveStreamMode").value = "";
//    }
//    else {
        swfobject.embedSWF(
	        hdnspotlightTemplate, //"../spotlight/Spotlight_LimitOf7.swf", // path to swf
	        "spotlightGoesHere", // id of element to replace with swf
	        "990", // width
	        "307", // height
	        "9.0.0", // minimum flash version required
	        false,
	        { xmlFile: hdnspotlightXMLPath + "?nocache=" + getCurrentDateTime() }, // flashvars
	        {quality: "best", scale: "noscale", wmode: "transparent", bgcolor: "000000", allowfullscreen: "false" }, // params
	        {align: "middle", style: "margin-top: 10px;"} // attributes
        );
//    }
    //    }
    if ($.browser.msie) {

        if (divSpotLight && divSpotLight.className == "toggler-promo closed") {
            if (window.document.getElementById("ctl00_ctl00_SpotLight1_spotlightPromo")) {
                window.document.getElementById("ctl00_ctl00_SpotLight1_spotlightPromo").innerHTML = '<a id="spotlightGoesHere" href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a>';
            }
        }
    }
}
function funLivestreamSpotlightObject() {
    var strFlashFileName = "";
    var strStreamCategory = document.getElementById("ctl00_ctl00_MainMenu1_hdnStreamCategory");
    var strStreamMessage = document.getElementById("ctl00_ctl00_MainMenu1_hdnStreamMessage");
    var strFailureFlag = document.getElementById("ctl00_ctl00_MainMenu1_hdnFailureFlag");
    if (strStreamCategory && strStreamCategory.value.toLowerCase() == "live") {
        strFlashFileName = "AkamaiFlashPlayer_Live.swf";
    }
    else if (strStreamCategory && strStreamCategory.value.toLowerCase() == "test") {
        strFlashFileName = "AkamaiFlashPlayer_Test.swf";
    }
    var hasReqestedVersion = DetectFlashVer(10, 0, 0); //DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    if (hasReqestedVersion) {
        if (strFailureFlag && strFailureFlag.value.toLowerCase() == "n") {
            var flashvars = {
                src: "http://mediapm.edgesuite.net/ovp/content/demo/smil/elephants_dream.smil",
                autostart: "true",
                themeColor: "0395d3",
                mode: "sidebyside",
                scaleMode: "fit"
            };
            var params = { wmode: "transparent" };
            var attributes = {
                id: "myPlayer",
                name: "myPlayer",
                allowFullScreen: "true",
                align: "middle",
                style: "margin-top: 10px;"
            };
            swfobject.embedSWF("../spotlight/" + strFlashFileName, "spotlightGoesHere", "990", "307", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
            funBuildSoftwareUpdateAlterMsg(strStreamMessage.value, "OK")
            toggleVis('divSoftwareUpdateAlterMsg');
        }
        else {
            window.document.getElementById("imgSpotlightImage").src = "../images/LiveVideoFeed_Trouble.jpg";
        }
    }    
}

function onSilverlightError(sender, args) 
{
	var appSource = "";
	if (sender != null && sender != 0) 
	{
		appSource = sender.getHost().Source;
	}
	var errorType = args.ErrorType;
	var iErrorCode = args.ErrorCode;
	var errMsg = "Unhandled Error in Silverlight 2 Application " + appSource + "\n";
	errMsg += "Code: " + iErrorCode + "    \n";
	errMsg += "Category: " + errorType + "       \n";
	errMsg += "Message: " + args.ErrorMessage + "     \n";
	if (errorType == "ParserError") 
	{
		errMsg += "File: " + args.xamlFile + "     \n";
		errMsg += "Line: " + args.lineNumber + "     \n";
		errMsg += "Position: " + args.charPosition + "     \n";
	}
	else if (errorType == "RuntimeError") 
	{
		if (args.lineNumber != 0) {
			errMsg += "Line: " + args.lineNumber + "     \n";
			errMsg += "Position: " + args.charPosition + "     \n";
		}
		errMsg += "MethodName: " + args.methodName + "     \n";
	}
	throw new Error(errMsg);
}
function funGetBrowserType()
{
    var browser = navigator.appName;
    var b_version=navigator.appVersion;
    var version=parseFloat(b_version);
    return browser;
}
function funPBTrends(TitleName,WprTitleId,TitleCat,Category,ViewType,AssetType,AssetFormatType,AssetName,FileName,FileSize)
{
    if (AssetType != "") 
    {
        AssetType = AssetType.replace(/&/g, "$@$");
    }
    //TitleName = TitleName.replace(/@@@/g, '"');
    TitleName = encodeURI(TitleName);
    //ViewType = ViewType.replace(/@@@/g, '"');
    ViewType = encodeURI(ViewType);
     var vardate = new Date();   
    funGetHtmlFromJQuery("WebTrends.aspx","TitleName=" + TitleName +"~"+ vardate + "&WprTitleId=" + WprTitleId + "&TitleCat=" + TitleCat  + "&Category=" + Category  + "&ViewType=" + ViewType  + "&AssetType=" + AssetType  + "&AssetFormatType=" + AssetFormatType  + "&AssetName=" + AssetName  + "&FileName=" + FileName  + "&FileSize=" + FileSize);
}
function funOpenLAScreenings(strEmail, strFirstName, strLastName) 
{
//    strEmail = strEmail.replace(/~@@~/g, "'");
//    strFirstName = strFirstName.replace(/~@@~/g, "'");
//    strLastName = strLastName.replace(/~@@~/g, "'");
    window.open("http://www.20thcenturyfox-tvd.com/sites/lascreeningsInfo/index.asp?hdnemail=" + strEmail + "&hdnfname=" + strFirstName + "&hdnlname=" + strLastName, "LAScreenings", "menubar=1,width=800,height=600,status=yes,location=yes,scrollbars=yes,resizable=yes,top=100,left=100,toolbar=yes");
}
function funUnderConstruction()
{
    window.alert("Under Construction");
}

function funSessionExpiryNav(strResult)
{
    if(strResult && Trim(strResult) == "session expired")
    {
        window.location.href = "TitlesList.aspx?sessionexpired=Y";
    }
}

function funSessionExpiryNavMSG()
{
    funBuildAlterMsg("Your previous session has expired.  Please login to FoxFast again to continue using the site.", "OK");
    toggleVis('saveSearchDialog');
}

function funPrint()
{
    var adRestrictDetailsWrapper = window.document.getElementById("adRestrictDetailsWrapper");
    var tblBtns = window.document.getElementById("tblBtns");
    var divclosebtn = window.document.getElementById("divclosebtn");
    if (window.print && adRestrictDetailsWrapper) 
    {
        if(tblBtns && divclosebtn)
        {
            tblBtns.style.display = 'none';
            divclosebtn.style.display = 'none';
        }
        //window.print();  
        var WinPrint = window.open('','','left=0,top=0,width=1,height=1,t oolbar=0,scrollbars=0,status=0');
        WinPrint.document.write(adRestrictDetailsWrapper.innerHTML);
        WinPrint.document.close();
        WinPrint.focus();
        WinPrint.print();
        WinPrint.close();
        
        if(tblBtns && divclosebtn)
        {
            tblBtns.style.display = '';
            divclosebtn.style.display = '';
        }
    } 
    else 
    {
        var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
        document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
        WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
    }
    
    return false;
}

function funNavHomPageOnLogin(strInfo)
{
    //Added by Anil on 03.03.2009 for getting system info for entrique functionality.                
    funGetSystemInfo();

    var strValues = strInfo.split('~');
    if (strValues[1] == "livestream") {
        funViewLiveStream();
    }   
    else if (strValues[1] == "BQAssetsY") {

        // Resetting the default page values.
        if (window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnSortId")) {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnSortId").value = "sortID1";
        }
        if (window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCurrentPageNo")) {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnCurrentPageNo").value = "1";
        }
        if (window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnNoofTitlesPerPage")) {
            window.document.getElementById("ctl00_ctl00_BodyContent_SubBodyContent_hdnNoofTitlesPerPage").value = "25";

        }
        window.document.getElementById("hdnNavigationMode").value = "cart";
        window.document.forms[0].action = "BQAssetCart.aspx";
        window.document.forms[0].method = "post";
        window.document.forms[0].__VIEWSTATE.name = "";
        window.document.forms[0].submit();
    }
    else {
        // strResult =  validuser~Titlelist_Default_View~Search_Id~Search_Name; 
        NavAsPerUserPreferences(strInfo);
    }
}

function Openpopup(url, width, height, name, ModalYN)
{
    if(ModalYN == 'Y')
    {
        window.showModalDialog(url, "", "dialogWidth:500px;dialogHeight:500px;dialogLeft:220px;dialogTop:120;center:yes;status:no");
    }
    else
    {
        var left = (screen.width - width)/2;
        var top = (screen.height - height)/2;
        var params = 'width='+width;
        params += ', height='+height;    
        params += ', directories=no';
        params += ', location=no';
        params += ', menubar=no';
        params += ', resizable=no';
        params += ', scrollbars=no';
        params += ', status=no';
        params += ', toolbar=no';
        params += ', top='+top;
        params += ', left='+left;
        
        newwin=window.open(url, name, params);
        if (window.focus) 
        {
            newwin.focus();
        }
    }
    return false;
}

function toggleVideoLoadingMsg(displayType) {
    var el = document.getElementById('divVideoProgressDialog');
    if (displayType == 'none') {
        el.style.display = 'none';
    }
    else {
        el.style.display = '';
    }
}
function funKnowPlayerVersions() {
    var strMediaPlayerVersion = "";
    var OSType = funGetOperatingSystem();
    try {
        if (OSType.toLocaleLowerCase() == "macintosh" && !$.browser.mozilla) {
            if ($("#QTPlayer>#QTBody")) {
                $("#QTPlayer>#QTBody").html("");
            }
            funBuildSoftwareUpdateAlterMsg("<br /><label style='font-weight:bold;color:#F89602;width:600px;padding-left:190px;'>Software&nbsp;Upgrade&nbsp;Required</label><br /><br />We're sorry, to play FoxFast's secure video on a MAC computer you must be using Firefox browser software.  Please download and install Firefox by clicking <a href='http://www.firefox.com' target='_blank' style='color:White'>here</a>.<br /><br />Please contact your company's IT Administration if you have any difficulty with the Firefox browser software installation.", "OK")
            toggleVis('divSoftwareUpdateAlterMsg');
            return false;
        }
        else if ($.browser.msie) {
            strMediaPlayerVersion = printResults();
            if (strMediaPlayerVersion != "" && parseInt(strMediaPlayerVersion) < 11) {
                if ($("#QTPlayer>#QTBody")) {
                    $("#QTPlayer>#QTBody").html("");
                }
                funBuildSoftwareUpdateAlterMsg("<br /><label style='font-weight:bold;color:#F89602;width:600px;padding-left:190px;'>Software&nbsp;Upgrade&nbsp;Required</label><br /><br />We're sorry, to play FoxFast's secure video you must upgrade your Windows Media Player software to version 11 or above.  Please download and install Windows Media Player version 11 by clicking <a href='http://www.microsoft.com/windows/windowsmedia/player/11/default.aspx' target='_blank' style='color:White'>here</a>.<br /><br />Please contact your company's IT Administration if you have any difficulty with the Windows Media Player software installation.", "OK")
                toggleVis('divSoftwareUpdateAlterMsg');
                return false;
            }
            else {
                return true;
            }
        }
        else {
            return true;
        }
    }
    catch (e) {
        return true;
    }
}
function funBuildPswdPolicyAlterMsg(Msg, txtOk) {
    window.document.getElementById("saveSearchDialog").innerHTML = "<div class='top'></div>" +
        "<div class='body'>" +
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");'><img src='../images/close.gif' border='0' /></a></div>" +
            "<div class='modalContent'>" +
    //<!-- put prompt text within p tags -->
                "<table><tr><td><p>" +
                Msg + //"Save new title search as:"+
                "</p></td></tr></table>" +
    //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='toggleVis(\"saveSearchDialog\");' class='affirmative'>" + txtOk + "</a>" +
            "</div>" +
        "</div>" +
      "<div class='bot'></div>";
}

function funBuildSoftwareUpdateAlterMsg(Msg, txtOk) {
    window.document.getElementById("divSoftwareUpdateAlterMsg").innerHTML = "<div class='topwider' ></div>" +
        "<div class='bodywider'>" +
            "<div class='modalClose'><a href='javascript:void(0);' onclick='toggleVis(\"divSoftwareUpdateAlterMsg\");'><img src='../images/close.gif' border='0' /></a></div>" +
            "<div class='modalContent' >" +
    //<!-- put prompt text within p tags -->
                "<table><tr><td><p>" +
                Msg + //"Save new title search as:"+
                "</p></td></tr></table>" +
    //<!-- using close link here again to cancel out of the dialog -->
                "<a href='javascript:void(0);' onclick='toggleVis(\"divSoftwareUpdateAlterMsg\");' class='affirmative'>" + txtOk + "</a>" +
            "</div>" +
        "</div>" +
      "<div class='botwider'></div>";

}
function funSetSeasonPass(strTitObjObjId, strSeasonName, hasSeasonPassYN) {
    if (hasSeasonPassYN == "Y") {
        funBuildAlterMsg("You already have a Season Pass for '" + strSeasonName + "'.  Please visit the User Preferences page if you would like to cancel this Season Pass", "OK");
        toggleVis('saveSearchDialog');
    }
    else {
        funBuildConfirmationMsg("Click OK to add a Season Pass for '" + strSeasonName + "'.", "OK", "Cancel", "funSetSeasonPass1(\"" + strTitObjObjId + "\",\"" + strSeasonName + "\")");
        toggleVis('saveSearchDialog');
    }
}
function funSetSeasonPass1(strTitObjObjId, strSeasonName) {
    toggleVis('saveSearchDialog');
    var vardate = new Date();
    var strResult;
    strResult = funGetHtmlFromJQuery("Xmlhttp.aspx", "TitleId=" + strTitObjObjId + "~@$~" + vardate + "&Type=insertseasonpass");
    if (Trim(strResult) == "Record Already Exists") {
        toggleVis('saveSearchDialog');
        funBuildAlterMsg("You already have a Season Pass for '" + strSeasonName + "'.  Please visit the User Preferences page if you would like to cancel this Season Pass", "OK");
    }
    else {
        funSessionExpiryNav(strResult);
    }
}
function S4() {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
function guid() {
    return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
function funDirectVideoPlayLogin() {
    funBuildAlterMsg("Please login to FoxFast, above.  Your video will begin playing after your successful login.", "OK")
    toggleVis('saveSearchDialog');
}
function funDirectVideoLivestreamLogin() {
    //funBuildAlterMsg("Please login to FoxFast, above.  Your live stream will begin playing after your successful login.", "OK")
	funBuildAlterMsg("Thank you for your interest in watching the FBC Upfront Presentation.  Unfortunately, we are no longer streaming this video.", "OK")
    toggleVis('saveSearchDialog');
}

function funChangePwdRedirect(Msg, NavPage) {
    if (NavPage == "home") {
        funBuildAlterMsgWithAction(Msg, "OK", "funNavToHome()");
    }
    else if (NavPage == "bqhome") {
    funBuildAlterMsgWithAction(Msg, "OK", "funNavToBQHome()");
    }
    else {
        funBuildAlterMsgWithAction(Msg, "OK", "funNavToScreeningRoomVideoPlay()");
    }
    toggleVis('saveSearchDialog');
}
function funNavToScreeningRoomVideoPlay() {
    window.document.forms[0].action = "ScreeningRoom.aspx";
    window.document.forms[0].method = "post";
    window.document.forms[0].__VIEWSTATE.name = "";
    window.document.forms[0].submit();
    return false;
}
function funNavToBQHome() {
    // Added for showing Loading wait.. Message.
    toggleVis('divProgressDialog');
    var strResult = funLeftFilter_SessionMemberPreference_Update('MP~Y');
    funNavHomPageOnLogin(strResult);
    return false;
}
function funNavToHome() {
    // Added for showing Loading wait.. Message.
    toggleVis('divProgressDialog');
    var strResult = funLeftFilter_SessionMemberPreference_Update('MP~N');
    funNavHomPageOnLogin(strResult);
    return false;
}

function getCurrentDateTime() {
    var d = new Date();
    return  d.getMonth() + "_" + d.getDate() + "_" + d.getFullYear() + "_" + d.getHours() + "_" + d.getMinutes() + "_" + d.getSeconds();
}
function funReplaceWithActualChar(strText) {
    return strText.replace(/~@@~/g, "'").replace(/@@@/g, "\"").replace(/\$@\$/g, "&");
}
function funViewLiveStream() {
    if (window.document.getElementById("ctl00_ctl00_hdnLiveStreamMode")) {
        window.document.getElementById("ctl00_ctl00_hdnLiveStreamMode").value = "Y";
    }
    funNavScreeningRoom('All');
}
function funShowLiveBroadCastMessage() {
    //funBuildAlterMsg("Sorry, you are not authorized to view this live broadcast.  Please contact your Fox representative.", "OK");
	funBuildAlterMsg("Thank you for your interest in watching the FBC Upfront Presentation.  Unfortunately, we are no longer streaming this video.", "OK");
    toggleVis('saveSearchDialog');
}





// Flash Player Version Detection - Starts Here.  
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion() {
    var version;
    var axo;
    var e;

    // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

    try {
        // version will be set for 7.X or greater players
        axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
        version = axo.GetVariable("$version");
    } catch (e) {
    }

    if (!version) {
        try {
            // version will be set for 6.X players only
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");

            // installed player is some revision of 6.0
            // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
            // so we have to be careful. 

            // default to the first public version
            version = "WIN 6,0,21,0";

            // throws if AllowScripAccess does not exist (introduced in 6.0r47)		
            axo.AllowScriptAccess = "always";

            // safe to call for 6.0r47 or greater
            version = axo.GetVariable("$version");

        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 4.X or 5.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = axo.GetVariable("$version");
        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 3.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
            version = "WIN 3,0,18,0";
        } catch (e) {
        }
    }

    if (!version) {
        try {
            // version will be set for 2.X player
            axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
            version = "WIN 2,0,0,11";
        } catch (e) {
            version = -1;
        }
    }

    return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer() {
    // NS/Opera version >= 3 check for Flash plugin in plugin array
    var flashVer = -1;

    if (navigator.plugins != null && navigator.plugins.length > 0) {
        if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
            var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
            var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
            var descArray = flashDescription.split(" ");
            var tempArrayMajor = descArray[2].split(".");
            var versionMajor = tempArrayMajor[0];
            var versionMinor = tempArrayMajor[1];
            var versionRevision = descArray[3];
            if (versionRevision == "") {
                versionRevision = descArray[4];
            }
            if (versionRevision[0] == "d") {
                versionRevision = versionRevision.substring(1);
            } else if (versionRevision[0] == "r") {
                versionRevision = versionRevision.substring(1);
                if (versionRevision.indexOf("d") > 0) {
                    versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
                }
            }
            var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
        }
    }
    // MSN/WebTV 2.6 supports Flash 4
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
    // WebTV 2.5 supports Flash 3
    else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
    // older WebTV supports Flash 2
    else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
    else if (isIE && isWin && !isOpera) {
        flashVer = ControlVersion();
    }
    return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) {
    versionStr = GetSwfVer();
    if (versionStr == -1) {
        return false;
    } else if (versionStr != 0) {
        if (isIE && isWin && !isOpera) {
            // Given "WIN 2,0,0,11"
            tempArray = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
            tempString = tempArray[1]; 		// "2,0,0,11"
            versionArray = tempString.split(","); // ['2', '0', '0', '11']
        } else {
            versionArray = versionStr.split(".");
        }
        var versionMajor = versionArray[0];
        var versionMinor = versionArray[1];
        var versionRevision = versionArray[2];

        // is the major.revision >= requested major.revision AND the minor version >= requested minor
        if (versionMajor > parseFloat(reqMajorVer)) {
            return true;
        } else if (versionMajor == parseFloat(reqMajorVer)) {
            if (versionMinor > parseFloat(reqMinorVer))
                return true;
            else if (versionMinor == parseFloat(reqMinorVer)) {
                if (versionRevision >= parseFloat(reqRevision))
                    return true;
            }
        }
        return false;
    }
}
// Flash Player Version Detection - Ends Here.
function funPBTrendsForLiveVideo(strLiveVideoEmailLinkClickYN) {
    var Category = window.document.getElementById("ctl00_ctl00_MainMenu1_hdnStreamCategory").value; ;
    /*if (strLiveVideoEmailLinkClickYN.toLowerCase() == "y") {
        Category = "Access From Email Link";
    }*/
    var version = GetSwfVer();
    var ViewType = "Play - Live Stream - (Flash Player" + ((version != "")? " : " + version: "") + ")";
    funPBTrends("", "", "", Category, ViewType, "", "", "", "", "");
}