var defaultValues = {
    'name': 'Your Name',
    'phone': 'Phone',
	'company': 'Company',
	'title': 'Title',
	'email': 'Email',
	'promo': 'Promo Code'
};

$('input').live('focus', function() {
    var el = $(this);
    if (el.hasClass('default')) {
        el.removeClass('default').val('');
    }
    if (el.attr('id') === 'phone') {
        $(this).mask('(___)___-____', {placeholder:' '});
    }
	if (el.attr('id') === 'phone') {
        $(this).mask('(___)___-____', {placeholder:' '});
    }
	if(this.value == 'Your Name' || this.value == 'Company' || this.value == 'Title' || this.value == 'Email' || this.value == 'Promo Code') { this.value = ''; }
});

$('input').live('blur', function() {
    var el = $(this);
    var name = el.attr('name');

    // Really we only want to do anything if the field is *empty*
    if (el.val().match(/^[\s\_\(\)\-]*$/)) {
        // To get our default style back, we'll re-add the classname
        el.addClass('default');

        // Unmask the 'dob' field
        console.log(name);
        if (name == 'phone') {
            el.unmask();
        }
		if (name == 'name' || name == 'company' || name == 'title' || name == 'email' || name == 'promo') {
            el.unmask();
        }

        // And finally repopulate the field with its default value
        el.val(defaultValues[name]);
    }
});
