function genericLayout(frameWidth, frameHeight, frameTop, frameLeft) {
  var conversationE = document.getElementById("conversation");
  var nlE = document.getElementById("nlInteraction");
  var appletE = document.getElementById("AppletDiv");
  var statusE = document.getElementById("StatusBar");
  var logoE = document.getElementById("Logo");
  var recResultsE = document.getElementById("RecResults");
  var galaxyHTMLE = document.getElementById("galaxyHTML");
  var loggedInE = document.getElementById("LoggedInDiv");
  var scenarioE = document.getElementById("ScenarioDiv");

  var topHeight = frameTop;
  var statusHeight = 19;
  var controlHeight = 25;

  var statusWidth = frameWidth / 3;  
  if (statusE || recResultsE) {
	topHeight += statusHeight;
  } else {
    statusWidth = 0;
  }
  
  var appletWidth = (appletE != null) ? _appletWidth : 0;
  var appletHeight = (appletE != null) ? _appletHeight : 0;
  var logoWidth = (logoE != null) ? _logoImgWidth : 0;
  var logoHeight = (logoE != null) ? _logoImgHeight : 0;
  
  //var controlWidth = frameWidth - 15 - logoWidth - appletWidth;
  var controlWidth = 350;
	
  var recResultsHeight = 19;
  if (_inCar) {
  	statusWidth = 85;
  }
  var recResultsWidth = frameWidth - statusWidth - 5;

  var conversationHeight, conversationWidth, conversationLeft, conversationHeight;
  var htmlTop, htmlLeft, htmlWidth, htmlHeight;

  var nlTop  = appletHeight;
  var nlLeft =  (logoWidth + 5);
  var nlWidth = (controlWidth + (_wideConversation ? 300 : 0));
  var nlHeight = controlHeight;
  
  
  if(_wideConversation) {  
  	conversationTop = topHeight + statusHeight + 5;
  	conversationWidth = frameWidth - 20;
  	conversationLeft = 10;
  	conversationHeight = topHeight;
  	
  	var nlOffset = 0;

	if(_inputNLBelow) {
  		nlTop = conversationTop + conversationHeight + 5;
		nlHeight = controlHeight + 10; 
		nlLeft = 10;
		nlWidth = frameWidth - 20;
		nlOffset = nlHeight + 5;
		document.getElementById("inputNL").size = (_inputNLWidthOverride != -1) ? _inputNLWidthOverride : 140;
  	}
  	
  	
  	htmlTop = topHeight + statusHeight + conversationHeight + 5 + nlOffset;
  	htmlLeft = 0;
  	htmlWidth = frameWidth;
  	htmlHeight = frameHeight - topHeight - statusHeight - conversationHeight - 5 - nlOffset;
  } else {
	  conversationTop  = 0;
	  conversationWidth = frameWidth - controlWidth - logoWidth - 5;
	  conversationLeft = frameWidth - conversationWidth - 5;
	  conversationHeight = topHeight;
	  
	  htmlTop = (topHeight + statusHeight + 5);
  	  htmlLeft = 0;
 	  htmlWidth = frameWidth - 5;
      htmlHeight = frameHeight - topHeight - statusHeight - 5;
  }
   
  //override some settings for in car and mobile
  if(_inCar || _mobile) {
  	appletHeight = 0;
  	controlHeight = 0;
  	logoHeight = 0;
  	topHeight = 0;
  	conversationHeight = 0;
  	nlHeight = 0;
  }
  
  if(loggedInE) {
	loggedInE.style.left = logoWidth + 5 + appletWidth + 5 + "px";
	loggedInE.style.top = "10px";  
  }

  if (statusE) {
  	statusE.style.top = topHeight + "px";
  	statusE.style.left = "0px";
  	statusE.style.width = statusWidth + "px";
  	statusE.style.height = statusHeight + "px";
  }
  
  if(conversationE) {
  	conversationE.style.top = conversationTop + "px";
  	conversationE.style.width = conversationWidth + "px";
  	conversationE.style.left = conversationLeft + "px";
  	conversationE.style.height = conversationHeight + "px";
  }
  
  if(nlE) {
  	nlE.style.top = nlTop + "px";
  	nlE.style.left = nlLeft + "px";
  	nlE.style.width = nlWidth + "px";
  	nlE.style.height = nlHeight + "px";
  }
    
  if(scenarioE) {
  	scenarioE.style.top = "0px";
  	scenarioE.style.left = "0px";
  	var scenarioWidth = (logoWidth - 5);
  	scenarioE.style.width = scenarioWidth + "px";
  	scenarioE.style.height = _scenarioIsMaximized ? "" : ((topHeight - 9)+ "px");  	  	  	
  }
  
  if (recResultsE) {
	  recResultsE.style.top = topHeight + "px";
	  recResultsE.style.left = (statusWidth + 5) + "px";
	  recResultsE.style.width = recResultsWidth + "px";
	  recResultsE.style.height = recResultsHeight + "px";
  }
	
  if (_inCar) {
  	recResultsE.style.zIndex = "6";
  	//recResultsE.style.backgroundColor = "#ff9900"; // this does not work because the spans get appended.
  }
  
  if(galaxyHTMLE) {
  	galaxyHTMLE.style.top = htmlTop + "px";
  	galaxyHTMLE.style.left = htmlLeft + "px";
  	galaxyHTMLE.style.width =  htmlWidth + "px";
  	galaxyHTMLE.style.height = htmlHeight + "px";
  }
  
  //let any application-specific handlers do their layout
  if(_galaxyHandlers && _galaxyHandlers.layoutHandler) _galaxyHandlers.layoutHandler(frameWidth, frameHeight, topHeight, statusHeight);
}
