var CNN_My_PlayList = new Object();
var CNN_My_PlayList_Count = 0;
var xmlHTTPSec;
var xmlHTTPBYSec;
var xmlHTTPRVideos;
var currSectionNav = "navBy_Section";
var currPlayNav = "navNext_Up";
var currBySectionNav = "middle_east";
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['navBy_Section'] = '77px';
CNN_Nav_Widths['navNext_Up'] = '112px';
CNN_Nav_Widths['navMyPlay_List'] = '112px';

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";

	}
	
	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) { }

	CNN_writeMyPlayList();
	
}


function CNN_writeMyPlayList() {

	var str_playlist_count = "<a href=\"javascript:load_Play_List('navMyPlay_List');\"><div>MY&nbsp;PLAYLIST&nbsp;&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 {
				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(CNNPlaylistManager.getInstance().MYPMStorage.contains(cnnSectionData[loadingSection][i])){
					temp_vid_code += '_saved'; 
				}
			
				temp_vid_code += '"><div style="height:70px;padding-top:9px;"><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 style="padding:0px;height:50px;height:auto;height:50px;" class="vid_play"><div style="margin:0px;height:36px;height:auto; height:36px;word-spacing:0px;"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\''+ cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');">' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</a><span class="vid_duration"> ' + temp_vid_dur + '</span></div><div style="padding-top:0px;padding-left:70px;" id="playListAdder'+cnnSectionData[loadingSection][i]+'">';

				idVal = (cnnSectionData[loadingSection][i]).slice(cnnSectionData[loadingSection][i].lastIndexOf('/')+1);
				if (CNNPlaylistManager.getInstance().noIEStorage == false) {
					if (CNNPlaylistManager.getInstance().MYPMStorage.contains(cnnSectionData[loadingSection][i])) {
					}
					else{ 
						randNum = Math.round(Math.random() * 1000);
						temp_vid_code += '<div onclick="CNNPlaylistManager.getInstance().MYPMAddToPlaylist(\''+cnnSectionData[loadingSection][i]+'\',\''+randNum+'\');" style="margin-top:-10px;height:100px;cursor:pointer; width:50px;"><img src="http://i.cdn.turner.com/cnn/images/1.gif" alt="" style="width:100px; height:100%;"/></div>';
					}	
				}					
				
				temp_vid_code += '</div></div></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);
		}
		
	}
}

function makePlaylistAdderClickable(jsonPath){
	var jsonPath1 = jsonPath;
	
	document.getElementById("vid_" + jsonPath1.replace(/\.json/,"")).className = "sec_video_box";
	randNum = Math.round(Math.random() * 1000);

	temp_playlist_adder = '<div onclick="CNNPlaylistManager.getInstance().MYPMAddToPlaylist(\''+jsonPath+'\',\''+randNum+'\');" style="margin-top:-10px;height:100px;cursor:pointer; width:50px;"><img src="http://i.cdn.turner.com/cnn/images/1.gif" alt="" style="width:100px; height:100%;"/></div>';
	
	document.getElementById('playListAdder'+jsonPath).innerHTML = temp_playlist_adder;
}

function makePlaylistAdderUnclickable(jsonPath){
	var jsonPath1 = jsonPath;
	
	document.getElementById("vid_" + jsonPath1.replace(/\.json/,"")).className = "sec_video_box_saved";
	document.getElementById('playListAdder'+jsonPath).innerHTML = "";
}



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="height:70px;padding-top:9px;"><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 style="padding:0px;height:50px;height:auto;height:50px;" class="vid_play"><div style="margin:0px;height:36px;height:auto; height:36px;word-spacing:0px;"><a href="javascript:CNNPlaylistManager.getInstance().BVPMVideoSelected(\''+ cnnSectionData[loadingSection][i] + '\',\''+loadingSection+'\');">' + XML_top_node[i].getElementsByTagName("tease_txt")[0].childNodes[0].nodeValue + '</a><span class="vid_duration"> ' + temp_vid_dur + '</span></div><div style="padding-top:0px;padding-left:70px;" id="playListAdder'+cnnSectionData[loadingSection][i]+'">';
				
				idVal = (cnnSectionData[loadingSection][i]).slice(cnnSectionData[loadingSection][i].lastIndexOf('/')+1);
				if (CNNPlaylistManager.getInstance().noIEStorage == false) {
					if (CNNPlaylistManager.getInstance().MYPMStorage.contains(cnnSectionData[loadingSection][i])) {
					} else {
						randNum = Math.round(Math.random() * 1000);
						temp_vid_code += '<div onclick="CNNPlaylistManager.getInstance().MYPMAddToPlaylist(\''+cnnSectionData[loadingSection][i]+'\',\''+randNum+'\');" style="margin-top:-10px;height:100px;cursor:pointer; width:50px;"><img src="http://i.cdn.turner.com/cnn/images/1.gif" alt="" style="width:100px; height:100%;"/></div>';
					}							
				}
				temp_vid_code += '</div></div></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);
		}
		
	}
	
}
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);
	
		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;

	}
	
}

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');
			document.getElementById("PlayList_Nav").className = document.getElementById("PlayList_Nav").className.replace("_alt","");

		}
		else {
	
			WTPO_HideLayer('Play_Box');
			WTPO_ShowLayer('My_Play_Box');
			document.getElementById('PlayList_Nav').className += "_alt";
	
		}
		
		currPlayNav = nav_section_id;
	
	}

}

function load_By_Section(by_nav_section_id, xml_file_url) {

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

		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);

		currBySectionNav = by_nav_section_id;
	
	
	}
	
}

function load_Related_Videos(section) {

		xml_sec_url = "/.element/ssi/auto/1.0/video/xml/by_section_" + section + ".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" style="direction:rtl;"><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 clearCommentsForm(){
	document.getElementById('name').value = '';
	document.getElementById('location').value = '';
	document.getElementById('comment').value = '';
}


var commentsHack = 0;
function showComments() { 
		killTaboolaObject();
		WTPO_HideLayer('cnnVPCommPosted');
		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 = document.getElementById("mediacontrols");
		//var controller = (navigator.appName.indexOf("Microsoft") != -1) ? window["mediacontrols"] : document["mediacontrols"];

		controller.style.width = '287px';
		controller.style.height = '60px';

		if(commentsHack == 0){
			commentsHack++;
			showComments();
		}else{
			commentsHack = 0;
		}
		doubleTabHack();
		if(noComments){
			document.getElementById('cnnVPCommentsCon').style.display = "none";
			document.getElementById('cnnVPCommPost').style.height = "354px";
			showPost();
		}
		else{ 
			if(postingAllowed){
				document.getElementById('cnnVPCommentsCon').style.height = "325px";
				document.getElementById('cnnVPCommentsBox').style.height = "318px";
				document.getElementById('postACommentLink').style.textAlign = "right";
			}else{
				document.getElementById('cnnVPCommentsCon').style.height = "300px";
				document.getElementById('cnnVPCommentsBox').style.height = "293px";
				document.getElementById('postACommentLink').style.textAlign = "left";
			}
				
			document.getElementById('cnnVPCommentsCon').style.display = "block";
			heightTemp = document.getElementById('cnnVPCommentsCon').style.height;
			document.getElementById('cnnVPCommPost').style.height = "";
			hidePost(true); 
		}
	}

function doubleTabHack(){
	document.getElementById("navBy_Section").className=document.getElementById("navBy_Section").className;
}

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.style.width = '500px';
		controller.style.height = '33px';
		if (CNNPlaylistManager.getInstance().nextUpSlate == null && CNNPlaylistManager.getInstance().endSlate == null) {
			alert(CNNPlaylistManager.getInstance().playlist.jsonList[CNNPlaylistManager.getInstance().playlist.pointer].id);
			window.displayOverlay = trcAttachOverlay('FlashCNN_PLAYER', CNNPlaylistManager.getInstance().playlist.jsonList[CNNPlaylistManager.getInstance().playlist.pointer].id, 'taboolaEventHandler', { link_target: 'local' });
		}
		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, "" );
			try{document.getElementById('commentsPadding').style.paddingBottom = '5px'; document.getElementById("commentsAd").style.display = "block";}catch(e){}
		} 
		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))
			try{document.getElementById('commentsPadding').style.paddingBottom = '5px'; document.getElementById("commentsAd").style.display = "block";}catch(e){}
		}
		doubleTabHack();
		
	}

var heightTemp = "";
function showPost() {
	clearCommentsForm();
	WTPO_HideLayer('cnnVPCommWrap');
	if (noComments){
		document.getElementById('comment').style.height = "225px";
	}
	else{
		document.getElementById('comment').style.height = "69px";
	}
	if (document.getElementById) { 
		document.getElementById('cnnVPCommentsCon').style.height = "";
		document.getElementById('cnnVPCommentsBox').style.height = '146px'; }
	else if (document.all) { document.all['cnnVPCommentsBox'].style.height = '143px'; }	
	WTPO_ShowLayer('cnnVPCommPost');
}

function hidePost(val) {
	if(val == undefined){ val = false; }
	WTPO_HideLayer('cnnVPCommPosted');
	if (document.getElementById) { 
		document.getElementById('cnnVPCommentsCon').style.height = heightTemp;
		if(postingAllowed){
			document.getElementById('cnnVPCommentsBox').style.height = '318px'; 
		}else{
			document.getElementById('cnnVPCommentsBox').style.height = '293px';
		}
	}
	else if (document.all) { document.all['cnnVPCommentsBox'].style.height = '318px'; }	
	WTPO_ShowLayer('cnnVPCommWrap');
	if(val){
		WTPO_HideLayer('cnnVPCommPost');
	}
	if(noComments){
		hideComments();
	}
}

function sub_Post() {
	WTPO_HideLayer('cnnVPCommPost');
	//Do some AJAX submission then...
	if(noComments){
		document.getElementById('cnnVPCommentsCon').style.display = "none";
		document.getElementById('cnnVPCommPost').style.height = "";
		document.getElementById('cnnVPCommentsBox').style.height = "0px";
		document.getElementById('cnnVPCommPosted').style.height = "342px";
		document.getElementById('cnnTYBox').style.height = "280px";
		document.getElementById('thankYouSpacer').style.height = "143px";
		//Revert back to default player if no comments to be displayed
		window.setTimeout("hideComments()", 8000);
	}else{
		document.getElementById('cnnTYBox').style.height = "";
		document.getElementById('cnnVPCommPost').style.height = "";
		document.getElementById('thankYouSpacer').style.height = "";
		document.getElementById('cnnVPCommentsCon').style.display = "block";
		document.getElementById('cnnVPCommentsBox').style.height = "122px";
		document.getElementById('cnnVPCommPosted').style.height = "";
		//Display comments
		window.setTimeout("showComments()", 8000);
	}
	WTPO_ShowLayer('cnnVPCommPosted');
	
}

