Change Class with javascript
===

I have a problem, i'm doing one site for school work, the background size is cover, to get every screen, but when you resize the browser, every div goes out of it's place, so i tried to make a onResize javascript code: 

> function MOSTRA() {

> var SCR = screen.availWidth

> var BRW = window.outerWidth

	if BRW < SCR {
	document.getElementById(BODY).className = 'BDYL'
	 }
	 else { document.getElementById(BODY).className = 'BDNL' 
	 }
	 }
    <body id="BODY" class="BDNL" onResize="MOSTRA()">

So i through that if you resize you window to some lower width than your screen, it would change the class to one that is Background-size:auto, so it wouldn't go wrong, but it doesn't change the class.
So, how can i change the background size or the whole class? can't use more than JAVASCRIPT, HTML, or CSS.

sorry for any english errors...