<?php
/**
 * The main template file.
 *
 * This is the most generic template file in a WordPress theme
 * and one of the two required files for a theme (the other being style.css).
 * It is used to display a page when nothing more specific matches a query.
 * E.g., it puts together the home page when no home.php file exists.
 * Learn more: http://codex.wordpress.org/Template_Hierarchy
 *
 * @package Loyt
 */

get_header(); ?>
<?php if ( have_posts() ) : ?>
	<?php while ( have_posts() ) : the_post(); ?>
		<section class="banner-paginas container">
			<ul class="body-list"><?php
				$images = types_render_field("banner-page", array("raw"=>"true", "separator"=>";"));
				$banners = explode(";", $images);
				$cont = 0;
				foreach( $banners as $banner ):
					if ($cont==0) {?>
				<li class="active"><?php 
				} else {?>
				<li><?php
				} ?>
				<figure>
					<img src="<?php echo $banner; ?>"alt="Loyt" class="img-responsive" />
				</figure>
			</li><?php
			$cont++;
			endforeach;?>
		</ul>
	</section>
<?php endwhile; ?>
<?php endif; ?>
<div class="container">
	<section class="cont-box">
		<section class="col-lg-6  col-md-6 col-sm-6 cua  hidden-xs"><?php 
			$box_args = array(
				'post_type' => 'home-box',
				'order' => 'ASC'
				);              
			$boxes = new WP_Query( $box_args );
			$conteo = 0;   
			while ($boxes->have_posts())
			{
				$boxes->the_post();
				$boxImage = types_render_field("image-homebox", array("output"=>"raw"));
				$boxCss = types_render_field("css-homebox", array("output"=>"raw"));
				$boxLink = types_render_field("link-homebox", array("output"=>"raw"));
				if($conteo % 2 == 0){?>
				<section class="row internoCua"><?php
				}?>
				<section class="col-lg-6 col-md-6 col-sm-6 <?php echo $boxCss; ?>">
					<img src="<?php echo $boxImage; ?>" class="imgaside container" />
					<a href="<?php echo $boxLink; ?>">
						<div class="cajatexto"><?php the_title(); ?></div>
					</a>
				</section><?php
				if ($conteo % 2 != 0){?>
			</section><?php
		}
		$conteo++;
	}?>
	<div class="hidden-xs centroaside">
		<img src="<?php echo get_bloginfo('template_url'); ?>/images/bol.png">
	</div>
</section>
</section>
<?php if ( have_posts() ) : ?>
	<?php while ( have_posts() ) : the_post(); ?>
		<section class="col-lg-6 col-md-6 col-sm-6 formulario">
			<h1 class="title">Cotizacion de Carga</h1>
			<?php the_content(); ?>
		</section>
		<div class="clearfix"></div>
	<?php endwhile; ?>
	<section class="quienes">
		<section class="col-md-4">
			<img src="<?php echo get_bloginfo('template_url'); ?>/images/logo.jpg" class="logoQ"/>
			<div class="clearfix"></div>
		</section>
		<section class="col-md-8 quienesText">
			<p>
				"Somos una empresa dedicada a brindar servicios de asesoramiento log&iacute;stico en comercio exterior, transporte interurbano/nacional y Almacenaje de mercanc&iacute;as. Dise&ntilde;amos planes para que sus operaciones seas r&aacute;pidas, seguras y al menor costo posible, permitiendo a los clientes enfocarse en su negocio principal."
			</p>
		</section>
		<div class="clearfix"></div>
	</section>
	<section class="feed">
		<?php if ( dynamic_sidebar('Widget para Noticias') ) : else : endif; ?>
	</section>
</div>
<script type="text/javascript">
	jQuery(document).ready(function () {
		jQuery("#name").attr("placeholder","Nombre o Empresa");
		jQuery("#email").attr("placeholder","E-mail");
		jQuery("#telefono").attr("placeholder","Telefono");
		jQuery("#origen").attr("placeholder","Origen");
		jQuery("#destino").attr("placeholder","Destino");
		jQuery("#mercancia").attr("placeholder","Mercancia");
		jQuery("#descripcion").attr("placeholder","Descripcion de la Mercaderia");
		jQuery("#peso").attr("placeholder","Peso");
		jQuery("#volumen").attr("placeholder","Volumen");
		jQuery("#cantidadc").attr("placeholder","Cantidad Carga");
		jQuery("#cantidadb").attr("placeholder","Cantidad Bultos");
	});
</script>
<?php endif; ?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
