//Variables for EmbedFlash function*******************************************
//****************************************************************************
var v_bio_nav="/primetime/survivor6/swf/bionav.swf";
var v_ratingtrends="/primetime/survivor6/swf/ratingtrends.swf";
var v_ultimate="/primetime/survivor6/swf/ultimate.swf";
var v_tcvh="/primetime/survivor6/swf/tcvh.swf";
var v_challenges="/primetime/survivor6/swf/challenges.swf";
var v_master="/primetime/survivor6/swf/master.swf";
var v_whosnext="/primetime/survivor6/swf/whosnext.swf";
var v_freezeframes="/primetime/survivor6/swf/freezeframes.swf";

//Image substitution
var v_bio_nav_image="/primetime/survivor6/images/swf/bionav.gif";
var v_ratingtrends_image="/primetime/survivor6/images/swf/rating_trends.jpg";
var v_ultimate_image="/primetime/survivor6/images/swf/ultimate.jpg";
var v_tcvh_image="/primetime/survivor6/images/swf/tcvh.jpg";
var v_challenges_image="/primetime/survivor6/images/swf/challenges.jpg";
var v_master_image="/primetime/survivor6/images/swf/master.jpg";
var v_whosnext_image="/primetime/survivor6/images/swf/whosnext.jpg";
var v_freezeframes_image="/primetime/survivor6/images/swf/freezeframes.jpg";
//var v_macromedia="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash target='_blank'";



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

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



//************************************************************************
//Poll function*****************************************************
function pollResults(address,pollName){
var qID = 0
var radioGrp = document.forms[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", "width=510,height=380,menubar=0,location=0,scrollbars=0", "0" );
		whandle.focus();
	}
}
//*****Hide Url of Voting Beans******************************************************************
function hideUrl(){
window.status='';return true;
}
//***********************************************************************
//Chat redirect script***************************************************
function gochat() {
	openWin('http://acx.prospero.com/n/pfx/forum.aspx?webtag=cbssurvivoras&nav=chat',680,530,'bigchatwindow','no')
//openWin('/Common/chat.html',680,530,'bigchatwindow','no')
}


//***********************************************************************
function turnon(theimage) {
	document.images[theimage].src="/primetime/survivor6/images/show/shownav/" + theimage + "_on.gif";
}

function survivorsOn(theimage) {
	document.images[theimage].src="/primetime/survivor6/images/nav/survivors/nav_" + theimage + "_on.gif";
}


//*********BANNER AD FUNCTIONS***********************************************
function ad_468x60(){
	document.write('<br><script language=javascript>genAd("468x60")</script><br>')
}

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

if(document.images){
for (i=1; i<=8; i++)
{
eval("topnav_"+i+"_off = new Image()");eval("topnav_"+i+"_off.src = '/primetime/survivor6/images/topnav/topnav_"+i+"_off.gif'");
eval("topnav_"+i+"_on = new Image()");eval("topnav_"+i+"_on.src = '/primetime/survivor6/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/survivor6/images/topnav/subnav_1_"+i+"_off.gif'");
eval("subnav_1_"+i+"_on=new Image()");eval("subnav_1_"+i+"_on.src='/primetime/survivor6/images/topnav/subnav_1_"+i+"_on.gif'");
}

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

}

var s6_NS = (document.layers) ? 1 : 0;
var s6_IE = (document.all && document.getElementById) ? 1 : 0;
var s6_N6 = (!document.all && document.getElementById) ? 1 : 0;
//var s6_IE = (navigator.appName == "Microsoft Internet Explorer") ? 1 : 0;
//var s6_NS = (navigator.appName == "Netscape") ? 1 : 0;
var s6_hideMenu = null;

function s6_Hide(div){
if(s6_IE)eval('document.all.subnav_'+div+'.style.visibility="hidden"');
if(s6_NS)eval('document.subnav_'+div+'.visibility="hidden"');
if(s6_N6) {
	switch (div){
	case "1": 
		s6_elm = document.getElementById('subnav_1');
		break;
	case "4": 
		s6_elm = document.getElementById('subnav_4');
		break;
	}
	s6_elm.style.visibility = "hidden";
}
}

function s6_Show(div){
if(s6_IE)eval('document.all.subnav_'+div+'.style.visibility="visible"');
if(s6_NS)eval('document.subnav_'+div+'.visibility="visible"');
if(s6_N6) {
	switch (div){
	case "1": 
		s6_elm = document.getElementById('subnav_1');
		break;
	case "4": 
		s6_elm = document.getElementById('subnav_4');
		break;
	}
	s6_elm.style.visibility = "visible";
}
}

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

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

//MenuMouseOver for div1
function s6_mImgOn(divNum,Num) {
clearTimeout(s6_hideMenu);
if (document.images) {
	if(s6_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	document.images["subnav_" +divNum+ "_" +Num].filters.alpha.opacity=100;
	}
	if(s6_NS){
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	}
	if(s6_N6){
	realNum = Num-1;
	img1 = document.getElementById("subnav_1").getElementsByTagName("IMG");
	img1[realNum].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	}
}
}

function s6_mImgOff(divNum,Num) {
if (document.images) {
	if(s6_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	document.images["subnav_" +divNum+ "_" +Num].filters.alpha.opacity=75;
	}
	if(s6_NS){
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].style.MozOpacity=0.75;
	}
	if(s6_N6){
	realNum = Num-1;
	img1 = document.getElementById("subnav_1").getElementsByTagName("IMG");
	img1[realNum].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	}
}
}

//MenuMouseOver for div4
function s6_mImgOn_D4(divNum,Num) {
clearTimeout(s6_hideMenu);
if (document.images) {
	if(s6_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	document.images["subnav_" +divNum+ "_" +Num].filters.alpha.opacity=100;
	}
	if(s6_NS){
	document.subnav_4.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].style.MozOpacity=1;
	}
	if(s6_N6){
	realNum = Num-1;
	img4 = document.getElementById("subnav_4").getElementsByTagName("IMG");
	img4[realNum].src = eval("subnav_" +divNum+ "_" +Num+ "_on.src");
	img4[realNum].style.MozOpacity=1;
	}
}
}

function s6_mImgOff_D4(divNum,Num) {
if (document.images) {
	if(s6_IE){
	document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	document.images["subnav_" +divNum+ "_" +Num].filters.alpha.opacity=75;
	}
	if(s6_NS){
	document.subnav_4.document.images["subnav_" +divNum+ "_" +Num].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	document.subnav_1.document.images["subnav_" +divNum+ "_" +Num].style.MozOpacity=0.75;
	}
	if(s6_N6){
	realNum = Num-1;
	img4 = document.getElementById("subnav_4").getElementsByTagName("IMG");
	img4[realNum].src = eval("subnav_" +divNum+ "_" +Num+ "_off.src");
	img4[realNum].style.MozOpacity=0.75;
	}
}
}

function s6_hideAll(){
s6_Hide('1');
s6_Hide('4');
}


//CHEVY SWEEPSTAKES POPUP
function popChevy()
{
	//detect for cookie
	var allCookies = document.cookie;
	var pos = allCookies.indexOf("survivor5---chevysweeps=");
	var value = "";
	
	var nextDay = new Date();
	var day = nextDay.getDate();
	day++;
	nextDay.setDate(day);
	
	if (pos != -1) {
		var start = pos + 24;
		var end = allCookies.indexOf(";", start);
		if (end == -1) end = allCookies.length;
		var value = allCookies.substring(start, end);
		value = unescape(value);
	}
	
	//if cookie exists then do not popup
	if(value == "") {
		//if not then set cookie and do popup
		openWin('/primetime/survivor6/popups/chevy.html',510,300,'chevysweeps','no');
		document.cookie = "survivor5---chevysweeps=123456789; expires=" + nextDay.toGMTString() + " path=/; domain=cbs.com";
	}
}

