<script type="text/javascript">
 $(document).ready(function() {
	// validate the comment form when it is submitted

	// validate signup form on keyup and submit
	$("#frmUsers").validate({
		rules: {
			txtEmail: {
                          	required: true,
                                email: true
			},
			txtFname: {
				required: true

			},
			txtLname: {
				required: true

			}
		},
		messages: {
			txtEmail: {
				required: "Please enter Email",
				 email: "Please enter valid Email"
			},
			txtFname: {
				required: "Please enter First Name"

			},
			txtLname: {
                            required: "Please enter Last Name"
                        }

		}
	});
      $("#frmEditPass").validate({
        rules: {
                txtPass: {
                    required: true,
                    minlength: <?php echo PASSWORD_LENGTH?>
                },
                txtCpass: {
                    required: true,
                    minlength: <?php echo PASSWORD_LENGTH?>,
                    equalTo: "#txtPass"
                }
        },
        messages: {
                txtPass: {
				required: "Please enter Password",
				minlength: "Your password must be at least <?php echo PASSWORD_LENGTH?> characters long"
			},
                txtCpass: {
                        required: "Please reenter Password",
                        minlength: "Your password must be at least <?php echo PASSWORD_LENGTH?> characters long",
                        equalTo: "Password Mismatch"
                }

        }
    });
 });

function updateState(selObj)
{
    country = selObj.options[selObj.selectedIndex].value;

    if(country == 'US')
    {
        document.getElementById("txtState1").style.display = "none";
        document.getElementById("txtState").style.display = "block";
    }
    else
    {
        document.getElementById("txtState1").style.display = "block";
        document.getElementById("txtState").style.display = "none";
        document.getElementById("txtState1").value='';
    }
}
function changeStatus(id,status,type)
{
    var data 	= 'id='  + id+'&status='+status+'&type='+type;
    $.ajax({
            url: "<?php echo ConfigUrl::base(); ?>index/updateStatus/",
            type: "POST",
            data: data,
            cache: false,
            success: function (html) {
                    if (html==1) {
                         $('#status'+id).load('<?php echo ConfigUrl::base(); ?>index/ajaxLoadStatus?id='+id+'&type='+type, function() {
                               //alert('Load was performed.');
                            });
                         return false;
                    }
                    else alert('Sorry, unexpected error. Please try again later.');
            }
    });
}
</script>
 <?php
//$messageClass = (!empty($this->error)) ? 'red' : 'green';?>
<!--<div  style="color:red;font-size: 15px " ><?php echo  $this->message; ?></div>-->
<?php if(isset($this->message)){ ?>
    <div class="messageBox"><span  class="<?php echo $this->messageClass ?>" ><?php if(isset($this->message)){ echo  $this->message; } ?></span></div>
<?php
}?>

<div class="full_width">
<div class="row">
	<div class="col-xs-12 col-sm-12 col-md-1 col-lg-2"></div>
		<div class="col-xs-12 col-sm-12 col-md-10 col-lg-8">
			<form name="frmUsers" id="frmUsers" method="post" action="">
			<input type="hidden" value="<?php echo $this->id;?>" name="id"/>
			<input type="hidden" value="edit" name="act"/>
				<div class="form_main_outer">
						<h1>Manage Profile</h1>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>Username<span style="color: red">*</span></label>
									<b><?php echo stripslashes($this->resUsers->vLoginName);?></b>
									<input type="hidden" name="loginName" value="<?php echo stripslashes($this->resUsers->vLoginName);?>" >
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>Email<span style="color: red">*</span></label>
									<input type="text" class="form-control" id="txtEmail" name="txtEmail" value="<?php echo stripslashes($this->resUsers->vEmail);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-6 form_main_inner_L">
									<label>First Name<span style="color: red">*</span></label>
									<input type="text" class="form-control" id="txtFname" name="txtFname" value="<?php echo stripslashes($this->resUsers->vFirstName);?>"/>
								</div>
							 
								<div class="col-xs-12 col-sm-6">
									<label>Last Name<span style="color: red">*</span></label>
									<input type="text" class="form-control" id="txtLname" name="txtLname" value="<?php echo stripslashes($this->resUsers->vLastName);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>Address1</label>
									<input type="text" class="form-control" id="txtAddress1" name="txtAddress1" value="<?php echo stripslashes($this->resUsers->	vAddress1);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>Address2</label>
									<input type="text" class="form-control" id="txtAddress2" name="txtAddress2" value="<?php echo stripslashes($this->resUsers->vAddress2);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-6 form_main_inner_L">
									<label>City</label>
									<input type="text" class="form-control" id="txtCity" name="txtCity" value="<?php echo stripslashes($this->resUsers->vCity);?>"/>
								</div>
							
								<div class="col-xs-12 col-sm-6">
									<label>State</label>
									<?php
										$selDisplay ="";
										$inputDiaply ="";
                                                                                
                                                                                if(isset($selectedCountry)){
                                                                                    if(trim($selectedCountry) == "US"){
                                                                                        $inputDiaply="none";
                                                                                    }else{
                                                                                        $selDisplay ="none";
                                                                                    }
                                                                                }else{
                                                                                    $inputDiaply="none";
                                                                                }
										
									   ?>
										<select validate="required:true" name="txtState" id="txtState" class="form-control" style="display:<?php echo $selDisplay?> ">
											<option value="">select</option>
											  <?php
											  $selectedState    =  stripslashes($this->resUsers->vState);
											  global $usStates;
											  foreach($usStates  as $key => $value)
											  {
											 ?>
											  <option value="<?php echo $key?>" <?php if($key==$selectedState) echo "selected";?>><?php echo $value;?></option>
											  <?php
											  }
											 ?>
										 </select>
										<input name="txtState1"  id="txtState1" class="form-control" type="text" value="<?php echo ($this->resUsers->vState)?$this->resUsers->vState:stripslashes($this->resUsers->vState)?>" style="display:<?php echo $inputDiaply?> ">
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-6 form_main_inner_L">
									<label>Zip</label>
									<input type="text" class="form-control" id="txtZip" name="txtZip" value="<?php echo stripslashes($this->resUsers->nZip);?>"/>
								</div>
							 
								<div class="col-xs-12 col-sm-6">
									<label>Country</label>
									<select onchange="updateState(this)" name="txtCountry" id="txtCountry" class="form-control">
										<option value="">Select Country</option>
										<?php
										 $selectedCountry    = stripslashes($this->resUsers->vCountry);
										 if($selectedCountry=="") $countryKey   ="US";
										 else
										 $countryKey = $selectedCountry;
										 global $countries;
										foreach( $countries as $key => $value)
										{
						
										?>
										<option value="<?php echo $key?>" <?php if($key==$countryKey) echo "selected";?>><?php echo $value;?></option>
										<?php
										}
										 ?>
										<option value="undefined">undefined</option>
									</select>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-5 form_main_inner_L">
									<label>Phone</label>
									<input type="text" class="form-control" id="txtPhone" name="txtPhone" value="<?php echo stripslashes($this->resUsers->vPhone);?>"/>
								</div>
							 
								<div class="col-xs-12 col-sm-7">
									<label>Fax</label>
									<input type="text" class="form-control" id="txtFax" name="txtFax" value="<?php echo stripslashes($this->resUsers->vFax);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>URL</label>
									<input type="text" class="form-control" id="txtUrl" name="txtUrl" value="<?php echo stripslashes($this->resUsers->vUrl);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-5 col-md-5 col-lg-4 form_main_inner_L">
									<label>Gender</label>
									<input type="radio" name="radGender" value="M" <?php echo ($this->resUsers->vGender=="M")?"checked":"";?>/> Male &nbsp; &nbsp; &nbsp; 
									<input type="radio"  name="radGender" value="F" <?php echo ($this->resUsers->vGender=="F")?"checked":"";?>/> Female
								</div>
							 
								<div class="col-xs-12 col-sm-7 col-md-7 col-lg-8">
									<label>Education</label>
									<input type="text" class="form-control" id="txtEdu" name="txtEdu" value="<?php echo stripslashes($this->resUsers->vEducation);?>"/>
								</div>
							</div>
						</div>
						
						<div class="form_main_inner">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<label>Description</label>
									<textarea class="form-control" id="txtDesc" name="txtDesc"><?php echo stripslashes($this->resUsers->vDescription);?></textarea>
								</div>
							</div>
						</div>
						
						 
						
						<div class="form_main_btt_outer">
							<div class="row">
								<div class="col-xs-12 col-sm-12">
									<input type="submit" value="Update" name="btnProfile" class="button"/>
								</div>
							</div>
						</div>
						
				<div class="clear"></div>
			</div>
			<input type="hidden" value="hidden" name="hidInput" />
			</form>
		</div>
	<div class="col-xs-12 col-sm-12 col-md-1 col-lg-2"></div>
	
	
	<div class="clear"></div>
	
	
	<div class="col-xs-12 col-sm-12 col-md-1 col-lg-2"></div>
	<div class="col-xs-12 col-sm-12 col-md-10 col-lg-8">
		<form name="frmEditPass" id="frmEditPass" method="post" action="">
		<input type="hidden" value="<?php echo $id;?>" name="id"/>
		<input type="hidden" value="edit" name="act"/>
		
		<div class="form_main_outer">
			
			<h1>Change Password</h1>
			<div class="form_main_inner">
				<div class="row">
					<div class="col-xs-12 col-sm-12">
						<label>Password<span style="color: red">*</span></label>
						<input type="password" class="form-control" id="txtPass" name="txtPass" value=""/>
                        <div>
                            <label style="background:none;" for="txtPass" class="error" generated="true"></label>
                        </div>
					</div>
				</div>
			</div>
			
			<div class="form_main_inner">
				<div class="row">
					<div class="col-xs-12 col-sm-12">
						<label>Confirm Password<span style="color: red">*</span></label>
						<input type="password" class="form-control" id="txtCpass" name="txtCpass" value=""/>
						<div>
							<label style="background:none;" for="txtCpass" class="error" generated="true"></label>
						</div>
					</div>
				</div>
			</div>
			
			<div class="form_main_inner">
				<div class="row">
					<div class="col-xs-12 col-sm-12">
						<input type="submit"  value="Submit" name="btnPassword" class="button"/>
						<input type="button"  value="Back" name="Cancel" class="button_secondery" onclick="window.location ='<?php echo ConfigUrl::base()?>index/dashboard'"/>
					</div>
				</div>
			</div>
						
		</div>
		</form>
	</div>
	<div class="col-xs-12 col-sm-12 col-md-1 col-lg-2"></div>
	
	
</div>
	<div class="clear"></div>
</div>




