<?php $lang=Yii::app()->session['lang'] ;
header('Content-Type:text/javascript'); 
?>

$(".section6 .owl-carousel").owlCarousel({
    margin: 30,
    items: 3, 
    nav:true,
    autoplay:false,
    autoplayTimeout:3000,
    autoplayHoverPause:true,
    navText:[' <img class="icon-slider" src="images/carousel-prev1.png">'
    , '<img class="icon-slider" src="images/carousel-next1.png">'], 
    loop:true, 
    items:3, 
    margin:30,
    stagePadding:30,
    smartSpeed:450,
    responsive : { 
    0:{
        items:1,
         margin:40, 
        navText:[' <img class="icon-slider" src="images/carousel-prev2.png">'
       , '<img class="icon-slider" src="images/carousel-next2.png">']
    },
    767 : {
        items:1,
         margin:40, 
        navText:[' <img class="icon-slider" src="images/carousel-prev2.png">'
       , '<img class="icon-slider" src="images/carousel-next2.png">']
    },
   768: {
       items:3, 
       navText:[' <img class="icon-slider" src="images/carousel-prev1.png">'
       , '<img class="icon-slider" src="images/carousel-next1.png">']
          }
     } 
      });   
 $('.section6 .owl-carousel').on('translate.owl.carousel', function(event) {
              if ($(window).width() >= 768){
    $(this).find(".service-image").hide( ).addClass('animated zoonOut');
              }
             else{
     $(this).find(".service-image").show( ).addClass('animated zoomIn');     
             }
}); 
 $('.section6 .owl-carousel').on('translated.owl.carousel', function(event) {
      if ($(window).width() >= 768){
 $(this).find(".service-image").fadeIn().addClass('animated fadeIn');
      }
     else{ 
 $(this).find(".service-image").fadeIn().addClass('animated fadeIn');   
     }
});
 $(".section3 .owl-carousel").owlCarousel({
            margin: 30,
            items: 2, 
            nav:true,  
            autoplay:true,
            autoplayTimeout:3000,
            autoplayHoverPause:true,
            loop:true,
            navText:[' <img class="icon-slider" src="images/carousel-prev1.png">'
            , '<img class="icon-slider" src="images/carousel-next1.png">']  
          });
  

 
  jQuery(window).on('load',function () {
    
    var first_visit="<?php  
                          
                          if(!isset(Yii::app()->session['first_visit']))
                          {
                            echo 'notisset';
                          }
                          else if(Yii::app()->session['first_visit']=='true')
                          {
                            echo 'true';
                          }else if(Yii::app()->session['first_visit']=='false')
                          {
                            echo 'false';
                          }else{
                            echo 'kk';
                            }
                          
                          ?>";
    if(first_visit=='notisset' || first_visit=='true'){
      
     
      $("#myModal").modal('show');
      <?php Yii::app()->session['first_visit']='true'; ?>
      first_visit="<?php echo Yii::app()->session['first_visit']; ?>";
      
    }
    // else if(first_visit=='true')
    
    // {
    //   $("#myModal").modal('show');
    // }


});


  $("#bclose").click(function(){
        <?php Yii::app()->session['first_visit']='false'; ?>
    });
	
	$('#myCarousel').on('slide.bs.carousel',function(e) {
		var prev = $(this).find('.active');
		<!-- console.log(prev); -->
        var videoSlide = $('#video-player').closest('.carousel-item');
		if(videoSlide.index()==-1)
		{
			
			callPlayer(prev[1].id,'pauseVideo')	
		}
			
		
		
       
    });
	//to stop youtube video
	
	function callPlayer(frame_id, func, args) {
    if (window.jQuery && frame_id instanceof jQuery) frame_id = frame_id.get(0).id;
    var iframe = document.getElementById(frame_id);
    if (iframe && iframe.tagName.toUpperCase() != 'IFRAME') {
        iframe = iframe.getElementsByTagName('iframe')[0];
    }
    if (iframe) {
        // Frame exists, 
        iframe.contentWindow.postMessage(JSON.stringify({
            "event": "command",
            "func": func,
            "args": args || [],
            "id": frame_id
        }), "*");
    }
}
