<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo $title_for_layout?></title>
<link rel="stylesheet" type="text/css" href="<?php echo $cnfg["sitebasefolder"];?>/css_responsive/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $cnfg["sitebasefolder"];?>/css_responsive/animate.css">
<link rel="stylesheet" type="text/css" href="<?php echo $cnfg["sitebasefolder"];?>/css_responsive/responsive.css">
<link rel="stylesheet" type="text/css" href="<?php echo $cnfg["sitebasefolder"];?>/css_responsive/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="<?php echo $cnfg["sitebasefolder"];?>/css_responsive/price-range.css">
<?php
if(isset($style)){ 
	echo $html->css($style); 
}else{
	echo $html->css("flowers"); 
}
?> 
<?php
if(isset($menu_array)) {
   if(count($menu_array) > 1) {
	echo $javascript->link('multilevelmenu.js'); } }
?>
<link rel="icon" href="<?php echo $this->webroot . 'favicon.ico'; ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->webroot . 'favicon.ico'; ?>" type="image/x-icon" />
<?php echo $scripts_for_layout ?> 
<?php if (isset($meta_description) && !empty($meta_description)) { ?>
    <meta name="description" content="<?php echo $meta_description; ?>" />
<?php } ?>
<?php if (isset($meta_keywords) && !empty($meta_keywords)) { ?>
    <meta name="keywords" content="<?php echo $meta_keywords; ?>" />
<?php } ?>
    
    
    <?php
if(isset($style)){
	echo $html->css($style); 
}else{
	echo $html->css("style"); 
}
echo $html->css("login_home");
echo $javascript->link('jquery.js');
?> 


        <script>

    // placeholder polyfill
    $(document).ready(function(){
        var flash_sess = '<?php echo $session->read('NewsLetter'); ?>';
        if(flash_sess == 'yes'){
            $('#txtEmail').focus();
        }
        function add() {
            if($(this).val() == ''){
                $(this).val($(this).attr('placeholder')).addClass('placeholder');
            }
        }

        function remove() {
            if($(this).val() == $(this).attr('placeholder')){
                $(this).val('').removeClass('placeholder');
            }
        }

        // Create a dummy element for feature detection
        if (!('placeholder' in $('<input>')[0])) {

            // Select the elements that have a placeholder attribute
            $('input[placeholder], textarea[placeholder]').blur(add).focus(remove).each(add);

            // Remove the placeholder text before the form is submitted
            $('form').submit(function(){
                $(this).find('input[placeholder], textarea[placeholder]').each(remove);
            });
        }
    });
</script>
<script language="javascript" type="text/javascript">
function sub(){
	document.src.submit();
}
</script>
    <script type="text/javascript">
$(function(){
	$("#login_link").click(function(){
		$("#login-panel").slideToggle("slow");
		return false;
	});



	});

function validateLoginForm(){

	var frm = document.usrlogin;
	if(frm.username.value == ""){
		$("#login-panel").slideDown("slow");
		alert("Please enter your user name.");
		frm.username.focus();
		return false;
	}else if(frm.password.value == ""){
		$("#login-panel").slideDown("slow");
		alert("Please enter your password.");
		frm.password.focus();
		return false;
	}else {
		return true;
	}
        return false;
}

function clearText(thefield){
        if (thefield.defaultValue==thefield.value)
            thefield.value = ""

    }
    </script>
</head>
<body>
<center>

	<div id="layout">
	<header id="header"><!--header-->
        <div class="header-middle"><!--header-middle-->
            <div class="container">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="logo pull-left">
                            <a href="<?php echo $html->url('/index.php');?>"><?php echo $html->image('/img/SiteLogo_disp.gif', array('width' => 48, 'height' => 46, 'border' => 0));?><?php echo $cnfg["site_name"]; ?></a>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <div class="shop-menu pull-right">
                            <ul class="nav navbar-nav">
                                <li>
                                    <?php if($session->check('Userlog') <> false)
                                    {
                                    $sus    =   $session->read('Userlog');?>

                                    <div id="username">Welcome <span><?php echo $sus["uname"]; ?> </span>
                                    </div>
                                    <div class="clear"></div>
                                    <?php } ?>
                                </li>
                                <li><a href="<?php echo $html->url('/carts/show');?>"><i class="fa fa-shopping-cart"></i> Cart <span class="count"><?php echo $cartcount;?></span></a></li>
                                <?php if($session->check('Userlog') == false)
                    {
                    ?>
                                <li>
                                    <a id="login_link" class="left"><i class="fa fa-lock"></i> Login</a> <span class="loginnav_slash">/</span>
                                    <a class="left" href="<?php echo FULL_BASE_URL .$cnfg["sitebasefolder"]."/users/register";?>" class="signup_btn"><span>Sign up</span></a> 
                                </li>
                                
                               <?php } else {   
                ?>  
                                <li><a href="<?php echo $html->url('/users/myaccount');?>"
                                                <?php if (strpos($html->url(), 'myaccount') !== false)
                                                        echo 'id="links_active"'; ?>><i class="fa fa-user"></i> My Account</a></li>
                                <li>
                                <a href="<?php echo $html->url('/users/logout');?>"><i class="fa fa-lock"></i> Logout</a>
                                </li>
                                 <?php } ?>
                                
                                <!-- Login drop down -->
                                <div id="login-panel" align="left">
                                    <form name="usrlogin" action="<?php echo $html->url('/users/login');?>" method="post" id="usrlogin">
                                        <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
                                            <tr>
                                                <td>
                                                    <table border="0" cellpadding="0" cellspacing="10" width="100%">
                                                        <tr>
                                                            <td colspan="2" class="maintext" align="center"><font color="red">
                                                                </font></td>
                                                        </tr>
                                                        <tr>
                                                            <td class="maintext5" align="left" width="28%">User Name </td>
                                                            <td width="66%">
                                                                <input name="username" type="text" class="box2_adminnew" size="27" value="Username"   onfocus="clearText(this);"/>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td class="maintext5" align="left" >Password</td>
                                                            <td>
                                                                <input name="password" type="password" class="box2_adminnew" size="27" maxlength="25" value="Password"   onfocus="clearText(this,'txtPassword');"/>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right">
                                                                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                                                    <tr>
                                                                        <td align="left" width="49%"><span class="secue">
                                                                                <?php echo $html->image('/img/secure.png');?>
                                                                                 </span><span class="secue"></span>
                                                                                </td>
                                                                                 <td align="right" width="51%"><div align="right"><span class="secue"><span>100% <br>
                                                          secure</span></span></div>
                                                                       </td>
                                                                    </tr>
                                                                                </table>
                                                                                <span class="secue"> </span> </td>
                                                                                <td align="right" valign="top">
                                                                                   
                                                                                     <!--   <input src="login_files/joyent_com.png" name="btnLogin" value="Login" onclick="return validateLoginForm();" height="34" type="image" width="89">-->
                                                                                    <input type="submit" class="login_btn_dropdown" value="Login" onclick ="return validateLoginForm()" />
                                                                                            </td>
                                                                                            </tr>
                                                                                            <tr>
                                                                                                <td colspan="2" class="login_txts" align="center"><a href="<?php echo $html->url('/users/forgotpword');?>">Forgot password?&nbsp;</a></td>
                                                                                            </tr>
                                                                                            <tr>
                                                                                                <td colspan="2" class="login_txts" align="center">New User &nbsp;<a href="<?php echo $html->url('/users/register');?>">Sign Up</a>&nbsp; for a new account</td>
                                                                                            </tr>
                                                                                            <tr>
                                                                                                <td colspan="2" align="center">
                                                                                                    <?php echo $html->image('/img/up_arrow.png', array( 'border' => 0,'style' => 'cursor:pointer','onclick' => "$('#login-panel').slideToggle('slow');"));?>
                                                                                                   <!-- <img src="login_files/up_arrow.png" style="cursor:pointer " onclick="$('#login-panel').slideToggle('slow');" border="0" height="20" width="20">-->
                                                                                                </td>
                                                                                            </tr>
                                                                                            </table></td>
                                                                                            </tr>
                                                                                            </table>





                                                                                            </form>
                                </div>
                                <!-- Login drop down ends-->
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div><!--/header-middle-->
    
        <div class="header-bottom"><!--header-bottom-->
            <div class="container">
                <div class="row">
                    <div class="col-sm-8">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                        </div>
                        <div class="mainmenu pull-left">
                            <ul class="nav navbar-nav collapse navbar-collapse">
                                <li><a href="<?php echo $html->url('/index.php');?>" class="active">Home</a></li>
                                <!--
                                <li class="dropdown"><a href="#">Blog<i class="fa fa-angle-down"></i></a>
                                    <ul role="menu" class="sub-menu">
                                        <li><a href="blog.html">Blog List</a></li>
                                        <li><a href="blog-single.html">Blog Single</a></li>
                                    </ul>
                                </li> 
                                -->
                                <li><a href="<?php echo FULL_BASE_URL .$cnfg["sitebasefolder"]."/Helps/userhelp";?>" target="_blank">Help</a></li>
                                <li>
                                <?php if($cnfg['admin_blog_settings']=='Y') { ?>
                                                <a href="<?php echo FULL_BASE_URL .$cnfg["sitebasefolder"]."/app/webroot/blog"?>" target="_blank">Blog</a>
                                <?php
                                } ?>
                                </li>

                            </ul>
                        </div>
                        <div class="clearfix"></div>
                    </div>
                    <div class="col-sm-4">
                            <form name="src" action="<?php echo $html->url('/products/search');?>" method="get" id="src">
                            <div class="search_box pull-right">
                                <input name="srchProduct" type="text" id="srchProduct" placeholder="Search for brands, products, styles, etc." />
                                <input name="Submit" type="submit" value="" />
                            </div>
                            </form>
                    </div>
                </div>
            </div>
        </div><!--/header-bottom-->
    </header><!--/header-->
	  <div id="mainbody">
		<section>
		<div class="container">
			<div class="row">
		<!--mainbody area start -->
		
				<div  class="col-sm-3" id="body_left_area">
				<!--body left area start -->
				<div class="left-sidebar" id="categories">
				<!--categories area start -->
				
						<h2>Category</h2>
						<div align="left" id="" class="u-vmenu">
						<?php
							function generate_menu($parent,$menu_array,$siteurl)
							{

									$has_childs = false;
									$pk	=	0;

									foreach($menu_array as $key => $value)
									{
										$parray[$pk]	=	$value['parent'];
										$pk++;
									}

									foreach($menu_array as $key => $value)
									{
											if ($value['parent'] == $parent)
											{
													//if this is the first child print '<ul>'
													if ($has_childs === false)
													{

															$has_childs = true;
															echo '<ul>';
													}

													if(in_array($key,$parray)){
														echo '<li><a href="#" onclick="return false;">' . $value['name'] . '</a>';
													}
													else
													{
														echo '<li><a href="'.$siteurl.'/categories/show_cat/'.cleancatnames($value['name'])."/".$key.'/">' . $value['name'] . '</a>';
													}
													generate_menu($key,$menu_array,$siteurl);
													echo '</li>';
											}
									}

									if ($has_childs === true) echo '</ul>';
							}
							//generate menu starting with parent categories (that have a 0 parent)
							if(empty($menu_array)===false)
							generate_menu(1,$menu_array,$cnfg["sitebasefolder"]);
							?>
					</div>
				<!--categories area end -->
				</div>
				<div class="clear"></div>
				<!--body left area end -->
		  </div>





				<div class="col-sm-9" class="bodyright" >
				<?php echo $content_for_layout ?> 
				</div>
				<div class="clear"></div>
				</div>
				</div>
			</section>

					<div align="left" class="float_clear"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
		
		
		
	  </div>
	  <footer id="footer"><!--Footer-->
        <div class="footer-widget">
            <div class="container">
                <div class="row">
                    <?php
                //Setting the footer links              
                $flinks=array();
                foreach($footerlinks as $val)
                {
                  if(trim($val) <> '')
                  {
                      $lnk='';$lnk_txt='';
                      if(trim(strtolower($val)) == 'aboutus')  { $lnk_txt='About Us'; $lnk=$html->url('/cmspages/aboutus'); }
                      else  if(trim(strtolower($val)) == 'faq') { $lnk_txt='FAQ'; $lnk=$html->url('/cmspages/faq'); }
                      else  if(trim(strtolower($val)) == 'terms') { $lnk_txt='Terms & Conditions'; $lnk=$html->url('/cmspages/terms'); }    
                      else  if(trim(strtolower($val)) == 'testimonials') { $lnk_txt='Testimonials'; $lnk=$html->url('/cmspages/testimonials'); }    
                      else  if(trim(strtolower($val)) == 'community') { $lnk_txt='Community'; $lnk=$html->url('/cmspages/community'); }         
                      $flinks[]='<a href="'.$lnk.'">'.$lnk_txt.'</a>';
                  }   
                }
                $cnts_lnk=$html->url('/contacts/add');
                $flinks[]='<a href="'.$cnts_lnk.'">Contact Us</a>';
                //Setting the footer links
                 ?>
                    <div class="col-sm-4">
                        <div class="single-widget">
                            <h2>Quick Links</h2>
                            <ul class="nav nav-pills nav-stacked">
                                <li><a href="#"><?php echo implode($flinks);?></a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="single-widget">
                            <h2>Follow Us</h2>
                            <ul class="nav nav-pills nav-stacked">
                                <li>
                                    <?php
                                     //Social media settings
                                    if(isset ($cnfg) ){
                                        ?>
                                    <div>
                                    <?php

                                        if(isset($cnfg['enable_facebook'])){
                                            if($cnfg['enable_facebook'] == 'Y'){?>
                                                <a href="<?php echo $html->url($cnfg['facebook_url']);?>"><?php echo $html->image('/img/Facebook.png', array('border' => 0));?></a>
                                        <?php    }
                                        }
                                        if(isset($cnfg['enable_twitter'])){
                                            if($cnfg['enable_twitter'] == 'Y'){?>
                                                <a href="<?php echo $html->url($cnfg['twitter_url']);?>"><?php echo $html->image('/img/Twitter.png', array('border' => 0));?></a>
                                        <?php    }
                                        }
                                  ?>
                                </div>
                                    <?php
                                      }
                                       //Social media settings ends
                                      ?>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="col-sm-4">
                        <div class="single-widget">
                            <h2>Subscribe Newsletter</h2>
                            
                             <form action="<?php echo $html->url('/users/subsnewsletter'); ?>" method="post" class="searchform">
                                <input id="txtEmail" name="txtEmail" type="text" placeholder="Enter Email Address" />
                                <input name="submit" id="submit" type="submit" class="subscribe_btn btn btn-default" value="Subscribe" />
                                 <?php if($session->read('NewsLetter') == 'yes'){ $session->del('NewsLetter'); if($session->check('Message.flash')) { ?>
                                                <p><font color="<?php if($session->read('NewsStatus') == 'fail'){  echo "#801A00 "; }else { echo "66FF33";} ?>" ><?php $session->flash(); ?></font></p><?php } } ?>
                                                <div class="clear"></div>
                            </form>
                        </div>
                    </div>
                    
                </div>
            </div>
        </div>
        
        <div class="footer-bottom">
            <div class="container">
                <div class="row">
                    <p class="aligncenter">
                        Powered by&nbsp;<a href="http://www.iScripts.com/vistacart" target="_blank">iScripts Vistacart</a>. A premium product from <a href="http://www.iScripts.com" target="_blank">iScripts.com</a>
                    </p>
                </div>
            </div>
        </div>
        
    </footer><!--/Footer-->
	<?php
	function cleancatnames($text)
				{
					$code_entities_match = array(' 
		','--','&quot;','!','@','#','$','%','^','&','*','(',')','_','+','{','}','|',':','"','<','>','?','[',']','\\',';',"'",',','.','/','*','+','~','`','=');
					$code_entities_replace =
					array('-','-','','','','','','','','','','','','','','','','','','','','','','','','');
					$text = str_replace($code_entities_match, $code_entities_replace, $text);
					return $text;
				}
 ?>

              <div class="clear"></div>
	  </div>
            <div class="clear"></div>
	</div>
	
	
</center>
<?php
    echo $javascript->link('js/jquery.js');
    echo $javascript->link('js/bootstrap.min.js');
    echo $javascript->link('js/jquery.scrollUp.min.js');
    echo $javascript->link('js/jquery.prettyPhoto.js');
    echo $javascript->link('js/main.js');
    ?>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $cnfg["sitebasefolder"];?>/js/vmenuModule.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".u-vmenu").vmenuModule({
            Speed: 200,
            autostart: false,
            autohide: true
        });
    });
</script>
</body>

    <script language="javascript">
        function chekClear(){

            if($("#srchProduct").val() =="Search for brands, products, styles, etc."){
                $("#srchProduct").val("");
            }else if( $("#srchProduct").val() == ""){
                 $("#srchProduct").val("Search for brands, products, styles, etc.");
            }
        }
      </script>
</html>