// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

Event.observe(window, 'load', function() {
  // Clear the input fields on select
  if($('clearit')){
    var orig_value = $('clearit').value;
    Event.observe($('clearit'), 'click', function(){
      //clear box, and set the text color to black
      if ( orig_value == $('clearit').value ) {
        $('clearit').value = '';
      }
    });
    Event.observe($('clearit'), 'blur', function(){
      if ($('clearit').value == '') {
        //clear box, and set the text color to black
        $('clearit').value = orig_value;
      }
    });
  }
  
  if($('error')) {
    Effect.Fade('error', { duration: 1.0, delay: 3.0 });
  }
  if($('success')) {
    Effect.Fade('success', { duration: 1.0, delay: 3.0 });
  }


  Event.observe($('display_manufacturers'), 'click', function(){
    $('categories_container').style.display = 'none';
    $('manufacturers_container').style.display = 'block';
  });
  
  Event.observe($('display_categories'), 'click', function(){
    $('manufacturers_container').style.display = 'none';
    $('categories_container').style.display = 'block';
  });
  
});