
// JavaScript Document
/*
---------------------
Onload function
---------------------
*/
function RunOnLoad(){
//	P7_Uberlink('p7uberlink','BodyId');
	P7_Uberlink('menulink','masthead_menu'); // menu
/*	document.getElementById("wrapper").style.margin = '255px auto 20px auto !important' */
	MailLink('wrapper','');

//	SideLink('SideLink','MenuSideBar','noTop');
	P7_Uberlink('SideLink','MenuSideBar');

//	document.getElementById("masthead").style.overflow = 'inherit'
	document.getElementById("masthead").style.visibility = 'visible'

}


/* 
  ------------------------------------------------
  PVII Uberlink
  Current Page Link Highlighter
  Copyright (c) 2007 Project Seven Development
  www.projectseven.com
  Version: 1.0.0
  ------------------------------------------------
*/
function P7_Uberlink(cl,d){
	var i,ob,tA,h=document.location.href;
	if(document.getElementById){
	ob=(d)?document.getElementById(d):document;
	if(ob){
	tA=ob.getElementsByTagName('A');
	for(i=0;i<tA.length;i++){
	if(tA[i].href==h){
	tA[i].className=cl;
}}}}}


/*
-----------------
Bund txt function
-----------------
*/
function TripNote(){
	if (document.getElementById("NoteTxt").style.visibility != 'visible'){
		document.getElementById("NoteTxt").style.visibility = 'visible'
		document.getElementById("NoteTxt").style.height = 'auto'
	}else{
		document.getElementById("NoteTxt").style.visibility = 'hidden'
		document.getElementById("NoteTxt").style.height = '0px'
	}
}


/*
------------------
Mail spoofe
------------------
*/

function MailLink(d,r){		//	MailLink('[BodyId - område]','[evt. extra tegn efter €]');
	var i,ob,tA,L,T;
	if(document.getElementById){
		ob=(d)?document.getElementById(d):document;
		if(ob){
			tA=ob.getElementsByTagName('A');
			for(i=0;i<tA.length;i++){
				L=tA[i].href
				T=tA[i].innerHTML
				if(L.indexOf("mailto:")== 0){

//					ex = new RegExp("€"+r,"g");
					ex = new RegExp(unescape("%u20AC")+r,"g");
					ex2 = new RegExp("%E2%82%AC"+r,"g");
					tA[i].href=L.replace(ex,"@");
					if (navigator.appName != "Microsoft Internet Explorer"){tA[i].href=L.replace(ex2,"@");}
					tA[i].innerHTML=T.replace(ex,"@");
				}
			}
			tA=ob.getElementsByTagName('input');
			for(i=0;i<tA.length;i++){
				L=tA[i].type
				T=tA[i].innerHTML
				if(L== "hidden"){
//					ex = new RegExp("€"+r,"g");
					ex = new RegExp(unescape("%u20AC")+r,"g");
					tA[i].value=tA[i].value.replace(ex,"@");
				}
			}
		}
	}
}




function SideLink(cl,d,v){    //   SideLink('SideLink','MenuSideBar','noTop');  SideLink('[Classe navn]','[ID område]','[noTop (Level 0)]');
	var i,ob,tA,h=document.location.href;
	if(document.getElementById){
		ob=(d)?document.getElementById(d):document;
		if(ob){
			tA=ob.getElementsByTagName('A');
			for(i=0;i<tA.length;i++){
				if(tA[i].href==h){
					if(tA[i].parentNode.parentNode.id == d){
						if(v == "noTop"){
							tA[i].parentNode.className=cl+"noTopFirst"
							tA[i].parentNode.childNodes[2].className=cl+"noTopSubFirst"
						}else{
							tA[i].parentNode.className=cl+"Sub"
						}
					}else if(tA[i].parentNode.parentNode.parentNode.parentNode.id == d){
						if(v == "noTop"){
							tA[i].parentNode.parentNode.parentNode.className=cl+"noTop"
							tA[i].parentNode.parentNode.className=cl+"noTopSub"
						}else{
							tA[i].parentNode.parentNode.parentNode.className=cl+"Sub"
						}
					}else if(tA[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.id == d){
						if(v == "noTop"){
							tA[i].parentNode.parentNode.parentNode.parentNode.parentNode.className=cl+"noTop"
							tA[i].parentNode.parentNode.parentNode.parentNode.className=cl+"noTopSub"
						}else{
							tA[i].parentNode.parentNode.parentNode.parentNode.parentNode.className=cl+"Sub"
						}
					}
					tA[i].className+=cl;
				}
			}
		}
	}
}
