$(function() {
	//embedFlvPlayer();
	videoThumbOverlay();
}); //close document.ready

function embedFlvPlayer(){

	var vplayer='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="550" height="400" id="vidPlayer" align="middle">';
	vplayer+='<param name="allowScriptAccess" value="sameDomain" />';
	vplayer+='<param name="allowFullScreen" value="false" />';
	vplayer+='<param name="movie" value="vidPlayer.swf" />';
	vplayer+='<param name="FlashVars" value="{{filepath}}" />';
	vplayer+='<param name="quality" value="high" />';
	vplayer+='<param name="bgcolor" value="#ffffff" />';	
	vplayer+='<embed src="vidPlayer.swf" FlashVars="{{filepath}}" quality="high" bgcolor="#ffffff" width="550" height="400" name="vidPlayer" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	vplayer+='</object>';
	$('.divFlv').each(function(i){

		var src=$(this).children('.itemFlv').attr('title');
		vplayer=vplayer.replace(/{{filepath}}/g,src);
		$(this).append(vplayer);
		$(this).children('.itemFlv').remove();
	});

}

function videoThumbOverlay(){

	jQuery.each($(".itemFlvThumb"),function(){
	origImg = $(this).attr("src");
	$(this).attr("origimg",origImg);
	$(this).hover(function(){


	newImg = $(this).attr("alt");
	$(this).attr("src",newImg);
		//var offset = $(this).offset();
		//var width=$(this).attr('offsetWidth');
		//var height=$(this).attr('offsetHeight');
		//var left=offset.left;
		//left=(offset.left + width/2)-11;
		//var top=offset.top;
		//top=(top + height/2)-10;
		//var overlay='<div class="overlay" style="left:'+left+'px;top:'+top+'px"></div>';
		//$(this).parent().append(overlay);
	}, function(){
	//$('.overlay').remove();
	origImg = $(this).attr("origimg");
	$(this).attr("src",origImg);
	});
	});

	/*$('.flvThumb a').each(function(i){
		var offset = $(this).children('.itemFlvThumb').offset();
		var width=$(this).children('.itemFlvThumb').attr('offsetWidth');
		var height=$(this).children('.itemFlvThumb').attr('offsetHeight');
		var left=offset.left;
		left=(offset.left + width/2)-50;
		var top=offset.top;
		top=(top + height/2)-50;

		var overlay='<div class="overlay" style="left:'+left+'px;top:'+top+'px"></div>';
		$(this).append(overlay);
	});*/
}
