function SetDisplay (layername) {
  if  (document.getElementById(layername).className == "open") {
    document.getElementById(layername).className = 'close';
  }
  else {
    document.getElementById(layername).className = 'open';
  }
}

var openCloseTexts = new Array();
var closeText = "Luk";

function toggleMoreInfoLinks(divId)
{
  if(document.getElementById(divId + 'OpenCloseLink'))
  {
    var openCloseLinkObj = document.getElementById(divId + 'OpenCloseLink');

    if(openCloseLinkObj.innerHTML != closeText)
    {
      openCloseTexts[divId] = openCloseLinkObj.innerHTML;
    }

    if(openCloseLinkObj.innerHTML != closeText)
    {
      openCloseLinkObj.innerHTML = closeText;
    }
    else
    {
      openCloseLinkObj.innerHTML = openCloseTexts[divId];
    }
  }
}
// EBST javascripts

function mailMe() {
  var URL = '' + encodeURIComponent(location.href);
  var rr_subject = encodeURIComponent("Du er blevet tippet om ebst.dk ");
  var rr_body = encodeURIComponent("Hej, Jeg har fundet en side du skal se:");
  location.href="mailto:?subject=" + rr_subject + "&body=" + rr_body + escape('\n')+URL;
}

function showDiv(theDiv, theElement) {

    var selectedDiv = document.getElementById(theDiv);
    var theDiv0 = document.getElementById('div0');
    var theDiv1 = document.getElementById('div1');
    var theDiv2 = document.getElementById('div2');
    var thePane0 = document.getElementById('pane0');
    var thePane1 = document.getElementById('pane1');
    var thePane2 = document.getElementById('pane2');

    thePane0.className = 'unselectedFane';
    thePane1.className = 'unselectedFane';
    thePane2.className = 'unselectedFane';

    if (theDiv == 'div0') { thePane0.className = 'selectedFane'; }
    if (theDiv == 'div1') { thePane1.className = 'selectedFane'; }
    if (theDiv == 'div2') { thePane2.className = 'selectedFane'; }

    // Set all layers to none
    theDiv0.style.display = "none";
    theDiv1.style.display = "none";
    theDiv2.style.display = "none";

    // Show the actual layer
    selectedDiv.style.display = "block";
}
function showDiv4(theDiv, theElement) {

    var selectedDiv = document.getElementById(theDiv);
    var theDiv1 = document.getElementById('div1');
    var theDiv2 = document.getElementById('div2');
    var theDiv3 = document.getElementById('div3');
    var theDiv4 = document.getElementById('div4');
    var thePane1 = document.getElementById('pane1');
    var thePane2 = document.getElementById('pane2');
    var thePane3 = document.getElementById('pane3');
    var thePane4 = document.getElementById('pane4');

    thePane1.className = 'unselectedFane';
    thePane2.className = 'unselectedFane';
    thePane3.className = 'unselectedFane';
    thePane4.className = 'unselectedFane';

    if (theDiv == 'div1') { thePane1.className = 'selectedFane'; }
    if (theDiv == 'div2') { thePane2.className = 'selectedFane'; }
    if (theDiv == 'div3') { thePane3.className = 'selectedFane'; }
    if (theDiv == 'div4') { thePane4.className = 'selectedFane'; }

    // Set all layers to none
    theDiv1.style.display = "none";
    theDiv2.style.display = "none";
    theDiv3.style.display = "none";
    theDiv4.style.display = "none";

    // Show the actual layer
    selectedDiv.style.display = "block";
}

function showDiv8(theDiv, theElement) {
    var selectedDiv = document.getElementById(theDiv);
    try { var theDiv1  = document.getElementById('div1');}  catch (e) { null; }
    try { var theDiv2  = document.getElementById('div2');}  catch (e) { null; }
    try { var theDiv3  = document.getElementById('div3');}  catch (e) { null; }
    try { var theDiv4  = document.getElementById('div4');}  catch (e) { null; }
    try { var theDiv5  = document.getElementById('div5');}  catch (e) { null; }
    try { var theDiv6  = document.getElementById('div6');}  catch (e) { null; }
    try { var theDiv7  = document.getElementById('div7');}  catch (e) { null; }
    try { var theDiv8  = document.getElementById('div8');}  catch (e) { null; }    
    try { var theDiv9  = document.getElementById('div9');}  catch (e) { null; }
    try { var theDiv10 = document.getElementById('div10');} catch (e) { null; }
    try { var theDiv11 = document.getElementById('div11');} catch (e) { null; }
    try { var theDiv12 = document.getElementById('div12');} catch (e) { null; }        
    
    try { var thePane1  = document.getElementById('pane1');}  catch (e) { null; }
    try { var thePane2  = document.getElementById('pane2');}  catch (e) { null; }
    try { var thePane3  = document.getElementById('pane3');}  catch (e) { null; }
    try { var thePane4  = document.getElementById('pane4');}  catch (e) { null; }
    try { var thePane5  = document.getElementById('pane5');}  catch (e) { null; }
    try { var thePane6  = document.getElementById('pane6');}  catch (e) { null; }
    try { var thePane7  = document.getElementById('pane7');}  catch (e) { null; }
    try { var thePane8  = document.getElementById('pane8');}  catch (e) { null; }
    try { var thePane9  = document.getElementById('pane9');}  catch (e) { null; }
    try { var thePane10 = document.getElementById('pane10');} catch (e) { null; }
    try { var thePane11 = document.getElementById('pane11');} catch (e) { null; }
    try { var thePane12 = document.getElementById('pane12');} catch (e) { null; }                

    try { thePane1.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane2.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane3.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane4.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane5.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane6.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane7.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane8.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane9.className  = 'unselectedFane';} catch (e) { null; }
    try { thePane10.className = 'unselectedFane';} catch (e) { null; }
    try { thePane11.className = 'unselectedFane';} catch (e) { null; }
    try { thePane12.className = 'unselectedFane';} catch (e) { null; }
		                
    if (theDiv == 'div1')  { thePane1.className  = 'selectedFane'; }
    if (theDiv == 'div2')  { thePane2.className  = 'selectedFane'; }
    if (theDiv == 'div3')  { thePane3.className  = 'selectedFane'; }
    if (theDiv == 'div4')  { thePane4.className  = 'selectedFane'; }
    if (theDiv == 'div5')  { thePane5.className  = 'selectedFane'; }
    if (theDiv == 'div6')  { thePane6.className  = 'selectedFane'; }
    if (theDiv == 'div7')  { thePane7.className  = 'selectedFane'; }
    if (theDiv == 'div8')  { thePane8.className  = 'selectedFane'; }
    if (theDiv == 'div9')  { thePane9.className  = 'selectedFane'; }
    if (theDiv == 'div10') { thePane10.className = 'selectedFane'; }
    if (theDiv == 'div11') { thePane11.className = 'selectedFane'; }
    if (theDiv == 'div12') { thePane12.className = 'selectedFane'; }

   // Set all layers to none
    try { theDiv1.style.display  = "none";} catch (e) { null; }
    try { theDiv2.style.display  = "none";} catch (e) { null; }
    try { theDiv3.style.display  = "none";} catch (e) { null; }
    try { theDiv4.style.display  = "none";} catch (e) { null; }
    try { theDiv5.style.display  = "none";} catch (e) { null; }
    try { theDiv6.style.display  = "none";} catch (e) { null; }
    try { theDiv7.style.display  = "none";} catch (e) { null; }
    try { theDiv8.style.display  = "none";} catch (e) { null; }
    try { theDiv9.style.display  = "none";} catch (e) { null; }
    try { theDiv10.style.display = "none";} catch (e) { null; }
    try { theDiv11.style.display = "none";} catch (e) { null; }
    try { theDiv12.style.display = "none";} catch (e) { null; }

    // Show the actual layer
    selectedDiv.style.display = "block";
}

function showHideQa(which) {
	var status = document.getElementById(which).style.display;		
	
	if (status=='none')
	{
		document.getElementById(which).style.display='';
		document.getElementById(which+'arrow').src='http://www.ebst.dk/guide/br/grafik/qa/qa_arrow_down.gif';			
		document.getElementById(which+'link').title='Skjul';		
	}
	else
	{
		document.getElementById(which).style.display='none';
		document.getElementById(which+'arrow').src='http://www.ebst.dk/guide/br/grafik/qa/qa_arrow_right.gif';
		document.getElementById(which+'link').title='Vis';
	}
}

function popupForm(sideid, height) {
  if (height != null && height != "") {
    h = height;
  } else {
    h = 500;
  }
  w = 586;
//  link = "http://www.ebst.dk/form/form.xsql?emne="+sideid;
  link = "/"+sideid+"/0/199";

  fromLeft = (screen.width-w)/2;
  fromTop = (screen.height-h)/2;

  open(link,"_blank","left="+fromLeft+",top="+fromTop+",width="+w+",height="+h+",status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes");
}

/* LBE */
function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.href && anchor.rel == "external") {       
     anchor.target = "_blank";
   }   
 }
}
window.onload = externalLinks;
