
// function MakeElacticLayout(minw,optw,maxw){
// if(document.getElementById){
// 	el_SetWidth(minw,optw,maxw);
// 	window.onresize=function(){el_SetWidth(minw,optw,maxw);}
// 	}
// }

function el_SetWidth(minw,optw,maxw){
	var w=el_getBrowserWidth();
	if(w==0) return;
	var el=document.getElementsByTagName('BODY')[0];
	//var el = document.getElementById('bodybox');
	el.style.marginLeft="auto";
	el.style.marginRight="auto";
	var d=el.style;
	if(w<=minw) { // we are fixed here
		d.width=minw+"px";
	}else if(w>=maxw) { // we are again fixed here
		d.width=maxw+"px";
	}else if (w <= optw){ // w > minw  && w<= optw // we are fluid here
		d.width = 'auto' ;
	}else{ // 	w > optw && w < max w // we are elastic here
		d.width = 'auto' ;
		// it would be nice to go elastic here
	}
}

function el_getBrowserWidth(){
	if (window.innerWidth!=window.undefined) {
		if (document.body.scrollHeight > 0 ) { // account for scrollbar
			return window.innerWidth - 15 ;
		}
		return window.innerWidth;
        }
        if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth;
        if (document.body) return document.body.clientWidth;
        return 0;
}