/*
 * Requires JQuery (Written using ver 1.2)
 * www.jquery.com
 */

$(document).ready(function() { 
 transplantLabelText();
 clearTextfields();
 colorIntroText();
});

/* */
function transplantLabelText() {
 // Find labels
 var labels = $('label');

 // Grabb the 'for' attribute and text for each label
 jQuery.each(labels, function() {
   var label_for = $(this).attr('for');
   var label_text = $(this).text();

   // Find the corresponding input element
   if ('input#'+label_for) {

     // Set the field 'value' attribute to the label's text
     var target = 'input#'+label_for;
     $(target).attr('value', label_text);
   }
 });
}

/* */
function clearTextfields() {
  // Find target text fields
  var targets = $('input[type="text"]');
  
  // Set listener on each text field
  jQuery.each(targets, function() {
  
    $(this).one('click', function() {
      $(this).attr({value: ""});
    });
  
  });
  
}

/* */
function colorIntroText() {
  // Find the target span elements
  var targets = $('div.intro-inner span');
  var colors = new Array('#fff', '#ff432f', '#fff');
  
  for(i = 0; i < targets.length; i++) {
    $(targets[i]).css('color', colors[i]);
  }
}