// Global Functions// set the servername for appsif ( document.domain.match("dev") ) { secure_servername = "https://dev.homebox.com"; }else { secure_servername = "https://www.hbo.com"; }// global window popping script// use this script for popping windows within the site and cross-domainfunction winPop(url,width,height){	window.open(	url,	"HBOwinpop",	"screenX=10,screenY=10,left=10,top=10,toolbar=no,location=no,resizable=yes,scrollbars=yes,status=yes,height=" + height + ",width=" + width);}// use only for the privacy policyfunction WinOpen(height,width,url){	window.open(	url,	"RegHelp",	"toolbar=no,location=no,resizable=yes,scrollbars=yes,status=no,height="+height+",width="+width);}// kostas's flash-only popping script.. to be used for all INTERNAL flash popping// this script does not work cross-domains. please use the winPop script for popping windows across domainsvar extWin;function openFlashWin(url,w,h){	var x = (screen.width - w)/2;	var y = (screen.height - h)/3;	if(typeof(extWin)=="undefined" || extWin.closed==true){		extWin = window.open(url,"external","width="+w+",height="+h+",left="+x+",top="+y+",toolbar=no,location=no,menubar=no,status=yes,scrollbars=no,resizable=no");		if(extWin.opener == null) extWin.opener = window;		extWin.w = w;		extWin.h = h;	} else {		if(w != extWin.w || h != extWin.h){			extWin.resizeTo(w,h);			extWin.moveTo(x,y);			extWin.w = w;			extWin.h = h;		}		if(extWin.location != url) extWin.location = url;		extWin.focus();	}}// special report popupfunction newsPopup (){	resultWindow = "http://www.hbo.com/special report/processing.html";	window.open(resultWindow,'popup','width=360,height=400,toolbar=no,location=no,resizable=no,scrollbars=no,status=yes,left=10,top=10,screenX=10,screenY=10');}// Chat popupfunction chatPopup (){	resultWindow = "http://www.hbo.com/corpinfo/processing_login.html";	window.open(resultWindow,'chat','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}// this is the new login popup. you can use this to either pop the login or registrationfunction loginPopup (URL){	window.open(URL,'login','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}// game login popupfunction gamePopup (URL){	window.open(URL,'game','width=800,height=570,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}// this is the boxing event login popup -- same as above, just different window sizefunction boxingPopup (URL){	window.open(URL,'game','width=600,height=475,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}// this pops the Poll window and is called by all Pollsfunction popPoll() {	pollWindow = window.open("","PollResults","width=500,height=500,RESIZABLE=NO,SCROLLBARS=NO");}// This pops the Contest window and is called by all Contestsfunction popContest(contest_id,ro,ows,tws,aid,bgcolor,textcolor,header) {	var contestURL = secure_servername + '/apps/contest/actions/EnterContest?CONTEST_ID=' + contest_id + '&ro=' + ro + '&ows=' + ows + '&tws=' + tws + '&activity_type_id=' + aid + '&bgcolor=' + bgcolor + '&textcolor=' + textcolor + '&header=' + header;	//alert( contestURL );	contestWindow = window.open ("http://www.hbo.com/special report/processing.html","ContestResults","width=625,height=500,resizable=yes,scrollbars=yes,toolbar=no,location=no,status=yes,left=10,top=10,screenX=10,screenY=10");	contestWindow.focus();	contestWindow.location.href = contestURL;}// This pops the slideshow windowfunction popSlideshow(slideshowURL) {	slideshowWindow = window.open(slideshowURL,'slideshow','width=620,height=550,toolbar=no,location=no,resizable=no,scrollbars=no,status=yes,left=10,top=10,screenX=10,screenY=10');	slideshowWindow.focus();}// every window on HBO.com should be named MAIN so that the store and login// can be redirected back to the parent window...window.name = "MAIN";// the following scripts are used to read the login cookie and display the header// this cookie function is also used with the SURVEY scripts below...function getCookie (name) {var dcookie = document.cookie;var cname = name + "=";var clen = dcookie.length;var cbegin = 0;        while (cbegin < clen) {        var vbegin = cbegin + cname.length;                if (dcookie.substring(cbegin, vbegin) == cname) {                var vend = dcookie.indexOf (";", vbegin);                        if (vend == -1) vend = clen;                return unescape(dcookie.substring(vbegin, vend));                }        cbegin = dcookie.indexOf(" ", cbegin) + 1;                if (cbegin == 0) break;        }return null;}var hbo_username = getCookie("logged_in_user");// these functions are used in the global nav ONLYfunction registerPop(){	window.open(secure_servername + '/apps/login/UserRegistration.do?ro=103245&ows=103271&tws=103271&activity_type_id=AIMQRYD2&survey_id=XTRAND2&pFlow=1','login','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}function signinPop(){	window.open(secure_servername + '/apps/login/secure/LogMeIn.do?ro=103268&ows=103270&tws=103270&activity_type_id=AIMQRYD2&survey_id=XTRAND2&pFlow=2','login','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}function profilePop(){	window.open(secure_servername + '/apps/login/secure/ProfileAtAGlance.do?ro=103258&ows=103270&tws=103270&survey_id=XTRAND2&activity_type_id=AIMQRYD2&pFlow=2','login','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');}// these functions are for the loginfunction writeCookie (cookieName, cookieValue, expiry){	var expDate = new Date();	expDate.setTime (expDate.getTime() + expiry);	document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/";}function deleteCookie (name) {	window.open(secure_servername + '/apps/login/Logout','login','width=625,height=500,toolbar=no,location=no,resizable=no,scrollbars=yes,status=yes,left=10,top=10,screenX=10,screenY=10');	var expireNow = new Date();	document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=/";	window.location.reload();}// SURVEY scripts -- added from home_extras.js// writeCookie [changed to writeCookieSurvey]// deleteCookie [changed to deleteCookie Survey]// functions changed so as not to interfere with the login cookie scriptsfunction writeCookieSurvey (cookieName, cookieValue, expiry) {	var expDays = 60; // number of days the cookie should last	var expDate = new Date();	expDate.setTime (expDate.getTime() + (expDays*24*60*60*1000));	document.cookie = cookieName + "=" + escape (cookieValue) + "; expires=" + expDate.toGMTString() + "; path=/";}function deleteCookieSurvey (name) {	var expireNow = new Date();	// null survey value and set cookie for one tick in the past	expireNow.setTime(expireNow.getTime() - 1);	document.cookie = name + "=" + "; expires=" + expireNow.toGMTString + "; path=/";}function surveyPopUp(pageIdentifier,freq) {	var survey5 = getCookie("survey5");	if (survey5 == "yes") {		// Survey invite previously given, do nothing	}	else {		// Survey invite has not been previously given, initiate		rrand = Math.random();		if (rrand < freq) {			// random seed below threshhold, set cookie and pop survey			writeCookieSurvey('survey5', 'yes');			window.open("/survey/pop-up_survey.html?" + pageIdentifier, "surveyInvitation", "top=5,left=5,height=400,width=500,toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0");		}		else {			// random seed above threshhold, do nothing		}	}}// PLEASE DISCONTINUE USING THIS SCRIPT!!// use only the winPop functionfunction WinOpenFullAttr(height,width,url,popname,fullattr){	window.open(	url,	popname,	fullattr + "," + "height=" + height + ",width=" + width);}// function for handling the episode guide dropdownfunction formHandler(form){var URL = document.form.site.options[document.form.site.selectedIndex].value;window.location.href = URL;}// function for bbsfunction talkcity(bbslink) {bbswindow=window.open(bbslink,"","personalbar=no,menubar=yes,toolbar=no,location=no,resizable=yes,scrollbars=yes,status=yes,height=500,width=710")}