﻿var agt    = navigator.userAgent.toLowerCase();
var is_mac = (agt.indexOf("mac") != -1);
var is_safari = (agt.indexOf("safari") != -1);
var is_gecko = ((agt.indexOf("gecko") != -1) && (!is_safari));
var is_opera = (agt.indexOf("opera") != -1);
var is_ie = ((agt.indexOf("msie") != -1) && (!is_opera));
var is_ie6 = ((agt.indexOf("msie 5") != -1) || (agt.indexOf("msie 6") != -1));
var is_ie7 = ((is_ie) && (!is_ie6));

function init() {
  if((is_ie7)||(is_opera)) {
  var viewportHeight = document.documentElement.offsetHeight || window.innerHeight;
  var remainedHeight = viewportHeight - 105;
  document.getElementById("content").style.height = remainedHeight + 'px';
  var scrolledHeight = document.getElementById("content").offsetHeight;
  var overflowHeight = scrolledHeight - remainedHeight;				//0 hvis ikke scrollbar
  var adjustedHeight = remainedHeight + overflowHeight - 26;
  var nestedTable1 = document.getElementById("channel1").childNodes[1] || document.getElementById("channel1");
  var nestedTable2 = document.getElementById("channel2").childNodes[1] || document.getElementById("channel2");
  nestedTable1.style.height = adjustedHeight + 'px';
  nestedTable2.style.height = adjustedHeight + 'px';
  }
}

function Show(button, mode) {
button.src = '../files/intra/external/' + mode + '.png';
}

var strCSS = '<style type="text/css">';
if(!is_ie6) {
  strCSS += 'div#panel div{width:61px;cursor:default;float:left;margin-right:2px;margin-bottom:2px;text-align:right;display:block;padding-left:1px;padding-right:1px;color:rgb(96,161,215);border:1px solid rgb(96,161,215);}';
  if(!is_opera) {
  strCSS += 'div#bodytext textarea{height:18px;}';
  }
  else {
  strCSS += 'div#bodytext textarea{height:60px;}';
  }
}
else {
strCSS += 'div#panel div{width:65px;cursor:default;float:left;margin-right:2px;margin-bottom:2px;text-align:right;display:block;padding-left:1px;padding-right:1px;color:rgb(96,161,215);border:1px solid rgb(96,161,215);}';
}
if(!is_ie) {
strCSS += 'html{overflow:-moz-scrollbars-vertical;}';
strCSS += 'div#bodytext{width:540px;margin:15px;}';
}
else {
strCSS += 'div#bodytext{width:540px;margin:15px;overflow:hidden;}';
}
strCSS += '</style>';

document.write(strCSS);
