var controllSize;
var controllSizeThree;
var controllSizeTwo;
var controllSizeOne;
$('#headerwrap').ready(function() {
var ua = navigator.userAgent;
if (ua.search(/Firefox/) > 0){ controllSizeOne = 1287 ; controllSizeTwo = 883 ; controllSizeThree = 733;}
else{ controllSizeOne = 1300 ; controllSizeTwo = 900 ; controllSizeThree = 750; }
});
var MAX = 'max';
var MIN;
var Content = $('#content');
var sideBar = $('#sidebar');
var scrolledH;
var rightSidebarH = $('#sidebar').height();
function scrollScreen () {
scrolledH = $(document).scrollTop();
if ( scrolledH > rightSidebarH ) {
sideBar.hide();
Content.removeClass(MIN);
Content.addClass(MAX);
}else {
sideBar.show();
Content.removeClass(MAX);
Content.addClass(MIN);
}
};
function resizeScreen () {
var sizesWindow = $('#headerwrap').width();
switch( true ){
case sizesWindow >= controllSizeOne:
MIN = 'minOne';
scrollScreen();
break;
case sizesWindow < controllSizeOne && sizesWindow >= controllSizeTwo:
MIN = 'minTwo';
scrollScreen();
break;
case sizesWindow < controllSizeTwo && sizesWindow >= controllSizeThree:
MIN = 'minThree';
scrollScreen();
break;
case sizesWindow < controllSizeThree:
MIN = MAX;
scrollScreen();
break;
}};
addEventListener('scroll', scrollScreen, false);
addEventListener('resize', resizeScreen, false);
$('body').ready(function() {
var sizesWindow = $('#headerwrap').width();
Content.removeClass('minOne');
Content.removeClass('minTwo');
Content.removeClass('minThree')
switch( true ){
case sizesWindow >= controllSizeOne:
MIN = 'minOne';
scrollScreen();
break;
case sizesWindow < controllSizeOne && sizesWindow >= controllSizeTwo:
MIN = 'minTwo';
scrollScreen();
break;
case sizesWindow < controllSizeTwo && sizesWindow >= controllSizeThree:
MIN = 'minThree';
scrollScreen();
break;
case sizesWindow < controllSizeThree:
MIN = MAX;
scrollScreen();
break;
}
});