window.indexWin = null;
e3const.selectedEventId = "";
e3const.selectedChannel = "";
e3const.selectedLeague = "";
e3const.selectedGameId = "";
e3const.selectedProvider = "";
e3const.channelTrack = "";
jQuery(document).ready(function(){
jQuery("#watch_now").click(function(){
launchPlayer(e3const.selectedEventId, 'espn1', e3const.selectedLeague, e3const.selectedGameId, null, this);
});
if (e3const.selectedProvider == "comcast" && ud.name == "invalid") {
set_cookie2("ssoprovider", "comcast", 10*60*1000);
window.location = "https://broadband.espn.com/opensso/saml2/jsp/spSSOInit.jsp?metaAlias=/sp&idpEntityID=https://sso.comcast.net/Comcast/IdP/sso&binding=HTTP-POST&reqBinding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:transient&RelayState="+encodeURIComponent(e3const.p_WATCHESPN)+"%2Findex%3Fid%3D" + e3const.selectedEventId;
} else if (e3const.selectedProvider == "cox" && ud.name == "invalid") {
set_cookie2("ssoprovider", "cox", 10*60*1000);
window.location = "https://broadband.espn.com/opensso/saml2/jsp/spSSOInit.jsp?metaAlias=/sp1&idpEntityID=idm.cox.net&binding=HTTP-POST&reqBinding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect&NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:transient&RelayState="+encodeURIComponent(e3const.p_WATCHESPN)+"%2Findex%3Fid%3D" + e3const.selectedEventId;
} else if (e3const.selectedProvider == "att" && ud.name == "invalid") {
set_cookie2("ssoprovider", "att", 10*60*1000);
window.location = "https://broadband.espn.com/opensso/saml2/jsp/spSSOInit.jsp?metaAlias=/sp2&idpEntityID=https://login2prodx.att.net/FIM/sps/ATT-ESPN/saml20&binding=HTTP-POST&reqBinding=urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&NameIDFormat=urn:oasis:names:tc:SAML:2.0:nameid-format:transient&RelayState="+encodeURIComponent(e3const.p_WATCHESPN)+"%2Findex%3Fid%3D" + e3const.selectedEventId;
}
});
function launchRemoteAccess(){
if(ud.affvalid == "true"){
if(ud.sso == "true"){
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncedAcc"});
} else if (ud.canaddsso == "true") {
if (ud.isLoggedIn == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/onNetwork?affiliate="+ud.name});
} else if (ud.ssoabuse == "true") {
jQuery.colorbox({width:"52px",href:e3const.p_WATCHESPN+"/build/colorbox/abuseSSO"});
} else if (ud.useraccountvalid == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/invalidSSO"});
} else if (ud.sso == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncAcc?affiliate="+ud.name});
}
} else {
if (ud.isLoggedIn == "true" && ud.name == "pressPass_sso") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncedAcc"});
} else {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/noSSO"});
}
}
} else {
jQuery.colorbox({width:"525px", href: e3const.p_WATCHESPN+"/build/colorbox/ssoUnavailable"});
}
}
function submitGetAccess() {
// called from colorbox/syncAcc.tea
var BASE_URL = "http://broadband.espn.com/espn3/auth";
jQuery.getJSON(BASE_URL + "/util/addSsoToken?callback=?", function(data){
jQuery('#overlay-content').html('');
if( data.success == false ) {
jQuery('#overlay-content').html('
'+data.errorMessage+'
');
} else {
jQuery('#overlay-content').html("Your Remote Access is Activated
When you are away from home, just sign in with your ESPN.com account to access WatchESPN.
");
mn_movie.add(ud.username);
}
});
jQuery('div#drawercontainer_message').html('
Please wait...this could take up to a few minutes.
');
}
function authProcess(channel) {
if (ud.filterESPN3 && channel != '' && channel != 'null' && channel != null && channel != 'espn3') {
var params = getLinkParams(true, true);
if(channel == "" || channel == null || channel == "null" || channel == "espn3"){
e3const.channelTrack = "espn3";
if(typeof anTrackEvent == "function"){
anTrackEvent(' ','espn_espn3_reg','step1:'+ud.name);
}
}else{
e3const.channelTrack = "ean";
if(typeof anTrackEvent == "function"){
anTrackEvent(' ','espn_ean_reg','step1:'+ud.name);
}
}
if(!params){
params = "/_/launchPlayer/true";
}else{
params = params + "launchPlayer/true";
}
ap_signin(params);
} else if (ud.affvalid == "true") {
if (ud.sso == "true") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncedAcc"});
} else if (ud.canaddsso == "true") {
if (( ud.name.indexOf("att") == 0 ) || (ud.name.indexOf("verizon") == 0) || (ud.name.indexOf("comcast") == 0) || ( ud.name.indexOf("cox") == 0 )) {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/notifySSO?affiliate="+ud.name});
} else if (ud.isLoggedIn == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/onNetwork"});
} else if (ud.ssoabuse == "true") {
jQuery.colorbox({width:"52px",href:e3const.p_WATCHESPN+"/build/colorbox/abuseSSO"});
} else if (ud.useraccountvalid == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/invalidSSO"});
} else if (ud.sso == "false") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncAcc"});
}
} else {
if (ud.isLoggedIn == "true" && ud.name == "pressPass_sso") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/syncedAcc"});
} else {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/noSSO"});
}
}
} else {
if (ud.isLoggedIn == "false" || typeof ud.isLoggedIn == "undefined"){
var params = getLinkParams(true, true);
e3const.channelTrack = "espn3";
if(typeof anTrackEvent == "function"){
anTrackEvent(' ','espn_espn3_reg','step1:invalid');
}
if(!params){
params = "/_/launchPlayer/true";
}else{
params = params + "launchPlayer/true";
}
ap_signin(params);
} else if (ud.ssoabuse == "true") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/abuseSSO"});
} else if (ud.sso == "true") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/offNetworkSynced"});
} else if (ud.isPassive == "true") {
jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/isPassive"});
} else {
var params = getLinkParams(true, true);
//jQuery.colorbox({width:"525px",href:e3const.p_WATCHESPN+"/build/colorbox/offNetwork"});
ap_signin(params);
e3const.channelTrack = "espn3";
if(typeof anTrackEvent == "function"){
anTrackEvent(' ','espn_espn3_reg','step1:invalid');
}
}
}
}
var launchPlayer = function(id, channel, league, gameId, auth, me) {
if(mobileRedirect){
var par = "";
if(id.length>0)
{
par += "&id="+id;
}
if(channel.length>0)
{
par += "&channel="+channel;
}
if(league.length>0)
{
par += "&league="+league;
}
if(gameId.length>0)
{
par += "&gameId="+gameId;
}
window.location = "http://www.espn.com/watchespn/roadblock"+qs+par;
}else{
if(!swfobject.hasFlashPlayerVersion("10.2.0"))
{
jQuery.colorbox({width:"576px", height:"225px", html: 'Insufficient Flash Player Requirements
Click below to download the latest version of Flash

'});
}else{
if(e3const.launchPlayerQueue != null){
clearTimeout(e3const.launchPlayerQueue);
}
if(typeof aeLoader !== "undefined" && !aeLoader.exists && e3const.aeLoaderAttempts++ < 8 && !e3const.userDataLoaded){
e3const.launchPlayerQueue = setTimeout(function(){launchPlayer(id, channel, league, gameId, auth, me);}, 5000);
}else{
jQuery(document).trigger("PLAY_LOADER_END");
if(typeof loadUserData == "function" && e3const.userDataLoaded != true){
loadUserData();
}
e3const.selectedChannel = null;
if (id != null && id != 'null' && id != '') {
e3const.selectedEventId = id;
} else if (channel != null && channel != 'null' && channel != '') {
e3const.selectedChannel = channel;
} else if (league != null && league != 'null' && league != '' && gameId != null && gameId != 'null' && gameId != '') {
e3const.selectedLeague = league;
e3const.selectedGameId = gameId;
}
if (auth == true) {
// auth will be true if the user got here via the authentication process. we don't want to launch the player immediately
// if auth is true, we want to show them a lightbox displaying the networks they have access to
jQuery.colorbox({width:"525px",href:e3const.p_AUTH + "/watchespn/complete" + getLinkParams(true, false), iframe:true, height:"400px"});
} else if ((ud.name == "" || ud.name == "invalid" || typeof ud.name == "undefined") || ((ud.filterESPN3 == true || ud.filterESPN3 == 'true') && channel != '' && channel != 'null' && channel != null && channel!='espn3')) {
// this is how they get out of this area: if they authenticate with an MVPD, filterESPN3 will be false
authProcess(channel);
} else {
var width = 1130;
var height = 800;
var url = e3const.p_WATCHESPN+"/player";
var kvPair = {};
addedUnderScore = false;
var idPassed = false;
//if user came from ESPN3 site and kept content filtered on index page, continue
//to filter content on the player page
if (id != null && id != 'null' && id != '') {
idPassed = true;
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'id/'+id+'/';
}
if (league != null && league != 'null' && league != '') {
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'league/'+league+'/';
}
if (gameId != null && gameId != 'null' && gameId != '') {
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'gameId/'+gameId+'/';
}
if (!idPassed && channel != null && channel != 'null' && channel != '') {
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'channel/'+channel+'/';
}
if ((screen.width<=1024) || (screen.height<=800)) {
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'size/condensed/';
}
if(e3const.beta == true || e3const.beta == "true"){
if (addedUnderScore == false) {
url += '/_/';
addedUnderScore = true;
}
url += 'beta/true/';
}
url = encodeURI(url);
indexWin = window.open(url, 'm3Window','resize=yes,status=0,top=0,left=0,width='+width+',height='+height+',directories=no');
popUp = setTimeout('popUpBlocked("'+url+'", "'+width+'", "'+height+'");',4500);
if(indexWin)
{
clearTimeout(popUp);
indexWin.focus();
}
}
}
}
}
}
function popUpBlocked(url, width, height){
jQuery.colorbox({width:"525px",
html: 'It appears you have a pop-up blocker on that kept the player from launching.
Click Here to try again
Please contact Customer Care at 888-549-ESPN if you need assistance.
'});
}
function watchNowClick(id, channel, league, gameId) {
launchPlayer(id, channel, league, gameId, null);
//parent.jQuery.colorbox.close();
jQuery('', {
src: e3const.p_WATCHESPN +'/closecolorbox'
}).appendTo('body');
}
function onAffChange() {
jQuery("#cont-btn").unbind('click');
var instructions = jQuery("div#instructions");
var espninstructions = jQuery("div#espninstructions");
var elem = jQuery("#selAffiliate option:selected"); //get the selected option (stored in memory so we don't traverse everytime)
var passProviderArry = []; //will hold all the providers that are integrated with adobe pass
espninstructions.hide();
instructions.hide();
//first check to see if we need to kick them off to the adobe pass flow
//then see if they are a legacy mvpd
if(elem.attr('data-mvpd') == "true"){
jQuery("#cont-btn").removeClass("btn-noaction");
jQuery("#cont-btn").addClass("btn-action");
jQuery("#cont-btn").click(function(e){
/*expire the omniture tracking cookie after 2 minutes */
var expDate = new Date();
expDate.setTime(expDate.getTime() + (60 * 60 * 1000 * 2));
jQuery.cookie("ap_mvpd", elem.val(), {expires : expDate});
if(typeof anTrackEventAP == "function"){
anTrackEventAP("mvpdSelectionOverride", null);
}
getAE().setSelectedProvider(elem.val());
});
}else if( elem.val().toLowerCase() == "notfound" ){
jQuery("#cont-btn").removeClass("btn-action");
jQuery("#cont-btn").addClass("btn-noaction");
instructions.html('Switch to an WatchESPN affiliated internet service provider or to contact your internet service provider and request WatchESPN. Click here to enter your ZIP code and find out which providers in your area carry offer WatchESPN
');
instructions.show();
jQuery("#cont-btn").unbind('click');
}else if( elem.val() != "" ){
jQuery("#cont-btn").removeClass("btn-action");
jQuery("#cont-btn").addClass("btn-noaction");
espninstructions.show();
}else{
jQuery("#cont-btn").removeClass("btn-action");
jQuery("#cont-btn").addClass("btn-noaction");
}
jQuery.colorbox.resize();
}
function getLinkParams(addUnderScore, seo) {
var linkParams = '';
if (e3const.selectedEventId != "null" && e3const.selectedEventId != "" && e3const.selectedEventId != null) {
if (seo == true) {
linkParams += "id/" + e3const.selectedEventId + '/';
} else {
linkParams += "id=" + e3const.selectedEventId + '&';
}
} else if (e3const.selectedChannel != "null" && e3const.selectedChannel != "" && e3const.selectedChannel != null) {
if (seo == true) {
linkParams += "channel/" + e3const.selectedChannel + '/';
} else {
linkParams += "channel=" + e3const.selectedChannel + '&';
}
} else if (e3const.selectedLeague != "null" && e3const.selectedLeague != "" && e3const.selectedLeague != null && e3const.gameId != "null" && e3const.gameId != "" && e3const.gameId != null) {
if (seo == true) {
linkParams += "league/" + e3const.selectedLeague + '/gameId/' + e3const.gameId
} else {
linkParams += "league=" + e3const.selectedLeague + '&gameId=' + e3const.gameId
}
}
if (linkParams != '' && addUnderScore == true) {
if (seo == true) {
linkParams = '/_/' + linkParams;
} else {
linkParams = '?' + linkParams;
}
} else if (linkParams != '' && addUnderScore == false) {
if (seo == true) {
linkParams = '/' + linkParams;
} else {
linkParams = '&' + linkParams;
}
}
return linkParams;
}