var elemBodyLeft = 0;
var elemBodyRight = 0;
var currAutoSizeMode = 0; // 1 - wide, 2 - regular, 3 - small

function onWindowResize() {
	if(getWindowWidth() > 1440) {
		currAutoSizeMode = 1;
		setClassOf(elemBodyLeft, "body_left_wide");
		setClassOf(elemBodyRight, "body_right_wide");
	} else if(getWindowWidth() < 1280) {
		currAutoSizeMode = 3;
		setClassOf(elemBodyLeft, "body_left_hidden");
		setClassOf(elemBodyRight, "body_right_hidden");
	} else {
		currAutoSizeMode = 2;
		setClassOf(elemBodyLeft, "body_left");
		setClassOf(elemBodyRight, "body_right");
  }
}

function initOnWindowResize(resizeBaseHref, lastAutoSizeMode) {
	elemBodyLeft = elemById("domBodyLeft");
	elemBodyRight = elemById("domBodyRight");
	if(elemBodyLeft && elemBodyRight) {
		onWindowResize();
		if(resizeBaseHref) {
			if(lastAutoSizeMode) {
				if(!isNaN(lastAutoSizeMode) && currAutoSizeMode > 0) {
					if(lastAutoSizeMode >= 1 && lastAutoSizeMode <= 3) {
						if(lastAutoSizeMode != currAutoSizeMode) {
							self.location.href = resizeBaseHref + currAutoSizeMode;
						}
					}
				}
			}
		}
		setWindowResizeHandler(onWindowResize);
	}
}

