function last(css_id){
	T = $(css_id).childNodes[$(css_id).childNodes.length-1];
	T.className = T.className + " last";
}

function ff_fp_divs_size(){
    f1 = 0;
    f2 = 0;
    f3 = 0;
    if ($("ff1")){
        f1 = $("ff1").offsetHeight;
    }
    if ($("ff2")){
        f2 = $("ff2").offsetHeight;
    }
    if ($("ff3")){
        f3 = $("ff3").offsetHeight;
    }
    M = Math.max(f1, f2, f3);
    if ($("ff1")) $("ff1").style.height = M + "px";
    if ($("ff2")) $("ff2").style.height = M + "px";
    if ($("ff3")) $("ff3").style.height = M + "px";
}

function popwin(e, fil, navn, bred, hoj, scroll, resize) {

	if (!e) {
		if (window.event) {
			e = window.event;
		} else {
			return;
		}
	}
	if (e.cancelBubble != null) e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	if (e.preventDefault) e.preventDefault();
	if (window.event) e.returnValue = false;
	if (e.cancel != null) e.cancel = true;

	window.open(fil,navn,eval("'width=" + bred + ",height=" + hoj + ",scrollbars=" + scroll + ",resizable=" + resize + ",status=no,titlebar=no'"));
	
}


function ff_subpage_divs_size(){

	if ( $("rightcol") != undefined ) {
		// Højre kolonne eksisterer ikke...
		M = Math.max($("leftcol").offsetHeight, $("midcol").offsetHeight, $("rightcol").offsetHeight);

		$("leftcol").style.height = M + "px";
		$("midcol").style.height = M + "px";
		$("rightcol").style.height = M + "px";
	} else {
		// Højre kolonne findes...
		M = Math.max($("leftcol").offsetHeight, $("midcol").offsetHeight);

		$("leftcol").style.height = M + "px";
		$("midcol").style.height = M + "px";
	}
}

function ff_openstockportal(file) {
  window.open('https://aktiebog2.prod.bec.dk/00000/aktionaer_portal.asp?ASIdent=20820', '', 'width=800,height=600');
}

function ff_openinteractivegraph() {
  window.open('http://omxlinkweb.omxgroup.com/omxlinkproxy/IR/irmodule.aspx?id=CSE37192&lang=da&width=770&height=570&menu=right&bgcolor=FFFAF0&graphbgcolor=FFFFFF&graphstripecolor=FFFFFF&graphcolor=000080&legendbgcolor=F5F5F5&textcolor=000000&comparecolor=FFC800&periode1color=A52A2A&periode2color=EE82EE&highlowcolor=A020F0&compare=3&cmp3id=SSESE0001776253&cmp3name=Nordic%20Information%20Technology&compare=3', '', 'width=800,height=600');
}

function ff_openwebcast() {
  window.open('http://webcast.zoomvision.se/denmark/clients/firstfarms/070328/frameset.php?chapter_1.asx&&9&video', '', 'width=975,height=700');
}

function ff_openstockwise() {
  window.open('http://www.stockwise.tv/ws3/mgpplayers/frmset1.asp?id=613', '',
              'width=975,height=700,resizable=no');
}

function ff_openvideoplayer(file) {
  window.open('/site/player/ask/'+file, '',
              'scrollbars=no,menubar=no,width=400,height=300,resizable=yes,toolbar=no,location=no,status=no');
}

function ff_playvideo(name,quality) {
  // Hide the question box
  document.getElementById("ff-player-ask").style.display="none";
  var player = document.getElementById("ff-player");

  if (quality == "high") {
      width = 800;
      height = 600;
      video_url = "http://windowsmedia.arkena.dk/firstfarmwm/videohotel/infovideo_high.asf";
  } else {
      width = 400;
      height = 300;
      video_url = "http://windowsmedia.arkena.dk/firstfarmwm/videohotel/infovideo_low.asf";
  }

  // Show the player
  player.width = width;
  player.height = height;
  player.src = video_url;
  player.style.display="block";

  // Resize window to fit player
  ff_resize_window(width, height);
}

function ff_openarkena() {
  window.open('http://ms.arkena.com/show/?k=11857824962206d6e61611470e5be42039f8afca2f49511151', '',
  'scrollbars=no,menubar=no,width=1000,height=700,resizable=yes,toolbar=no,location=no,status=no');
}

function ff_openarkena_en() {
  window.open('http://ms.arkena.com/show/?k=11857924982398007bcaae317adf3020f6d2cab961e4811153', '',
  'scrollbars=no,menubar=no,width=1000,height=700,resizable=yes,toolbar=no,location=no,status=no');
}

function ff_resize_window(width, height) {
    window.resizeTo(width, height);
}

function ff_getget(name) {
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if (results == null)
    return "";
  else
    return results[1];
}


/**
 * This function opens the current page in a new window for print.
 * print_url is the current URL, but with "/print" inserted at the
 * root, just after the hostname.
 **/
function ff_print() {
    var href = window.location.href;
    print_url = "";
    tmp = href.split("/");
    for (i in tmp) {
      if(i == 0) {
        print_url = tmp[i];
      } else if (i == 3) {
        print_url = print_url + "/printable/" + tmp[i];
      } else {
        print_url = print_url + "/" + tmp[i];
      }
    }
    window.open(print_url, '', 'menubar=yes,resizable=yes,toolbar=no,location=yes,status=no');
}


sfHover = function() {
    var sfEls = document.getElementById("menuul").getElementsByTagName("LI");
    for (var i=0; i<sfEls.length; i++) {
        sfEls[i].onmouseover=function() {
            this.className+=" sfhover";
        }
        sfEls[i].onmouseout=function() {
            this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

