
if (screen.width >= '1152'){

  var WidthTelo = 806;
  
  var HeightTelo = 608;
  
  var WidthContent = 816;
  
  var WidthSait = 1162;

} else {

    var WidthTelo = 635;
    
    var HeightTelo = 498;
    
    var WidthContent = 645;
    
    var WidthSait = 1000;

  }

var WidthHBB = 810;

var WidthHbbTop = 810;

var WidthHbbLeft = 650;

var Plus = 20;

var Minus = 20;

var WkolaL = 34;

var WkolaR = 167;

var KoefX = 9;

var PosSliderRes = Math.ceil(WidthTelo/KoefX);

var KoefY = Math.ceil(HeightTelo/PosSliderRes);

var PolzCenterMouse = 5;

var Obj = "div#flashobj";

function Reset(){
  
  $(Obj).css({"width" : WidthTelo + "px"});
  
  $(Obj).css({"height" : HeightTelo + "px"});
  
  $("div#slider").css({"left" : PosSliderRes+ "px"});
  
  Element();
  
  return false;
      
}

function Element(){

    PosSelect = $("div#slider").position().left;
        
    WidthElement = PosSelect*KoefX;
        
    if(WidthElement<(WidthContent-10)){       
        
        $("div.wrip-fon").css({"width" : WidthSait + "px"});
        
        $("div#content").css({"width" : WidthContent + "px"});
        
        $("div.head-bottom-block").css({"width" : WidthHBB + "px"});
        
        $("div.hbb-top").css({"width" : WidthHbbTop + "px"});
        
        $("div.hbb-left").css({"width" : WidthHbbLeft + "px"});  
               
    }
        
    else{
        
        $("div.wrip-fon").css({"width" : (WidthElement + 352) + "px"});
        
        $("div#content").css({"width" : (WidthElement + 6) + "px"});
        
        $("div.head-bottom-block").css({"width" : WidthElement + "px"});
        
        $("div.hbb-top").css({"width" : WidthElement + "px"});
        
        $("div.hbb-left").css({"width" : (WidthElement - 160) + "px"});
        
    }
    
    $(Obj).css({"width" : (PosSelect*KoefX) + "px"});
            
    $(Obj).css({"height" : (PosSelect*KoefY) + "px"});
    
    return false;
    
}

function PluzMinus(flag){
    
    PosSelect = $("div#slider").position().left;
  
    if(flag==1){
    
        if(PosSelect<=147){
            
            $("div#slider").css({"left" : (PosSelect + Plus) + "px"});
        
        }
      
        else{$("div#slider").css({"left" : 167 + "px"});}
        
        Element();
    }
    
    else{
    
        if(PosSelect>=53){
            
            $("div#slider").css({"left" : (PosSelect - Minus) + "px"});
        
        }
        
        else{$("div#slider").css({"left" : 33 + "px"});}
        
        Element();
        
    }
   
    return false;
    
}

function OpenSS(){
  
  $("div.fifefox").css({"display" : "block"});
  
}

$(document).ready(function(){

//Startovaia begin______________________________________________________________
  
  if (navigator.userAgent.toLowerCase().indexOf('msie') > -1) {
  
      var url = "this.style.behavior= 'url(#default#homepage)'; this.setHomePage('http://winx-games.ru');"
  
      $("li.system-menu-knopka3").html('<a class="smaller" onclick="' + url + '" href="javascript:void(0);"><span>Сделать стартовой</span></a>'); 
  
  } else if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
  
            $("li.system-menu-knopka3").html('<a class="smaller" onclick="OpenSS();" href="javascript:void(0);"><span>Сделать стартовой</span></a>');
  
         } else if(navigator.userAgent.toLowerCase().indexOf('opera') > -1){
         
                    $("li.system-menu-knopka3").html('<a class="smaller" href="/?page_id=149#content"><span>Сделать стартовой</span></a>');
         
                } else if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1){
                
                          $("li.system-menu-knopka3").html('<a class="smaller" href="/?page_id=167#content"><span>Сделать стартовой</span></a>');
                
                       } else if(navigator.userAgent.toLowerCase().indexOf('safari') > -1){
                       
                                 $("li.system-menu-knopka3").html('<a class="smaller" href="/?page_id=179#content"><span>Сделать стартовой</span></a>');
                       
                              }

//startovaia end________________________________________________________________
  
  $( "div.selector" ).draggable({ axis: "x" });
  
  $( "div.selector" ).draggable({ cursor: "pointer" });
  
  $("div#slider-box").mousedown(function(e){
      
      x1 = $("div#slider-box").offset().left + WkolaL;
  
      x2 = $("div#slider-box").offset().left + WkolaR;
  
      $( "div.selector" ).draggable({ containment: [x1,0,x2,0] });
  
      pLeft=$("div#slider-box").offset();
      
      Schet = e.clientX;
      
      Rezult=Schet-pLeft.left;
      
      if(Rezult>38&&Rezult<172){
      
          $("div#slider").css({"left" : (Rezult-PolzCenterMouse) + "px"});
          
          Element();
          
      }
      
      $("div.entry-game").mouseover(function(e){     
          
          Element();
          
          return false;
          
       });
  
       return false;
  
  });

  $("div.entry-game").mouseup(function(){
      
      Element();
      
  });

});



