// layout2.js
// Cross-Browser.com & SitePoint.com - Equal Column Height Demo (2 Column)

if (document.getElementById || document.all) { // minimum dhtml support required
  document.write("<"+"style type='text/css'>#footer{visibility:hidden;}<"+"/style>");
  window.onload = winOnLoad;
}
function winOnLoad()
{
  adjustWidth();
  var ele = xGetElementById('layer1');
  if (ele && xDef(ele.style, ele.offsetHeight)) { // another compatibility check
    adjustLayout();
    xAddEventListener(window, 'resize', winOnResize, false);
  }
}
function winOnResize()
{
  adjustWidth();
  adjustLayout();
}
function adjustLayout()
{

  // Get content heights
  var cHeight = xHeight('layer1');
  var lHeight = xHeight('layer2');

  // Find the maximum height
  var maxHeight = Math.max(lHeight, cHeight);

  // Assign maximum height to all columns
  xHeight('layer1', maxHeight);
  xHeight('layer2', maxHeight);
	
  // Show the footer
  xShow('footer');
}

function adjustWidth()
{
  //Get width sorted for layer1, layer1-2 and FCKEditor
  var layerwidth, innerlayerwidth, fckeditorwidth;
  var xUA=navigator.userAgent.toLowerCase();
  if (xUA.indexOf('msie')!=-1)
  { 
		layerwidth = screen.width - 255;
		innerlayerwidth = layerwidth - 215;
		fckeditorwidth = innerlayerwidth - 50;
  }
  else
  {
		layerwidth = window.innerWidth - 245;
		innerlayerwidth = layerwidth - 212;
		fckeditorwidth = innerlayerwidth - 20;
  }
  xWidth('layer1', layerwidth);
  xWidth('layer1-2', innerlayerwidth);
  xWidth('sknDiscussions_FCKeditor1___Frame', fckeditorwidth);
}