// tooltip shows title text on links with .tip
this.tooltip = function(){			
	$("a.tip").hover(function(){											  
		this.txt = this.title;
		this.title = "";									  
		$(this).parent().append("<div class='tooltip'>"+ this.txt +"</div>");
		$(".tooltip").fadeIn("fast")
	},
	function(){
		this.title = this.txt;		
		$(".tooltip").remove();
    });
};

// animates the hidden "seals" under "process"
this.showdots = function(){
	$('#process p').animate({ 
        opacity: 0
      }, 0 );
	$('#process li').hover(function() {
            $(this).children('p').stop().fadeTo(333, 1);
        },
        function() {
        	$(this).children('p').stop().fadeTo(1000, 0);
    });
};

$(document).ready(function() {
	tooltip();
	showdots();
	
	// form submission and validation
	$(".close").hide();
	var v = jQuery("#contactform").validate({
		submitHandler: function(form) {
			$("#contactform").append("<div class='seed'></div>");
			$(".close").show();
			jQuery(form).ajaxSubmit({
				target: ".seed",
				clearForm: true
			});
		}
	});
	$(".close").click(function() {
		$(".seed").fadeOut("fast");
		$(this).hide();
	});
	
	
	// scrooooollllling
	$.localScroll.hash({
		target: window,
		queue:true,
		duration:1500
	});
	$.localScroll({
		target: window,
		queue:true,
		duration:1000,
		hash:true,
	});
	
	// load tweets
	$(".tweet").tweet({
		username: "rocknroses",
		count: 2,
		loading_text: "getting tweets..."
	});
	
	// show and hide the baseline
	/*$(document).keypress(function(e)
	{
		switch(e.which)
		{
			// press "g"
			case 103: $("body").addClass("grid");
			break;
			
			// press "h"
			case 104: $("body").removeClass("grid");
		}
	});*/
});
