// imane on mouse over
function imgOver(item)
{
    if (item.srcn == null)
        item.srcn = item.src;
    item.src = item.getAttribute("srco");
	
}
function imgOut(item) 
{
    item.src = item.srcn;
}
// Expand or Collapse element
function ExpandOrCollaps(id)
{
    
    var obj = document.getElementById(id);
    obj.className = obj.className == 'collapsed'? 'expanded': 'collapsed';
}
/*
function removeSlash(itm)
{
	if(!itm)
		itm = document;
	if(itm.tagName && itm.tagName.toLowerCase() == "img")
	{

		if(itm.attributes["src"])
			itm.attributes["src"].value = itm.attributes["src"].value.replace("~/", "");
		if(itm.attributes["srco"])
			itm.attributes["srco"].value = itm.attributes["srco"].value.replace("~/", "");
	}
	for(var i=0; i<itm.childNodes.length; i++) 
		removeSlash(itm.childNodes[i]);
}


function onPageLoad()
{
	if(window.location.pathname.indexOf("/~/") > -1)
	{
		setTimeout("removeSlash();", 200);
	}
}
if(document.addEventListener)
	document.addEventListener("DOMContentLoaded", onPageLoad, false);
else
	window.attachEvent('onload',onPageLoad);
*/
/* 
============================================================================================================================================
// Expand or collapse FAQ
============================================================================================================================================
*/
function HideAll(att) {
  if (att) {
      if (att.attributes && att.attributes["name"] && att.attributes["name"].value == "faq") {
          att.style.display = 'none';
          if (att.previousSibling.attributes['closeclass'] != undefined) {
              att.previousSibling.className = att.previousSibling.attributes['closeclass'].value;
          }
      }
      for (var i = 0; i < att.childNodes.length; i++) 
        HideAll(att.childNodes[i]);
  }
}

function ShowParentNode(node) {
    if (node && node.parentNode && node.parentNode.attributes["name"] && node.parentNode.attributes["name"].value == "faq") {
      for (var i = 0; i < node.parentNode.childNodes.length; i++)
          if (node.parentNode.childNodes[i] != node)
              HideAll(node.parentNode.childNodes[i]);
      ShowParentNode(node.parentNode);
  }
}

function ShowHideNode(node) {
  if (node && node.attributes["name"] && node.attributes["name"].value == "faq") {
      for (var i = 0; i < node.childNodes.length; i++)
          HideAll(node.childNodes[i]);
    if (node.previousSibling.attributes['openclass'] != undefined)
      if (node.style.display == 'none') {
      if (node.previousSibling.attributes['closeclass'] == undefined)
          node.previousSibling.setAttribute('closeclass', node.previousSibling.attributes['class'].value);
      node.previousSibling.className = node.previousSibling.attributes['openclass'].value;
    }
    else if (node.previousSibling.attributes['closeclass'] != undefined)
      node.previousSibling.className = node.previousSibling.attributes['closeclass'].value;
        
    node.style.display = (node.style.display == 'none') ? 'block' : 'none';

      ShowParentNode(node);
  }
}
function showOrHide(obj) {
    if (obj) 
        ShowHideNode(obj.nextSibling);
}
/* Search */
var selectedServicemenu = null;
var subsite = '';
var searchpage = '';
function ssSetVisible(divID, ss, sp) {
    ssSetInvisible();
    subsite = ss;
    searchpage = sp;
    var divIDobj = document.getElementById(divID);
    if (divIDobj.style.display == "none") {
        divIDobj.style.display = "block"; // Viser dropdownbox med log ind
        
        selectedServicemenu = divID; // Overskriver global variablen med den presente
        if (divID == 'Soeg') {
            var soegeordobj = document.getElementById("soegeord");
            soegeordobj.focus();
            soegeordobj.select();
        }
    }
}

function ssSearch() {
    window.location = searchpage + "?searchtext=" + document.getElementById('soegeord').value + "&s=" + subsite;
}

function ssSetInvisible() {
    if (selectedServicemenu != null) {
        document.getElementById(selectedServicemenu).style.display = "none"; // Skjuler dropdownbox med log ind
        selectedServicemenu = null;
    }
}

function ssKeyPressed(event) {
    if (event.keyCode == 13) { // Der er klikket på [Enter]
        ssSearch();
        return false; // Stopper form action
    }
}

