$(document).ready(function(){
	// Check for hash value in URL
	//var hash = window.location.hash;
	//     $('#video-menu a').each(function(){
	// 	var href = $(this).attr('href');
	// 	if(hash=="#about" && hash==href) {
	// 		$("#video-loader").slideUp();
	// 		$("#about").slideDown();
	// 		$('#video-menu li').attr('class','');
	// 		$(this).parent().addClass('current');
	// 	} else if (hash==href){
	// 		var toLoad = 'videos.html '+hash;
	// 		$('#video-loader').load(toLoad,'');
	// 		$('#video-menu li').attr('class','');
	// 		$(this).parent().addClass('current');
	// 	} else {
	// 		$('#video-menu li').attr('class','');
	// 		$(this).parent().addClass('current');
	// 		
	// 	}
	// });
	$('#video-menu li:first').next().addClass('current');
	$("#videos div:first").slideDown();
	$('#video-menu a').click(function(){
		var href = $(this).attr('href');
		if(href=="#about") {
			$("#video-loader").slideUp();
			$("#about").slideDown();
			$('#video-menu li').attr('class','');
			$(this).parent().addClass('current');
		} else {
			$('#video-menu li').attr('class','');
			//window.location.hash = $(this).attr('href');
			$("#video-loader").slideUp(300,function() {
				$(this).addClass("hide");
				$("#videos div").hide();
				$(href).show();
				$("#video-loader").slideDown();
				$("#about").slideUp(300);
				$(this).removeClass("hide");
			}).slideDown();
			$(this).parent().addClass('current');
		}
	});
	
	$("object").attr('width','555').attr('height','319');
	$("embed").attr('width','555').attr('height','319');
	
	// twitter
	$.getJSON("http://twitter.com/status/user_timeline/ginafitch.json?count=10&callback=?",
        function(data){
          $.each(data, function(i,item){
			var imageRegEx = /(http:\/\/(www.|)+(twitpic.com|img.ly|yfrog.com)\/){1}[a-zA-Z0-9]{1,}/g;
			var txt = item.text
			.replace(/(https?:\/\/twitpic.com\/)+([_A-Za-z0-9]+)/ig,'<img src="$1/show/mini/$2"/>')
			//.replace(/(https?:\/\/[-a-z0-9._~:\/?#@!$&\'()*+,;=%]+)/ig,'<a href="$1">$1</a>')
			.replace(/@+([_A-Za-z0-9-]+)/ig, '<a href="http://twitter.com/$1">@$1</a>')
			.replace(/#+([_A-Za-z0-9-]+)/ig, '<a href="http://search.twitter.com/search?q=$1">#$1</a>');
			$('<li></li>').addClass(i%2 ? 'even' : 'odd').html('<a href="http://twitter.com/ginafitch/statuses/'+item.id+'">'+txt+'</a>').append("<abbr>"+$.timeago(item.created_at)+"</abbr><div class='clear'></div>").appendTo('#tweets');
	  	  });
        });
    
})