function gvpUtils() { var W3C = (!document.all && document.getElementById); var IE = (document.all); var ns4 = (document.layers); if(typeof console !== 'undefined') {var v_debug = false} var vMainInit = ''; var vBrowBackButStatus = '#vBrowBackbut'; var vQueryStr = ''; var vPathName = ''; var version = navigator.appVersion; var IE6 = (version.indexOf("MSIE 6.0") != -1) ? true : false; var IE = (version.indexOf("MSIE") != -1) ? true : false; var aminCtr = 0; var pSku; var pVidSrc; var pWidth; var body; function displayError(str, e) { if (v_debug) { if (IE) { alert("error occur in " + getFunctionName(str)+" "+e); } else { console.log("error occur in " + getFunctionName(str)+" "+e); } } } function getFunctionName(str) { var ownName = str; ownName = ownName.substr('function '.length); // trim off "function " ownName = ownName.substr(0, ownName.indexOf('(')); // trim off everything after the function name return ownName; } this.getPageLanguage = function getPageLanguage() { var p_lang = 'en_US'; if(typeof v_locale != 'undefined') { p_lang = v_locale; } return p_lang; } this.abandonPage = function abandonPage() { alert("abandonPage() stub function called."); this.closePopup(); } this.reportWebTrendsEvent = function reportWebTrendsEvent(wtSKU, pageName, locationOfLink, linkName, pageHit, fileName, target) { //alert('reportWebTrendsEvent()'); if(target == '') { target = this.getWindowLocation(); } var truncTarget = target.substr(27,target.length); var referrer = this.getWindowLocation(); // get's the referring page, which is the lastTarget lastTarget = target; // resets lastTarget for next time if(fileName != 'null') { dcsMultiTrackTop('DCS.dcsuri',truncTarget,'DCS.dcsref',referrer,'DCSext.wtNoHit',pageHit,'DCSext.wtPN',pageName,'WT.pn_sku',wtSKU,'DCSext.wtLinkLoc',locationOfLink,'DCSext.wtLinkName',linkName,'DCSext.wtFileName',fileName); } else { dcsMultiTrackTop('DCS.dcsuri',truncTarget,'DCS.dcsref',referrer,'DCSext.wtNoHit',pageHit,'DCSext.wtPN',pageName,'WT.pn_sku',wtSKU,'DCSext.wtLinkLoc',locationOfLink,'DCSext.wtLinkName',linkName); } // do whatever needs to be done to hit the webtrends server var s = "wtSKU=" + wtSKU + "\r\n"; s += "pageName=" + pageName + "\r\n"; s += "locationOfLink=" + locationOfLink + "\r\n"; s += "linkName=" + linkName + "\r\n"; s += "pageHit=" + pageHit + "\r\n"; s += "fileName=" + fileName + "\r\n"; s += "target=" + truncTarget + "\r\n"; s += "referrer=" + referrer + "\r\n"; //alert(s); } //-------------------------------------------- // Name: centerDiv // Desc: Move the div to the center of the browser. // param: id of div // return: nothing // Example how to call it: this.centerDiv("test") this.centerDiv = function centerDiv(param) { try { var dsocLeft=0, dsocTop=0; obj = this.getElementObj(param); if (IE) { var iebody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body; winH = parseInt(iebody.clientHeight / 2); winW = parseInt(iebody.clientWidth / 2); dsocLeft = iebody.scrollLeft; dsocTop = iebody.scrollTop; } else { winH = parseInt(window.innerHeight / 2); winW = parseInt(window.innerWidth / 2); dsocLeft = window.pageXOffset; dsocTop = window.pageYOffset; } var top = dsocTop + winH - parseInt(obj.offsetHeight / 2); var left = dsocLeft + winW - parseInt(obj.offsetWidth / 2); obj.style.top = top + "px"; obj.style.left = left + "px"; } catch(e) { displayError(arguments.callee.toString(), e); } } // end of centerDiv this.setModalTitle = function setModalTitle(titleToSet) { if(typeof titleToSet != 'undefined') { this.getElementObj("mainPopUpTitle").innerHTML = titleToSet; } else { this.getElementObj("mainPopUpTitle").innerHTML = 'AT&T Video Player' } } this.setFlashStageSize = function setFlashStageSize( p_width, p_height ) { //if (v_debug) console.log("setFlashStageSize(): width=" + p_width + ", height=" + p_height + " called: " + aminCtr + " times"); //The container for the Flash file $('mainPopupDiv').style.width = p_width+22 + "px"; $('mainPopupDiv').style.height = p_height+62 + "px"; //The object wrapper for the flash file $('stageResizerObj').style.width = p_width + "px"; $('stageResizerObj').style.height = p_height + "px"; //The embed element ignore if IE since it does not use embed for flash if(!IE) { $('stageResizer').style.width = p_width + "px"; $('stageResizer').style.height = p_height + "px"; } this.centerDiv('mainPopupDiv'); } this.getWindowLocation = function getWindowLocation(){ return window.location; } this.debug = function(p) { v_debug = p; } this.hideSelectOption = function(p) { try { // for IE6 var version=navigator.appVersion; if (version.indexOf("MSIE 6.0") != -1){ var select_array = document.getElementsByTagName("select"); for (i=0; i= 4) { if(arguments.length == 5) { if(playerType == '360') { pSku = mSkuOrPath; pWidth = 531; } else if(playerType == 'vid') { pVidSrc = mSkuOrPath; var loc = window.location.href; if(loc.indexOf('smartphones')!= -1) { pWidth = 505; } else { pWidth = 540; } } else if(playerType == 'div') { var pFrameArgs = mSkuOrPath.split('|'); var pFrameSrc = pFrameArgs[0]; var pFrameWidth = pFrameArgs[1]; var pFrameHeight = pFrameArgs[2]; pWidth = parseInt(pFrameWidth) + parseInt('22'); //console.log('framewidth: '+pFrameWidth+' frameheight: '+pFrameHeight); } else if(playerType == 'gvp') { pConfig = mSkuOrPath; pWidth = 542; } } else { pWidth = 582; } } try { var overLayDiv_id, messDivObj, popupDiv, id, buttonDivObj; if (blockBG) { overLayDiv_id = this.overLayDiv(true); } if (closeButton == true) { //this.visibleElement("popCloseButton", false); } if ($('mainPopupDiv')) { $('mainPopupDiv').show(); } else { var pPopDiv = $(document.createElement('div')); pPopDiv.setAttribute('id', 'mainPopupDiv'); pPopDiv.setAttribute('style', 'position:absolute; visibility:hidden; left:100px; top:100px; width:'+pWidth+'px; z-index:100; border:#CCCCCC solid 2px; background-color:#FFFFFF;'); if(IE) { pPopDiv.style.setAttribute('cssText', 'position:absolute; visibility:hidden; left:100px; top:100px; width:'+pWidth+'px; z-index:100; border:#CCCCCC solid 2px; background-color:#FFFFFF;'); } var pPopDivTitleBG = $(document.createElement('div')); pPopDivTitleBG.setAttribute('id', 'pPopDivTitleBG'); pPopDivTitleBG.setAttribute('style', 'height:37px; background-image:url(http://www.att.com/media/en_US/images/img/img_uverse-gradient-4x37_AA0009R6.gif); background-repeat:repeat-x; border-top:#FFFFFF solid 1px; border-left:#FFFFFF solid 1px; border-right:#FFFFFF solid 1px;'); if(IE) { pPopDivTitleBG.style.setAttribute('cssText', 'height:37px; background-image:url(http://www.att.com/media/en_US/images/img/img_uverse-gradient-4x37_AA0009R6.gif); background-repeat:repeat-x; border-top:#FFFFFF solid 1px; border-left:#FFFFFF solid 1px; border-right:#FFFFFF solid 1px;'); } var pPopDivTitleWrapper = $(document.createElement('div')); pPopDivTitleWrapper.setAttribute('id', 'pPopDivTitleWrapper'); pPopDivTitleWrapper.setAttribute('style', 'padding:10px;'); if(IE) { pPopDivTitleWrapper.style.setAttribute('cssText', 'padding:10px;'); } var pPopDivTitle = $(document.createElement('div')); pPopDivTitle.setAttribute('id', 'pPopDivTitle'); pPopDivTitle.setAttribute('style', 'float:left; padding-left:10px;'); if(IE) { pPopDivTitle.style.setAttribute('cssText', 'float:left; padding-left:10px;'); } var pPopDivTitleText = $(document.createElement('H1')); pPopDivTitleText.setAttribute('id', 'mainPopUpTitle'); pPopDivTitleText.setAttribute('style', 'font-size:14px;'); if(IE) { pPopDivTitleText.style.setAttribute('cssText', 'font-size:14px;'); } var pPopDivCloseButton = $(document.createElement('div')); pPopDivCloseButton.setAttribute('id', 'popCloseButton'); //pPopDivCloseButton.setAttribute('onclick', 'gvp.closePopup()'); pPopDivCloseButton.setAttribute('style', 'text-align:right; font-size:11px;'); if(IE) { pPopDivCloseButton.style.setAttribute('cssText', 'text-align:right; font-size:11px;'); } var pPopDivBody = $(document.createElement('div')); pPopDivBody.setAttribute('id', 'mainPopupBody'); pPopDivBody.setAttribute('style', 'border:#CCCCCC solid 1px; margin:10px;'); if(IE) { pPopDivBody.style.setAttribute('cssText', 'border:#CCCCCC solid 1px; margin:10px;'); } var pPopDivButton = $(document.createElement('div')); pPopDivButton.setAttribute('id', 'mainPopupButton'); pPopDivButton.setAttribute('style', 'padding-right:10px;padding-bottom:8px;'); if(IE) { pPopDivButton.style.setAttribute('cssText', 'padding-right:10px;padding-bottom:8px;'); } body.appendChild(pPopDiv); $('mainPopupDiv').appendChild(pPopDivTitleBG); $('pPopDivTitleBG').appendChild(pPopDivTitleWrapper); $('pPopDivTitleWrapper').appendChild(pPopDivTitle); $('pPopDivTitle').appendChild(pPopDivTitleText); $('pPopDivTitleWrapper').appendChild(pPopDivCloseButton); $('mainPopupDiv').appendChild(pPopDivBody); $('mainPopupDiv').appendChild(pPopDivButton); } if(title != '') { this.getElementObj("mainPopUpTitle").innerHTML = title; } else { this.getElementObj("mainPopUpTitle").innerHTML = 'AT&T Video Player' } if(playerType == '360') { this.getElementObj("mainPopupBody").innerHTML = '
'; if(! IE){$('mainPopupBody').focus();} } else if(playerType == 'vid') { var singleVidPath; var loc = window.location.href; //alert(loc); if(loc.indexOf('smartphones')!= -1) { singleVidPath = 'std_vid'; this.getElementObj("mainPopupBody").innerHTML = ' '; } else { singleVidPath = 'gvp_vid'; this.getElementObj("mainPopupBody").innerHTML = ' '; } } else if(playerType == 'div') { this.getElementObj("mainPopupBody").innerHTML = '
'; if(! IE){$('mainPopupBody').focus();} } else if(playerType == 'gvp' || playerType == null){ //this.getElementObj("mainPopupBody").innerHTML = ' '; } $('popCloseButton').innerHTML = 'Close '; if (IE6) { //hideSelectOption(true); } this.divPopUp('mainPopupDiv',true); } catch(e) { // do nothing displayError(arguments.callee.toString(), e); } } //-------------------------------------------- // Name: overLayDiv // Desc: Expand the div to cover the whole document and you can still can see it // param: param = true for expand or false for shrink // return: nothing // Example how to call it: this.overLayDiv(true); or this.overLayDiv(false); this.overLayDiv = function overLayDiv(param) { try { var winW = 1, winH = 1; var v_filter = 0; v_opacity = 0; var v_name = "overlayDiv"; var obj; obj = this.getElementObj(v_name); if (obj == null) { divElement = document.createElement("div"); divElement.setAttribute('id', v_name); divElement.setAttribute('style', "z-index:50;"); document.getElementsByTagName('body')[0].appendChild(divElement); obj = this.getElementObj(v_name); } if (param == true) { if (IE) { winW = document.body.scrollWidth; winH = document.body.scrollHeight ; var iebody = (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body; if (winH < iebody.clientHeight) winH = iebody.clientHeight; v_filter ="alpha(opacity=50)"; v_opacity = "50"; } else { winW = document.width; winH = document.height; if (winH < window.innerHeight) winH = window.innerHeight; v_filter ="alpha(opacity=.5)"; v_opacity = ".5"; } obj.style.filter = v_filter; obj.style.opacity = v_opacity; } obj.style.position = "absolute"; obj.style.top = "0px"; obj.style.left = "0px"; obj.style.height = winH + "px"; obj.style.width = winW + "px"; obj.style.backgroundColor = "black"; return(v_name); } catch(e) { displayError(arguments.callee.toString()); } } // end of overLayDiv //------------------------------------------ // Name: visibleElement // Desc: Function to hide or show an element with visibility property. Pass in an id or object and it will hide the element. // param: p1 = id string or an object; status = true or false // return: nothing // Example how to call it: this.visibleElement("test", true) this.visibleElement = function visibleElement(p1, status) { try { var obj = this.getElementObj(p1); if (obj != undefined) { if (status == true) { obj.style.visibility = ""; } else if (status == false) { obj.style.visibility = "hidden"; } } } catch(e) { displayError(arguments.callee.toString()); } } // end of visibleElement //-------------------------------------------- // Name: divPopUp // Desc: perform a div popup message // param: id = pass id of the div; visible = true for show div or false for hide div // return: nothing // Example how to call it: this.divPopUP("testDiv",true); or this.divPopUP("testDiv",false); this.divPopUp = function divPopUp(id, visible) { try { this.visibleElement(id, visible); if (visible) this.centerDiv(id); } catch(e) { displayError(arguments.callee.toString()); } } // end of divPopUp //-------------------------------------------- // Name: getElementObj // Desc: Function to get an obj of element. pass in an id and it return the obj // param: string of id // return: an object // Example how to call it: this.getElementObj("test", true) this.getElementObj = function getElementObj(param) { try { if (typeof param == 'object') { return param; } else { if (document.getElementById) { // W3C - Explorer 5+ and Netscape 6+ return document.getElementById(param); } else if (document.all) { // Explorer 4 return document.all[param]; } else if (document.layers) { // NS4 return document.layers[param]; } } } catch(e) { displayError(arguments.callee.toString()); } } // end of getElementObj //-------------------------------------------- // Name: flipBGFlash // Desc: Function to hide and show background flash // param: string of id // return: nothing this.flipBGFlash = function flipBGFlash(idToHide, visibilityOrDisplay) { try { if ($(idToHide) != null) { if(visibilityOrDisplay == 'visibility') { if($(idToHide).style.visibility == 'visible') { $(idToHide).setStyle({ visibility: 'hidden' }); } else { $(idToHide).setStyle({ visibility: 'visible' }); } } else if(visibilityOrDisplay == 'display') { if($(idToHide).style.display == 'block') { $(idToHide).hide(); } else { $(idToHide).show(); } } } } catch(e) { displayError(arguments.callee.toString()); } } // end of flipBGFlash // the following 3 methods encapsulate proper determination of existing OLAM customers this.isNumeric = function(inputVal) { if (isNaN(parseFloat(inputVal))) { return false; } return true } this.getCookie = function(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) { return null; } } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } this.checkExistingMobilityCustomer = function() { var p_isCustomer = new String('false'); var myCookie = this.getCookie('colam_ctn'); if(this.isNumeric(myCookie.substr(0, 9))) { p_isCustomer = 'true'; } //if(typeof console !== 'undefined') {console.log('called existing customer status: '+p_isCustomer);} return p_isCustomer; } } gvp = new gvpUtils();