// JavaScript Document
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
var w;
var h;
var minWidth = 400;
var maxWidth = 550;
var minHeight = 100;
		
function getWidth() {
	if(document.body.clientWidth && document.body.clientHeight){ 
		w = document.body.clientWidth;
		h = document.body.clientHeight;
	}
	if(window.innerWidth && window.innerHeight){
		w = window.innerWidth;
		h = window.innerHeight;
	}
}

function reFlow(){ 
	getWidth();
	if(document.getElementById){
		bodyText = document.getElementById("Layer1").style;
		rightBorder = document.getElementById("BottomRight").style;
		homediv = document.getElementById("homeLayer").style;
		LeftBar = document.getElementById("painting").style;
	}else{

		bodyText = document.all.Layer1.style;
		rightBorder = document.all.BottomRight.style;
		homediv = document.all.homeLayer.style;
	}
	

		//maxHeight = 550;
		targetWidth = w - parseInt(bodyText.left) - 120;
		targetHeight = h - parseInt(bodyText.top) - 60;

		if(targetWidth > minWidth && targetWidth < maxWidth){
			bodyText.width = targetWidth
		}
		
		if(targetWidth < minWidth){
			bodyWidth = minWidth
		}
		
		if(targetWidth > maxWidth){
			bodyText.width = maxWidth
		}
		if(minHeight < targetHeight ){
			bodyText.height = targetHeight;
		}
		
		
		targetLeft = w - 100;
		targetTop = h - 100;
		
		minLeft = parseInt(bodyText.left) + parseInt(bodyText.width) - 40;
		minTop = parseInt(bodyText.top) + parseInt(bodyText.height) - 30;
		if(minLeft < targetLeft){
			rightBorder.left = targetLeft;
		}else{
			rightBorder.left = minLeft;
		}
		if(minTop < targetTop){
			rightBorder.top = targetTop + 150;
		}else{
			rightBorder.top = minTop + 150 ;
		}
		
		if(parseInt(LeftBar.height) > parseInt(bodyText.height))
		{
			rightBorder.top = parseInt(LeftBar.height)+200;
			homediv.top = parseInt(LeftBar.height)+270;
			homediv.left = w/2;
		}
		else{
			homediv.top = parseInt(rightBorder.top)+70;
			homediv.left = w/2;
		}
	
}