$(document).ready(function() {
	var query = window.location.search.substring(1);
	if (query != "") {
		$("#"+query.split("=")[1]).css({backgroundColor:"#ddd"});
	}
	else {
		$("#video1").css({backgroundColor:"#ddd"});
	}

	$("#selector a").click(function() {
		var vid = $(this).attr("href").split("=")[1].split("&")[0];
		var url = "index.html?video="+vid+"&view=true";

		var pr = $(this).parent().attr("tagName").toLowerCase();
		if (pr == "p") {
			$(this).parent().parent().css({backgroundColor:"#ddd"});
			$(this).parent().parent().siblings().css({backgroundColor:"#fff"});
		}
		else {
			$(this).parent().siblings().css({backgroundColor:"#fff"});
			$(this).parent().css({backgroundColor:"#ddd"});
		}

		$("#show").load(url);
		return false;
	});
});