function openVideo(theLink, description){
	if (!description) {
		description = "";
	}
	$("#videoPlayer").html('<object width="544" height="433"><param name="movie" value="http://www.youtube.com/v/' +theLink + '?fs=1&hl=en_US&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + theLink + '?fs=1&hl=en_US&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="544" height="433" wmode="transparent"></embed></object>' + description);
	window.location.href = '#videoPlayer';
}

function initializeVideo(theLink,description){
	$("#videoPlayer").html('<object width="544" height="433"><param name="movie" value="http://www.youtube.com/v/' +theLink + '?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/' + theLink + '?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="544" height="433" wmode="transparent"></embed></object>' + description);
}

$(document).ready(function(){
	var description = $("table tr:first-child td:nth-child(2) div:nth-child(2) span").html();
	//$("td").not($("table tr:first-child td:first-child")).css({display:"none"});
	//var aTags = $("table").find("a:first-child");
	var aTags = $("#thumbs2 div").find("a:first-child");
	$.each(aTags,function(i,e) {
		// BIND CLICK
	
		$(e).click(function() {
							/*
			var spanTag = $(this).parents("td:first").next("td").find("span"),
				spanContents = spanTag.html();
			if (spanContents != "") {
				spanContents = '<h2>Description</h2><p class="description">' + spanContents + '</p>';
			}
			*/
			openVideo($(this).attr("href").split("v=")[1].split("&")[0]);
			return false;
		});
	});
	$("table div").attr('style','none');
	$('div[style*="width: 555"]').attr({
		width: "auto",
		style: "none"
	});
	$('td[width=256]').attr('width','544px');
	var spanTag = $("table tr:first-child td:first-child").next("td").find("span"),
		spanContents = spanTag.html();
	spanContents = '<h2>Description</h2><p class="description">' + spanContents + '</p>';
	var first = $("table a:first-child").attr("href").split("v=")[1].split("&")[0];
	//initializeVideo(first,spanContents);
});

