// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
//
function open_chat(){
  window.open("http://vic.helponclick.com/livechat/livechat.php?usrname=amcoonline&usr_id=7426", "online_chat", "height=460, width=660, scrollbars=yes, location=no, menubar=no, status=no, toolbar=no");
}

function attach_autoprompt( selector, message ) {
  var o = $(selector);

  // when you set 'defaultValue' it sets 'value' - so we need to first set 
  // 'defaultValue' and then set 'value' if it already had a value
  var val = o.attr('value');
  o.attr( 'defaultValue', message);

  if( val == '' ) {
    o.addClass('dimmed');
    o.attr('value', o.attr('defaultValue') );
  }
  else {
    o.attr('value', val );
  }

  o
    .focus(function() {
      if( this.value == this.defaultValue) {
        $(this).attr('value','');
        $(this).removeClass('dimmed');
      }
    })
    .blur(function() {
      if( this.value == '' ) {
        $(this).attr('value', $(this).attr('defaultValue'));
        $(this).addClass('dimmed');
      }
    });
}
