this.screenshotPreview = function(){	
	xOffset = 0;
	yOffset = -330;
	$("a.info").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? this.t : "info";
		$("body").append("<p id='infotooltip'>"+ c +"</p>");								 
		$("#infotooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
    },
	function(){
		this.title = this.t;	
		$("#infotooltip").remove();
    });	
	$("a.info").mousemove(function(e){
		$("#infotooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

$(function () {
// SHOW MORE EXPERTISE

	$('#more_expertise').live('click',function() {
		var thismore = $(this);
		var allshown = ($('#exprtiselist div.mixitem').not(':visible').length == 0);

		if (!allshown) {
			$('#exprtiselist div.mixitem').not(':visible').each( function() {
				jQuery(this).slideDown();
			});
		} else {
			$('#exprtiselist div.mixitem:gt(1)').each( function() {
				jQuery(this).slideUp();
			});
		}
		thismore.toggleClass('lesslist');
		thismore.toggleClass('morelist');
		return false
	});

// LOAD TWITER STUFF		
	function replaceURLWithHTMLLinks(text) {
		var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
		return text.replace(exp,"<a href='$1' target='_blank'>$1</a>"); 
	}

	$.ajax({
		url 		: "http://twitter.com/statuses/user_timeline/interlinejim.json?callback=?",
		dataType : "json",
		timeout	: 15000,
		success 	: function(data) {
			$("#data").html("Data successfully obtained! <br />");
			$("#nuggets").hide();
			for (i=0; i<data.length; i++) {
				$("#nuggets").append("<p>" + replaceURLWithHTMLLinks(data[i].text)) +"</p>";
			}

			$('#nuggets p:gt(4)').hide();
			$('#more_nuggets').live('click',function() {

				var thismore = $(this);
				var allshown = ($('#nuggets p').not(':visible').length == 0);
		
				if (!allshown) {
					$('#nuggets p').not(':visible').each( function() {
						jQuery(this).slideDown();
					});
				} else {
					$('#nuggets p:gt(4)').each( function() {
						jQuery(this).slideUp();
					});
				}
				thismore.toggleClass('lesslist');
				thismore.toggleClass('morelist');
				return false;
			});
			$("#nuggets").show();
		},
		error : function() {
			alert("Failure!");
		}
	});

// INFO ICON TOOLTIP	

	screenshotPreview();
});
