<div id="kb" class="block">
<div class="block_title">
<h3><b><a href="index.php">[l]Support Center[/l]</a> &raquo; <a href="#">[l]Profile[/l]</a></b></h3>
</div>
<ul>
<li>
<h1>[l]Client Password[/l]</h1>
<p class="kb st" style="background: url(templates/{TEMPLATE}/images/public/icon_submit_ticket.jpg) no-repeat 0 8px;">[l]Please keep your profile up to date.  You can use this section to update your billing preferences, alternatate contact information and update your password.[/l]</p>
</li>
<li>

    <div id="cip">
    <script language="javascript" type="text/javascript" src="{RELATIVE_PATH}javascript/modules/clients.js?version={VERSION}" ></script>
    <script language="javascript" type="text/javascript">
    // <![CDATA[

        function UpdatePassword(){

            //calls the ajax action that returns the fields
            //then call category with edit
            setStatus(lang("Updating Password"));

            var post;
            post = "new_password="+$('newpassword').value;
            post += "&confirm_password="+$('confirm_password').value;

            new Ajax.Request(   'index.php?fuse=clients&action=UpdatePassword',
                {
                    postBody    : post,
                    onSuccess   : UpdatePasswordReturn
                }
            );

        }

        function UpdatePasswordReturn(t,json){
            unsetStatus('', 1);
            var data = t.responseText;
	    data = data.split(',')[0];
            data = data.split('"')[3];
            data = data.replace(/\\n/g, '\n')
            alert(data); 
	    if(json.alertmessage!=""){
                alert(json.alertmessage);
            }
        }

        function checkPassword(){
            if (($('confirm_password').value !="") && ($('newpassword').value !="")){
                if ($('confirm_password').value != $('newpassword').value){
                    alert(lang("Your confirmation password does not match your new password"));
                    return (false);
                }
            }else{
                if (($('confirm_password').value =="") || ($('newpassword').value =="")){
                    alert(lang("You must fill all password fields if you wish to change this password"));
                    return (false);
                }
            }
            return (true);
        }

        if (document.images) {
            pic1= new Image(167,14);
            pic1.src="{RELATIVE_PATH}images/loading.gif";
        }
    // ]]>
    </script>


    <div class="nav_1">
        <ul>
            <li>
                <a href="index.php?fuse=clients&amp;view=ShowCustomerData"><span>[l]Profile[/l]</span></a>
            </li>
            <li>
                <a href="index.php?fuse=clients&amp;view=ViewProfile_AlternateEmails"><span>[l]Alternate Emails[/l]</span></a>
            </li>
            <li>
                <a href="index.php?fuse=clients&amp;view=ViewProfile_Billing"><span>[l]Billing[/l]</span></a>
            </li>
            <li class="selected">
                <a href="#"><span>[l]Password[/l]</span></a>
            </li>
	    <li>
                <a href="index.php?fuse=clients&amp;view=ViewProfile_StaffNotes"><span>[l]Notes[/l]</span></a>
            </li>

        </ul>
    </div>

    <br /><br />

    <form method="post" action="index.php?fuse=clients&amp;action=UpdatePassword">

    <!-- BEGIN DYNAMIC BLOCK: changePassword -->
    <div style="padding-left: 15px;">
        <span class="label130">[l]New Password[/l]:</span>
        <input class="{class}" type="password" name="new_password" size="30" id="newpassword" />
        <br />
        <span class="label130">[l]Confirm Password[/l]:</span>
        <input class="{class}" type="password" name="confirm_password" id="confirm_password" size="30" />
        <br />
        <br />

        <input type="submit" value='[l]update password[/l]' onclick='if (checkPassword()){ UpdatePassword();} return false;' class="body" />
    </div>
    <!-- END DYNAMIC BLOCK: changePassword -->
    </form>
    <br />

    </div>
</li>
</ul>
</div>
