if (Drupal.jsEnabled) {	
  $(document).ready(function() {
  	target_blank();
    defaultValues();
	nowhere_links();
  });
}

function defaultValues() {
  var fields = $('form input.form-default-value');
  var forms = fields.parents('form');
  fields.each(function() {
    this.defaultValue = this.value;
    $(this).focus(function() {
      if (this.value == this.defaultValue) {
        this.value = '';
        $(this).removeClass('form-default-value');
      }
    });
    $(this).blur(function() {
      if (this.value == '') {
        $(this).addClass('form-default-value');
        this.value = this.defaultValue;
      }
    });
  });

  // Clear all the form elements before submission.
  forms.submit(function() {
    fields.focus();
  });
};


function target_blank(){	
	$('a').filter(function() {
		// Filter out links within the site unless they're documents
		// Note: Use this declarative style for clarity
		if($(this).is('[href$=.doc]')) return true;
		if($(this).is('[href$=.pdf]')) return true;
		if(!$(this).is('[href^=http://]')) return false;
		if(!$(this).is('[href^=http://www.naeyc.org]') && !$(this).is('[href^=http://naeyc.org]')) {
			return true;
		}
	}).attr('target', '_blank');
}

function nowhere_links() {
  $('a[href$=nowhere]')
  .attr('href', 'javascript:;')
  // Everything from here onward will go in the master stylesheet once approved
  .css('color', '#ccc')
  .css('cursor', 'default')
  .hover(function() {
    $(this).css('text-decoration', 'none');
  },
  function() {
    return 1;
  });	  
}