Shadowbox.init({
    overlayColor:'#ffffff',
    color:'#ffffff'
});


$(function() {
	clearForms();
	hidePersonal();
});

// Sets up forms for auto-clear and auto-refill
function clearForms() {
    $('input[type=text]').each(function() {
        var $this = $(this);
        var defaultVal = $this.val();
        $this.focus( function() {
            if( $this.val() == defaultVal ) {
                $this.val("");
            }
            $this.addClass('modified');
        }).focusout( function() {
            if( $this.val() == "" || $this.val() == defaultVal ) {
                $this.val(defaultVal);
                $this.removeClass('modified');
            } else {
                $this.addClass('modified');
            }
        });
    });
}

function hidePersonal() {

	/** Hides phone numbers when you replace dashes with [dash1] and [dash2] **/
	$('.call-me').each(function() {
		var $this = $(this);
		var oldNumber = $this.text();
		var newNumber = oldNumber.replace("[dash1]","-");
		var finalNumber = newNumber.replace("[dash2]","-");
		$this.html(finalNumber);
	});
	
	/** Hides emails when you replace @ with a space **/
	$('.mail-me').each(function() {
		var $this = $(this);
		var oldAddress = $this.text();
		var newAddress = oldAddress.replace(" ","@");
		$this.html("<a target='_blank' href='mailto:"+newAddress+"'>"+newAddress+"</a>");
	});
	
}
