<?php
 session_start();
 include '../config.php';
 $lang = 'en';

if(strlen($_SESSION['acerca'])>90 && strlen($_COOKIE['persistID'])<2)
{
    $responseacerca = $_SESSION['acerca'];
    //echo $_SESSION['acerca'];
}
else{
	$curl = curl_init();
    curl_setopt_array($curl, array(
        CURLOPT_URL => $endpoint_graph_cms,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_ENCODING => '',
        CURLOPT_MAXREDIRS => 10,
        CURLOPT_TIMEOUT => 0,
        CURLOPT_FOLLOWLOCATION => true,
        CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        CURLOPT_CUSTOMREQUEST => 'POST',
        CURLOPT_POSTFIELDS =>'{"query":"query MyQuery {\\r\\n  paginasQuienesSomos(stage: PUBLISHED) {\\r\\n    imagenDerecha\\r\\n    imagenIzquierda\\r\\n    slug\\r\\n    subtituloDePagina\\r\\n    textoPrincipal\\r\\n    textoServicios\\r\\n    tituloDePagina\\r\\n    localizations {\\r\\n      imagenDerecha\\r\\n      imagenIzquierda\\r\\n      slug\\r\\n      subtituloDePagina\\r\\n      textoPrincipal\\r\\n      textoServicios\\r\\n      tituloDePagina\\r\\n      tituloInstrumentosDeBolsa\\r\\n      tituloInstrumentosDeMercado\\r\\n      tituloInstrumentosExtranjeros\\r\\n    }\\r\\n  }\\r\\n}\\r\\n","variables":{}}',
        CURLOPT_HTTPHEADER => array(
          'Content-Type: application/json',
          'Cookie: __cfduid=da2693cdfd39b7377a8a05e305da45b8f1613001694'
        ),
      ));
      
      
	  
   
  $responseacerca = curl_exec($curl);
  $_SESSION['acerca'] = $responseacerca;
  curl_close($curl);
}

$arrayacerca = json_decode($responseacerca, true);

$urles = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['slug'];
$urlen = $arrayacerca['data']['paginasQuienesSomos'][0]['slug'];
//echo  "Es:".$urles." En:".$urlen;
//echo  $lang ;

if($lang == 'en'){
	///////INFO PÁGINA
    $titulopag = $arrayacerca['data']['paginasQuienesSomos'][0]['tituloDePagina'];
    $imagenDerecha  = $arrayacerca['data']['paginasQuienesSomos'][0]['imagenDerecha'];
    $imagenIzquierda  = $arrayacerca['data']['paginasQuienesSomos'][0]['imagenIzquierda'];
    $textoPrincipal  = $arrayacerca['data']['paginasQuienesSomos'][0]['textoPrincipal'];
    $textoServicios  = $arrayacerca['data']['paginasQuienesSomos'][0]['textoServicios'];
    $tituloInstrumentosDeBolsa  = $arrayacerca['data']['paginasQuienesSomos'][0]['tituloInstrumentosDeBolsa'];
    $tituloInstrumentosDeMercado  = $arrayacerca['data']['paginasQuienesSomos'][0]['tituloInstrumentosDeMercado'];
    $tituloInstrumentosExtranjeros  = $arrayacerca['data']['paginasQuienesSomos'][0]['tituloInstrumentosExtranjeros'];
	
}
if($lang == 'es'){
	$titulopag = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['tituloDePagina'];
    $imagenDerecha  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['imagenDerecha'];
    $imagenIzquierda  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['imagenIzquierda'];
    $textoPrincipal  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['textoPrincipal'];
    $textoServicios  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['textoServicios'];
    $tituloInstrumentosDeBolsa  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['tituloInstrumentosDeBolsa'];
    $tituloInstrumentosDeMercado  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['tituloInstrumentosDeMercado'];
    $tituloInstrumentosExtranjeros  = $arrayacerca['data']['paginasQuienesSomos'][0]['localizations'][0]['tituloInstrumentosExtranjeros'];

}

$textoPrincipal = urldecode($textoPrincipal);
$textoServicios = urldecode($textoServicios);

$curl2 = curl_init();

curl_setopt_array($curl2, array(
  CURLOPT_URL => $endpoint_graph_cms,
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{"query":"query MyQuery {\\r\\n  instrumentos(stage: PUBLISHED) {\\r\\n    textoTooltip\\r\\n    titulo\\r\\n    localizations {\\r\\n      titulo\\r\\n      textoTooltip\\r\\n      categoria\\r\\n    }\\r\\n    categoria\\r\\n  }\\r\\n}\\r\\n","variables":{}}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'Cookie: __cfduid=da2693cdfd39b7377a8a05e305da45b8f1613001694'
  ),
));

$responseins = curl_exec($curl2);
//echo $responseins;
curl_close($curl2);

$arrayins = json_decode($responseins, true);
?>

<!DOCTYPE html>
<html lang="en" translate="no">
    <head>
        <?php include '../include/generales.php'; ?>
        <style>
            section#services {
                padding-top: 160px;
                padding-bottom:30px;
            }
.descarga {
    background-color: #48aa42 !important;
    width: 100%!important;
    min-height: 250px;
    float: left!important;
    color: #fff!important;
    text-align: left;
    padding: 1em!important;
    font-size: 2.2em;
    margin: 0!important;
	position: relative
}

		
.descarga-icon {
		
	position: absolute;
    bottom: 1em;
    right: 1em;3
}
			
.comunicado {
    height: auto;
    position: absolute;
    right: 0;
    z-index: 1;
    background-color: #48aa42;
    padding: 10px 110px 30px 40px;
    top: 447px;
}
		
.comunicado2 {
    height: auto;
    position: absolute;
    right: 0;
    z-index: 1;
    background-color: #9e9fb3;
    padding: 10px 110px 30px 40px;
    top: 796px;
}

.img-comunicado {
	max-width: 569px;
	height: 550px;
	position: absolute;
	right: 0;
	z-index:-1;
	background-color:#cdcdd4;
	padding-right: 0;
	padding-left: 0;
}
	

p {
    line-height: 1.75;
    color: #666;
}
.col-lg-4.img-int-01 {
    min-height: 400px;
}
.greenbar {
    bottom: 160px;
}

p {
    padding: 10px 10px 0;
}
img {
    vertical-align: middle;
    border-style: none;
    max-width: 100%;
}
.textoservs p {
    padding: 0;
    padding-left:15px;
}

span.bullet {
    color: #48aa42;
    font-size: 25px;
    position: absolute;
    margin-left: -15px;
    margin-top: -10px;
}



.col-lg-12.instrumentos p {
    padding: 0 0px 5px 15px;
    color: #2b4365;
    font-size: 13px;
    text-decoration: underline;
}
.col-lg-12.instrumentos p span {
    padding: 0px;
    color: #48aa42;
    text-decoration:none;
}

.col-lg-12.instrumentos p i {
    color: #48aa42;
}
p.tooltipn {
    margin: 0;
}

.col-lg-12.textoservs {
    display: inline-block;
    padding: 30px;
}
.col-lg-12.textoservs h3 {
    margin-bottom: 30px;
}
.col-lg-12.textoservs p {
    padding: 0;
    margin: 0;
    padding: 5px 015px;
}
.col-lg-8 {
    left: 33%;
    padding:0;
}
.innerbox {
    background: #f5f5f7;
    padding: 30px;
}
@media(max-width:700px){
    .col-lg-12.instrumentos p {
    padding: 0px 0px;
}
    h4, .h4 {
        font-size: 1.5rem;
        color: #2b4365;
    }
    section#services {
    padding-top: 90px;
}
.descarga {
    min-height: 10px;
}
.col-md-1.greenbar {
    display: none;
}

.img-int-01 {
    width: 100%;
    height: 100px;
    margin-bottom: 40px;
}

}

h4 {
    font-size: 2rem;
    /* color: #898ba4; */
    line-height: 1.5;
    padding-left: 15px;
}
.col-lg-4.img-int-01 {
    min-height: 200px;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    position: absolute;
    margin-left: 0;
    left: 0;
}
.col-lg-12.text2 {
    width: 100%;
    padding: 30px 0;
}

.text2 .col-lg-4 p {
    font-size: 17.5px;
    font-family: "Montserrat", sans-serif;
    line-height: 1.4;
    color: #2b4365;
    font-weight: 600;
    padding-right: 15%;
}
.text2 div {
    float: left;
}

.col-lg-8.normativa {
    border-bottom: 1px solid #48aa42;
    left:0;
}
h5 {
    font-size: 17.5px;
    color: #2b4365;
}
.col-lg-8.textoservs {
    left: 0;
    padding:0 15px;
}
.col-lg-4.img-int-01.imgservs {
    right: 0;
    left: auto;
    min-height: 400px;
}
.col-lg-8.textoservs h3 {
    margin-bottom: 30px;
}

@media(max-width:768px){
    section#services {
        padding-top: 60px;
        padding-bottom: 30px;
    }
    .col-lg-8 {
        left: 0;
        padding: 0;
        margin-top: 230px;
    }
    .text2 .col-lg-4 p {
        padding-right: 0;
    }
    .col-lg-8.normativa {
        border-bottom: 1px solid #48aa42;
        left: 0;
        margin-top: 30px;
        padding: 0 20px;
    }
    .col-lg-4.columnains {
        margin-bottom: 30px;
    }
    .col-lg-4.img-int-01.imgservs {
        min-height: 200px;
    }
}
    
    @media(max-width:700px){
    h4 {
        font-size: 17.5px;
        color: #898ba4;
        line-height: 1.5;
        padding-left: 10px;
    }
    .col-lg-12.text2 {
        width: 100%;
        padding: 15px 5%;
    }


    .text2 .col-lg-4 p {
        font-size: 17.5px;
        font-family: "Montserrat", sans-serif;
        line-height: 1.4;
        color: #2b4365;
        font-weight: 600;
        padding-right: 0;
        padding-left: 0;
        padding-bottom: 25px;
    }
    .col-lg-12.text2 {
        padding: 15px 0;
    }
    .col-lg-8.normativa {
        margin-top: 0;
        padding: 0 10px;
    }
    .col-lg-8.normativa p {
        padding-left: 15px;
    }
    .col-lg-4.columnains {
        margin-bottom: 30px;
        padding: 0;
    }
    .col-lg-12.instrumentos p {
        padding: 5px 0 5px 15px;
    }
    .col-lg-4.img-int-01.imgservs {
        min-height: 170px;
    }
}    

@media(max-width:500px){
    .col-lg-4.img-int-01 {
        min-height: 150px;
    }
    .col-lg-8 {
        margin-top: 180px;
    }
    .row {
        margin-right: 0;
        margin-left: 0;
    }
    .whitefooter {
        padding: 10px!important;
    }

}

	</style>
    </head>
    <body id="page-top" class="home" data-url = '<?php echo $page_url;?>'>
		
        <?php include '../include/nav2.php'; ?>
        
            <!-- Services-->
        <section class="page-section" id="services">
			<div class="container">
			  <div class="row">
			  	
				<div class="col-lg-4 img-int-01" style="background-image:url(<?php echo $cloudfront.$imagenDerecha;?>)">
				</div>	
                  <?php echo $textoPrincipal;?>
                 
			  </div>	  
            </div>
                            
           
           
            <div class="container">
                <div class="row">
                    <div class="col-lg-12 instrumentos">
                        <div class="row">
                            <div class="col-lg-4 columnains">
                                <div class="innerbox">
                                    <h5><?php echo $tituloInstrumentosDeBolsa;?></h5>
                                    <?php 
                                        foreach ($arrayins['data']['instrumentos'] as $item) {

                                            if($item['categoria'] == "bolsa"){
                                                
                                                if($lang == 'en'){
                                                    echo '<p aria-label-tooltip="'.strip_tags(urldecode ($item['textoTooltip'])).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$item['titulo'].'</p>';
                                                }

                                                if($lang == 'es'){
                                                    foreach ($item['localizations'] as $subitem) {
                                                        echo '<p aria-label-tooltip="'.strip_tags(urldecode ($subitem['textoTooltip'])).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$subitem['titulo'].'</p>';
                                                    }
                                                    
                                                }
                                            }
                                        
                                        }
                                    ?>
                                </div>
                            </div>

                            <div class="col-lg-4 columnains">
                                <div class="innerbox">
                                    <h5><?php echo $tituloInstrumentosDeMercado;?></h5>
                                    <?php 
                                        foreach ($arrayins['data']['instrumentos'] as $item) {
                                            if($item['categoria'] == "mercado"){
                                                
                                                if($lang == 'en'){
                                                    echo '<p aria-label-tooltip="'.urldecode ($item['textoTooltip']).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$item['titulo'].'</p>';
                                                }

                                                if($lang == 'es'){
                                                    foreach ($item['localizations'] as $subitem) {
                                                        echo '<p aria-label-tooltip="'.urldecode ($subitem['textoTooltip']).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$subitem['titulo'].' </p>';
                                                    }
                                                    
                                                }
                                            }
                                        
                                        }
                                    ?>
                                </div>
                        
                            </div>

                            <div class="col-lg-4 columnains">
                                <div class="innerbox">
                                    <h5><?php echo $tituloInstrumentosExtranjeros;?></h5>
                                    <?php 
                                        foreach ($arrayins['data']['instrumentos'] as $item) {
                                            if($item['categoria'] == "extranjeros"){
                                                
                                                if($lang == 'en'){
                                                    echo '<p aria-label-tooltip="'.urldecode ($item['textoTooltip']).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$item['titulo'].' </p>';
                                                }

                                                if($lang == 'es'){
                                                    foreach ($item['localizations'] as $subitem) {
                                                        echo '<p aria-label-tooltip="'.urldecode ($subitem['textoTooltip']).'" data-balloon-pos="down"  data-balloon-length="fit" class="tooltipn"><span class="bullet">•</span> '.$subitem['titulo'].' </p>';
                                                    }
                                                    
                                                }
                                            }
                                        
                                        }
                                    ?>
                                </div>
                        
                            </div>
                        </div>
                        </div>
                    </div>	  
                </div>	
											
        </section>

        <div class="container">
            <div class="row">
            
                <div class="col-lg-8 textoservs">
                  <p><?php echo $textoServicios;?></p>
                </div>
                <div class="col-lg-4 img-int-01 imgservs" style="background-image:url(<?php echo $cloudfront.$imagenIzquierda;?>)">
                 </div>
            </div>

        </div>
		
    		<?php include '../include/footer.php'; ?>
		<script>
			
		</script>
    </body>
</html>
