function _AutocompleterDefaultText()
{
    default_texts = {   location:    'Start typing location\'s name',
                        town:        'Start typing location\'s name',
                        geo_name_id: 'Start typing location\'s name',
                        school:      'Start typing schools\' name',
                        user:        'Start typing a contact\'s name',
                        creator_id:  'Start typing a contact\'s name',
                        new_member:  'Start typing a contact\'s name',
                        company:     'Start typing a company\'s name',
                        serv_prov:   'Start typing a service provider\'s name',
                        investor:    'Start typing an investor\'s name',
                        node_id:     'Start typing content title or keyword',
                        grant_table: 'Start typing location\'s name'
                    };
                    
	this.onLoad = function()
    {
        var forms_number   = document.forms.length;
        var inputs_ids     = new Array();
        var original_ids   = new Array();
        
        for (i = 0; i < forms_number; i++)
        {
          var form_id = document.forms[i].id;
          if (form_id == '')
            continue;
          
          var autocompleters = $(form_id).getElementsByClassName('ac_input');

          for (var x in autocompleters)
          {
            var aut_id = autocompleters[x].id;

            if (aut_id) //if it's an input
            {
                var sub_string = aut_id.substr(0,13);

                if (sub_string == "autocomplete_") //autocomplete
                {
                    var ac_type = aut_id.substr(13,aut_id.length-13);
                    original_ids[aut_id] = ac_type;

                    if (ac_type.match("_"))
                    {
                        var tmp_array = ac_type.split("_");
                        if (tmp_array.length >= 3)
                        {                          
                            if (( tmp_array[tmp_array.length-3] == 'geo') && (tmp_array[tmp_array.length-2] == 'name') &&
                                (tmp_array[tmp_array.length-1] == 'id'))
                            {
                                ac_type = 'geo_name_id';
                            }
                            else if ((tmp_array[tmp_array.length-2] == 'creator') && (tmp_array[tmp_array.length-1] == 'id'))
                            {
                                ac_type = 'creator_id';
                            }
                            else if ((tmp_array[tmp_array.length-2] == 'new') && (tmp_array[tmp_array.length-1] == 'member'))
                            {
                                ac_type = 'new_member';
                            }
                            else if (original_ids[aut_id] == 'company_profile_name')
                            {
                                ac_type = 'company';
                            }
                            else if (original_ids[aut_id] == 'service_provider_profile_name')
                            {
                                ac_type = 'serv_prov';
                            }
                            else if (original_ids[aut_id] == 'investor_profile_name')
                            {
                                ac_type = 'investor';
                            }
                            else if (original_ids[aut_id] == 'registration_profile_education_id')
                            {
                                ac_type = 'school';
                            }
                            else if (original_ids[aut_id] == 'featured_node_node_id')
                            {
                                ac_type = 'node_id';
                            }
                        }
                        else 
                        {
                          ac_type = tmp_array[tmp_array.length-1];
                        }
                    }
                    if (default_texts[ac_type]) //if the default text exists
                    {
                        inputs_ids[aut_id] = ac_type;

                        $(aut_id).onfocus = function() {
                                                            if (this.value == default_texts[inputs_ids[this.id]])
                                                            {
                                                                this.value = '';
                                                            }
                                                       };

                        $(aut_id).onblur  = function() {
                                                            if (this.value == '')
                                                            {
                                                              this.value = default_texts[inputs_ids[this.id]];
                                                              $(original_ids[this.id]).value = '';
                                                            }
                                                       };
                        if ($(aut_id).value == '')
                        {
                            //exceptions
                            if ((original_ids[aut_id] == 'company_profile_name') &&
                                ($(original_ids[aut_id]).value != ''))
                            {
                                $(aut_id).value = $(original_ids[aut_id]).value;
                            }
                            else if ((original_ids[aut_id] == 'service_provider_profile_name') &&
                                ($(original_ids[aut_id]).value != ''))
                            {
                                $(aut_id).value = $(original_ids[aut_id]).value;
                            }
                            else if ((original_ids[aut_id] == 'investor_profile_name') &&
                                ($(original_ids[aut_id]).value != ''))
                            {
                                $(aut_id).value = $(original_ids[aut_id]).value;
                            }
                            else if ((original_ids[aut_id] == 'registration_profile_education_id') &&
                                ($(original_ids[aut_id]).value != ''))
                            {
                                if (isNaN($(original_ids[aut_id]).value))
                                {
                                    $(aut_id).value = $(original_ids[aut_id]).value;
                                }
                                else //retrieve actual name of the education
                                {
                                    var AR = new Ajax.Request(
                        				'/index.php/profile/getEducationName.html',
                        				{
                        					asynchronous:true,
                        					evalScripts:false,
                        					onComplete:function(request, json){
                                                $('autocomplete_registration_profile_education_id').value = json.eduname;
                                            },
                        					parameters:"edu_id="+$(original_ids[aut_id]).value
                        				}
                        			);
                                }
                            }
                            else
                            {
                                $(aut_id).value = default_texts[ac_type];
                            }
                        }
                    }
                }
            }

          } //end for (var x in autocompleters)
        }
	}

}

var AutocompleterDefaultText = new _AutocompleterDefaultText();

