//$(document).load(function(){scrollTo(0,0);});
$(document).ready(function(){
	// set up tabbing
	$('#tabs').tabs({
		fx: {opacity: 'toggle'}
	}); 
	// set up lavalamp
	$('#tabs').lavalamp();
	$("#hire-link").click(function () {
		$('#tabs').lavalamp('activate', 1);
		$('#tabs').tabs("select", 1);
		this.blur();
	});
	$("#logo-link").click(function () {
		$('#tabs').lavalamp('activate', 0);
		$('#tabs').tabs("select", 0);
		this.blur();
	});
	// prevent section scrolling
	if(location.hash == '#about' ||
	   location.hash == '#resume' ||
	   location.hash == '#portfolio' ||
	   location.hash == '#tutorials') {
           //use setTimeout 0 to catch hash scrolling
            setTimeout(function() {
                scrollTo(0,0);
            }, 0);
	} 
	
	// "hire me" img replacement
	$("#hire-link").hover(
		function () {
			$('#hire-glow').stop().animate({
				opacity: 1
			}, 200)
		}, function () {
			$('#hire-glow').stop().animate({
				opacity: 0
			}, 200)
		}
	);
	
	// vcard img replacement 
	$("img.vcard").hover(
		function () {
			$(this).attr("src", "images/grab-my-vcard.png");
		}, function () {
			$(this).attr("src", "images/vcard-nograb.png");
		}
	);
	
    $(window).bind('load', function () {
    	//once page has loaded, preload replacement image
    	$(new Image()).attr("src", "images/grab-my-vcard.png");
    });
	
	// de-obscucate email addresses
	$("a[href^='mailto:']").simplespamblock();
	$('.nospam').remove();
	
	/*
	// quote box
	var phrases = new Array(
	    "David Baumgold: web developer, college student, and code monkey.",
	    "The internet is a wild place. I'm here to tame it.",
	    "The leprechauns in my head tell me to burn things!",
	    "Luke, I am your father's brother's wife's nephew's college roommate.",
	    "There's no \"I\" in team. But there is an \"m\" and an \"e\"!",
	    "In my spare time, I rather enjoy full-contact origami and zero-gravity skydiving.",
	    "If you're not living on the edge, you're taking up too much space."
	    //"If winners never quit and quitters never win, what about quitting while you're ahead?"
	);
	function writeQuote(phrases) {
	    $('#quote-box').text(phrases[Math.floor(Math.random()*phrases.length)]);
	}
	writeQuote(phrases);
	*/
});