<script language = "javascript">
<!--
function launchhex()
{
    y = window.open("../newedge/javascript/colorpicker/colorpicker.html","Hex","width=310,height=380,top=100,left=100,resizeable=no,scrollbars=no,menubar=no,toolbar=no,status=yes")
}

function toggleHexColorField(ctr){
	if(ctr.checked){
		$('hexColor').style.visibility = "hidden";
	}else{
		$('hexColor').style.visibility = "visible";
	}
}

var groupHasMembers = {groupHasMembers};

function deleteGroup(form)
{
    if (groupHasMembers &&
        !confirm(lang('This customer group has members. Are you sure you want to delete the group?\n(Customers won\'t be deleted)'))) {
        return false;
    }

    form.action = 'index.php?fuse=admin&action=DeleteCustomerGroup';

    return true;
}

//-->
</script>

<form method="post" action="index.php?fuse=admin&action=SaveCustomerGroup" />
    <input type="hidden" name="groupId" value="{groupId}" />
    <table>
        <tr>
            <td align="right" class="formlabel">[l]Name[/l]:</td>
            <td class="formfield">
                <input type="text" name="groupName" value="{groupName}" style="width:300px" maxlength="50" />
            </td>
        </tr>
        <tr>
            <td align="right" valign="top" class="formlabel" width="1%">[l]Description[/l]:</td>
            <td class="formfield">
                <textarea name="groupDescription" style="width:300px;" rows="2">{groupDescription}</textarea>
            </td>
        </tr>
        <tr>
            <td align="right" class="formlabel" width="100" nowrap="true">[l]Group Color[/l]:</td>
            <td class="formfield">
                <input type="checkbox" name="useDefault" {useDefaultCheckValue} onClick="toggleHexColorField(this);" /> [l]Use Default[/l] 
				<span id="hexColor" {hexColorVisibilityStyle}>&nbsp;&nbsp;[l]Hex Color:[/l] <input type="text" name="groupColor" value="{groupColor}" style="width:70px" /> <a href="#" onclick=launchhex()>[l]Color Picker[/l]</a></span>
			</td>            
        </tr>        
        <!-- BEGIN DYNAMIC BLOCK: groupNotes -->
        <tr>
            <td align="right" valign="top" class="formlabel" nowrap="true">[l]Staff Notes[/l]{staffNoteHelp}:</td>
            <td class="formfield">
                <script>onLoadFunctions.push(function() {loadClientNotes({groupId});});</script>
                <div id="clientNotes"></div>
            </td>
        </tr>
        <!-- END DYNAMIC BLOCK: groupNotes -->
        <tr>
            <td colspan="2" style="padding-top:10px">
                <input type="submit" value="[l]Save[/l]" class="button_medium" />&nbsp;&nbsp;
                <!-- BEGIN DYNAMIC BLOCK: deleteButton -->
                <input type="submit" value="[l]Delete[/l]" onclick="return deleteGroup(form)" class="button_medium" />
                <!-- END DYNAMIC BLOCK: deleteButton -->
            </td>
        </tr>
    </table>
</form>
