var plugin = flashplugin;

//Variables for top navigation************************************************
//Used as a parameter when calling EmbedFlash function************************
var v_top_nav_home="/primetime/bigbrother2/swf/top_nav_home.swf"
var v_top_nav_show_00="/primetime/bigbrother2/swf/top_nav_show_00.swf"
var v_top_nav_show_01="/primetime/bigbrother2/swf/top_nav_show_01.swf"
var v_top_nav_show_02="/primetime/bigbrother2/swf/top_nav_show_02.swf"
var v_top_nav_show_03="/primetime/bigbrother2/swf/top_nav_show_03.swf"
var v_top_nav_show_04="/primetime/bigbrother2/swf/top_nav_show_04.swf"
var v_top_nav_show_05="/primetime/bigbrother2/swf/top_nav_show_05.swf"
var v_top_nav_show_06="/primetime/bigbrother2/swf/top_nav_show_06.swf"
var v_top_nav_show_07="/primetime/bigbrother2/swf/top_nav_show_07.swf"
var v_top_nav_show_08="/primetime/bigbrother2/swf/top_nav_show_08.swf"
var v_top_nav_show_09="/primetime/bigbrother2/swf/top_nav_show_09.swf"
var v_top_nav_show_10="/primetime/bigbrother2/swf/top_nav_show_10.swf"
//var v_top_nav_show_11=""
//var v_top_nav_show_12=""

function winLaunch( address, winname, attributes, replace ){
var whandle = window.open( address, winname, attributes, replace );whandle.focus();
}

var v_houseguest_nav="/primetime/bigbrother2/swf/houseguest_nav.swf"
var v_voting_history_swf="/primetime/bigbrother2/swf/voting_history.swf"
var v_rating_trend_swf="/primetime/bigbrother2/swf/rating_trend.swf"
var v_housetour_swf="/primetime/bigbrother2/swf/house_tour.swf"
//****************************************************************************



//Check if Mac Browser********************************************************
//Use the MacBrowser var in the EmbedFlash function***************************
var MacBrowser=checkBrowser().mac;
//****************************************************************************



//*****************************************************************************
//Real Player detection********************************************************
var RealMode=0;
var RealPlayerG2=0;

if	(navigator.userAgent.indexOf("MSIE")<0	){
      numPlugins = navigator.plugins.length;
    for (i = 0; i < numPlugins; i++){
          rPlugin = navigator.plugins[i];
       if (rPlugin.name.substring(0,10)=="RealPlayer"){
              RealMode=1;
        }
    }
}

document.write('<script language=VBScript\> \n');
document.write('on error resume next \n');
document.write('RealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n');
document.write('</script\> \n');
//****************************************************************************
//****************************************************************************




//****************************************************************************
//Start GoLabel function******************************************************
var movie_ready = "false";
var label;

function bb2_movieobject(moviename)
{
	if (navigator.appName.indexOf ("Microsoft") !=-1) 
	{
		return window[moviename]
	}

	else
	{
		return document[moviename]
	}
}

function bb2_golabel(label,moviename)
{
	if(movie_ready == "false")
		{
			while(movie_ready == "false")
			{
				if(bb2_movieobject(moviename).PercentLoaded() == 100)
				{
					bb2_movieobject(moviename).TGotoLabel("_level0/",label);
					movie_ready = "true";
				}
			}
		}
		
	else
	{
		bb2_movieobject(moviename).TGotoLabel("_level0/",label);
	}
}
//End GoLabel function*******************************************************
//***************************************************************************





//***************************************************************************
//Start Flash Detect function ***********************************************

function bb2_EmbedFlash(flashobject,width,height,file,imgSrc,SendUrl,fVer,autostart,mapimage)
{
    bb2_FlashCode='';
	
	if(file==null && imgSrc==null)
    {
	return;}

    if(!fVer)
	{
	fVer=4;}
    
	if(!width || !height)
    {
	width=20;height=20;}
	
	if(!autostart)
    {
    autostart=true;}

    file_ID=file.substring(0,file.indexOf('.'));
	
	if (MacBrowser && flashobject=="top_nav"){
		if(SendUrl) {
		bb2_FlashCode+=('<a href="'+SendUrl+'">');
		bb2_FlashCode+=('<img src="'+imgSrc+'" alt="'+file_ID+'" border="'+0+'" width="'+width+'" height="'+height+'">');
		bb2_FlashCode+=('</a>');
		} else {
		bb2_FlashCode=('<img src="'+imgSrc+'" alt="'+file_ID+'" border="'+0+'" width="'+width+'" height="'+height+'" usemap="\#'+mapimage+'">');
		}
	} else {
		if (plugin==1) {
	    bb2_FlashCode=('<OBJECT ID="'+flashobject+'" classid="'+this.ClassID+'" codebase="'+this.FCodebase+'" WIDTH="'+width+'" HEIGHT="'+height+'">\n');bb2_FlashCode+=('<PARAM NAME=movie VALUE="'+file+'"> <PARAM NAME="quality" VALUE="high">\n');bb2_FlashCode+=('<PARAM NAME="AUTOSTART" VALUE="'+autostart+'"> \n');bb2_FlashCode+=('<EMBED swLiveConnect="true" src="'+file+'" quality=high width='+width+' height='+height+' NAME='+flashobject+' type="application/x-shockwave-flash" pluginspage="'+this.FDownload+'" autostart="'+autostart+'"></EMBED></OBJECT>');
		} else if (SendUrl) {
		bb2_FlashCode+=('<a href="'+SendUrl+'">');
		bb2_FlashCode+=('<img src="'+imgSrc+'" alt="'+file_ID+'" border="'+0+'" width="'+width+'" height="'+height+'">');
		bb2_FlashCode+=('</a>');
		} else {
		bb2_FlashCode=('<img src="'+imgSrc+'" alt="'+file_ID+'" border="'+0+'" width="'+width+'" height="'+height+'" usemap="\#'+mapimage+'">');
		}
	}
	document.write(bb2_FlashCode);
}
//End Flash Detect function**************************************************
//***************************************************************************




//***************************************************************************
//Start Countdown functions*****************************************************

//code taken from www.wsabstract.com 
//credit:Jeremy Proffitt

var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

c1=new Image(); c1.src="/primetime/bigbrother2/images/global/countdown/c1.gif"
c2=new Image(); c2.src="/primetime/bigbrother2/images/global/countdown/c2.gif"
c3=new Image(); c3.src="/primetime/bigbrother2/images/global/countdown/c3.gif"
c4=new Image(); c4.src="/primetime/bigbrother2/images/global/countdown/c4.gif"
c5=new Image(); c5.src="/primetime/bigbrother2/images/global/countdown/c5.gif"
c6=new Image(); c6.src="/primetime/bigbrother2/images/global/countdown/c6.gif"
c7=new Image(); c7.src="/primetime/bigbrother2/images/global/countdown/c7.gif"
c8=new Image(); c8.src="/primetime/bigbrother2/images/global/countdown/c8.gif"
c9=new Image(); c9.src="/primetime/bigbrother2/images/global/countdown/c9.gif"
c0=new Image(); c0.src="/primetime/bigbrother2/images/global/countdown/c0.gif"
cb=new Image(); cb.src="/primetime/bigbrother2/images/global/countdown/cb.gif"

function extract(d,h,m){
if (!document.images)
return

if (d<=9){
	document.images.h.src=eval("c"+d+".src")
} else {
	document.images.h.src=eval("c"+(d%10)+".src")
}

if (h<=9){
	document.images.a.src=c0.src
	document.images.b.src=eval("c"+h+".src")
} else {
	document.images.a.src=eval("c"+Math.floor(h/10)+".src")
	document.images.b.src=eval("c"+(h%10)+".src")
}

if (m<=9){
	document.images.d.src=c0.src
	document.images.e.src=eval("c"+m+".src")
} else {
	document.images.d.src=eval("c"+Math.floor(m/10)+".src")
	document.images.e.src=eval("c"+(m%10)+".src")
}


}


function show3(){
}

function show4(){
if (!document.images)
return
var yr=2003
var m=3
var showhour=21
var showminutes=60
var showday=25
var Digital=new Date()

var nowhour=Digital.getHours()
if (nowhour > showhour) {
	var hours=(43 - nowhour)
} else if (nowhour==showhour) {
	var hours=0
} else {
	var hours=(showhour - nowhour)
}
var nowminutes=Digital.getMinutes()
var minutes=(showminutes - nowminutes)

//var nowday=Digital.getDate() old stuff
//var days=(showday - nowday) old stuff

var today=new Date();
var todayy=today.getYear();
	if (todayy < 1000) {
	todayy+=1900;
	}
var todaym=today.getMonth();
var todayd=today.getDate();
var todaystring=montharray[todaym]+" "+todayd+", "+todayy;
var futurestring=montharray[m-1]+" "+showday+", "+yr;
var days=(Math.round((Date.parse(futurestring)-Date.parse(todaystring))/(24*60*60*1000))*1);

if (minutes==60) {
	minutes = 59
}

if (nowhour > showhour) {
	var days=days-1
}

extract(days,hours,minutes)
setTimeout("show3()",60000)
}

//***************************************************************************
//End Countdown function*****************************************************

//************************************************************************
//Start Poll function*****************************************************

function pollResults(){
var qID = 0;
var ones = arguments.length;
var address = arguments[0];

	if (ones == 2) {
	var pollName = arguments[1];
	var radioGrp = document.forms[pollName].q1;
	} else {
	var radioGrp = document.forms[1].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", "width=485,height=350,menubar=0,location=0,scrollbars=0", "0" );
		whandle.focus();
	}
}



//**********************************************************************
//End Poll function*****************************************************


//***********************************************************************
//Chat redirect script***************************************************
function gochat() {
alert("Chat is closed.");
//winLaunch('http://forums.prospero.com/n/pfx/forum.aspx?webtag=cbsbb&nav=chat','chat','width=680,height=530,location=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no');
}

//***********************************************************************
//Live Stream redirect script***************************************************
function golivestream() {

if (RealMode || RealPlayerG2){
		document.location='http://pylon.real.com/gp_only/ram.rxml?pid=bb&url=start.smi%3fmode=compact&promo=bigbrother/cbs_gp/bb2_cbs_gp_promo.smi&mode=compact';
} else {
	document.location='http://www.real.com/partners/bigbrother2/?src=cbsads';
}

}


this.author = "Alberto F. Araya ";
this.UpDated = "08/22/2001@12:00am";
this.version = "CBS.Com A.P.I. ver 4.0 ";
this.whatIs = version+'and updated on '+ UpDated;
document.write('<meta name="Author" CONTENT='+this.author+'>\n <meta name="Creator" CONTENT='+this.author+this.whatIs+'>\n');
this.FDownload = 'http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi?P1_Prod_Version=ShockwaveFlash';
this.FCodebase = 'http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=4,0,2,0';
this.ClassID = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
var plugin = 0;
currOpen = "";
var newstemp=0;
var entTemp=0;
var all_loaded=false;/*for dhtml menu*/
/*Global var end*/
function checkBrowser()
{
	this.ie4=false;
	this.ie5=false;
	this.ie51=false;
	this.ie6=false
	this.ns4=false;
	this.ns6=false;
	this.mac=false;	
	this.pc=false;
	this.aol=false;
	this.dom=document.getElementById?this.dom=true:this.dom=false;
	this.bname=navigator.appName;
	this.ver=navigator.appVersion;
	this.int_ver=parseInt(this.ver);
	this.navUser=navigator.userAgent;
	this.navMime=navigator.mimeTypes;
	this.navPlugs=navigator.plugins;
	this.bname.indexOf("Netscape")>=0&&this.int_ver==4?(this.ns4=true):(this.ns4=false);
	this.navUser.toLowerCase().indexOf('aol')!=-1?(this.aol=true):(this.aol=false);
	this.ver.indexOf('Mac')!=-1?(this.mac=true):(this.pc=true);
	this.navUser.indexOf('MSIE 4')>0?(this.ie4=true):(this.ie4=false);
	this.navUser.indexOf('MSIE 5')>0?(this.ie5=true):(this.ie5=false);
	this.navUser.indexOf('MSIE 5.13')>0?(this.ie51=true):(this.ie51=false);
	this.navUser.indexOf('MSIE 6')>0?(this.ie6=true):(this.ie6=false);
	this.navUser.indexOf("Netscape6")>0?(this.ns6=true):(this.ns6=false);
this.cbs=(this.ie5||this.ie4||this.ns4||this.ns6||this.ie6);
this.CbsDOM=(this.ie5||this.ns6||this.ie6);
this.CbsNDOM=(this.ie4||this.ns4);
return this;
}
