var pstop=false,continueParallax=function(){
  pstop=false;
  jQuery("#stage").jparallax({yparallax:false},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1,width:2100,height:1035});
};
  
jQuery(document).ready(function(){

  var startParallax=function(){
    jQuery("#stage").jparallax({yparallax:false},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1},{xtravel:0.1,width:2100,height:1035});
  },stopParallax=function(){
    //jQuery("#stage").jparallax({mouseResponse:false,xparallax:false,yparallax:false});
    pstop=true;
  };
  
    
  startParallax();
  
  jQuery("#dark").css({opacity:0.65});
  
  jQuery("#last div").click(function(){
    jQuery("#dark").css({display:"block",width:jQuery(window).width(),height:jQuery(window).height()});
    var id=this.id.substring(7);
    jQuery("#d"+id).css({display:"block"});
    jQuery("#wstage").css({ display: "block" });
    stopParallax();
    var p=jQuery("#picture"+id).offset();
    var p2=jQuery("#d"+id).offset();
   
    jQuery("#d"+id+" img").css({left:p.left-p2.left,top:p.top-p2.top});
     		
  });
  
  var day=function(){
    jQuery("#dark").css({display:"none"});
    jQuery("#wstage div").css({display:"none"});
    jQuery("#wstage").css({display:"none"});
    continueParallax();
  };
  
  jQuery(document).keyup(function(e){ 
    if(e.which===27){
      day();
      jQuery("#yt").css({display:"none"}).html("");
      continueParallax();
    } 
  });


  jQuery("#wstage .cls").click(day);


  jQuery("#dark").click(day);

  jQuery(window).resize(function(){
    jQuery("#dark").css({width:jQuery(window).width(),height:jQuery(window).height()});
   });
  
    
  jQuery("#tv a").click(function(e){
    window.focus();
    stopParallax();
    jQuery("#dark").css({display:"block"});
    jQuery("#yt").css({display:"block"}).html('<iframe width="560" height="315" src="http://www.youtube.com/embed/2EuYVyD5dNA" frameborder="0" allowfullscreen></iframe><span class="cls" onclick="jQuery(\'#dark\').css({display:\'none\'});jQuery(\'#yt\').css({display:\'none\'});continueParallax();jQuery(\'#yt\').html(\'\')"></span>');
    return false;
  });
  
  

});
