
var phoneSlideshow = (function() {

	function init() {
		[].slice.call( document.querySelectorAll( '.ms-wrapper' ) ).forEach( function( el, i ) {
			var open = false;
				el.querySelector( '.ms-screen-4' ).addEventListener( 'click', changeView, false );
			el.querySelector( '.ms-screen-4' ).addEventListener( 'touchstart', changeView, false );
			function changeView() {
				if( open ) {
					classie.remove( el, 'ms-view-layers' );
					shield.src="";
					shield.src="trik/bug/image/start.ogg";
					shield.play();
				}
				else {
					/**/classie.add( el, 'ms-view-layers' );
					shield.src="";
					shield.src="trik/bug/image/shield.ogg";
					shield.play();
					
					//window.location="trik/bug/bug2.html";
				}
				open = !open;
			}
			
			el.querySelector( '.ms-screen-2' ).addEventListener( 'click', changeView2, false );
			el.querySelector( '.ms-screen-2' ).addEventListener( 'touchstart', changeView2, false );
			
			
			function changeView2() {
			/*	if( open ) {
					classie.remove( el, 'ms-view-layers' );
				}
				else {
					classie.add( el, 'ms-view-layers' );
					window.location="trik/trik.html";
				}
				open = !open;*/
				
				
				
				
				
				
				
  		
  		  var introc2 = setInterval(function () {
           overlayintro.style.display="block";
                       overlayintro.style.backgroundImage = "url(trik/images/intro6.gif)";
           overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";

                                        shield.src="";
					shield.src="trik/bug/image/pausa.ogg";
					shield.play();
            clearInterval(introc2);
        }, 10);
        
 
  		  var introc3 = setInterval(function () {
  		        overlayintro.style.backgroundImage = "url(trik/images/introfin.gif)";
   overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
     

 overlay.style.backgroundImage = "url(images/intro.gif)";
             overlay.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
          


            clearInterval(introc3);
        }, 4000);
        
        
        /**/
        	  var introc4 = setInterval(function () {
      
                overlayintro.style.backgroundImage = "url(trik/images/introfin.gif)";
   overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
       

          // overlayintro.style.display="none";


             
           
            clearInterval(introc4);
        }, 5000);
        
       /*  */ var introc5 = setInterval(function () {
      
            
   

         //  overlayintro.style.display="none";
           
                  
window.location="trik/bug/bug2.html";

            clearInterval(introc5);
        }, 8000);
        
  
				
				
				
				
				
				
				
				
				
				
			}
			
			el.querySelector( '.ms-screen-3' ).addEventListener( 'click', changeView3, false );
			el.querySelector( '.ms-screen-3' ).addEventListener( 'touchstart', changeView3, false );
			
			
			function changeView3() {
			/*	if( open ) {
					classie.remove( el, 'ms-view-layers' );
				}
				else {
					classie.add( el, 'ms-view-layers' );
					window.location="trik/trik.html";
				}
				open = !open;*/
				
				
				
				
				
				
				
  		
  		  var introc2 = setInterval(function () {
           overlayintro.style.display="block";
                       overlayintro.style.backgroundImage = "url(trik/images/intro6.gif)";
           overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";

                                        shield.src="";
					shield.src="trik/bug/image/pausa.ogg";
					shield.play();
            clearInterval(introc2);
        }, 10);
        
 
  		  var introc3 = setInterval(function () {
  		        overlayintro.style.backgroundImage = "url(trik/images/introfin.gif)";
   overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
     

 overlay.style.backgroundImage = "url(images/intro.gif)";
             overlay.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
          


            clearInterval(introc3);
        }, 4000);
        
        
        /**/
        	  var introc4 = setInterval(function () {
      
                overlayintro.style.backgroundImage = "url(trik/images/introfin.gif)";
   overlayintro.style.backgroundSize = "100% 100%,0px 0px ,auto,auto";
       

          // overlayintro.style.display="none";


             
           
            clearInterval(introc4);
        }, 5000);
        
       /*  */ var introc5 = setInterval(function () {
      
            
   

         //  overlayintro.style.display="none";
           
                  
window.location="trik/bug/bug.html";

            clearInterval(introc5);
        }, 8000);
        
  
				
				
				
				
				
				
				
				
				
				
			}
			
			
			
			
			
			el.querySelector( '.ms-screen-1' ).addEventListener( 'click', changeView1, false );
			el.querySelector( '.ms-screen-1' ).addEventListener( 'touchstart', changeView1, false );
			function changeView1() {/*
				if( open ) {
					classie.remove( el, 'ms-view-layers' );
				}
				else {
					classie.add( el, 'ms-view-layers' );
				}
				open = !open;*/
				window.location="trik/trik.html";
				
			}
			
			
			
		} );
	}

	init();

})();