<!DOCTYPE html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />	
	<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
	<meta name="apple-mobile-web-app-capable" content="yes" />
	<!--[if gt IE 8]>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />        
    <![endif]--> 
    <title><?php echo $layout_title; ?></title>	
	<link rel="shortcut icon" href="<?php echo base_url() ?>img/salihin_logo.png">	 
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic,400,300,600,700' rel='stylesheet' type='text/css'>
	
	<!--<link href="css/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>-->
	<link href="<?php echo base_url() ?>css/plugins/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>
	<link href="<?php echo base_url() ?>css/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
	
    <link href="<?php echo base_url() ?>css/style.css" rel="stylesheet" type="text/css" />
	<link href="<?php echo base_url() ?>css/mystyles.css" rel="stylesheet" type="text/css" />
	<link href="<?php echo base_url() ?>css/stylesheet.css" rel="stylesheet" type="text/css" />
	<!--<link href="<?php echo base_url() ?>css/stylesheets.css" rel="stylesheet" type="text/css" />-->
	
    <script type="text/javascript" src="<?php echo base_url(); ?>js/modernizr.custom.63321.js"></script>
	<script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-1.10.1.min.js"></script>
        
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-2.0.0.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-ui-1.10.3.custom.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-migrate-1.1.1.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/globalize.js"></script>
    
    <script type="text/javascript" src="<?php echo base_url(); ?>js/bootstrap/bootstrap.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>js/cookies/jquery.cookies.2.2.0.min.js"></script>
    
    <script type="text/javascript" src="<?php echo base_url(); ?>js/scrollup/jquery.scrollUp.min.js"></script>
    
    <script type="text/javascript" src="<?php echo base_url(); ?>js/plugins.js"></script>    
    <script type="text/javascript" src="<?php echo base_url(); ?>js/actions.js"></script>
  
	
	<script type="application/x-javascript"> 
		addEventListener("load", function() 
		{ setTimeout(hideURLbar, 0); }, false); 
		function hideURLbar()
		{ window.scrollTo(0,1); } 
	</script>  
	
    <script type="text/javascript">
        $(document).ready(function() {
            // Create two variable with the names of the months and days in an array
            var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
            var dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

            // Create a newDate() object
            var newDate = new Date();
            // Extract the current date from Date object
            newDate.setDate(newDate.getDate());
            // Output the day, date, month and year   
            $('#Date').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear());

            setInterval(function() {
                // Create a newDate() object and extract the seconds of the current time on the visitor's
                var seconds = new Date().getSeconds();
                // Add a leading zero to seconds value
                $("#sec").html((seconds < 10 ? "0" : "") + seconds);
            }, 1000);

            setInterval(function() {
                // Create a newDate() object and extract the minutes of the current time on the visitor's
                var minutes = new Date().getMinutes();
                // Add a leading zero to the minutes value
                $("#min").html((minutes < 10 ? "0" : "") + minutes);
            }, 1000);

            setInterval(function() {
                // Create a newDate() object and extract the hours of the current time on the visitor's
                var hours = new Date().getHours();
                // Add a leading zero to the hours value
                $("#hours").html((hours < 10 ? "0" : "") + hours);
            }, 1000);
            //Checking userid is loged in from different IP address
            $("#userID").blur(function() {
                jQuery.ajax({
                    url: "<?php echo base_url() ?>login/check_userIP",
                    async: false,
                    type: "POST",
                    data: 'userID=' + $(this).val(),
                    dataType: "html",
                    success: function(data) {
                        if (data == 'error') {
                            var r = confirm("This User logged in from another computer. Do you want to continue?");
                            if(r){
                                console.log('um here');
                                resetUserSession();
                            }
                        }
                    }
                });
            });

        });

        function resetUserSession(){
            jQuery.ajax({
                url: "<?php echo base_url() ?>login/reset_ip",
                type: "POST",
                data: 'userID=' + $("#userID").val(),
                dataType: "html",
                success: function(data) {
                    console.log(data);
                }
            });
        }

        function  fgtpwdSubmit() {
            jQuery.ajax({
                url: "<?php echo base_url() ?>login/fgtpwdSubmit",
                type: "POST",
                data: 'userName=' + $("#fgtUserName").val(),
                success: function(data) {
                  switch (data){
                     case "0" :
                         alert("User not found");   
                         break;
                     case "1" :
                        alert("The administrator have noted your request !..."); 
                        break;
                    default:
                        alert("Service unavalable");
                        break;
                    }
                }
            });
        }

    </script>
<!--	
<style>
	.btn-form{padding: 7px 3px 7px 3px; margin:0 3px 0 -6px};
</style>
-->

</head>
<body>
    <!-- Modal -->
    <!--div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3 id="myModalLabel">Forget Password</h3>
        </div>
        <div class="modal-body">
            <form class="navbar-form pull-left">
               
                <input placeholder="User Name" id="fgtUserName" type="text" class="span2">
                <button class="btn" onclick="fgtpwdSubmit()">Submit</button>
            </form>
        </div>
    </div-->

	<div id="wrapper" class="screen_wide sidebar_off">       
        <div id="layout">
            <div id="content">                        
                <div class="wrap nm"> 
					<head>
						<div class="clearfix"></div>
					</head>				 
					<div class="content">
					
						<div class="clearfix">
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
						
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 	
							<div class="row-fluid">					
								<div class="span12">	
									<div class="widget">							
										<div class="clearfix"></div>							
									</div> 
								</div>
							</div> 
						<div class="row-fluid">					
							<div class="span6">	
								<div class="block">							
									<div class="logo_block_login">
										<img src="<?php echo base_url() ?>images/logo-sps.png" alt="SPS Logo"/>	
									</div>
									
								</div> 
							</div> <!--span6-->
							
							<div class="span6">	
								<div class="block signin_block_login">								
									<div class="">
									
										<h1>Welcome</h1>
										<?php
											$hidden = array('order_time' => date('Y-m-d H-i-s'),
												'prevurls' => $prevurls,
											);
											echo form_open('login/verifylogin', '', $hidden);
										?>
										<?php echo validation_errors(); ?>
										<li class="span12" style="overflow:hidden;margin-left:0;">
											<span class="icon user" style="float:left;"></span>
											<input id="userID" style="float:left;" type="text" class="text" name="userid" value="User Name" onfocus="if (this.value == 'User Name') {this.value = '';}" onblur="if (this.value == '') {this.value = 'User Name';}" >												
										</li>
										<li class="span12" style="overflow:hidden;margin-left:0;">
											<span class="icon lock" style="float:left;"></span>
											<input id="password" style="float:left;" type="password" class="text" name="password" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">												
										</li>
										
										<?php
											$preselcomp = NULL;
											$optioncomp[NULL] = 'Please Select Company';
												foreach ($companyList as $row) {
													$optioncomp[$row->ID] = $row->companyName . " [ " . $row->companyNo . " ]";
											}
											$js = 'class="validate[required]"';
												echo form_dropdown('compID', $optioncomp, $preselcomp, $js);
										?>   
										<div class="btn_login">
											<!--h3> <a href="#myModal" href="javascript:" data-toggle="modal">Forgot Password?</a></h3-->
											<input class="btn-form btn-warning-form btn-default" type="submit" onclick="myFunction()" value="Sign In" >
										</div>
										</form>																
									</div>
								</div>
							</div>	<!--span6-->							
						</div>  <!--row fluid-->
						
						<div class="row-fluid">
							<div class="span12">
								<div class="block">
									<div class="copyright_block">© Salihin Premier Solutions. All rights reserved <br/> www.salihinpremier.com</div>
								</div>
							</div>
						</div><!--row fluid-->
						<!--//End-login-form--> </loginform>
						
						</div> <!--clearfix-->				
						
					</div> <!--content-->					
				</div> <!--wrap-->
			</div> <!--content-->
		</div> <!--layout-->
	</div> <!--wrapper-->
	
</body>
</html>
