﻿function deactivateMenus() {
var anchorarr=document.getElementsByTagName("a");
var inactives=["2020","2021","2264","2265","2266","2267","1224"];


for (x=0;x<anchorarr.length;x++) {

if (anchorarr[x].className=="nav1" || anchorarr[x].className=="nav1aktiv" || anchorarr[x].className=="nav2" || anchorarr[x].className=="nav2aktiv") {

for (y=0;y<inactives.length;y++) {

if (anchorarr[x].href.indexOf(inactives[y])>-1) {
//document.write(anchorarr[x].href+'<br>');
//document.write("inactive<br>");
anchorarr[x].href = '#';
anchorarr[x].style.cursor = 'default';
}
}
}
}



}


Tangora.Events.AddHandler(window,"onload", function() {window.setTimeout(deactivateMenus,100);});

front=true;
var privateLinkCount=0;
var companyLinkCount=0;

function GetRequestParam(paramname) {
  // DH
  // Get a parameter from the URL
  var str="", start, length;
  var url=location.search.toLowerCase();
  paramname=paramname.toLowerCase();
  start=url.indexOf("&"+paramname+"=");
  if (start==-1) {
    start=url.indexOf("?"+paramname+"=");
  }
  end=url.indexOf("&", start+1);
  if (start!=-1) {
    str=url.substr(start+paramname.length+2);
    length=str.indexOf("&");
    if (length!=-1) {
  str=str.substr(0,length);
    }
  }
  return str;
}



function AddLink()
{
    //identify selected text
    var sText = document.selection.createRange();
    if (sText.text != "")
    {
	//create link
	document.execCommand("CreateLink");
	//change the color to indicate success
	if (sText.parentElement().tagName == "A")
	{
	  sText.execCommand("ForeColor",false,"#FF0033");
	}
    }
    else
    {
	  alert("Please select some text!");
    }   
}



// Hent side i div

var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
  {// code for Firefox, Opera, IE7, etc.
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
else
  {
  alert("Your browser does not support XMLHTTP.");
  }
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {// 4 = "loaded"
  if (xmlhttp.status==200)
    {// 200 = "OK"
    document.getElementById("T1").innerHTML=xmlhttp.responseText;
    }
  else
    {
    alert("Problem retrieving data:" + xmlhttp.statusText);
    }
  }
}

// this function puts the dark screen over the entire page
function DarkenPage()
{
    var page_screen = document.getElementById('page_screen');
    page_screen.style.height = document.body.parentNode.scrollHeight + 'px';
    page_screen.style.display = 'block';
}

// this function removes the dark screen and the page is light again
function LightenPage()
{
    var page_screen = document.getElementById('page_screen');
    page_screen.style.display = 'none';
}

function closepage() {
document.getElementById("nyhedsbrev").removeChild(document.getElementById("subdiv"));
document.getElementById("nyhedsbrev").removeChild(document.getElementById("T1"));
document.getElementById("nyhedsbrev").style.top='0px';
document.getElementById("nyhedsbrev").style.display='none';

}

function openpage(hentet) {
//document.style="filter:alpha(opacity=80);opacity: 0.8;";
//var newdiv=document.createElement("div");
//newdiv.setAttribute("id", "subdiv");

//var newtext=document.createTextNode('');

//newdiv.appendChild(newtext);

var newdiv2=document.createElement("div");
newdiv2.setAttribute("id", "T1");




document.getElementById("nyhedsbrev").appendChild(newdiv2);
document.getElementById("nyhedsbrev").style.top=getscrollpos()+50+'px';
//document.getElementById("nyhedsbrev").scrollIntoView(true);

loadXMLDoc(hentet);
document.getElementById("nyhedsbrev").style.display='';
}

function getscrollpos() {
return document.documentElement.scrollTop;
}
