var s9_NS = (document.layers) ? 1 : 0;
var s9_IE = (document.all && document.getElementById) ? 1 : 0;
var s9_N6 = (!document.all && document.getElementById) ? 1 : 0;
var s9_hideMenu = null;
var is_NS = s9_NS;
var is_IE = s9_IE;
var is_N6 = s9_N6;


function doHideAll(){
	if(is_IE) {
		document.all.show_nav.style.visibility="hidden";
		document.all.full_ep_nav.style.visibility="hidden";
		document.all.community_nav.style.visibility="hidden";
	}

	if(is_NS) {
		document.show_nav.visibility="hidden";
		document.full_ep_nav.visibility="hidden";
		document.community_nav.visibility="hidden";
	}

	if(is_N6) {	
		document.getElementById('show_nav').style.visibility = "hidden";
		document.getElementById('full_ep_nav').style.visibility = "hidden";
		document.getElementById('community_nav').style.visibility = "hidden";
	}
}

function doStyleChange(obj) {
	if(obj == "tab1_content") { reDoStyleChange('tab2_content'); reDoStyleChange('tab3_content'); }// reDoStyleChange('tab4_content'); }
	if(obj == "tab2_content") { reDoStyleChange('tab1_content'); reDoStyleChange('tab3_content'); }// reDoStyleChange('tab4_content'); }
	if(obj == "tab3_content") { reDoStyleChange('tab1_content'); reDoStyleChange('tab2_content'); }// reDoStyleChange('tab4_content'); }
	//if(obj == "tab4_content") { reDoStyleChange('tab1_content'); reDoStyleChange('tab2_content'); reDoStyleChange('tab3_content'); }
	
	if(is_IE) {
		eval('document.all.'+obj+'.style.visibility="visible"');
		eval('document.all.'+obj+'.style.display="block"');
	}
	if(is_NS) {
		eval('document.'+obj+'.visibility="visible"');
		eval('document.'+obj+'.display="block"');
	}
	if(is_N6) {	
		the_obj = document.getElementById(obj);
		the_obj.style.visibility = "visible";
		the_obj.style.display = "block";		
	}
}

function reDoStyleChange(obj) {
	if(is_IE) {
		eval('document.all.'+obj+'.style.visibility="hidden"');
		eval('document.all.'+obj+'.style.display="none"');
	}
	if(is_NS) {
		eval('document.'+obj+'.visibility="hidden"');
		eval('document.'+obj+'.display="none"');
	}
	if(is_N6) {	
		the_obj = document.getElementById(obj);
		the_obj.style.visibility = "hidden";
		the_obj.style.display = "none";		
	}
}

function changeClass(the_class) {
	document.getElementById('tab1').className = "tab1_off";
	document.getElementById('tab2').className = "tab2";
	document.getElementById('tab3').className = "tab3";
//	document.getElementById('tab4').className = "tab4";
	if(the_class == "tab1")
		document.getElementById(the_class).className = "tab1";
	else
		document.getElementById(the_class).className = "tab_on";

} 

function rollStyle_on(obj) {
	if(obj == "tab1")
		document.getElementById(obj).className = "tab1_over";
	else
		document.getElementById(obj).className = "tab_over";
	
	if(eval("document.getElementById('"+obj+"_content').style.display") == "block") {
		if(obj == "tab1") document.getElementById(obj).className = "tab1";
		else document.getElementById(obj).className = "tab_on";
	}
}

function rollStyle_off(obj) {
	if(obj == "tab1")
		document.getElementById(obj).className="tab1_off";
	else
		document.getElementById(obj).className = obj;
		
	if(eval("document.getElementById('"+obj+"_content').style.display") == "block") {
		if(obj == "tab1") document.getElementById(obj).className = "tab1";
		else document.getElementById(obj).className = "tab_on";
	}
}

function displayWiki(wikiNum) {
	if(is_IE) {
		eval('document.all.tag_cloud_'+wikiNum+'.style.visibility="visible"');
		eval('document.all.tag_cloud_'+wikiNum+'.style.display="block"');
	}

	if(is_NS) {
		eval('document.tag_cloud_'+wikiNum+'.visibility="visible"');
		eval('document.tag_cloud_'+wikiNum+'.display="block"');
	}

	if(is_N6) {	
		the_wiki = document.getElementById("tag_cloud_" + wikiNum);
		the_wiki.style.visibility = "visible";
		the_wiki.style.display = "block";		
	}
}

function displayMB(mbNum) {
	if(is_IE) {
		eval('document.all.messageboard_'+mbNum+'.style.visibility="visible"');
		eval('document.all.messageboard_'+mbNum+'.style.display="block"');
	}

	if(is_NS) {
		eval('document.messageboard_'+mbNum+'.visibility="visible"');
		eval('document.messageboard_'+mbNum+'.display="block"');
	}

	if(is_N6) {	
		the_MB = document.getElementById("messageboard_" + mbNum);
		the_MB.style.visibility = "visible";
		the_MB.style.display = "block";		
	}
}

//launch innertube player
function innertube(cat, vid, format, auto, source) {
	if (vid == null) {
		vid = "";
	}

	if (cat == null) {
		cat = "";
	}

	if (format == null) {
		format = "";
	}

	if (auto == null) {
		auto = "0";
	}

	if (source == null) {
		pSource = "";
	} else {
		pSource = "&source=" + source;
	}
	innertubeWindow = window.open ("/innertube/player.php?cat=" + cat + "&vid=" + vid + "&format=" + format + "&auto=" + auto + pSource, "innertubePlayer", "status=1, toolbar=0, location=0, menubar=0, resizable=0, scrollbars=0, height=705, width=950"); 
	if (window.focus) {
		innertubeWindow.focus();
	}
}

/*START****TEMPORARY CODE FIX FOR FEEDBACK LINK AT FOOTER. REMOVE WHEN NEW FEEDBACK FOOTER ADDED!!!!!*****/
function reloadwin(){if ((winw != window.innerWidth) || (winh != window.innerHeight)){var holder=location.href;holder=holder.split("#");location.href=holder[0];}}
/*created and added on 12/15/2000@1:33pm by Alberto Araya reedited on 9-19-01*/
var myArray = new Array();
myArray = document.location.href.split("/");
var title = myArray[3];
var sec = myArray[4];
if(sec == null || title == null){if((myArray[2]=='cbs.com')||(myArray[2]=='www.cbs.com')||(myArray[2]=='stager.cbsig.net')){title = "HomePage";sec = "HomePage";}}
function size_window(w,h){thisWin(title,sec,530,h);}
function thisWin(title,sec,w,h){switch(title){case 'daytime':if(sec==''){sec='DAYTIME';popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");}
else{popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");}
break;case 'primetime':popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");break;case 'latenight':if(myArray[4]=='lateshow'){popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");}else{popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");}break;case 'news':popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");break;
case 'cbsstore':popwin = window.open("/info/user_services/fb_global_form.shtml",title,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");break;
case 'info':popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");break;
default:/*from home page.*/popwin = window.open("/info/user_services/fb_global_form.shtml",sec,"height="+h+",width="+w+",status=0,scrollbars=yes,location=0,menubar=0,resizable=no");break;}}
/*END****TEMPORARY CODE FIX FOR FEEDBACK LINK AT FOOTER. REMOVE WHEN NEW FEEDBACK FOOTER ADDED!!!!!*****/

//  swfObject include By Sang
document.write('<scr'+'ipt type="text/javascript" src="/Common/js/swfobject.js" ></scr'+'ipt>');


function init() {
	
	var parentDiv = new Array();
	
	//START Play Button Overlays
	var playThumbsArray = new Array();
	playThumbsArray = $$('div.playThumb');
	for (i=0;i<playThumbsArray.length;i++) {
		if (playThumbsArray[i].select('a')[0]) {
			var linkHref = playThumbsArray[i].select('a')[0].readAttribute('href');	
			var a = new Element('a', { 'class': 'playBtnOverlay', href: linkHref});
			playThumbsArray[i].insert(a);
			parentDiv[i] = playThumbsArray[i].up();
			parentDiv[i].observe('click', respondToClick)
		}
		
	}
	//END Play Button Overlays
	
	
	var galleryThumbsArray = new Array();
	galleryThumbsArray = $$('div.galleryThumb');

	for (var i=0;i<galleryThumbsArray.length;i++) {
		parentDiv[i] = galleryThumbsArray[i].up();
		parentDiv[i].observe('click', respondToClick)
	}
}


function respondToClick(event) {
	parent.location.href = this.select('a')[0].readAttribute('href')
}


