<div>
    <ul class="tabs">
        <li class="active"><a href="index.php?fuse=clients&amp;view=ShowCustomerData"><?php echo $this->lang("Profile"); ?></a></li>
        <li><a href="index.php?fuse=clients&amp;view=Profile_AlternateEmails"><?php echo $this->lang("Alternate Emails"); ?></a></li>
        <li><a href="index.php?fuse=clients&amp;view=Profile_Billing"><?php echo $this->lang("Billing"); ?></a></li>
        <li><a href="index.php?fuse=clients&amp;view=Profile_Password"><?php echo $this->lang("Password"); ?></a></li>
	<li><a href="index.php?fuse=clients&amp;view=Profile_StaffNotes"><?php echo $this->lang("Notes"); ?></a></li>
        <div class="bottom clear"></div>
    </ul>
</div>

<form method="post" name="customerdata" action="index.php?fuse=clients&amp;action=UpdateCustomer">
    <input type="hidden" name="id" value="<?php echo $this->customerId; ?>" />
    <input type="hidden" name="userid" value="<?php echo $this->customerId; ?>" />
    <input type="hidden" name="packageaction" value="0" />
    <input type="hidden" name="packageplugin" value="0" />

    <?php if ($this->packageWithPlugin!="") { ?>
        <input type="hidden" name="packagewithplugin" value="<?php echo $this->packageWithPlugin; ?>" />
    <?php } ?>

    <?php if ($this->error != "") {
        echo $this->error;
    } ?>

	<table class="ts2" cellspacing="0">
    	<tr>
        	<td class="label"><?php echo $this->lang('Status'); ?>:</td>
            <td><?php echo $this->customerStatus; ?></td>
        </tr>
        <tr>
        	<td class="label"><?php echo $this->lang('User ID'); ?>:</td>
            <td><?php echo $this->customerId; ?></td>
        </tr>
        <!-- loop through the custom fields -->
		<?php foreach ($this->customFields as $customField) { ?>
        <tr>
        	<td class="label"><?php echo $customField['rowLabel']; ?>:</td>
            <td>

            <?php if ($customField['isReadOnly']) {
                    echo $customField['value']."</td></tr>";
                    continue;
               } ?>

			<?php if ($customField['isLanguages']) { ?>
            <select name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>">
                    <?php foreach ($customField['languages'] as $language) { ?>
                    <option value="<?php echo $language['typeLanguageOptionValue']; ?>" <?php echo $language['typeLanguageOptionSelected']; ?> ><?php echo $language['typeLanguageOptionLabel']; ?></option>
                    <?php } // end languages foreach ?>
                </select>
			<?php } //end languages ?>
            
            <?php if ($customField['isTextArea']) { ?>
            <textarea name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>" style="display: inline-block; width: 300px; vertical-align: top;" rows ="10" cols='30'><?php echo $customField['value']; ?></textarea>
			<?php } //end textarea ?>
            
            <?php if ($customField['isDropDown']) { ?>
            <select name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>">
                    <?php foreach ($customField['dropdownoptions'] as $dropdown) { ?>
                    <option value="<?php echo $dropdown['typeDropdownOptionValue']; ?>" <?php echo $dropdown['typeDropdownOptionSelected']; ?> ><?php echo $dropdown['typeDropdownOptionLabel']; ?></option>
                    <?php } //end forloop dropdown ?>
                </select>
            <?php } // end is dropdown ?>
             
            <?php if ($customField['isCountry']) { ?>
                <script type="text/javascript">
                    countryVAR = 'CT_<?php echo $customField['fieldId'];?>';
                </script>
                <select name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>" onChange="getTax();">
                    <?php echo $customField['countries']; ?>
                </select>
            <?php } //end country ?>
             
            <?php if($customField['isYesNo']) { ?>
            <select name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>">
                    <option value="1" <?php echo $customField['yesSelected']; ?> ><?php echo $this->lang("Yes"); ?></option>
                    <option value="0" <?php echo $customField['noSelected']; ?> ><?php echo $this->lang("No"); ?></option>
                </select> <?php echo $customField['allowEmailHelp']; ?>
            <?php } //end if ?>
             
            <?php if($customField['isDate']) { ?>
            <span style="display: inline-block">
                    <input type="hidden" name='CTT_<?php echo $customField['fieldId'];?>' id="CTT_<?php echo $customField['fieldId'];?>" value="<?php echo $customField['typeDateConstant'];?>" />
                    <input type="text" name='CT_<?php echo $customField['fieldId'];?>' id="CT_<?php echo $customField['fieldId'];?>" value="<?php echo $customField['value']; ?>" />
                        <script type="text/javascript">
                            datefields.push("CT_<?php echo $customField['fieldId'];?>");
                        </script>
                </span>
            <?php } //isDate ?>
             
            <?php if($customField['isState']) { ?>
                <script type="text/javascript">
                    var stateVAR = 'CT_<?php echo $customField['fieldId'];?>';
                </script>
            <?php } //isState ?>
             
            <?php if($customField['isVat']) { ?>
                <script type="text/javascript">
                    var vatVAR = 'CT_<?php echo $customField['fieldId'];?>';
                </script>
                <input type="hidden" name="customTagsVAT" value='CT_<?php echo $customField['fieldId'];?>' />
                <span id="vat_country"></span>
            <?php } //isVat ?>
             
            <?php if($customField['isTextField']) { ?>
            <input type="text" name='CT_<?php echo $customField['fieldId'];?>' id='CT_<?php echo $customField['fieldId'];?>' size="40" value="<?php echo $customField['value']; ?>" <?php if($customField['isVat']) {  echo "onBlur='getTax();'";  } ?> />
            <?php } //end textfield ?>
            
            <?php if($customField['isVat']) { ?>
                <span id="vat_valid" style="display:none"><?php echo $this->lang("Valid VAT Number"); ?></span>
                <span id="vat_invalid" style="display:none"><?php echo $this->lang("Invalid VAT Number"); ?> <a href="javascript:getTax();"><?php echo $this->lang("Retry"); ?></a></span>
                <span id="vat_error" style="display:none"><?php echo $this->lang("Unable to validate at the moment."); ?> <a href="javascript:getTax();"><?php echo $this->lang("Retry"); ?></a></span>
            <?php } //isVat ?>
            
            <?php if($customField['isOrganization']) { ?>
            &nbsp; <input type="checkbox" name="isOrganization" <?php if ($customField['checkedIsOrganization']) { echo "checked='checked'"; }?> /><?php echo $customField['organizationHelp']; ?>
            <?php } //is organization ?>
            
            <?php foreach ($customField['hiddenFields'] as $otherHiddeField) { ?>
            <input type="hidden" name="<?php echo $otherHiddeField['fieldName']; ?>" value="<?php echo $otherHiddeField['fieldValue']; ?>" />
            <?php } ?>
            </td>
       	</tr>
		<?php } //end customField ?>
    </table>

    <input type="submit" class="button" value='<?php echo $this->lang("Update"); ?>' onclick='check(form,form.elements.length);return false;' />
    <input type="hidden" name="removeArray" value='<?php echo $this->queryString1;?>' />
    <input type="hidden" name="customTagsArray" value='<?php echo $this->queryString2;?>' />

    <script type="text/javascript">
        var mainForm = document.forms['customerdata'];
        getTax();
    </script>
</form>