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

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

<div class="container">
	
    <?php if(of_get_option('show_standar_top')){?>
	
        <?php
        $args=array(
                'post_type' => 'std_serv',
                'post_status' => 'publish',
                'posts_per_page' => -1,
            );
            $my_query = null;
            $my_query = new WP_Query($args);
            $std_serv = array();
            
            while ($my_query->have_posts()) {
                $my_query->the_post();
                $std_serv[] = array(
                    'title' => get_the_title(),
                    'icon' => get_field('stdicon'),
                    'subtitle' => get_field('subtitle'),
                    'description' => get_field('description'),
                    'btn_title' => get_field('btn_title'),
                    'btn_link' => get_field('btn_link')
                );
            }
        $c = 0;
    
	    $i = 0;
        $stdserv_count = 0;
        foreach($std_serv as $key){
		    $i++;
            if(of_get_option('standar_serv'.$i) == '1'){
                $stdserv_count++;    
            }
        }
		
		$i = 0;
        foreach($std_serv as $key){
		    $i++;
             if(of_get_option('standar_serv'.$i) == '1'){
             $c++;
                if($c==1){echo '<div class="row-fluid">';}
    ?>
		
        <div class="span4">
		  
            <div class="features option_two">
			
                <div class="icon">
			  
                    <?php echo $key['icon'];?>
				
                </div>
			  
                <h3 <?php echo colors('h3');?> ><?php echo $key['title'];?></h3>
			  
                <span <?php echo colors('h1s');?> ><i><?php echo $key['subtitle'];?></i></span>
			  
                <p <?php echo colors('p');?> ><?php echo $key['description'];?></p>
			  
                <a <?php echo colors('a');?>  href="<?php echo $key['btn_link'];?>" class="botton"><?php echo $key['btn_title'];?></a>
			  
            </div>
			
        </div>
		  
        <?php 
                if($c%3==0){ 
                echo '</div>';
                if($c+1<=$stdserv_count){
                    echo '<div class="row-fluid">';
                }
                }elseif($c==$stdserv_count){
                    echo '</div>';
                }
            }    
        }
        ?>
        
	<?php }?>
    
        <?php if(of_get_option('show_standar_mid')){?>
        
	    <?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('standar_plan')){
                $planes_count++;    
            }
        }
        foreach($plan as $key){
             
             if($key['category'] == of_get_option('standar_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>';
                    }
                }
            }
        ?>
		
        <!-- About -->
        
	    <?php }?>	
        
        <?php 
            if(of_get_option('show_standar_but')){
        ?>
		
        <div class="about top" <?php echo colors('std');?>>
      
            <div class="row-fluid">
      
                <?php 
                    $img_float = '<img src="'.of_get_option('standar_but_img').'" alt="">'; 
                    if(of_get_option('standar_but_img_pos')=='1'){echo $img_float;}
                ?>

                <div class="span8" style="<?php if(of_get_option('standar_but_img_pos')=='1'){echo 'float:right;';}else{echo 'float:left;';}?>"> 
        
                    <h3 <?php echo colors('h3');?> ><?php echo of_get_option('standar_but_title');?></h3>
          
                    <p <?php echo colors('p');?> ><?php echo of_get_option('standar_but_desc');?></p>
          
                </div>

                <?php if(of_get_option('standar_but_img_pos')=='2'){echo $img_float;}?>
        
            </div>
      
        </div>
    
        <!-- About -->
		
        <?php }?>
		
    </div>
		
</div>
	
<?php }?>
    
<div class="clearfix"></div>
	
<?php  get_footer(); ?>