function installStuff() {
	$("#addlist li").click(function() {
		$("#adddesc li").hide();
		$("#desc-"+this.id).slideDown(100);
		this.blur();
	});
	
	$.History.bind('/love',function(state) {
		ov_show("http://www.google.com.br/search?q=wh%D0%B0t+is+%D0%86%CE%BF%CE%BD%D0%B5", "What is Love?", {});	
	});
	
	$.History.bind('/stuff',function(state) {
		$.get("?act=stuff",function(xml){
			$.History.go('#/stuff/'+$("link",xml).text());
		});		
	});
	
	$.History.bind('/live',function(state) {
		ov_show("http://cdn.livestream.com/grid/LSPlayer.swf?channel=thejcs&amp;autoPlay=true", null, {});
	});
	
	$.History.bind('/backpack',function(state) {
		ov_show("http://thejcs.com.br/tf2items", null, {});
	});
	
	$.History.bind('/console',function(state) {
		$("#menu").fadeOut('slow', function(){
			$("#console").fadeIn('fast');
			runCmd('');		
		});
	});
	
	$("#console form").submit(function(){
		var cmd = $("#console form .inputbox:first").attr('value');
		
		runCmd(cmd);
		
		return false;
	});
	
	function runCmd(cmd) {
		$.get("?act=console&cmd="+cmd,function(result){
			if(result.length == 0)
			{
				$("#console").fadeOut('slow', function(){
					$("#menu").fadeIn('fast');			
				});
				$.History.go('');
			}
			else
			{
				$("#console form .inputbox:first").attr('value', result).focus().select();
			}
		});
	}
	
	$.History.bind(function(state){
		if(state.length == 0)
		{
			$("#menu").show();
			$("#console").hide();
		}
		// TODO: Add links to media
		if(state.indexOf("/stuff") == 0 && state.length != 6)
		{
			$.get("?act=stuff&q="+state.substr(7), function(xml){
				var videoname = $("name",xml).text();
				var videolink = $("link",xml).text();
				var videofile = $("file",xml).text();
				
				ov_show(videofile, videoname, {});
			});							
		}
	});
}

$(installStuff);
