$(document).ready(function() {
	
	$("#currently").hide();
	$(".button-looking").click( function() { 
		$('#currently').slideToggle(600, 'easeOutBounce'); 
		if($(this).hasClass("button-open"))
			$(this).removeClass("button-open"); 	
		else
			$(this).addClass("button-open"); 	
	});
	
	$('a.goto-top').click(function(){
		if($('.button-looking').hasClass("button-open"))
			$('#currently').slideUp(600, 'easeOutBounce', function () {$('.button-looking').removeClass("button-open");});
		$('body').scrollTo( 0, 500 /*,  { easing:'easeOutBounce'} */);
		return false;
	});
	
	$('a.goto-profile').click(function(){
		if($('.button-looking').hasClass("button-open"))
			$('#currently').slideUp(600, 'easeOutBounce', function () {
				$('.button-looking').removeClass("button-open");
				$.scrollTo( '#about', 800 /*, {easing:'easeOutBounce'}*/ );
			});
		else
			$.scrollTo( '#about', 800/*, {easing:'easeOutBounce'} */);
		
		return false;
	});
	
	$('a.goto-contact').click(function(){
		if($('.button-looking').hasClass("button-open"))
			$('#currently').slideUp(600, 'easeOutBounce', function () {
				$('.button-looking').removeClass("button-open");
				$.scrollTo( '#footer', 800 /*, {easing:'easeOutBounce'}*/ );
			});
		else
			$.scrollTo( '#footer', 800/*, {easing:'easeOutBounce'} */);
		
		return false;
	});
	/*
	var offset = $("#sidebar-menu").offset();
    var topPadding = 0;
    $(window).scroll(function() {
        if ($(window).scrollTop() > offset.top) {
        		$("#sidebar-menu").stop().animate({
            		marginTop: $(window).scrollTop() - offset.top + topPadding
            	});
        } else {
            $("#sidebar-menu").stop().animate({
                marginTop: 0
            });
        };
    });
    */
    $('input:text, textarea').each(function(index) {
    	$(this).focusout(function() { if($(this).val() == '') $(this).val($(this).attr('title')); });
    	$(this).focusin(function() { if($(this).val() == $(this).attr('title')) $(this).val(''); });
    });
    $("form").bind("submit", function(event) {
    	$('input:text, textarea').each(function(index) {
    		if($(this).val() == $(this).attr('title')) $(this).val('');
    	});
    	return true;
    });
    
    $("a[rel=external]").attr('target', '_blank');
});
