//***************************************************************************
//Right Navigation for the Houseguest Pages**********************************
if(document.images){
	for (i=1; i<=12; i++){ 
	eval("guest"+i+"_on = new Image()");eval("guest"+i+"_on.src = '/primetime/bigbrother3/images/houseguests/nav/guest"+i+"_on.jpg'");
	}
}

function gueston(gnumber) {
	document.images["guest" + gnumber].src = eval("guest" + gnumber + "_on.src");
}


//***************************************************************************
//Tertiary Navigation for Fantasy League**************************************
if(document.images){
	for (i=1; i<=4; i++){ 
	eval("fantnav"+i+"_on = new Image()");eval("fantnav"+i+"_on.src = '/primetime/bigbrother3/images/fantasy/nav/fantnav"+i+"_on.gif'");
	}
}

function fantasy_nav_on(fantnumber) {
	document.images["fantnav" + fantnumber].src = eval("fantnav" + fantnumber + "_on.src");
}


//*******************************************************************************
//Right side dropdown navigation for fantasy league
function houseguestPoints() {
	Item = pointsby.houseguest.selectedIndex;
	if(pointsby.houseguest.options[Item].value != '--- Choose Houseguest ---') document.location = pointsby.houseguest.options[Item].value;
}

function categoryPoints() {
	Item = pointsby.category.selectedIndex;
	if(pointsby.category.options[Item].value != '--- Choose Houseguest ---') document.location = pointsby.category.options[Item].value;
}


//***************************************************************************
//Right Navigation for the Show Pages*****************************************
wk0_on = new Image();wk0_on.src = "/Common/images/spacer.gif";
wk0w_on = new Image();wk0w_on.src = "/primetime/bigbrother3/photos/show_nav/wk0w_on.gif";

for (i=1; i<=11; i++){ 
eval("wk"+i+"_on = new Image()");eval("wk"+i+"_on.src = '/primetime/bigbrother3/photos/show_nav/wk"+i+"_on.gif'");
eval("wk"+i+"t_on = new Image()");eval("wk"+i+"t_on.src = '/primetime/bigbrother3/photos/show_nav/wk"+i+"t_on.gif'");
eval("wk"+i+"s_on = new Image()");eval("wk"+i+"s_on.src = '/primetime/bigbrother3/photos/show_nav/wk"+i+"s_on.gif'");
eval("wk"+i+"w_on = new Image()");eval("wk"+i+"w_on.src = '/primetime/bigbrother3/photos/show_nav/wk"+i+"w_on.gif'");
}

function turnon(theWeek,theDay) {
	document.images[theWeek].src= eval(theWeek + "_on.src");
	document.images[theWeek + theDay].src= eval(theWeek + theDay + "_on.src");
}

//****************************************************************************
//topnav drop menu************************************************************
// all functions and variables were given bb3_ appended to the front to *******
// dinstinguish them from any functions and variables in core.js**************

if(document.images){
for (i=1; i<=7; i++)
{
eval("topnav_"+i+"_off = new Image()");eval("topnav_"+i+"_off.src = '/primetime/bigbrother3/images/topnav/topnav_"+i+"_off.gif'");
eval("topnav_"+i+"_on = new Image()");eval("topnav_"+i+"_on.src = '/primetime/bigbrother3/images/topnav/topnav_"+i+"_on.gif'");
}

for (i=1; i<=5; i++)
{
eval("subnav_1_"+i+"_off=new Image()");eval("subnav_1_"+i+"_off.src='/primetime/bigbrother3/images/topnav/subnav_1_"+i+"_off.gif'");
eval("subnav_1_"+i+"_on=new Image()");eval("subnav_1_"+i+"_on.src='/primetime/bigbrother3/images/topnav/subnav_1_"+i+"_on.gif'");
}

for (i=1; i<=4; i++)
{
eval("subnav_3_"+i+"_off=new Image()");eval("subnav_3_"+i+"_off.src='/primetime/bigbrother3/images/topnav/subnav_3_"+i+"_off.gif'");
eval("subnav_3_"+i+"_on=new Image()");eval("subnav_3_"+i+"_on.src='/primetime/bigbrother3/images/topnav/subnav_3_"+i+"_on.gif'");
}

for (i=1; i<=3; i++)
{
eval("subnav_2_"+i+"_off=new Image()");eval("subnav_2_"+i+"_off.src='/primetime/bigbrother3/images/topnav/subnav_2_"+i+"_off.gif'");
eval("subnav_2_"+i+"_on=new Image()");eval("subnav_2_"+i+"_on.src='/primetime/bigbrother3/images/topnav/subnav_2_"+i+"_on.gif'");
}

}

var bb3_NS = (document.layers) ? 1 : 0;
var bb3_IE = (document.all && document.getElementById) ? 1 : 0;
var bb3_N6 = (!document.all && document.getElementById) ? 1 : 0;
//var bb3_IE = (navigator.appName == "Microsoft Internet Explorer") ? 1 : 0;
//var bb3_NS = (navigator.appName == "Netscape") ? 1 : 0;
var bb3_hideMenu = null;

function bb3_Hide(div){
if(bb3_IE)eval('document.all.subnav_'+div+'.style.visibility="hidden"');
if(bb3_NS)eval('document.subnav_'+div+'.visibility="hidden"');
if(bb3_N6) {
	switch (div){
	case "1": 
		bb3_elm = document.getElementById('subnav_1');
		break;
	case "2": 
		bb3_elm = document.getElementById('subnav_2');
		break;
	case "3": 
		bb3_elm = document.getElementById('subnav_3');
		break;
	}
	bb3_elm.style.visibility = "hidden";
}
}

function bb3_Show(div){
if(bb3_IE)eval('document.all.subnav_'+div+'.style.visibility="visible"');
if(bb3_NS)eval('document.subnav_'+div+'.visibility="visible"');
if(bb3_N6) {
	switch (div){
	case "1": 
		bb3_elm = document.getElementById('subnav_1');
		break;
	case "2": 
		bb3_elm = document.getElementById('subnav_2');
		break;
	case "3": 
		bb3_elm = document.getElementById('subnav_3');
		break;
	}
	bb3_elm.style.visibility = "visible";
}
}

function bb3_imgOn(Num) {
bb3_hideAll();
if (document.images) {
document.images["topnav_" +Num].src = eval("topnav_" +Num+ "_on.src")
}
}

function bb3_imgOff(Num) {
if (document.images) {
document.images["topnav_" +Num].src = eval("topnav_" +Num+ "_off.src")
}
}

//MenuMouseOver for div1
function bb3_mImgOn(divNum,Num) {
clearTimeout(bb3_hideMenu);
if (document.images) {
	if(bb3_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
	}
	if(bb3_NS){
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
	}
	if(bb3_N6){
	img1 = document.getElementById("subnav_1").getElementsByTagName("IMG");
	img1[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
	}
}
}

function bb3_mImgOff(divNum,Num) {
if (document.images) {
	if(bb3_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
	}
	if(bb3_NS){
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
	}
	if(bb3_N6){
	img1 = document.getElementById("subnav_1").getElementsByTagName("IMG");
	img1[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
	}
}
}

//MenuMouseOver for div2
function bb3_mImgOn_D2(divNum,Num) {
clearTimeout(bb3_hideMenu);
if (document.images) {
if(bb3_IE){
document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
}
if(bb3_NS){
document.subnav_2.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
}
	if(bb3_N6){
	img2 = document.getElementById("subnav_2").getElementsByTagName("IMG");
	img2[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
	}
}
}

function bb3_mImgOff_D2(divNum,Num) {
if (document.images) {
if(bb3_IE){
document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
}
if(bb3_NS){
document.subnav_2.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
}
	if(bb3_N6){
	img2 = document.getElementById("subnav_2").getElementsByTagName("IMG");
	img2[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
	}
}
}

//MenuMouseOver for div3
function bb3_mImgOn_D3(divNum,Num) {
clearTimeout(bb3_hideMenu);
if (document.images) {
if(bb3_IE){
document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
}
if(bb3_NS){
document.subnav_3.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
}
	if(bb3_N6){
	img3 = document.getElementById("subnav_3").getElementsByTagName("IMG");
	img3[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src")
	}
}
}

function bb3_mImgOff_D3(divNum,Num) {
if (document.images) {
if(bb3_IE){
document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
}
if(bb3_NS){
document.subnav_3.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
}
	if(bb3_N6){
	img3 = document.getElementById("subnav_3").getElementsByTagName("IMG");
	img3[Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src")
	}
}
}

function bb3_hideAll(){
bb3_Hide('1');
bb3_Hide('2');
bb3_Hide('3');
}


//***********************************************************************
//Chat redirect script***************************************************
function gochat() {
alert("Chat is closed.");
	//openWin('http://plnk.peoplelink.com/echat/bigbrother3_1/index.htm',680,480,'chat','no')
//	openWin('http://forums.prospero.com/n/pfx/forum.aspx?webtag=cbsbb&nav=chat',680,480,'chat','no')
	//openWin('/Common/chat.html',680,530,'bigchatwindow','no')
}


//***********************************************************************




//Poll function*****************************************************
function pollResults(address,pollName,x,y){
var qID = 0
var radioGrp = document[pollName].q1;
	for (var i = 0; i < radioGrp.length; i++){
		if (radioGrp[i].checked) {qID = radioGrp[i].value}}
		if (qID == 0)
		alert('Please select an answer before voting.')
		else{
		var whandle = window.open( address + qID, "pollWin" + pollName, "width=" + x + ",height=" + y + ",menubar=0,location=0,scrollbars=0", "0" );
		whandle.focus();
	}
}
//**********************************************************************



//////////////////////////////////////////////////////////////////////////////////////////////
//Live Stream redirect script***************************************************
//*****************************************************************************
document.write('<OBJECT ID="IERPCtl" WIDTH=0 HEIGHT=0 CLASSID="CLSID:FDC7A535-4070-4B92-A0EA-D9994BCC0DC5"></OBJECT>');


function isRealOne() {

        RealOneInst = 'undetermined';
        
        var agt=navigator.userAgent.toLowerCase();
        var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                        && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                        && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
        if (is_nav) {
                IERPCtl = 0;
        }
        
	

      
        if (navigator.plugins) {
                if ((navigator.userAgent.charAt(8)) >= ('3'))
                {
                var nPlayerInstalled=2;
                var i=0;
                while (navigator.plugins[i])
                        {
                        if ((navigator.plugins[i].name) == 'RealOne Player Version Plugin')
                                {
                                        nPlayerInstalled=1;
                                        szPlayerVersion=navigator.plugins[i].description;
                                        break;
                                }
                        i++;
                        }
        
                        if ( nPlayerInstalled == 2 )
                        {
                                var nRPVersion = IERPCtl.RealPlayerVersion;
                                if ( nRPVersion == null )
                                {
                                nPlayerInstalled=2;
                                } else {
                                nPlayerInstalled=1;
                                }
                        }
                }       

                if (nPlayerInstalled == 1)
                {
                RealOneInst = 'installed';  
                } 
                if (nPlayerInstalled == 2)
                {
                RealOneInst = 'notinstalled';
                }
        } else {
        RealOneInst = 'undetermined';
        }
        if (RealOneInst == 'installed') {
                if (agt.indexOf("(r1 ") != -1) {
                        RealOneInst = 'using';
                }
        }

        return RealOneInst;     
		
}

		
function loadlink(page,premium) {

	var checkbrowser = isRealOne();

	if (checkbrowser == 'using') {
	     window.location = (page);
	}

	if (checkbrowser == 'installed') {
	     window.location = (page);
	}

	if (checkbrowser =='undetermined' || checkbrowser =='notinstalled') {

		
		if (navigator.userAgent.indexOf("Mac") != -1) {
		window.open('/primetime/bigbrother3/popups/real_player.html','r1popup','width=485,height=420,toolbar=no,scrollbars=yes,resizable=yes,directories=no,location=no,status=no,menubar=no');	
		//window.location = (page);
		}
		else {if (navigator.userAgent.indexOf("95") != -1) {
		window.location = (page);
		}
		else {if (navigator.userAgent.indexOf("Linux") != -1) {
		window.open('/forward/www.real.com/detect/ukopen/otherOS.html','r1popup','width=245,height=400,toolbar=no,scrollbars=yes,resizable=yes,directories=no,location=no,status=no,menubar=no');
		//window.open('/primetime/bigbrother3/popups/otherOS.html','r1popup','width=250,height=180,toolbar=no,scrollbars=no,resizable=no,directories=no,location=no,status=no,menubar=no');	
		}
		else {
			if (premium == 'yes') {
			document.location = "/forward/www.real.com/partners/bigbrother/index.html";
			//window.open = '/primetime/bigbrother3/popups/premium.html','r1popup','width=250,height=180,toolbar=no,scrollbars=no,resizable=no,directories=no,location=no,status=no,menubar=no');
			}
	
			if (premium == 'no') {
			//do nothing
			//window.open('/primetime/bigbrother3/popups/free.html','r1popup','width=250,height=160,toolbar=no,scrollbars=no,resizable=no,directories=no,location=no,status=no,menubar=no');
			}
		};
	    };
		};


	}

}

function golivestream() {
	loadlink('/forward/start.real.com/rd?pid=bb3&url=bb3_start.smil&src=CNT.cbs.0.0.0.bb3','yes');
}
