// 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);
}

function WinPOP(height,width,url)
{
	window.open(
	url,
	"RegHelp",
	"toolbar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes,height="+height+",width="+width);
}


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);
}

// 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;
}

function checklogon (name) {
	var hbo_username1 = getCookie("logged_in_user");
	var hbo_username2 = getCookie("user_name");
	var hbo_username = null;

	if (hbo_username2 != null) {
		var hbo_username = hbo_username2;
		// alert( "hello 2" );
	}
	if (hbo_username1 != null) { 
		var hbo_username = hbo_username1; 
		// alert( "hello 1" );
	}
	
	if (hbo_username == "") { 
		var hbo_username = null; 
		// alert( "hello 1" );
	}
			
	// alert( "hbo_username:"+hbo_username+":" );
	return hbo_username;
}

var hbo_username = checklogon("logged_in_user");


// every window on HBO.com should be named MAIN 
window.name = "MAIN";


	



if (document.images){
		understandingon = new Image(1,1);
		understandingon.src ="/addiction/img/alt_nav/nav_understanding_on.jpg";
		
		adolescenton = new Image(1,1);
		adolescenton.src ="/addiction/img/alt_nav/nav_adolescent_on.jpg";
		
		treatmenton = new Image(1,1);
		treatmenton.src ="/addiction/img/alt_nav/nav_treatment_on.jpg";
		
		aftercareon = new Image(1,1);
		aftercareon.src ="/addiction/img/alt_nav/nav_aftercare_on.jpg";
		
		stigmaon = new Image(1,1);
		stigmaon.src ="/addiction/img/alt_nav/nav_stigma_on.jpg";
		
		thefilmon = new Image(1,1);
		thefilmon.src ="/addiction/img/alt_nav/nav_thefilm_on.jpg";
					
		
		understandingoff = new Image(1,1);
		understandingoff.src ="/addiction/img/alt_nav/nav_understanding_off.jpg";
		
		adolescentoff = new Image(1,1);
		adolescentoff.src ="/addiction/img/alt_nav/nav_adolescent_off.jpg";
		
		treatmentoff = new Image(1,1);
		treatmentoff.src ="/addiction/img/alt_nav/nav_treatment_off.jpg";
		
		aftercareoff = new Image(1,1);
		aftercareoff.src ="/addiction/img/alt_nav/nav_aftercare_off.jpg";
		
		stigmaoff = new Image(1,1);
		stigmaoff.src ="/addiction/img/alt_nav/nav_stigma_off.jpg";
		
		thefilmoff = new Image(1,1);
		thefilmoff.src ="/addiction/img/alt_nav/nav_thefilm_off.jpg";
		}
		
		function Nav2ImgOn (imgName) {
			if (document.images) {
			document[imgName].src= eval(imgName+"on.src");
			}
		}
		function Nav2ImgOff (imgName) {
			if (document.images){
			document[imgName].src= eval(imgName+"off.src");
			}
		}



var contentVersion = 8;
var flashCanPlay = false;
			

var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

	if(plugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	var pluginVersion;
	for (var i = 0; i < words.length; ++i) {
		if(isNaN(parseInt(words[i]))) continue;
		pluginVersion = words[i]; 
		}
		flashCanPlay = pluginVersion >= contentVersion;
		} else if(navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('flashCanPlay = ');
		document.write('(IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash."');
		document.write(' & contentVersion)))\n');
		document.write('<' + '/SCR' + 'IPT\> \n');
		}
		
