function videoHover(videoID, area){ 
	var coords = $(area + '_thumb_' + videoID).cumulativeOffset();
	$(area + '_hover_' + videoID).setStyle({ left: (coords[0]+110) +'px', top: (coords[1]-50) +'px' });
	$(area + '_hover_' + videoID).show();
}
function videoHoverOut(videoID, area){ 
	$(area + '_hover_' + videoID).hide();
}


var videoWidth = '600';	//'650'; //'500';
var videoHeight = '394';   	//'500';  //'400';

if (parseInt(screen.width) < 1280) {
	videoWidth = '600';
	videoHeight= '394';

}

//var s1 = new SWFObject("vidViewer.swf","mpl",videoWidth,videoHeight,"9","#d4d4d4");
//var s1 = new SWFObject("tvwcplayer3.swf","mpl",videoWidth,videoHeight,"9");
//var s1 = new SWFObject("http://www.tvwebcity.tv/site/swf/vidViewer.swf", "VideoViewer", videoWidth, videoHeight, "8", "#cccccc");
//var s1 = new SWFObject("flvplayer.swf","video","600","400","10.0.0");
//var s1 = new SWFObject("mediaplayer.swf","mpl","550","320","9");

function play(dir, flv,days,hits,title,textValue, fullTextValue, id) {
	
	
	var e = document.getElementById('flvplayer-cont');
	if (e) e.innerHTML = '<div id="flvplayer"></div>';
	
	hq = false;
	flashvars = {};
	 flashvars.lq = "rtmp://tvwebcity.fcod.llnwd.net/a1741/o15/" + dir + "/" + flv;
	 if (hq) { flashvars.hq = "rtmp://tvwebcity.fcod.llnwd.net/a1741/o15/" + dir + "/TWC_" + flv; }	 	 
	 flashvars.autoPlay = 1;
	 flashvars.autoRewind = 0;
	 flashvars.skinAutoHide = 0;
	 flashvars.volume = 3;
	 flashvars.borderColor = "FFFFFF";
 
//alert("Trying to play "+flashvars.lq);	 
	params = {};
	 params.quality = "high";
	 params.allowFullScreen = "true";
	 params.bgcolor = "#000000";
	attributes = {};
	 attributes.id = "flvplayer";
	 attributes.name = "flvplayer";
	swfobject.embedSWF("flvplayer.swf", "flvplayer", "600", "400", "10", false, flashvars, params, attributes);
	
	changeDetails(days,hits,title,textValue,fullTextValue);	
}


function changeText(title,value) {
	document.getElementById("vidText").innerHTML = value;
	document.getElementById("vidTitle").innerHTML = title;
}

function changeVideoDetails(value) {
//alert("CHANGING VIDEO DETAILS to "+value);
	document.getElementById("video_description").innerHTML = value;
}

function handleHTML(value) {
	 encodedHtml = escape(value);
     encodedHtml = encodedHtml.replace(/\//g,"%2F");
     encodedHtml = encodedHtml.replace(/\?/g,"%3F");
     encodedHtml = encodedHtml.replace(/=/g,"%3D");
     encodedHtml = encodedHtml.replace(/&/g,"%26");
     encodedHtml = encodedHtml.replace(/@/g,"%40");
     encodedHtml = encodedHtml.replace(/"/g, escape("\""));
     encodedHtml = encodedHtml.replace(/'/g, escape("\'"));
     
	 return encodedHtml;
}

function changeDetails(daysSince,hits,title,value,fullValue) {
//alert("CHANGING DETAILS - Title = "+title+" Value = "+value);	
	document.getElementById("video_meta").innerHTML = "Added "+daysSince+"&nbsp;&nbsp;|&nbsp;&nbsp;"+hits+" Views";
	document.getElementById("video_title").innerHTML = "<h1>"+title+"</h1>";
	//var modifiedFullValue = fullValue.replace("'","$#39;");
	var modifiedFullValue = handleHTML(fullValue);	//.replace( /"/g, escape("\""));
	////modifiedFullValue = modifiedFullValue.replace( /'/g, escape("\'"));	
	//modifiedFullValue = "TEST";
	if (value.indexOf(". . .") != -1) {
//alert("modifiedFullValue = "+modifiedFullValue);
		//document.getElementById("video_description").innerHTML = value +" <br/><br/><a href=\"#\" onclick=\"hs.marginLeft=350; return hs.htmlExpand(this, { contentId: 'highslide-html_fullArticle' } )\" class=\"highslide\">Read Full Article</a>";
		document.getElementById("video_description").innerHTML = value +" <br/><br/><a href=\"javascript:changeVideoDetails('"+modifiedFullValue+"');\">Read Full Article</a>";
		//document.getElementById("video_description").innerHTML = value +" <br/><br/><a href=\"javascript:changeVideoDetails('TESTING');\">Read Full Article</a>";
//alert("video_description innerHTML = "+document.getElementById("video_description").innerHTML);		
		document.getElementById("fullArticle").innerHTML = fullValue;
	} else {
		document.getElementById("video_description").innerHTML = value;
		//document.getElementById("fullArticle").innerHTML = fullValue;
	}
	
	//alert("video_description innerHTML = "+document.getElementById("video_description").innerHTML);
}

