<link rel="stylesheet" type="text/css" href="<?= GLOBAL_ADMIN_CSS_PATH ?>style.css" />
<!--<link rel="stylesheet" type="text/css" href="<?= GLOBAL_ADMIN_CSS_PATH ?>style1.css" />
<script src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery.min.js"></script>
<script type="text/javascript"  src="<?php echo GLOBAL_ADMIN_JS_PATH; ?>jquery.passstrength.js"></script> -->

<style>
    /*        body
            {
                ie needs this
                margin:0px;
                padding:0px;
                set global font settings
                font-size:10px;
                font-family:Tahoma,Verdana,Arial;
            }*/
    a:hover
    {
        color:#fff;
    }

    #user_registration
    {
        border:1px solid #cccccc;
        margin:auto auto;
        /*margin-top:100px;*/
        /*width:400px;*/
    }


    #user_registration label
    {
        display: block;   block float the labels to left column, set a width 
        /*float: left;*/ 
        /*width: 70px;*/
        /*margin: 0px 10px 0px 5px;*/ 
        text-align: right; 
        line-height:1em;
        font-weight:bold;
    }

    #user_registration input
    {
        /*width:250px;*/
    }

    #user_registration p
    {
        clear:both;
    }

    #submit
    {
        border:1px solid #cccccc;
        width:100px !important;
        margin:10px;
    }

    h1
    {
        text-align:center;
    }

    #passwordStrength
    {
        height:10px;
        display:block;
        float:left;
    }

    .strength0
    {
        width:250px;
        background:#cccccc;
    }

    .strength1
    {
        width:50px;
        background:#ff0000;
    }

    .strength2
    {
        width:100px;	
        background:#ff5f5f;
    }

    .strength3
    {
        width:150px;
        background:#FF4500;
    }

    .strength4
    {
        background:#4dcd00;
        width:200px;
    }

    .strength5
    {
        background:#399800;
        width:250px;
    }


</style>
<script>
    function passwordStrength(password)
    {
    
       if(password=='')
           {
              
               document.getElementById("passworddisplay").style.display='none';
           }
           else{
                document.getElementById("passworddisplay").style.display='';
           }
        var desc = new Array();
        desc[0] = "Very Weak";
        desc[1] = "Weak";
        desc[2] = "Better";
        desc[3] = "Medium";
        desc[4] = "Strong";
        desc[5] = "Strongest";

        
            var score   = 0;

        //if password bigger than 6 give 1 point
        if (password.length > 6) score++;

        //if password has both lower and uppercase characters give 1 point	
        if ( ( password.match(/[a-z]/) ) && ( password.match(/[A-Z]/) ) ) score++;

        //if password has at least one number give 1 point
        if (password.match(/\d+/)) score++;

        //if password has at least one special caracther give 1 point
        if ( password.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/) )	score++;

        //if password bigger than 12 give another 1 point
        if (password.length > 12) score++;

        document.getElementById("passwordDescription").innerHTML = desc[score];
        document.getElementById("passwordStrength").className = "strength" + score;
    }
</script>
<script type="text/javascript">
    function validate()
    { 
    
        var myString=trim(document.getElementById('pwdpassword').value);
        var digitString = myString.replace(/[^0-9]/g , "");
        var specialString = myString.replace(/[a-zA-Z0-9]/g, "");
        var charString = myString.replace(/[^A-Z]/g, "");
        
        var passlen=trim(document.getElementById('pwdpassword').value);
        var Passlen=passlen.length;
                
        if(document.getElementById('txtfname').value == "")
        {
            alert("Please enter first name.");
            document.getElementById('txtfname').focus();
            return false;
        }
        else if(document.getElementById('txtemail').value == "")
        {
            alert("Please enter Email ID.");
            document.getElementById('txtemail').focus();
            return false;
        }
        else if(!checkemail(document.getElementById('txtemail').value))
        {
            alert("Please enter valid Email ID.");
            document.getElementById('txtemail').focus();
            return false;
        }
        else if(document.getElementById('txtemail1').value == "")
        {
            alert("Please enter Email ID.");
            document.getElementById('txtemail1').focus();
            return false;
        }
        else if(!checkemail(document.getElementById('txtemail1').value))
        {
            alert("Please enter valid Email ID.");
            document.getElementById('txtemail1').focus();
            return false;
        }

        if(trim(document.getElementById('pwdpassword').value)!='')
        {  
            if(Passlen < 8)
            {
                alert("Password should be Minimum 8 characters or  Long");
                document.getElementById('pwdpassword').focus();
                return false;
            }
            if(digitString < 1)
            {
                alert("Passwords must include at least 1 Numeric Characters.");
                document.getElementById('pwdpassword').focus();
                return false; 
            }
            if(charString < 1)
            {
                alert("Passwords must include at least 1 Capital Alphabate.");
                document.getElementById('pwdpassword').focus();
                return false; 
            }
            
            if(Passlen > 20)
            {
                alert("Password should be Maximum 20 characters");
                document.getElementById('pwdpassword').focus();
                return false;
            }
        }
        if(document.getElementById('pwdpassword').value != document.getElementById('pwdconfirmpassword').value)
        {
            alert("Password mismatch!");
            document.getElementById('pwdpassword').focus();
            return false;
        }
//        else if(document.getElementById('var_contactusmail').value == "")
//        {
//            alert("Please enter contactus Email ID.");
//            document.getElementById('var_contactusmail').focus();
//            return false;
//        }
//        else if(!checkemail(document.getElementById('var_contactusmail').value))
//        {
//            alert("Please enter valid Email ID.");
//            document.getElementById('var_contactusmail').focus();
//            return false;
//        }
        else if(document.getElementById('var_newslattermail').value == "")
        {
            alert("Please enter newsletter email id.");
            document.getElementById('var_newslattermail').focus();
            return false;
        }
        else if(!checkemail(document.getElementById('var_newslattermail').value))
        {
            alert("Please enter valid newsletter email id.");
            document.getElementById('var_newslattermail').focus();
            return false;
        }
        else if(document.getElementById('var_bookanappointmentmail').value == "")
        {
            alert("Please enter book an appointment email id.");
            document.getElementById('var_bookanappointmentmail').focus();
            return false;
        }
        else if(!checkemail(document.getElementById('var_bookanappointmentmail').value))
        {
            alert("Please enter valid book an appointment email id.");
            document.getElementById('var_bookanappointmentmail').focus();
            return false;
        }
        document.getElementById('h_save_profile').value='T';
        SetBackground();
        return true;
    }
    
    function checkemail(str)
    {
        var testresults;
        
        var filter=/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i;

        if (filter.test(str))
            testresults=true
        else
            testresults=false

        return (testresults)
    }
    function checkuser(userid,eid)
    {
        xmlHttp=GetXmlHttpObject();
        if(xmlHttp==null)
        {
            alert("Browser does not support HTTP request.");
            return;
        }
        var url="index.php?module=settings&view=system&action=checksame&userid="+userid+"&eid="+eid;
        xmlHttp.open("GET",url,false);
        xmlHttp.send(null);
        return trim(xmlHttp.responseText);
    }

</script>
<div class="web-booking-main">
    <div class="clear"></div>
    <div class="booking-title-bg">
    </div>
    <div class="add-new-user-title">
        <h2><img alt="add-new-listing" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>/content-icon.png">Change Profile</h2>
    </div>
    <br class="clear"/>
    <?php if ($messagebox != "") { ?>
        <div class="booking-blue-bg">
            <strong> <?= $messagebox ?></strong>
        </div>
        <?
    }
    $password = $configObj->glLibraryObj->decryptPass($rows['var_password']);
    ?>
    <div class="clear"></div>
    <form method="post" action="index.php?module=settings&view=profile&action=edit" onsubmit="return validate();"  id="user_registration" name="user_registration">
        <input type="hidden" name="int_glcode" id="int_glcode" value="<?= $users->int_glcode ?>" />
        <input type="hidden" name="eid" id="eid" value="<?= $_SESSION['cl_admin_id'] ?>" />
        <div class="grid-list-subtitle-bg" onclick="javascript:expandcollapsepanel('dvpersonalinformation');" style="cursor:pointer;" >
            <table cellspacing="0" cellpadding="0" border="0" width="70%">
                <tr>
                    <td align="left" valign="top" class="grid-td-left">
                        Personal Information         </td>
                </tr>
            </table>
        </div>
        <div class="clear"></div>
        <div class="information-white-bg" id="dvpersonalinformation" >
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td  height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">First Name: </td>
                    <td  align="left" valign="middle"><input name="txtfname" id="txtfname" type="text" class="textarea1" value="<?php echo htmlspecialchars($rows['var_fname']) ?>" />
                        <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
                    </td>
                    <td  height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">Last Name:</td>
                    <td  align="left" valign="middle"><input name="txtlname" id="txtlname" type="text" class="textarea1" value="<?php echo htmlspecialchars($rows['var_lname']) ?>" /></td>
                </tr>                         
                <tr>
                    <td width="" height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">Email ID: </td>
                    <td width="" align="left" valign="middle"><input name="txtemail" id="txtemail" type="text" class="textarea1" value="<?php echo $rows['var_emailid'] ?>" />
                        <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
                    </td>
<!--                    <td>&nbsp;</td>
                    <td>&nbsp;</td>-->
                    <td  height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">Personal Email ID: </td>
                    <td  align="left" valign="middle"><div><input name="txtemail1" id="txtemail1" type="text" class="textarea1" value="<?php echo $rows['var_emailid1']; ?>" />
                            <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
                            <img width="16" height="16" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>help.png" onmouseover="showDiv(event,'dvhlpemail')" onmouseout="hidediv('dvhlpemail');" alt="">
                            <div id="dvhlpemail" onmouseover="showDiv(event,'dvhlpemail')" onmouseout="hidediv('dvhlpemail');" 
                                 style=" z-index:99999; position: absolute; right:50px; top:330px; background-color: #d5ecfa; 
                                 width: 400px; height:35px; padding: 10px; color:#0b336a;border: #95d0f2 2px solid;display: 
                                 none;font-family:Tahoma, Arial, Verdana;font-size:13px;font-weight:bold;">
                                Note : You need to enter email id to get forgot password email.
                            </div>
                        </div>
                    </td>
                </tr>

                <tr>
                    <td width="" height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">New Password : </td>
                    <td width="425" align="left" valign="middle">
                        <div>
                            <input name="pwdpassword" id="pwdpassword" type="password" class="textarea1" onkeyup="passwordStrength(this.value)"  autocomplete="off" value=""/>
                        </div>

                    </td>
                    <td width="" height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px;">Confirm Password : </td>
                    <td width="" align="left" valign="middle">
                        <input name="pwdconfirmpassword" id="pwdconfirmpassword" type="password" class="textarea1"  />
                        <input name="h_save_profile" id="h_save_profile" type="hidden"  value="T" />
                    </td>
                </tr>
                <tr id="passworddisplay" style="display:none;">
                    <td>&nbsp;</td>
                    <td>
                          <label for="passwordStrength">Password strength - </label> 
                          <div id="passwordDescription" style="float: right;width: 304px;margin-top: -14px;">  Password not entered</div>
                        <div class="spacer3"></div>
                        <div id="passwordStrength" class="strength0"></div>
                        <br/>
                    </td>
                </tr>

                <tr>

                    <td>&nbsp;</td>
                    <td>
                        <span style="color: #0B336A;font-family: Tahoma,Arial,Verdana;font-size: 13px;font-weight: bold;">Password should be in between 8 to 20 characters long  and  <br/> must   contain at least one capital alphabet and numeric.</span>
                    </td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                </tr>

                <div style="height:15px; width:100%;"></div>
            </table>
        </div>
        <?php if ($configObj->glSessionObj->value('admin_id') == '1' || $configObj->glSessionObj->value('chr_user') == 'A') { ?>
                    <div class="clear"></div>
                    <div class="grid-list-subtitle-bg" style="margin-top:10px; cursor:pointer" onclick="javascript:expandcollapsepanel('dvemailinformation');" >
                    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="FCKeditor">
                      <tr>
                     <td align="left" valign="top" class="grid-td-left">E-mail Detail
                         <span><img width="16" height="16" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>help.png" onmouseover="showDiv(event,'dvhlpvaremail')" onmouseout="hidediv('dvhlpvaremail');" alt="">
                         <div id="dvhlpvaremail" onmouseover="showDiv(event,'dvhlpvaremail')" onmouseout="hidediv('dvhlpvaremail');" 
                              style=" z-index:99999; position: absolute; background-color: #d5ecfa; width: 400px; height:35px; padding: 10px; color:#0b336a;border: #95d0f2 2px solid;display: none;font-family:Tahoma, Arial, Verdana;font-size:13px;font-weight:bold;">
                         You need to enter email id to get all the system emails & notifications.
                         </div></span>
                     </td>
                     </tr>
                    </table>
                    </div>
            <div class="clear"></div>
                       <div class="information-white-bg" id="dvemailinformation" >
                        <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        
                        <tr>
                           <tr>
<!--                        <td  width="16%" height="35" align="right" valign="middle" class="form_titles" style="padding-right:10px; padding-bottom:10px;">Contact Us Email ID: </td>
                        <td  width="25%" align="left" valign="middle" style="padding-bottom:10px;">
                            <input name="var_contactusmail" id="var_contactusmail" style="width:92%;" type="text" class="textarea1" value="<?= $rows1['var_contactusmail'] ?>" />
                            <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
                            <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
                        </td>-->
                        <td  width="" height="35" align="right" valign="middle" class="form_titles"  style=padding-bottom:10px;">Newsletter Email ID: </td>
                        <td  width="30%" align="left" valign="middle" style="padding-bottom:10px;">
                            <input name="var_newslattermail" id="var_newslattermail" style="width:40%;" type="text" class="textarea1" value="<?= $rows1['var_newslattermail'] ?>" />
                             <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
<!--<span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>-->
                        </td>
                        <td  width="" height="35" align="right" valign="middle" class="form_titles"  style=padding-bottom:10px;">Book An Appointment Email ID: </td>
                        <td  width="32%" align="left" valign="middle" style="padding-bottom:10px;">
                            <input name="var_bookanappointmentmail" id="var_bookanappointmentmail" style="width:40%;" type="text" class="textarea1" value="<?= $rows1['var_bookanappointmentmail'] ?>" />
                             <span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>
<!--<span style="font-family:Verdana, Geneva, sans-serif; font-size:11px; color:#F00; padding-left:3px;" >*</span>-->
                        </td>
                    </tr>
                    
                        </tr>
                        </table>
                        </div>
        <?php } ?>
        <div class="clear"></div>   
        <div style="height:15px; width:100%;"></div>
        <div class="form_titles" align="center" style="padding-bottom:20px;">Fields marked with (<span class="star">*</span>) are required.</div>                    
        <table width="160" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td height="30" align="center" valign="middle">
                    <input type="image"  onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image34','','<?= GLOBAL_ADMIN_IMAGES_PATH ?>/submit-button-blue-hover.gif',1)" src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>/submit-button-blue.gif" alt="Submit" name="Image34" width="81" height="25" border="0" id="Image34" >       
                    <div class="clear"></div>
                </td>
                <td width="30" align="center" valign="middle">&nbsp;</td>
                <td align="center" valign="middle"><a href="index.php" onClick="SetBackground()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image35','','<?= GLOBAL_ADMIN_IMAGES_PATH ?>/cancel-button.jpg',1)"><img src="<?= GLOBAL_ADMIN_IMAGES_PATH ?>/cancel-button.jpg" alt="Submit" name="Image35" border="0" id="Image35" /></a></td>
            </tr>
        </table>
    </form>
</div>
