<!DOCTYPE HTML>
<html lang="en-US">
	<head>
		<title><?php echo $titulo." - ".$descripcion_titulo; ?></title>
		
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="<?php echo site_url("estilos/css/bootstrap.min.css"); ?>"/>
		<link rel="stylesheet" href="<?php echo site_url("fonts/font.min.css"); ?>"/>
		<!-- text fonts -->
		<link rel="stylesheet" href="<?php echo site_url("fonts/font.css"); ?>" />
		<!-- ace styles -->
		<link rel="stylesheet" href="<?php echo site_url("estilos/css/ace.min.css"); ?>" id="main-ace-style" />
		<link rel="stylesheet" href="<?php echo site_url("estilos/css/jquery-ui.min.css"); ?>"/>
		<!-- ace settings handler -->
		<script src="<?php echo site_url("js/jquery-2.0.3.js"); ?>"></script>
		<script src="<?php echo site_url("estilos/js/ace.min.js"); ?>"></script>
		<script src="<?php echo site_url("estilos/js/jquery-ui.min.js"); ?>"></script>
		<script src="<?php echo site_url("estilos/js/jquery.ui.touch-punch.min.js"); ?>"></script>

		<!-- inline styles related to this page -->
		<script src="<?php echo site_url("js/bootstrap.min.js");?>"></script>

		<script type="text/javascript">
			$(document).ready(function(){
				i="<?php echo $this->input->get('i'); ?>";
				j="<?php echo $this->input->get('j'); ?>";
				nombre="<?php echo $this->input->get('nombre'); ?>";
				$("li .hover").removeClass("active");
				$("#li"+i+""+j).addClass("active");
				$("li.li-menu").removeClass("active");
				$("#li"+i).addClass("active");
				$("#titulo_principal").html(nombre);
			});
			function cargar_funcion(funcion,i,j,nombre){
				open_cargar("Espere un momento...");
				location.href="<?php echo base_url(); ?>"+funcion+"?i="+i+"&j="+j+"&nombre="+nombre;
				/*$("#body-main").load("<?php echo base_url(); ?>"+funcion,function(){
					$("li .hover").removeClass("active");
					$("#li"+i+""+j).addClass("active");
					$("li.li-menu").removeClass("active");
					$("#li"+i).addClass("active");
					$("#titulo_principal").html(nombre);
					close_cargar();
				});*/
			}
			function alertar(msg){
				$("#123abcdefhijklmnopqrstuvwxyz").html(msg);
				$("#dialog_mensaje").dialog("open");
			}
			function open_cargar(msg){
				$("#1234567890abcdefhijklmnopqrstuvwxyz").html(msg);
				$("#dialog_loading").dialog("open");
			}
			function close_cargar(){
				$("#dialog_loading").dialog("close");
			}
			$(document).ready(function(){
				$("#dialog_loading").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:90,
					resizable:false
				});
				$("#dialog_mensaje").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:150,
					resizable:false,
					buttons: [ 
						{
							text: "Cerrar",
							"class" : "btn btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						},
					]
				});
				$("#dialog_change_pass").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:270,
					resizable:false,
					buttons: [ 
						{
							text: "Cambiar Clave",
							"class" : "btn btn-primary btn-xs",
							click: function() {
								ant=$("#ant").val();
								new1=$("#new1").val();
								new2=$("#new2").val();
								if(ant=="" && new1=="" && new2==""){
									$("#ant, #new1, #new2").css("background-color","#f09784");
									alert("Ingrese estos campos");
									return;
								}
								else{
									$("#ant, #new1, #new2").css("background-color","#fff");
								}
								if(new1!=new2){
									$("#new1").css("background-color","#f09784");
									$("#new2").css("background-color","#f09784");
									alert("Las claves ingresadas no coinciden");
									return;
								}
								else{
									$("#new1").css("background-color","#fff");
									$("#new2").css("background-color","#fff");
								}
								var where={
									usua_pass:ant,
								};
								var data={
									usua_pass:new1,
								};
								var param={
									where:where,
									data:data
								};
								$.post("<?php echo site_url("sistema/update_clave"); ?>",param,function(data){
									if(data==0){
										alert("Ocurrio Un Error Al Intentar Actualizar La Clave, Intentelo Nuevamente");
									}
									else if(data==1){
										alert("La Clave Fue Cambiada Satisfactoriamente");
									}
									$("#form_change_pass")[0].reset();
									$("#dialog_change_pass").dialog( "close" ); 
								});
							} 
						},
					]
				});
				$("#dialog_pos_menu").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:270,
					resizable:false,
					buttons: [ 
						{
							text: "Cerrar",
							"class" : "btn btn-default btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						},
					]
				});
				$("#dialog_datos_user").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:350,
					resizable:false,
					buttons: [ 
						{
							text: "Cerrar",
							"class" : "btn btn-primary btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						},
					]
				});
				$("#dialog_datos_contacto").dialog({
					autoOpen:false,
					modal: true,
					title_html:true,
					title: "<?php echo $titulo; ?>",
					width:500,
					height:350,
					resizable:false,
					buttons: [ 
						{
							text: "Cerrar",
							"class" : "btn btn-primary btn-xs",
							click: function() {
								$( this ).dialog( "close" ); 
							} 
						},
					]
				});
			});
		</script>
	</head>

	<body class="no-skin">
	
	<div id="dialog_mensaje" style="display:none;">
		<div id="123abcdefhijklmnopqrstuvwxyz"></div>
	</div>

	<div id="dialog_loading" style="display:none;">
		<img src="<?php echo site_url("estilos/css/images/loading.gif"); ?>" height="32">
		<xxx id="1234567890abcdefhijklmnopqrstuvwxyz"></xxx>
	</div>	
	
	<div id="dialog_change_pass" style="display:none;">
		<form id="form_change_pass" class="col-sm-12 form-horizontal">
			<table class="col-sm-12">
				<tr>
					<td class="right">Clave Anterior:</td>
					<td><input type="password" id="ant" class="col-xs-12"/></td>
				</tr>
				<tr><td>&nbsp</td></tr>
				<tr>
					<td>Nueva Clave:</td>
					<td><input type="password" id="new1" class="col-xs-12"/></td>
				</tr>
				<tr><td>&nbsp</td></tr>
				<tr>
					<td>Repita La Nueva Clave:</td>
					<td><input type="password" id="new2" class="col-xs-12"/></td>
				</tr>
			</table>
		</form>
	</div>
	
	<div id="dialog_pos_menu" style="display:none;">
		<table class="col-sm-12">
			<tr align="center">
				<td>
					<a href="#" class="btn btn-app btn-primary no-radius" onclick="posmenu('left')">
						<i class="ace-icon glyphicon glyphicon-step-backward bigger-230"></i>
						Menu<br>Izquierda
					</a>
					
					<a href="#" class="btn btn-app btn-success no-radius" onclick="posmenu('top')">
						<i class="ace-icon glyphicon glyphicon-upload bigger-230"></i>
						Menu<br>Arriba
					</a>
					
					<a href="#" class="btn btn-app btn-yellow no-radius" onclick="posmenu('min')">
						<i class="ace-icon glyphicon glyphicon-minus bigger-230"></i>
						Menu<br>Min
					</a>
				</td>
			</tr>
		</table>
	</div>
	
	<div id="dialog_datos_user" style="display:none;">
		<div class="widget-box widget-color-blue3">
			<div class="widget-header">
				<h5 class="widget-title bigger lighter">
					<i class="ace-icon fa fa-table"></i>
					Datos del Administrador
				</h5>
			</div>
			<div class="widget-body">
				<div class="widget-main no-padding">
					<table class="table table-bordered table-hover table-striped">
						<tbody>
							<tr>
								<td>USUARIO:</td>
								<td><?php echo $this->session->userdata("usua_user") ?></td>
							</tr>
							<tr>
								<td>DATOS:</td>
								<td>
									<?php echo $this->session->userdata("usua_nombres") ?>
									<?php echo $this->session->userdata("usua_apellidos") ?>
								</td>
							</tr>
							<tr>
								<td>ESTADO:</td>
								<td>ACTIVO</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	
	<div id="dialog_datos_contacto" style="display:none;">
		<div class="widget-box widget-color-blue3">
			<div class="widget-header">
				<h5 class="widget-title bigger lighter">
					<i class="ace-icon fa fa-table"></i>
					Datos del Contacto
				</h5>
			</div>
			<div class="widget-body">
				<div class="widget-main no-padding">
					<table class="table table-bordered table-hover table-striped">
						<tbody>
							<tr>
								<td>Desarrollado por:</td>
								<td>Ing. Victor Hugo Bejar Gonzales</td>
							</tr>
							<tr>
								<td>Celular:</td>
								<td>958273933</td>
							</tr>
							<tr>
								<td>Email:</td>
								<td>victor.bejar.g@gmail.com</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>
		</div>

	</div>
		<div id="navbar" class="navbar navbar-default">
			<div class="navbar-container" id="navbar-container">
				<button type="button" class="navbar-toggle menu-toggler pull-left" id="menu-toggler">
					<span class="sr-only">Toggle sidebar</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>

				<div class="navbar-header pull-left">
					<a href="#" class="navbar-brand">
						<small>
							<i class="fa fa-leaf"></i>
							Bienvenido(a): 
							<?php echo $this->session->userdata("usua_nombres"); ?>
							<?php echo $this->session->userdata("usua_apellidos"); ?>
						</small>
					</a>
				</div>

				<div class="navbar-buttons navbar-header pull-right" role="navigation">
					<ul class="nav ace-nav">
						<li class="light-blue">
							<a data-toggle="dropdown" href="#" class="dropdown-toggle">
								<img class="nav-user-photo" src="<?php echo site_url("estilos/avatars/user.jpg"); ?>" alt="Jason's Photo" />
								<span class="user-info">
									<small>Bienvenido,</small>
									<?php echo $this->session->userdata("usua_nombres"); ?>
									<?php echo $this->session->userdata("usua_apellidos"); ?>
								</span>

								<i class="ace-icon fa fa-caret-down"></i>
							</a>

							<ul class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
								<li>
									<a href="#" onclick="$('#dialog_change_pass').dialog('open')">
										<i class="ace-icon fa fa-key fa-icon"></i>
										Cambiar Clave
									</a>
								</li>

								<li>
									<a href="#" onclick="$('#dialog_datos_user').dialog('open')">
										<i class="ace-icon fa fa-user"></i>
										Mis Datos
									</a>
								</li>								

								<li>
									<a href="#" onclick="$('#dialog_datos_contacto').dialog('open')">
										<i class="ace-icon fa fa-globe"></i>
										Contactos
									</a>
								</li>
								
								<li class="divider"></li>

								<li>
									<a href="<?php echo site_url("sistema/cerrar_session"); ?>">
										<i class="ace-icon fa fa-power-off"></i>
										Salir
									</a>
								</li>
							</ul>
						</li>
					</ul>
				</div>
			</div><!-- /.navbar-container -->
		</div>

		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
				/*$(document).ready(function(){
					$("#li0").addClass("active open");
					$("#li00").addClass("active");
				});*/
			</script>

