<?php

// no direct access
defined('_JEXEC') or die;

$url = JURI::root().'templates/ol_tesio/';

$document = &JFactory::getDocument();  
$bgr                    = $this->params->get ('bgr');
$seofix                 = $this->params->get ('seofix');
$juaccordation_image1 	= $this->params->get('juaccordation_image1', '' );
$juaccordation_image1s 	= $this->params->get('juaccordation_image1s', '' );
$juaccordation_image2 	= $this->params->get('juaccordation_image2', '' );
$juaccordation_image2s 	= $this->params->get('juaccordation_image2s', '' );
$juaccordation_image3 	= $this->params->get('juaccordation_image3', '' );
$juaccordation_image3s 	= $this->params->get('juaccordation_image3s', '' );
$juaccordation_image4 	= $this->params->get('juaccordation_image4', '' );
$juaccordation_image4s 	= $this->params->get('juaccordation_image4s', '' );
$juaccordation_image5 	= $this->params->get('juaccordation_image5', '' );
$juaccordation_image5s 	= $this->params->get('juaccordation_image5s', '' );
$juaccordation_image6 	= $this->params->get('juaccordation_image6', '' );
$juaccordation_image6s 	= $this->params->get('juaccordation_image6s', '' );

$document->addCustomTag('<link rel="stylesheet" href="'.$url.'slider/css/flexslider.css" type="text/css" />');
$document->addCustomTag('<script type="text/javascript" src="'.$url.'slider/scripts/jquery.flexslider-min.js"></script>');
$document->addCustomTag('<script type="text/javascript" src="'.$url.'slider/scripts/css3-mediaqueries.js"></script>');
$document->addCustomTag('<script type="text/javascript" src="'.$url.'slider/scripts/kwiks.js"></script>');
?> 
<style type="text/css">
@media handheld, only screen and (min-width: 960px) {
	.flexslider .slides > li {
		margin-right: -.<?php echo $this->params->get('styleh'); ?>em;
		width:<?php echo $this->params->get('styleh'); ?>%;
	}
}
</style>
<script type="text/javascript">
var Main = Main || {};

jQuery(window).load(function() {
window.responsiveFlag = jQuery('#responsiveFlag').css('display');
Main.gallery = new Gallery();

jQuery(window).resize(function() {
Main.gallery.update();
});
});

function Gallery(){
var self = this,
container = jQuery('.flexslider'),
clone = container.clone( false );

this.init = function (){
if( responsiveFlag == 'block' ){
var slides = container.find('.slides');

slides.kwicks({
max : 880,
spacing : 0
}).find('li > a').click(function (){
return false;
});
} else {
container.flexslider();
}
}
this.update = function () {
var currentState = jQuery('#responsiveFlag').css('display');

if(responsiveFlag != currentState) {

responsiveFlag = currentState;
container.replaceWith(clone);
container = clone;
clone = container.clone( false );

this.init();	
}
}

this.init();
}
</script>
<div id="container">		
<div class="flexslider">
<ul class="slides">
<?php if ($juaccordation_image1): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image1; ?>" alt="image1" />
</li>
<?php endif;?>				
<?php if ($juaccordation_image2): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image2; ?>" alt="image2" />
</li>
<?php endif;?>
<?php if ($juaccordation_image3): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image3; ?>" alt="image3" />
</li>
<?php endif;?>
<?php if ($juaccordation_image4): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image4; ?>" alt="image4" />
</li>
<?php endif;?>
<?php if ($juaccordation_image5): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image5; ?>" alt="image5" />
</li>
<?php endif;?>
<?php if ($juaccordation_image6): ?>
<li>
<img src="<?php echo $seofix; ?><?php echo $juaccordation_image6; ?>" alt="image6" />
</li>
<?php endif;?>
</ul>
</div> 	
</div>
<span id="responsiveFlag"></span>


<!-- <?php echo $_VERSION->URL; ?>  -->


