var hostrecords_dispatch = function(){
    packageemanager.newhostrecordid = 0;
    //setup environment for hosting
}

//delete the selected host entry
function hostrecords_deleteaddress(row)
{
    id = row.id.split("_");
    $('#fieldblock_'+id[1]).html('');
}

//add a new host entry
function hostrecords_addzoneentry()
{   
    packageemanager.newhostrecordid++;
    //$('#selectedproduct-view').append(String.format('<div id="fieldblock_{0}" '+hideElementStyle+' class="fieldblock"><dt><dd style="padding-left:0px !important;"><div style="float:left;" id="dnshostname_{0}"></div><div style="float:left;padding-left:5px;" id="dnshosttype_{0}"></div><div style="float:left;padding-left:5px;" id="dnshostaddress_{0}"></div><div style="float:left;padding-left:5px;" id="deleterowbtn_{0}"></div></dd></dt></div>',currentFieldData.id));
    newdiv = $('<div id="fieldblock_'+packageemanager.newhostrecordid+'" class="fieldblock"><dt><dd style="padding-left:0px !important;"><div style="float:left;" id="dnshostname_'+packageemanager.newhostrecordid+'"></div><div style="float:left;padding-left:5px;" id="dnshosttype_'+packageemanager.newhostrecordid+'"></div><div style="float:left;padding-left:5px;" id="dnshostaddress_'+packageemanager.newhostrecordid+'"></div><div style="float:left;padding-left:5px;" id="deleterowbtn_'+packageemanager.newhostrecordid+'"></div></dd></dt></div>')
    $('#fieldblock_addhostrecord').prepend(newdiv);
    controlid = packageemanager.newhostrecordid;
    //add new record field
    new Ext.form.TextField({
        id:               "hostname_CT_"+controlid,
        name:             "hostname_CT_"+controlid,
        width:            50,
        disabled:         false,
        border:           false,
        value:            '',
        allowBlank:       false,
        validationEvent: false,
        blankText:        lang("This field is required"),
        renderTo:         'dnshostname_' + packageemanager.newhostrecordid
    });
    storeObject = [['A','A'],['MXE','MXE'],['MX','MX'],['CNAME','CNAME'],['URL','URL'],['FRAME','FRMAE'],['TXT','TXT']];
    new Ext.form.ComboBox({
        id:               "hosttype_CT_"+controlid,
        name:             "hosttype_CT_"+controlid,
        typeAhead:        true,
        triggerAction:    'all',
        lazyRender:       true,
        mode:             'local',
        width:            70,
        disabled:         false,
        store:            storeObject,
        allowBlank:       false,
        blankText:        lang("This field is required"),
        forceSelection:   true,
        editable:         false,
        selectOnFocus:    true,
        value:            'A',
        renderTo:         'dnshosttype_' + packageemanager.newhostrecordid
    });

    new Ext.form.TextField({
        id:               "hostaddress_CT_"+controlid,
        name:             "hostaddress_CT_"+controlid,
        width:            220,
        disabled:         false,
        border:           false,
        value:            '',
        allowBlank:       false,
        validationEvent: false,
        blankText:        lang("This field is required"),
        renderTo:         'dnshostaddress_' + packageemanager.newhostrecordid
    });
    
    new Ext.Button({
         id: "CT_"+controlid+"_hostdelete",
         name: "CT_"+controlid+"_hostdelete",
         renderTo : 'deleterowbtn_' + controlid,
         width: 20,
         cls: 'x-box-text-small',
         text: 'X',
         handler: function() {
             hostrecords_deleteaddress(this);
         }
     });
    
}