var RBS = {

	base_url: '/',
	
	init: function( base_url ) {
		this.base_url = base_url;
		this.init_placeholder();
    this.init_custom_select();
	},
	
	init_placeholder: function() {
    // src: https://gist.github.com/379601
    jQuery('[placeholder]').focus(function() {
      var input = jQuery(this);
      if (input.val() == input.attr('placeholder')) {
        input.val('');
        input.removeClass('placeholder');
      }
    }).blur(function() {
      var input = jQuery(this);
      if (input.val() == '' || input.val() == input.attr('placeholder')) {
        input.addClass('placeholder');
        input.val(input.attr('placeholder'));
      }
    }).blur().parents('form').submit(function() {
      jQuery(this).find('[placeholder]').each(function() {
        var input = jQuery(this);
        if (input.val() == input.attr('placeholder')) {
          input.val('');
        }
      })
    });
  },
	
	init_custom_select: function() {
    if (!jQuery.browser.opera) {
      jQuery('select').each( function() {
        var title = jQuery( this ).attr('title');
        if( jQuery('option:selected', this).val() != ''  ) title = jQuery('option:selected', this).text();
        jQuery( this )
          .css( {'z-index' : 10, 'opacity' : 0, '-khtml-appearance' : 'none'} )
          .after('<span class="select">' + title + '</span>')
          .change( function() {
            val = jQuery('option:selected', this).text();
            jQuery( this ).next().text( val );
          })
      });
    };
  },
	
	update: function( field ) {
	  /*
		if ( jQuery.trim( field.value ) != '' ) {
			data = { 
				"key" : field.name,
				"val" : field.value 
			};
			$.post( this.base_url + 'index.php/abo/update' , data );
		}
		//*/
	}
	
}

$(document).ready(function(){
	/* */
});
