var CNN_My_PlayList = new Object();
var CNN_My_PlayList_Count = 0;
var xmlHTTPSec;
var xmlHTTPBYSec;
var xmlHTTPRVideos;
var currSectionNav = "navTop_Stories";
var currPlayNav = "navNext_Up";
var currBySectionNav = "us";
var currBySectionSubNav = "";
var secNav_TimeOut;
var nav_pad_right;
var playNav_TimeOut;
var playnav_pad_right;
var pipeline_flag = 0;

var CNN_Nav_Widths = new Object();
CNN_Nav_Widths['navTop_Stories'] = '83px';
CNN_Nav_Widths['navMost_Popular'] = '98px';
CNN_Nav_Widths['navStaff_Picks'] = '83px';
CNN_Nav_Widths['navCNN_TV'] = '60px';
CNN_Nav_Widths['navPipeline_Live'] = '60px';
CNN_Nav_Widths['navI_Reports'] = '77px';
CNN_Nav_Widths['navBy_Section'] = '77px';
CNN_Nav_Widths['navNext_Up'] = '112px';
CNN_Nav_Widths['navMyPlay_List'] = '112px';
CNN_Nav_Widths['navIndia'] = '77px';
CNN_Nav_Widths['navHighlights'] = '118px';
CNN_Nav_Widths['navSessions'] = '98px';
CNN_Nav_Widths['navCEOS'] = '98px';


function CNN_AddToPlaylist(video_id, tz_image_url, video_url, tease_txt, vid_duration) {

	if(!CNN_My_PlayList[video_id]) {
	
		CNN_My_PlayList_Count++;
		document.getElementById("vid_" + video_id).className += "_saved";
		document.getElementById("aplink_" + video_id).className += "_saved";
		WTPO_writeToLayer("in playlist", "aplink_" + video_id);

	}
	
	CNN_My_PlayList[video_id] = '<div class="box_item" id="mylist_' + video_id + '"><img src="' + tz_image_url + '" width="45" height="25" border="0" alt="" /><a href="' + unescape(video_url) + '">' + unescape(tease_txt) + '</a> <span class="duration">' + unescape(vid_duration) + ' <a href="javascript:CNN_RemFromPlaylist(\'' + video_id + '\');"><img src="/video/bvp/images/playlist/btn_x.gif" width="12" height="12" alt="" border="0"></a></span></div>';
	
	CNN_writeMyPlayList();

}

function CNN_RemFromPlaylist(video_id) {

	CNN_My_PlayList[video_id] = '';
	CNN_My_PlayList_Count--;

	try { document.getElementById("vid_" + video_id).className = document.getElementById("vid_" + video_id).className.replace("_saved",""); }
	catch(e) { }

	try { document.getElementById("aplink_" + video_id).className = document.getElementById("aplink_" + video_id).className.replace("_saved",""); }
	catch(e) { }

	try { WTPO_writeToLayer("add to my playlist", "aplink_" + video_id); }
	catch(e) { }
	
	CNN_writeMyPlayList();
	
}


function CNN_writeMyPlayList() {

	var str_playlist_count = "<a href=\"javascript:load_Play_List('navMyPlay_List');\"><div>MY&nbsp;PLAYLIST&nbsp;&nbsp;";
	
	//if(CNN_My_PlayList_Count < 10) { str_playlist_count += "&nbsp;"; }
	
	str_playlist_count += "<span style=\"color:#949494;\">" + CNN_My_PlayList_Count + "</span></div></a>&nbsp;";

	WTPO_writeToLayer(str_playlist_count, "navMyPlay_List_R");
	var temp_mylist_code = '';
	
	for(var video_id in CNN_My_PlayList) {
	
		temp_mylist_code += CNN_My_PlayList[video_id];
	
	}	
	
	WTPO_writeToLayer(temp_mylist_code, "My_Play_Box");

}

function handle_PlayList_XML() {

	//Required loading check clause
	if (xmlHTTP.readyState == 4) { 
	
		video_for_list = "";
		
		pulled_text = xmlHTTP.responseText;
		XML_content = WTPO_getXMLStringDOC(pulled_text);
		
		var XML_top_node = XML_content.getElementsByTagName("video");		
		for(var i=0;i < XML_top_node.length;i++) {
			
			try {
			
				try { temp_vid_dur = XML_top_node[i].getElementsByTagName("vid_duration")[0].childNodes[0].nodeValue; }
				catch(e) { temp_vid_dur = ""; }
				
				temp_video_for_list = '<div class="box_item" id="nextup_' + XML_top_node[i].getElementsByTagName("video_id")[0].childNodes[0].nodeValue + '"><img src="' + XML_top_node[i].getElementsByTagName("image_url")[0].childNodes[0].nodeValue + '" width="45" height="25" border="0" alt="" /><a href="' + XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue + '">' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</a> <span class="duration">' + temp_vid_dur + '</span></div>';

			}
			catch(e) { temp_video_for_list = ""; }
			
			video_for_list += temp_video_for_list;
			
		}

		WTPO_writeToLayer(video_for_list, "Play_Box");
		
	}
	
}
var first_time = false;
function handle_Section_XML() {
	//Required loading check clause
	if (xmlHTTPSec.readyState == 4) { 
		if (cnnSectionData[loadingSection] == null) { cnnSectionData[loadingSection] = new Array(); }
		video_for_box = "";
		
		pulled_text = xmlHTTPSec.responseText;
		XML_content = WTPO_getXMLStringDOC(pulled_text);
		
		var XML_top_node = XML_content.getElementsByTagName("video");		
		for(var i=0;i < XML_top_node.length;i++) {
			
			try {
			
//		uncomment this once we get real JSON published on the test site
				cnnSectionData[loadingSection][i] = XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue;
//
//				fakeUrls = new Array(
//					"/data/content/sensitive.becky.ice.bar.cnn.json",
//					"/data/content/sesay.nigeria.elections.cnn.json",
//					"/data/content/rugman.france.pres.candidates.itn.json",
//					"/data/content/gorani.france.undecided.voters.cnn.json",
//					"/data/content/short.is.nigeria.elections.cnn.json"
//				);
//				cnnSectionData[loadingSection][i] = fakeUrls[(i%5)];

				var tease_txt_string = XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue;
				tease_txt_string = tease_txt_string.replace('\'', '\\\'');
				
				try { temp_vid_dur = XML_top_node[i].getElementsByTagName("vid_duration")[0].childNodes[0].nodeValue; }
				catch(e) { temp_vid_dur = ""; }
				
				temp_vid_code = '<div id="vid_' + XML_top_node[i].getElementsByTagName("video_id")[0].childNodes[0].nodeValue + '" class="sec_video_box';
			
				if(CNN_My_PlayList[XML_top_node[i].getElementsByTagName("video_id")[0].childNodes[0].nodeValue]) { temp_vid_code += '_saved'; }
			
				if (!pipeline_flag) {
					temp_vid_code += '"><div style="padding-top:10px;"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\''+ cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');"><img src="' + XML_top_node[i].getElementsByTagName("image_url")[0].childNodes[0].nodeValue + '" width="125" height="70" alt="" border="0"></a></div><div class="vid_play"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\''+ cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');"><b>' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</b></a> ' + temp_vid_dur + '</div>';
				} else {
					streamid = XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue.slice(XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue.length-1);
					temp_vid_code += '"><div style="padding-top:10px;"><a href="#" onclick="window.open(\'http://www.cnn.com/video/live/live.html?stream=stream'+streamid+'\',\'liveplayer\',\'width=672,height=540,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no\',true); return false;"><img src="' + XML_top_node[i].getElementsByTagName("image_url")[0].childNodes[0].nodeValue + '" width="125" height="70" alt="" border="0"></a></div><div class="vid_play"><a href="#" onclick="window.open(\'http://www.cnn.com/video/live/l1vePl@y3r.html?stream=stream'+streamid+'\',\'liveplayer\',\'width=672,height=540,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no\',true);"><b>' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</b></a> ' + temp_vid_dur + '</div>';
				}
//				if(!pipeline_flag) {
				
					idVal = (cnnSectionData[loadingSection][i]).slice(cnnSectionData[loadingSection][i].lastIndexOf('/')+1);
					if (!pipeline_flag) { 
						if (CNNPlaylistManager.getInstance().MYPMStorage.contains(cnnSectionData[loadingSection][i])) {
						temp_vid_code+='<div class="add_play" id="'+idVal+'">in playlist</div>';
					}
					else {
						randNum = Math.round(Math.random() * 1000);
						temp_vid_code += '<div id="'+idVal+'" class="add_play"><a href="javascript:CNNPlaylistManager.getInstance().MYPMAddToPlaylist(\''+cnnSectionData[loadingSection][i]+'\',\''+randNum+'\');" class="aplink';
						temp_vid_code += '">add to my playlist';
						temp_vid_code += '</span></a></div>';
					}	}			
					
//				}
				
				temp_vid_code += '</div>';

			}
			catch(e) {  temp_vid_code = ""; }
			
			video_for_box += temp_vid_code;
		}

		WTPO_writeToLayer(video_for_box, "Secton_Box_Container");
		pipeline_flag = 0;
		if (first_time && currSectionNav != 'navBy_Section') {
			first_time = false;
			CNNPlaylistManager.getInstance().BVPMGetSplashPlaylist(loadingSection);
//			CNNPlaylistManager.getInstance().BVPMVideoSelected(cnnSectionData['top_stories'][0],'top_stories');
		}
		
	}

}

function handle_By_Section_XML() {
	//Required loading check clause
	if (xmlHTTPBYSec.readyState == 4) { 
		if (cnnSectionData[loadingSection] == null) { cnnSectionData[loadingSection] = new Array(); }
	
		by_video_for_box = "";
		
		pulled_text = xmlHTTPBYSec.responseText;
		XML_content = WTPO_getXMLStringDOC(pulled_text);
		
		var XML_top_node = XML_content.getElementsByTagName("video");		
		for(var i=0;i < XML_top_node.length;i++) {
			
			try {
			
				cnnSectionData[loadingSection][i] = XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue;
				var tease_txt_string = XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue;
				tease_txt_string = tease_txt_string.replace('\'', '\\\'');

				try { temp_vid_dur = XML_top_node[i].getElementsByTagName("vid_duration")[0].childNodes[0].nodeValue; }
				catch(e) { temp_vid_dur = ""; }

				temp_vid_code = '<div id="vid_' + XML_top_node[i].getElementsByTagName("video_id")[0].childNodes[0].nodeValue + '" class="sec_video_box';
			
				if(CNN_My_PlayList[XML_top_node[i].getElementsByTagName("video_id")[0].childNodes[0].nodeValue]) { temp_vid_code += '_saved'; }
			
				temp_vid_code += '"><div style="padding-top:10px;"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\'' + cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');"><img src="' + XML_top_node[i].getElementsByTagName("image_url")[0].childNodes[0].nodeValue + '" width="125" height="70" alt="" border="0"></a></div><div class="vid_play"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\'' + cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');"><b>' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</b></a> ' + temp_vid_dur + '</div>';
				
				idVal = (cnnSectionData[loadingSection][i]).slice(cnnSectionData[loadingSection][i].lastIndexOf('/')+1);
				if (CNNPlaylistManager.getInstance().MYPMStorage.contains(cnnSectionData[loadingSection][i])) {
					temp_vid_code+='<div class="add_play" id="'+idVal+'">in playlist</div>';
				} else {
					randNum = Math.round(Math.random() * 1000);
					temp_vid_code += '<div id="'+idVal+'" class="add_play"><a href="javascript:CNNPlaylistManager.getInstance().MYPMAddToPlaylist(\''+cnnSectionData[loadingSection][i]+'\');" class="aplink';
					temp_vid_code += '">add to my playlist';
					temp_vid_code += '</span></a></div>';
				}							
				temp_vid_code += '</div>';

			}
			catch(e) { temp_vid_code = ""; }
			
			by_video_for_box += temp_vid_code;
			
		}

		WTPO_writeToLayer(by_video_for_box, "By_Section_Content");
		if (first_time) {
			first_time = false;
			CNNPlaylistManager.getInstance().BVPMGetSplashPlaylist(loadingSection);
//			CNNPlaylistManager.getInstance().BVPMVideoSelected(cnnSectionData['top_stories'][0],'top_stories');
		}
		
	}
	
}
var loadingSection = '';
function xmlSlice(val) {
	return val.slice(val.lastIndexOf('/')+1,val.lastIndexOf('.'));
}

function load_Section(nav_section_id, xml_file_url, is_by_section, firstTime, omo) {
	if(currSectionNav != nav_section_id || firstTime == true || omo == true) {
		loadingSection = xmlSlice(xml_file_url);
	
		if(nav_section_id == 'navPipeline_Live') { pipeline_flag = 1; }
		
		clearTimeout(secNav_TimeOut);
		if (document.getElementById) { document.getElementById(currSectionNav + '_R').style.width = CNN_Nav_Widths[currSectionNav]; }
		else if (document.all) { document.all[currSectionNav + '_R'].style.width = CNN_Nav_Widths[currSectionNav]; }

		document.getElementById(nav_section_id).className += "_active";
		document.getElementById(currSectionNav).className = document.getElementById(currSectionNav).className.replace("_active","");
	
		
		WTPO_writeToLayer("", "Secton_Box_Container");
		
		nav_pad_right = 104;
		cnn_slideNav(nav_section_id + '_R', xml_file_url);

		if(is_by_section) { 
	
			WTPO_HideLayer('Section_Box');
			WTPO_ShowLayer('By_Section_Box');
			xmlHTTPBYSec = WTPO_getXMLHTTP();
			WTPO_getXMLContent(default_section_xml, handle_By_Section_XML, xmlHTTPBYSec);
		
		}
		else {
	
			WTPO_HideLayer('By_Section_Box');
			WTPO_ShowLayer('Section_Box');
	
		}
	
		currSectionNav = nav_section_id;
/*
		if(nav_section_id == 'navPipeline_Live') { 
			pipeline_flag = 0;
			str = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td style="padding: 0px 0px 0px 9px;" valign="top">';
			str += '<font style="font-family: Helvetica, Arial, Sans-Serif; font-weight: bold; font-size: 38px; color: #949494;">Free Live Video Coming Soon!</font>';
			str += '<br><br><div style="width: 550px;"><font style="font-family: Helvetica, Arial, Sans-Serif; font-size: 14px; color: #949494;">CNN.com will soon be offering free LIVE news video, providing instant access to Breaking News video from around the world.  Watch the latest headlines unfold on four LIVE news feeds.  See the latest entertainment news, politcal debates and world news videos and be the first to say "I just saw it on CNN.com."</font>';
			str += '</td><td align="right"><img src="/video/bvp/images/live_screen.jpg"></td></tr></table>';
			WTPO_writeToLayer(str, "Secton_Box_Container");
		} */
	}
	
}

function cnn_slideNav(nav_corner_id, file_url, slide_width) {

	nav_pad_right += 10;
	if(!slide_width) { slide_width = 204; }
	
	if(nav_pad_right <= slide_width) {
	
		if (document.getElementById) { document.getElementById(nav_corner_id).style.width = nav_pad_right + 'px'; }
		else if (document.all) { document.all[nav_corner_id].style.width = nav_pad_right + 'px'; }
		temp_to_str = "cnn_slideNav('" + nav_corner_id + "','" + file_url + "', '" + slide_width + "')";
		secNav_TimeOut = setTimeout(temp_to_str,40)

	}
	else {

		clearTimeout(secNav_TimeOut);
		if(file_url) {
		
			xmlHTTPSec = WTPO_getXMLHTTP();
			WTPO_getXMLContent(file_url, handle_Section_XML, xmlHTTPSec);
	
		}
		
	}
	
}

function load_Play_List(nav_section_id) {

	if(currPlayNav != nav_section_id) {
		
		clearTimeout(secNav_TimeOut);
		document.getElementById("navMyPlay_List").className = document.getElementById("navMyPlay_List").className.replace("_active","");
		document.getElementById("navMyPlay_List_R").style.width = CNN_Nav_Widths["navMyPlay_List"];
		document.getElementById("navNext_Up").className = document.getElementById("navNext_Up").className.replace("_active","");
		document.getElementById("navNext_Up_R").style.width = CNN_Nav_Widths["navNext_Up"];
		document.getElementById(nav_section_id).className += "_active";
	
		nav_pad_right = 104;
		cnn_slideNav(nav_section_id + '_R', '', 154);

		if(nav_section_id == "navNext_Up") {
	
			WTPO_HideLayer('My_Play_Box');
			WTPO_ShowLayer('Play_Box');

		}
		else {
	
			WTPO_HideLayer('Play_Box');
			WTPO_ShowLayer('My_Play_Box');
	
		}
		
		currPlayNav = nav_section_id;
	
	}

}

function load_By_Section(by_nav_section_id, xml_file_url, by_nav_sub, is_sub_nav) {

	if(by_nav_section_id != currBySectionNav || by_nav_sub) {
		loadingSection = xmlSlice(xml_file_url);
	
		WTPO_HideLayer('Section_Box');
		WTPO_ShowLayer('By_Section_Box');

		if(!is_sub_nav) {
			document.getElementById('section_' + by_nav_section_id).className += "_active";
			document.getElementById('section_' + currBySectionNav).className = document.getElementById('section_' + currBySectionNav).className.replace("_active","");
		}
		
		xmlHTTPBYSec = WTPO_getXMLHTTP();
		WTPO_getXMLContent(xml_file_url, handle_By_Section_XML, xmlHTTPBYSec);

		if(!is_sub_nav) { currBySectionNav = by_nav_section_id; }
		if(currBySectionSubNav) { WTPO_HideLayer('subsection_' + currBySectionSubNav); }
		currBySectionSubNav = '';
		
		if(by_nav_sub) {
			WTPO_ShowLayer('subsection_' + by_nav_sub);
			currBySectionSubNav = by_nav_sub;
		}		
	
	}
	
}

function load_Related_Videos(section) {
		xml_sec_url = "/.element/ssi/auto/2.0/video/xml/by_section_" + section + ".xml";
		//xml_sec_url = "/.element/ssi/auto/2.0/video/xml/top_stories_services.xml";
		if(section=='/fortune/globalforum')
			xml_sec_url = "/.element/ssi/auto/2.0/video/xml/globalforum.xml";
		loadingSection = xmlSlice(xml_sec_url);
		
		xmlHTTPRVideos = WTPO_getXMLHTTP();
		WTPO_getXMLContent(xml_sec_url, handle_Related_Videos, xmlHTTPRVideos);

}

function handle_Related_Videos() {

	if (xmlHTTPRVideos.readyState == 4) {
	
		if (cnnSectionData[loadingSection] == null) { cnnSectionData[loadingSection] = new Array(); }
	
		str_related_table = '<table cellspacing="0" cellpadding="0" border="0"><colgroup><col width="59"><col width="111"><col width="59"><col width="111"><col width="59"><col width="111"></colgroup><tr valign="top">';
		
		pulled_text = xmlHTTPRVideos.responseText;
		XML_content = WTPO_getXMLStringDOC(pulled_text);
		
		var rel_videos = 0;
		
		var XML_top_node = XML_content.getElementsByTagName("video");		
		for(var i=0;i < XML_top_node.length;i++) {
			
			var rel_success = true;
			var temp_rel_code = '';
			try {
			
				cnnSectionData[loadingSection][i] = XML_top_node[i].getElementsByTagName("video_url")[0].childNodes[0].nodeValue;
				var tease_txt_string = XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue;
				tease_txt_string = tease_txt_string.replace('\'', '\\\'');

				try { temp_vid_dur = XML_top_node[i].getElementsByTagName("vid_duration")[0].childNodes[0].nodeValue; }
				catch(e) { temp_vid_dur = ""; }

				if(rel_videos < 3) { temp_rel_code = '<td bgcolor="#484848" valign="middle"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\'' + cnnSectionData[loadingSection][i] + '\',\'' + loadingSection + '\');"><img src="' + XML_top_node[i].getElementsByTagName("tz_image_url")[0].childNodes[0].nodeValue + '" width="45" height="25" alt="" border="0" vspace="7" hspace="7"></a></td><td><div class="ovr_thmb_td"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\'' + cnnSectionData[loadingSection][i] + '\',\'' + loadingSection + '\');">' + tease_txt_string + '</a><br>' + temp_vid_dur + '</div></td>'; }
				
			}
			catch(e) { temp_rel_code = '';rel_success = false;}
			
			str_related_table += temp_rel_code;
			if(rel_success) { rel_videos++; } 
			
		}

		str_related_table += '</tr></table>';
	
		WTPO_writeToLayer(str_related_table, "thumBs");

	}

}

function showComments() { 
		CNNPlaylistManager.getInstance().nextUpSlate = null;
		CNNPlaylistManager.getInstance().endSlate = null;
		CNNPlaylistManager.getInstance('bvpplayer').isSmall = true;
		CNNPlayer.getInstance(CNNPlaylistManager.getInstance('bvpplayer').playerName).isSmall = true;
		document.getElementById('cnnVPFlashLargeContainer').style.width = "287px";
		document.getElementById('cnnVPFlashLargeContainer').style.height = "161px";
		CNNPlayer.getActivePlayer().getMediaPlayer().getViewport().setSize('287px','161px');
		document.getElementById('cnnVPInfoL').style.display = 'none';
		document.getElementById('cnnVPInfoLeftColS').style.display = 'block';
		document.getElementById('controlsContainer').style.width = "287px";
		document.getElementById('controlsContainer').style.height = "63px";
		document.getElementById('cnnVPInfoRightColS').style.display = 'block';
		callControllerMethod('setLayoutType', 'SCRUBBER_ABOVE');
		var controller = (navigator.appName.indexOf("Microsoft") != -1) ? window["mediacontrols"] : document["mediacontrols"];
		controller.width = '287';
		controller.height = '60';
	}
function hideComments() { 
		CNNPlaylistManager.getInstance('bvpplayer').isSmall = false;
		CNNPlayer.getInstance(CNNPlaylistManager.getInstance('bvpplayer').playerName).isSmall = false;
		document.getElementById('cnnVPFlashLargeContainer').style.width = "574px";
		document.getElementById('cnnVPFlashLargeContainer').style.height = "324px";
		CNNPlayer.getActivePlayer().getMediaPlayer().getViewport().setSize('574px','324px');
		document.getElementById('cnnVPInfoL').style.display = 'block';
		document.getElementById('cnnVPInfoLeftColS').style.display = 'none';
		document.getElementById('cnnVPInfoRightColS').style.display = 'none';
		callControllerMethod('setLayoutType', 'SCRUBBER_INLINE');
		var controller = (navigator.appName.indexOf("Microsoft") != -1) ? window["mediacontrols"] : document["mediacontrols"];
		document.getElementById('controlsContainer').style.width = "574px";
		document.getElementById('controlsContainer').style.height = "33px";
		controller.width = '574';
		controller.height = '33';
		if (CNNPlaylistManager.getInstance().nextUpSlate != null) {
			document.getElementById('commentHolder1').style.display = 'none';
			document.getElementById('cnnVPCHdr').style.display = 'none';
			document.getElementById('commentHolder2').style.display = 'none';
			document.getElementById('videoComments').innerHTML = '';
			CNNPlaylistManager.getInstance().nextUpSlate.setState( xmp.ENDED, "" );
		} 
		if (CNNPlaylistManager.getInstance().endSlate != null) {
			document.getElementById('commentHolder1').style.display = 'none';
			document.getElementById('cnnVPCHdr').style.display = 'none';
			document.getElementById('commentHolder2').style.display = 'none';
			document.getElementById('videoComments').innerHTML = '';
			CNNPlaylistManager.getInstance().advanceTo(CNNPlaylistManager.getInstance().activePlaylist,(CNNPlaylistManager.getInstance().playlists[CNNPlaylistManager.getInstance().activePlaylist].jsonList.length-1))
		}
	}

function showPost() {
	
	WTPO_HideLayer('cnnVPCommWrap');
	if (document.getElementById) { document.getElementById('cnnVPCommentsBox').style.height = '143px'; }
	else if (document.all) { document.all['cnnVPCommentsBox'].style.height = '143px'; }	
	WTPO_ShowLayer('cnnVPCommPost');
	
}

function hidePost() {
	
	WTPO_HideLayer('cnnVPCommPosted');
	if (document.getElementById) { document.getElementById('cnnVPCommentsBox').style.height = '318px'; }
	else if (document.all) { document.all['cnnVPCommentsBox'].style.height = '318px'; }	
	WTPO_ShowLayer('cnnVPCommWrap');
	
}

function sub_Post() {

	WTPO_HideLayer('cnnVPCommPost');
	//Do some AJAX submission then...
	WTPO_ShowLayer('cnnVPCommPosted');
	
}


