/**
 * Handle text boxes which have instructional text/labels that disappears on focus
 */
Event.observe(window, 'load', function() {
  $$('input.default_text, textarea.default_text').each(function(input) {
    if (input.value == '' || input.value == input.title) {
      input.value = input.title
      input.addClassName('empty');
    }
    Event.observe(input, 'focus', (function(event) {
      if (this.value == this.title) this.value = '';
      this.removeClassName('empty');
    }).bind(input));
    Event.observe(input, 'blur', (function(event) {
      if (this.value == '') {
        this.value = this.title;
        this.addClassName('empty');
      }
    }).bind(input));
    if (input.form) Event.observe(input.form, 'submit', (function(event) {
      if (this.value == this.title) this.value = '';
    }).bind(input));
  });
});

/**
 * Drop in flash for h1 tags that need it
 */
Event.observe(window, 'load', function() {
  var idx = 1;
  $$('h1.tool').each(function(h1) {
    var txtValue = h1.innerHTML;
    var id = 'h1_swf_'+(id++);
    h1.innerHTML = '<div id="'+id+'"></div>';
    swfobject.embedSWF('/swf/h1.swf', id, 714, 72, '9.0.0', false, {txt:txtValue}, {menu:'false',wmode:'transparent',scale:'noscale'});
  });
});

