home *** CD-ROM | disk | FTP | other *** search
/ familyradio.com / www.familyradio.com.tar / www.familyradio.com / js / misc.js < prev   
Text File  |  2011-03-22  |  1KB  |  50 lines

  1. function email_focus() {
  2.     if ($(this).val() == 'your@email.com') {
  3.         $(this).val('')
  4.         $(this).removeClass('faded');
  5.     }
  6. }
  7.  
  8. function email_blur() {
  9.     if ($(this).val() == '') {
  10.         $(this).val('your@email.com')
  11.         $(this).addClass('faded');
  12.     }    
  13. }
  14.  
  15. function subscribe_submit() {
  16.     email = $('#email_field').val();
  17.  
  18.     $.post('subscribe.php?json=1', $('#subscribe_form').serialize(), subscribe_result, 'json');
  19.     $('#subscribe_button').attr("disabled","disabled");
  20.     $('.form_message').fadeOut('fast');
  21.     $('#loading').fadeIn('fast');
  22.     return false;
  23. }
  24.  
  25. function subscribe_result(data) {
  26.     $('#loading').hide();
  27.     if (data.error) {
  28.         display_message(data.error);
  29.     } else {
  30.         display_message(data.info, 'info')
  31.     }
  32.     $('#subscribe_button').removeAttr("disabled");
  33. }
  34.  
  35. function display_message(msg, type) {
  36.  
  37.     if (!type) type = 'error';
  38.  
  39.     if (type == 'error') {
  40.         $('#error_message').html(msg).fadeIn('slow');
  41.         setTimeout('hide_error()', 4000);
  42.     } else {
  43.         $('#error_message').hide();
  44.         $('#info_message').html(msg).fadeIn('slow');
  45.     }
  46. }
  47.  
  48. function hide_error() {
  49.     $('#error_message').fadeOut('slow');
  50. }