<?php
    $GLOBALS['img']='online-store';
    get_header();
    the_post();
?>

<?php if(of_get_option('show_online')){ ?>

<?php 
    if(of_get_option('show_online_desc')){ 
    $img_float = '<div class="span4"><img src="'.of_get_option('online_desc_img').'" alt=""></div> ';
?>

<div class="container top">
     
    <div class="row-fluid">
	 
        <?php if(of_get_option('online_desc_img_pos')=='1'){echo $img_float;}?>
	   
        <div class="span8">
	   
            <h3 <?php echo colors('h3');?> ><?php echo strtoupper(of_get_option('online_desc_title'));?></h3>
		
            <p <?php echo colors('p');?> ><?php echo insert_br(of_get_option('online_desc_desc'));?></p>
		
        </div>
	   
        <?php if(of_get_option('online_desc_img_pos')=='2'){echo $img_float;}?>
	   
    </div>
	
    <?php }?>

    <!-- divisor -->
	
    <div class="divisor">
	
        <div class="circle_left"></div>
	  
        <div class="circle_right"></div>
	  
    </div>
	
    <!-- divisor -->
  
    <div class="clearfix"></div>

    <?php if(of_get_option('show_online_plans')){?>
	
        <?php
        $args=array(
            'post_type' => 'plan',
            'post_status' => 'publish',
            'posts_per_page' => -1,
        );
        $my_query = null;
        $my_query = new WP_Query($args);
        $plan = array();
        
        while ($my_query->have_posts()) {
            $my_query->the_post();
            $plan[] = array(
                'title' => get_the_title(),
                'subtitle' => get_field('subtitle'),
                'price' => get_field('price'),
                'freq' => get_field('frequency'),
                'options' => get_field('options'),
                'category' => get_field('categoria'),
                'btn_title' => get_field('btn_title'),
                'btn_link' => get_field('btn_link')
            );
        }
        $c = 0;
        $planes_count = 0;
        foreach($plan as $key){
            if($key['category'] == of_get_option('online_plan')){
                $planes_count++;    
            }
        }
        foreach($plan as $key){
             if($key['category'] == of_get_option('online_plan')){
             $c++;
              //  if(of_get_option('price_first_plan'.$c) == 1 ){
              if($c==1){echo '<div class="row-fluid top">';}
     
     ?>
    
        <div class="span3">
      
            <!-- Item table -->
        
            <div class="item_table option_pricing">
        
                <div class="head_table">
          
                    <div class="head_title">    
            
                        <h1 <?php echo colors('h1');?> ><?php echo $key['title'];?></h1>
              
                        <span <?php echo colors('h1s');?> ><?php echo $key['subtitle'];?></span>
              
                    </div>
            
                    <h2 <?php echo colors('h2');?> ><?php echo $key['price'];?><span <?php echo colors('h1s');?> > $/ <?php echo $key['freq'];?></span></h2>                        
            
                </div>

                <ul class="items">
          
                    <?php foreach($key['options'] as $data){?>
          
                    <li><?php echo $data['icon'];?> <?php echo $data['descripotion'];?></li>
            
                    <?php }?>
                            
                </ul> 

                <a <?php echo colors('a');?>  href="<?php echo $key['btn_link'];?>" class="botton"><?php echo $key['btn_title'];?></a>  

            </div>
        
            <!-- End Item table -->
        
        </div>
      
        <?php 
                    if($c%4==0){ 
                    echo '</div>';
                    if($c+1<=$planes_count){
                        echo '<div class="row-fluid top">';
                    }
                    }elseif($c==$planes_count){
                        echo '</div>';
                    }
                }
            }
        ?>
      
    <?php }?>
	
    <!-- divisor -->
	
    <div class="divisor">
	
        <div class="circle_left"></div>
	  
        <div class="circle_right"></div>
	  
    </div>
	
    <!-- divisor -->
	
    <?php if(of_get_option('show_online_last')){?>
	
    <div class="row-fluid">
	
        <div class="span8">
	  
            <h3 <?php echo colors('h3');?> ><?php echo of_get_option('online_last_title');?></h3>
		
            <p <?php echo colors('p');?> ><?php echo of_get_option('online_last_desc');?></p>
		
            <p></p>
		
            <?php 
			    if(of_get_option('show_online_accordion')){
                for($i=1; $i<=of_get_option('online_accordion_num'); $i++){
            ?>
		
            <div class="accordion-trigger"><?php echo of_get_option('title_online_accordion'.$i);?></div>   
		  
            <div class="accordion-container">
			
                <?php switch(of_get_option('style_online_accordion'.$i)){
                    case '1':
                        echo '<p '.colors('p').' >'.insert_br(of_get_option('desc_online_accordion'.$i)).'</p>';
                        break;
                    case '2':
                        $img_float = '<div><img src="'.of_get_option('img_online_accordion'.$i).'" alt=""></div> ';
                        if(of_get_option('img_pos_online_accordion'.$i)=='1'){echo $img_float;}
                        echo '<p '.colors('p').' >'.of_get_option('img_desc_online_accordion'.$i).'</p>';
                        if(of_get_option('img_pos_online_accordion'.$i)!='1'){echo $img_float;}
                        break;
                    case '3':
                        echo '<ul class="items_description">';
                        for($j=1; $j<=of_get_option('vig_num_online_accordion'.$i); $j++){
                            echo '<li>'.of_get_option('vignette_online_accordion'.$i.$j).'</li>';
                        }
                        echo '</ul>';
                        break;
                }?>
              
            </div>
			
        <?php }?>
		
    </div>
	  
    <?php }?>
	  
    <?php if(of_get_option('show_online_last_right')){?>
	  
    <div class="span4">
	  
        <!-- info -->
		
        <div class="info">
		
            <?php if(of_get_option('show_online_last_right')){?>
		  
            <h4 <?php echo colors('h4');?> ><?php echo of_get_option('online_zone1_title');?></h4>

            <div class="row-fluid">
		  
                <?php for($i=1; $i<=of_get_option('online_zone1_pay_num'); $i++){?>
		  
                <div class="span2">
			
                    <img src="<?php echo of_get_option('online_zone1_card'.$i);?>" alt="">
			  
                </div>
			
                <?php }?>

            </div>

            <div class="clearfix"></div>

            <div class="support">
		  
                <div class="row-fluid">
			
                    <div class="span3">
			  
                        <img src="<?php echo of_get_option('online_zone1_call_img');?>" alt="">
				
                    </div>

                    <div class="span9">
			  
                        <p <?php echo colors('p');?> ><?php echo of_get_option('online_zone1_title_call');?></p>
				
                        <?php for($i=1; $i<=of_get_option('online_zone1_call_num'); $i++){?>
				
                        <p <?php echo colors('p');?> ><?php echo of_get_option('online_zone1_call_title'.$i);?>: <span <?php echo colors('h1s');?> ><?php echo of_get_option('online_zone1_call_phone'.$i);?></span></p>
                
				        <?php }?> 
                
                    </div>
			  
                </div>   
			
            </div>
		  
            <?php }?>
		  
            <div class="clearfix"></div>
		  
            <?php if(of_get_option('show_online_zone2')){?>
		  
            <h4 <?php echo colors('h4');?> ><?php echo of_get_option('online_zone2_title');?></h4>
		  
            <p <?php echo colors('p');?> ><?php echo of_get_option('online_zone2_desc');?></p>
		  
            <ul class="list list_support">
		  
                <?php for($i=1; $i<=of_get_option('online_zone2_tran_num'); $i++){?>
		  
                <li><a <?php echo colors('a');?> href="<?php echo of_get_option('online_zone2_tran_link'.$i);?>"><i <?php echo font_awesome_icon_style('tranf');?>></i><?php echo of_get_option('online_zone2_tran_title'.$i);?></a></li>
          
		        <?php }?>

            </ul>
		  
            <?php }?>
		  
        </div>
		
        <!-- info -->
		
    </div>
	  
    <?php }?>  

	</div>
	
	</div>
	
    <?php }?>
	
</div>
	
</div>

<!-- Container -->
  
<?php } get_footer(); ?>