$(document).ready(function(){
	$("#videothumbnail-2").click(function() { swapvideo(2); return false; });
	$("#videotitle-2").click(function() { swapvideo(2); return false; });
	$("#videothumbnail-3").click(function() { swapvideo(3); return false; });
	$("#videotitle-3").click(function() { swapvideo(3); return false; });
	$("#videothumbnail-4").click(function() { swapvideo(4); return false; });
	$("#videotitle-4").click(function() { swapvideo(4); return false; });
	$("#videothumbnail-5").click(function() { swapvideo(5); return false; });
	$("#videotitle-5").click(function() { swapvideo(5); return false; });
	$("#videothumbnail-6").click(function() { swapvideo(6); return false; });
	$("#videotitle-6").click(function() { swapvideo(6); return false; });	
	
	function swapvideo(id) {
		
		var url = $("#videothumbnail-" + id + " a").attr("href");
		var thevideohtml = "<object type=\"application/x-shockwave-flash\" data=\"" + url + "\" width=\"425\" height=\"344\"><param name=\"movie\" value=\"" + url + "\" /></object>"
		$("#videoplayer-1").html(thevideohtml);
		
		var thevideotitle = $("#videotitle-" + id + " div div").html();
		$("#videotitle-1").html(thevideotitle);

	}
	
	function right(str, n){
		if (n <= 0)
		   return "";
		else if (n > String(str).length)
		   return str;
		else {
		   var iLen = String(str).length;
		   return String(str).substring(iLen, iLen - n);
		}
	}
	
});
