var FF=false
var IE=false
var aktivpic
var rootpath
var shrpath
var elmbeskr
var initok=false
var errinfo=''
var eflag=0
var menuref=0

var help_sys=''
var help_section=''
var help_evntObj
var help_evntData
var help_evntObjX
var help_evntObjY
var help_pageWidth
var help_pageHeight
var help_hndl
var help_hostURL

window.addEventListener  ?  FF=true : IE=true

function init()  {
try {
if (eflag==1 || top.window.document.URL.indexOf('/cms/default') !=-1)  {
	eflag=1
	return
	}
    }
catch(e)  {}

if (document.getElementsByTagName('IFRAME').length>0) {
	if (IE)
		window.attachEvent('onresize',winsize)
	else
		window.addEventListener('resize', winsize, false);		
}

IE ? elmbeskr='srcElement' : elmbeskr='target'
rootpath=location.href.substr(0,location.href.lastIndexOf('/'))

shrpath='/shr/funktioner'

// se efter evt kommunikationsparametre
if (document.location.search.substr(1,8)=='cmsparms')  {
	var tmp=document.location.search.substr(10).split('|')
	for (i=0;i<tmp.length;i++)  {
		parm=tmp[i].split(';')
		try {
			if (document.getElementById(parm[0]).tagName=='INPUT')
				document.getElementById(parm[0]).value=unescape(parm[1])
			else
				document.getElementById(parm[0]).innerHTML=unescape(parm[1])
			}
		catch(e)  {}
		if (parm[0]=='info')  {
			if (parm[1].indexOf('Log ind OK') !=-1 && parm[1].substr(0,6)=='cookie')  {
				document.getElementById('husktxt').style.display='none'
				document.getElementById('send').style.display='none'
				document.getElementById('info').innerHTML=unescape(parm[1].substr(6))
				}
			}
		}
	}

var allobj=document.body.getElementsByTagName("IMG")

// *** check for test eller produktion ***
if (location.href.indexOf('//easyplanner.dk') !=-1) {
   if (location.href.indexOf('?rnd=') !=-1 || location.href.indexOf('toolbar') != -1) {return}	//hvis test under editor -> exit
   embedToObject()
   xmlhttp=svrconn()
   xmlhttp.open("GET",shrpath+'/gethostCMS.asp?p='+document.location.pathname,false)
   xmlhttp.send(null)
   help_hostURL=xmlhttp.responseText
   help_init()
   try {
	var headobj=document.getElementsByTagName("LINK")
	var urlprefix=location.href.substr(0,location.href.lastIndexOf('/'))+'/css/'
	//for (i=0;i<headobj.length;i++) {
	//	if (headobj[i].href.substr(0,5) !='/css/') {
	//		headobj[i].href=urlprefix+headobj[i].href.substr(headobj[i].href.lastIndexOf('/')+1)
	//		}
	//}
	var urlprefix=location.href.substr(0,location.href.lastIndexOf('/'))+'/images/'

	for (i=0;i<allobj.length;i++)  {
		if (allobj[i].src.indexOf('/shr/') ==-1 && allobj[i].src.substr(0,4) !='http') {
		allobj[i].src=urlprefix+allobj[i].src.substr(allobj[i].src.lastIndexOf('/')+1)
		}
	}
	}
   catch(e) {}
	if (location.search)  {
		var iframs=document.getElementsByTagName('IFRAME')
		for (i=0;i<iframs.length;i++)  {
			if (iframs[i].src.indexOf('http:')==-1)  {
				if (iframs[i].src.substr(iframs[i].src.lastIndexOf('/')+1,1).toUpperCase()=='M')  {
					iframs[i].src=iframs[i].src+'?'+unescape(location.search.substring(1))
					//alert(iframs[i].src)
					break
					}
				if (iframs[i].id=='main' && location.search.indexOf('.asp')!=-1)  {
					iframs[i].src=unescape(location.search.substring(1))
					break
					}
				}
			}
		}
	var iframs=document.getElementsByTagName('IFRAME')
	// beregn cellehjder på alle celler - compabilitet Chrome FF IE8
	if (iframs.length>0) {
		try {
		tabeller=document.getElementsByTagName('TABLE')
		for (i=0;i<tabeller.length;i++) {
			//beregnTabel(tabeller[i])
			}
		//for (i=0;i<iframs.length;i++)  {
		//	if (iframs[i].id=='main') {
		//		var hjd=parseInt(iframs[i].parentNode.offsetHeight)
		//		iframs[i].style.height=hjd+'px'
		//		iframs[i].parentNode.innerHTML=iframs[i].parentNode.innerHTML
		//			}
		//	}	
		}
		catch(e) {}
		}
	var acronym=document.getElementsByTagName('ACRONYM')
	for (i=0;i<acronym.length;i++)  {
		var id=acronym[i].id
		var html=getHTML(id)
		if (html.length>0)  {
			acronym[i].parentElement.innerHTML=html
			}
		else  {
			acronym[i].parentElement.innerHTML='Include ikke fundet'
			}
		}	
}
else	{
	// produktion
	embedToObject()
	help_hostURL=document.location.hostname
	help_init()
	try {
		xmlhttp=svrconn()
		xmlhttp.open("GET",shrpath+'/trackCMS.asp?p='+document.location.pathname+'&d='+document.location.hostname+'&r='+escape(document.referrer),true)
		xmlhttp.send(null)
	}
	catch(e) {}
	// sæt startside via extern parm
	if (location.search)  {
		if (location.search.indexOf('guid')==-1)  {
			var iframs=document.getElementsByTagName('IFRAME')
			for (i=0;i<iframs.length;i++)  {
				if (iframs[i].src.indexOf('http:')==-1)  {	//ej for externe
					if (iframs[i].src.substr(iframs[i].src.lastIndexOf('/')+1,1).toUpperCase()=='M')  {
						iframs[i].src=iframs[i].src+'?'+unescape(location.search.substring(1))
						//alert(iframs[i].src)
						break
						}
					if (iframs[i].id=='main' && location.search.indexOf('.asp')!=-1)  {
						iframs[i].src=unescape(location.search.substring(1))
						break
						}
					}
				}
			}
		}
	var iframs=document.getElementsByTagName('IFRAME')
	// beregn cellehjder på alle celler - compabilitet FF IE8
	if (iframs.length>0) {
		try {
		tabeller=document.getElementsByTagName('TABLE')
		for (i=0;i<tabeller.length;i++) {
			//beregnTabel(tabeller[i])
			}
		//for (i=0;i<iframs.length;i++)  {
		//	if (iframs[i].id=='main' || iframs[i].id.substr(0,1)=='x') {
		//		var hjd=parseInt(iframs[i].parentNode.offsetHeight)
		//		iframs[i].style.height=hjd+'px'
		//		//iframs[i].parentNode.innerHTML=iframs[i].parentNode.innerHTML
		//			}
		//	}	
		}
		catch(e) {}
		}
	//includes
	var acronym=document.getElementsByTagName('ACRONYM')
	for (i=0;i<acronym.length;i++)  {
		var id=acronym[i].id
		var html=getHTML(id)
		if (html.length>0)  {
			acronym[i].parentElement.innerHTML=html
			}
		else  {
			acronym[i].parentElement.innerHTML='Include ikke fundet'
			}
		}
	// hvis siden vises som stand alone
	//if (window.top==self)  {
	//	var oDiv=document.createElement('DIV')
	//	document.body.appendChild(oDiv)
	//	oDiv.innerHTML='<p><a style=\'font-size:12px;text-decoration:underline\' href="http://'+location.hostname+'">Link til hovedside</a></p>'
	//	}
	setTimeout("suburl=''",3000)
	}
try {resizeBGimages(document.body)}
catch(e) {}
try {prodInit()}
catch(e) {}
try {runSlideShow()}
catch(e) {}
try {runSlideShow_1()}
catch(e) {}
try {runSlideShow_2()}
catch(e) {}
try {runSlideShow_3()}
catch(e) {}
try {ticinit()}
catch(e) {}
try {faqinit()}
catch(e) {}
try {plugins()}
catch(e) {}
// indsæt følsomhed i grafiske elementer og billeder med ID værdi
// indsæt loaderror handler for alle billeder som kun har ID værdi og gem org. url til billede i accessKey

for (i=0;i<allobj.length;i++)  {
	if (allobj[i].id.length>0 && allobj[i].accessKey) {
		if (IE) {
			allobj[i].attachEvent('onmouseover',over)
			allobj[i].attachEvent('onmouseout',ud)
			//allobj[i].attachEvent('onclick',valg)
			//allobj[i].style.filter='Alpha(opacity=50)'
			allobj[i].setAttribute('className','knapud',0)
			}
		else {
			allobj[i].addEventListener('mouseover', over, false)
			allobj[i].addEventListener('mouseout', ud, false)
			//allobj[i].addEventListener('click', valg, false)
			allobj[i].setAttribute('className','knapud',0)
			}
		}
	if (allobj[i].id.length>0)  {
		if (IE) {
			allobj[i].attachEvent('onerror',picloaderror)
			allobj[i].attachEvent('onload',picloaded)
			allobj[i].accessKey=allobj[i].src
			}
		else	{
			allobj[i].addEventListener('onerror', picloaderror, false)
			allobj[i].addEventListener('onload', picloaded, false)
			allobj[i].accessKey=allobj[i].src
			}
		}
	}

// indsæt checkrutine i alle anker-tags. styrer hvordan et link skal behandles afh af target-værdi
var allobj=document.body.getElementsByTagName("A")
for (i=0;i<allobj.length;i++)  {
	//email spam trapper, hvis bruger anvender den
	if (allobj[i].href.indexOf('mailto:') !=-1) {
		if (IE) {
			if (allobj[i].innerText.length>0) { allobj[i].innerText=allobj[i].innerText.replace('spam.','') }
			var tmp=allobj[i].innerText	// IE8 fejl korrektion
			allobj[i].href=allobj[i].href.replace('spam.','')
			allobj[i].innerText=tmp
			}
		else	{
			if (allobj[i].textContent.length>0) { allobj[i].textContent=allobj[i].textContent.replace('spam.','') }
			allobj[i].href=allobj[i].href.replace('spam.','')
			}
		}
	else	{
		if (IE) {	
			allobj[i].attachEvent('onclick',check)
			}
		else  {
			allobj[i].addEventListener('click', check, false)
			}
		// abs links tilrettes
		//if (allobj[i].href.indexOf('www.')>0 && allobj[i].href.indexOf('http://www')==-1) {
		if (allobj[i].href.substr(0,4)=='www.') {
			allobj[i].href='http://'+allobj[i].href.substr(allobj[i].href.indexOf('www.'))
			}
		}
	}

//var allobj=document.body.getElementsByTagName("IFRAME")
//for (i=0;i<allobj.length;i++)  {
//	if (allobj[i].dataSrc && allobj[i].dataSrc.length>0)  {
//		if (IE) {
//			allobj[i].attachEvent('onload',iframeload)
//			}
//		else  {
//			allobj[i].addEventListener('onload', iframeload, false)
//			}		
//		}
//	}
loadmenu()
initok=true
}

function beregnTabel(obj)  {
return
if (obj.style.height.length==0 || obj.style.height.indexOf('%')==-1) return

var i
var border=0
if (obj.border.length>0)
	border=parseInt(obj.border)
var cellSpacing=1
if (obj.cellSpacing.length>0)
	cellSpacing=parseInt(obj.cellSpacing)
else
	cellSpacing=cellSpacing+2
var cellPadding=1	
if (obj.cellPadding.length>0)
	cellPadding=parseInt(obj.cellPadding)
if (obj.style.paddingTop.length>0)
	cellPadding=cellPadding+parseInt(obj.style.paddingTop)
if (obj.style.borderTopWidth.length>0)
	cellSpacing=cellSpacing+parseInt(obj.style.borderTopWidth)
if (obj.parentNode.tagName=='BODY' && obj.style.height=='100%') {
	var bodymargintop=0
	var bodymarginbot=0
	if (obj.parentNode.style.marginTop.length>0)
		bodymargintop=parseInt(obj.parentNode.style.marginTop)
	if (obj.parentNode.style.marginBottom.length>0)
		bodymarginbot=parseInt(obj.parentNode.style.marginBottom)
	obj.style.height=parseInt(obj.parentNode.clientHeight-bodymargintop-bodymarginbot-2*border-2*cellSpacing-2*cellPadding-2)+'px'
	}
var tabelHeight=obj.offsetHeight-border*2-cellSpacing*2-cellPadding*2-1
var sumceller=0
var celler=obj.childNodes[0].childNodes		//TR-elementer
for (i=0;i<celler.length;i++)  {
	var cellehjd=celler[i].childNodes[0].style.height
	if (cellehjd.length>0)  {
		if (cellehjd.indexOf('%') !=-1) 
			if (parseInt(cellehjd)<100)
				sumceller=sumceller+parseInt(parseInt(cellehjd)*tabelHeight/100)+cellSpacing+cellPadding+border
			else {
				celler[i].childNodes[0].style.height=tabelHeight-cellSpacing-cellPadding-border
				sumceller=tabelHeight-cellSpacing-cellPadding-border
				}
		else
			sumceller=sumceller+parseInt(cellehjd)+cellSpacing+cellPadding+border
		}
	}
var resthjd=tabelHeight-sumceller-cellSpacing-cellPadding-border
if (resthjd>0) {
	for (i=0;i<celler.length;i++)  {
		var cellehjd=celler[i].childNodes[0].style.height
		if (cellehjd.length==0) {
			var childs=celler[i].childNodes
			for (j=0;j<childs.length;j++) {
				childs[j].style.height=resthjd
				}
			break
			}
		}
	}	
}

function svrconn()  {
  var req = false;
  if (FF) {
    try {
      req = new XMLHttpRequest();
    } catch (e) {
      req = false;
    }
  } else if (IE) {
    // Internet Explorer - Windows
    try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        req = false;
      }
    }
  }
  if (!req) {
    	alert('Din browser understøtter ikke XMLHTTPRequest objektet.\nDu skal anvende Internet Explorer ver. 6 eller nyere, eller FireFox ver. 1.5 eller nyere')
	return false
	}
  return req
}
      
function over(evt)  {
var obj=evt[elmbeskr]
if (obj.getAttribute('className') !='knapvalg')  {
	obj.setAttribute('className','knapover',0)
	}
}
function ud(evt) {
var obj=evt[elmbeskr]
if (obj.getAttribute('className') !='knapvalg')  {
	obj.setAttribute('className','knapud',0)
	}
}
function valg(obj)  {
//var obj=evt[elmbeskr]
var allobj=document.getElementsByName(obj.id)
for (i=0;i<allobj.length;i++)  {
	allobj[i].setAttribute('className','knapud',0)
	}
obj.setAttribute('className','knapvalg',0)

}

function checklink(obj)  {
if (obj.href.length==0) {return false}
if (obj.href.substr(obj.href.length-1)=='#') {return false}	//ikke aktiv href (men giver hover effekt m.m.)
if (obj.target.length>0) {
	if (obj.href.indexOf('visblog') !=-1)  {
		var tmp=obj.href.split('=')
		visblog(tmp[1])
		return false
		}
	if (obj.href.indexOf('vissidenavn') !=-1)  {
		var tmp=obj.href.split('=')
		visside(tmp[1],obj.target)
		return false
		}
	if (obj.target=='main')  {
		
		try {document.getElementById('main').src=obj.href; return false}
		      	catch(e) {return false;parent.document.getElementById('main').src=rootpath+'/'+obj.href; return false}
		}
	if (obj.target=='pop')  {
		stdpopup(obj.href); return false
		}
	if (obj.target=='pic')  {
		picpopup(aktivpic,obj); return false
		}
	if (obj.target=='swf')  {
		swfpopup(obj.href); return false
		}
	if (obj.target.indexOf('popGB') !=-1)  {
		GBpopup(obj.href,obj.target,obj.title); return false
		}
	if (obj.target.indexOf('_top') !=-1)  {
		top.document.location.href=obj.href
		//window.setTimeout("top.document.location.reload(true)",100)
		return false
		}
	return true
	}
else	{
	if (obj.attributes.getNamedItem('onclick') && obj.attributes.getNamedItem('onclick').value!='null' && obj.attributes.getNamedItem('onclick').value.length>0) {return false}
	document.location.href=obj.href
	return false
	}
}

function qlink(obj,href,target)  {
if (target.length>0) {
	if (target=='main')  {
		try {document.getElementById('main').src=rootpath+'/'+href; return false}
		      	catch(e) {return}
		}
	if (target=='pop')  {
		stdpopup(rootpath+'/'+href); return false
		}
	window.open(rootpath+'/'+href)
	return true
	}
else	{
	document.location.href=rootpath+'/'+href
	return false
	}
}

function check(evt)  {
// her kommer alle onclick events. skal nu undersøge om der er et link forbundet 
// A-tag kan ligge et eller flere niveauer højere
var obj= evt[elmbeskr]
while (obj) {
	if (obj.tagName=="A") {
		if (!checklink(obj)) {
			if (FF) {evt.stopPropagation();evt.preventDefault()}
			return false
			}
		}
	if (obj.tagName=="IMG") {
		aktivpic=obj.src
		if (obj.id.length>0) {
			valg(obj)
			}
		}
	obj=obj.parentNode
	}
}

function picpopup(pic,obj) {

try  {
var pictype=pic.substr(pic.lastIndexOf('.'))
var picroot=pic.substr(0,pic.lastIndexOf('_V'))+pictype
}
catch(e)  {
	picroot=obj.href
	}
//if (rootpath.length>0)
//	window.open(rootpath+'/shr/funktioner/popuppic.asp?id='+picroot,'popup','width=100,height=100,top=0,left=0,resize=yes,status=no')
//else
var rc=window.open('/shr/funktioner/popuppic.asp?id='+picroot,'popuppic','width=100,height=100,top=0,left=0,resize=yes,status=no')
if (rc=='failed' || rc==null)
	alert('Du anvender blokering af Popup vinduer. Hold evt. Ctrl+Alt-knapperne nede og prøv igen.')
}

function stdpopup(url)  {
var rc=window.open('/shr/funktioner/popupstd.asp?url='+escape(url),'popupstd','width=100,height=100,top=0,left=0,resize=yes,status=no')
if (rc=='failed' || rc==null)
	alert('Du anvender blokering af Popup vinduer. Hold evt. Ctrl+Alt-knapperne nede og prøv igen.')
}

function chatpopup(aid,sid,qid)  {
var rc=window.open('SightMaxAgentInterface/PreChatSurvey.aspx?accountID='+aid+'&siteID='+sid+'&queueID='+qid,'chatWindow','width=490,height=404,resizable=0,scrollbars=no,menubar=no,status=no')
if (rc=='failed' || rc==null)
	alert('Du anvender blokering af Popup vinduer. Hold evt. Ctrl+Alt-knapperne nede og prøv igen.')
}

function swfpopup(url)  {
var rc=window.open('/shr/funktioner/popupswf.asp?url='+escape(url),'popupstd','width=100,height=100,top=10,left=10,resize=yes,status=no')
if (rc=='failed' || rc==null)
	alert('Du anvender blokering af Popup vinduer. Hold evt. Ctrl+Alt-knapperne nede og prøv igen.')
}

function GBpopup(url,target,title)  {
	var GBregex = /(\d+).*?(\d+)/;
	var GBmatch = GBregex.exec(target);
	if (GBmatch != null && GBmatch.length > 1) {
		var w=GBmatch[1];
		var h=300;
		if (GBmatch.length > 2)
			h=GBmatch[2];
	} else {
		var w=300;
		var h=300;	
	}
	top.popVis(w,h,url,title)
	return
	if (FF)
		GB_showCenter(' ',url,h+'px',w+'px');
	else
		GB_showCenter(' ',url,h,w);
}

// menustyring *****************
// menuer hentes ind via XMLHTTP interface som udføres ved load
// i eks html ligger placeholder (DIV tag) hvori menuen lægges

var menuobj = new Array()
function loadmenu()  {
menuref=0
if (location.hash.length>0)  {
	menuref=location.hash.replace('#','')
	}
var menures=document.getElementsByTagName("DIV")
for (var i=0;i<menures.length;i++)  {
	if (menures[i].id.indexOf('mph_') !=-1)  {
		var id=menures[i].id.split('_')
		var tmpmenuobj
		clientSideInclude(menures[i].id, id[1],tmpmenuobj,menuref)
		menures[i].style.backgroundColor=''
		menuobj[i]=menures[i]
		window.setTimeout("menuobj["+i+"].style.visibility='visible'",500)		//giv tid til browser
		}
	}

}

function menuvalg(obj,ref)  {
var subs=document.getElementsByTagName('DIV')
for (i=0;i<subs.length;i++)  {
	if (subs[i].id.indexOf('submenu') !=-1)
		subs[i].style.display='none'
	}
var subs=document.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.borderLeftStyle=''
	}
obj.style.borderLeftStyle='inset'
if (document.getElementById('submenu_'+ref))	
	document.getElementById('submenu_'+ref).style.display='block'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {event.returnValue=false}
			catch(e) {evnt.preventDefault()}
			}
		else {
			document.getElementById('main').src=obj.href
			try {event.returnValue=false}
			catch(e) {evnt.preventDefault()}
			}
		}
	}
}

function menuvalg_V2(obj,ref,id,evnt)  {
var subs=document.getElementsByTagName('DIV')
for (i=0;i<subs.length;i++)  {
	if (subs[i].id.indexOf('submenu') !=-1)
		subs[i].style.display='none'
	}
var subs=document.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.textDecoration=''
	}
obj.style.textDecoration='underline'
if (document.getElementById('submenu'+id+'_'+ref))	
	document.getElementById('submenu'+id+'_'+ref).style.display='block'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {document.getElementById('main').src=obj.href;evnt.returnValue=false}
			document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}
}

function Hmenuvalg_V3(obj,par,evnt)  {
var tmpobj=obj.parentNode.parentNode.parentNode
//var LI=obj.parentNode.parentNode
var subs=tmpobj.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.textDecoration='none'
	}
obj.style.textDecoration='underline'
obj.blur()
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try{
				try {evnt.stopPropagation();evnt.preventDefault()}
				catch(e) {evnt.returnValue=false}
			}
			catch(e) {}
			var href=obj.href.replace(rootpath,'')
			if (href.length>1)
				document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}
}

function menuvalgV(obj,ref,evnt)  {
var subs=document.getElementsByTagName('DIV')
for (i=0;i<subs.length;i++)  {
	if (subs[i].id.indexOf('submenu') !=-1)
		subs[i].style.display='none'
	}
var subs=document.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.borderLeftStyle=''
	}
var submenu=document.getElementById('submenu_'+ref)
deltaTop=0
deltaLeft=0
var objx=obj
if (objx.offsetParent) {
	deltaLeft = objx.offsetLeft
	deltaTop = objx.offsetTop
	while (objx = objx.offsetParent) {
		deltaLeft += objx.offsetLeft
		deltaTop += objx.offsetTop
	}
}
submenu.style.top=deltaTop+obj.offsetHeight     //-parseInt(document.body.style.marginTop)
submenu.style.left=deltaLeft   //-parseInt(document.body.style.marginLeft)
document.getElementById('submenu_'+ref).style.display='block'
obj.style.borderLeftStyle='inset'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}
}

function menuvalgV_V2(obj,ref,id,evnt)  {
var subs=document.getElementsByTagName('DIV')
for (i=0;i<subs.length;i++)  {
	if (subs[i].id.indexOf('submenu') !=-1)
		subs[i].style.display='none'
	}
var subs=document.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.borderLeftStyle=''
	}
var submenu=document.getElementById('submenu'+id+'_'+ref)
deltaTop=0
deltaLeft=0
var objx=obj
if (objx.offsetParent) {
	deltaLeft = objx.offsetLeft
	deltaTop = objx.offsetTop
	while (objx = objx.offsetParent) {
		deltaLeft += objx.offsetLeft
		deltaTop += objx.offsetTop
	}
}
submenu.style.top=parseInt(deltaTop+obj.offsetHeight+3)+'px'
submenu.style.left=parseInt(deltaLeft+3)+'px' 
document.getElementById('submenu'+id+'_'+ref).style.display='block'
obj.style.borderLeftStyle='inset'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}
}

function submenuvalg(obj,ref,evnt)  {
var subs=document.getElementsByTagName('A')
for (i=0;i<subs.length;i++)  {
	subs[i].style.borderLeftStyle=''
	}
obj.style.borderLeftStyle='inset'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}	
}

function submenuvalgV(obj,ref)  {
document.getElementById('submenu_'+ref).style.display='none'	
}

function submenuvalgV_V2(obj,ref,id,evnt)  {
document.getElementById('submenu'+id+'_'+ref).style.display='none'
if (obj.target.indexOf('main') != -1)  {
	if (document.getElementById('main'))  {
		if (obj.href.lastIndexOf('#') ==(obj.href.length-1)) {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			}
		else {
			try {evnt.stopPropagation();evnt.preventDefault()}
			catch(e) {evnt.returnValue=false}
			document.getElementById('main').src=obj.href
			}
		}
	}
else if (obj.href.lastIndexOf('#') ==(obj.href.length-1))  {
	try {evnt.stopPropagation();evnt.preventDefault()}
	catch(e) {evnt.returnValue=false}	
	}	
}

function clientSideInclude(id, url,menuobj,menuref) {
// fuld url skal opbygges. fjern evt. qstring
var currurl=document.location.href.substr(0,document.location.href.lastIndexOf('/')+1)
if (currurl.indexOf('?') !=-1)  {
	currurl=currurl.substr(0, currurl.indexOf('?'))
	}
if (currurl.indexOf('#/') !=-1)  {
	currurl=currurl.substr(0, currurl.indexOf('#/'))
	}
currurl=currurl.substr(0,currurl.lastIndexOf('/')+1)
menuurl=currurl+'M'+url+'.asp'
var req = svrconn();
var element = document.getElementById(id);
 if (!element) {
  alert("Skal være et div eller span element");
  return;
 }
  if (req) {

	req.open('GET', shrpath+ '/getpage.asp?'+menuurl, false);
	    req.send(null);
	var data=req.responseText
	// opsplit script, style, html

	if (!document.getElementById('dyncss'+url))	//forhindrer dobbelt load
	{
	  var objHead = document.getElementsByTagName('head');
	  if (objHead[0])
	  {
	    var objCSS = objHead[0].appendChild(document.createElement('link'));
	    objCSS.id = 'dyncss'+url;
	    objCSS.rel = 'stylesheet';
	    objCSS.href = 'css/getcss.asp?'+url
	    objCSS.type = 'text/css';
	  }
	}
	var htmldata = unescape(data)
	element.innerHTML = htmldata	
	if (menuref.length>0)  {	//ref til hovedmenupunkter
		var tmpref=menuref.split('#')
		var tmp=element.getElementsByTagName('A')
		var indx=0
		try {
			for (ix=0;ix<tmp.length;ix++) {
			if (tmp[ix].className=='cmsmenu')  {
				indx=indx+1
				if (indx==tmpref[0]) {
					try {
						tmp[ix].href=tmp[ix].href+menuref.substr(1)
						tmp[ix].onclick()
						}
					catch(e) {
						menuobj=tmp[ix]
						eval(menuobj.getAttribute('onclick').replace('this','menuobj'))
						//tmp[ix].click()
						}
					break
					}
				}
			}
		    }
		catch(e) {}
		}
  	}
}

function clearfelt(obj)  {
try  {
	if (obj.value.indexOf('...') !=-1)
		obj.value=''
	if (obj.value.indexOf('hh:mm:ss') !=-1)
		obj.value=''
	if (obj.innerHTML.indexOf('...') !=-1)
		obj.innerHTML=''
	if (obj.getAttribute('data').indexOf('NNN') !=-1)
		obj.select()
	}
catch(e) {}

}

function checkfelt(obj)  {

try {
	obj.style.borderColor=''
	}
catch(e) {}
try  {
	if (obj.getAttribute('data').length>0)  {
		var regel=obj.getAttribute('data')
		if (obj.value.length==0 && regel.indexOf('REQ') ==-1)	//ikke req
			return true
		if (regel.indexOf('@@@') !=-1) {
			re=/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i
			var ret=re.test(obj.value)
			if (!ret) {
				obj.style.borderColor='red'
				errinfo="Email adresse formatet er forkert."
				return false
				}
			}
		if (regel.indexOf('HMS') !=-1) {
			re=/\b[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}\b/i
			var ret=re.test(obj.value)
			if (!ret) {
				obj.style.borderColor='red'
				errinfo="Formatet er forkert."
				return false
				}
			}
		if (regel.indexOf('NNN') !=-1) {
			if (isNaN(obj.value.replace(/[,\.]/g,''))) {
				obj.style.borderColor='red'
				errinfo="Skal være et tal."
				return false
				}
			}
		if (regel.indexOf('DATO') !=-1)  {
			re=/(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)[0-9]{2}/
			var ret=re.test(obj.value)
			if (!ret) {
				obj.style.borderColor='red'
				errinfo="Dato format skal være dd-mm-aaaa"
				return false
				}			
			}
		if (regel.indexOf('REQ') !=-1)  {
			if (obj.value.length==0)  {
				obj.style.borderColor='red'
				errinfo='Oplysningen mangler'
				return false
				}
			}
		}
	}
catch(e) {return true}
return true
}

function checklogin()  {
  var req = svrconn()
  if (req) {
	var fsnavn=fsnavne.split('|')
	var tmpfsnavne=fsnavne
	for (i=0;i<fsnavn.length;i++)  {
		var tmp=fsnavn[i].split('__')
		re=/%/g
		tmp[1]=tmp[1].replace(re,'')
		var tmpfsnavne=tmpfsnavne.replace('%'+tmp[1]+'%',document.getElementById(tmp[1]).value)
		}
	//alert(shrpath+'/dslookup.asp?dsid='+dsid+'&fsnavne='+fsnavne)
	req.open('GET', shrpath+'/dslookup.asp?s='+logpage+'&dsid='+dsid+'&fsnavne='+tmpfsnavne, false);
	    req.send(null);
	var data=req.responseText
	if (data.length>1500)
		alert(data.substr(1500))
	if (data !='1') {
		document.getElementById('mess').innerHTML=errmess
		if (erraction.length>0) {
			document.location.href=erraction
			}
		return false
		}
	document.location.href=okaction
	}
}

//indbygget delay for evt. færdiggørelse af validering
var mailobj
var mailcontpage
function sendmail(obj,contpage)  {
mailobj=obj
mailcontpage=contpage
window.setTimeout('sendmail2()',200)
}

function sendmail2()  {
var obj=mailobj
var contpage=mailcontpage
//samling af alle indtastede værdier
var result=''
var coll=obj.elements
for (i=0;i<coll.length;i++)  {
	if (coll.item(i).type=="radio" || coll.item(i).type=="checkbox")  {
		if (coll.item(i).checked) {	result=result+coll.item(i).name+'__'+coll.item(i).value+"|"}
		}
	else {
		if ( coll.item(i).value.indexOf('...') !=-1 || !checkfelt(coll.item(i)) ) {
			coll.item(i).style.borderColor='red'
			alert("Én eller flere oplysninger mangler eller er forkert udfyldt.\n"+errinfo)
			coll.item(i).focus()
			return
			}
	re=/\n/g
	result=result+coll.item(i).name+'__'+coll.item(i).value.replace(re,"<br>")+"|"}
	}
// send til behandling på server
var conn=svrconn()
conn.open('GET',shrpath+'/cmsemail.asp?parm='+escape(result), false)
conn.send(null)
if (conn.responseText != 'OK')  {
	alert(conn.responseText)
	if (conn.responseText.length>1500)
		alert(conn.responseText.substr(1500))
	return
	} 	 
document.location.href=contpage
}

function dslistning(objid)  {
if (!initok)	{
	window.setTimeout('dslistning("'+objid+'")',200)
	return
	}
var req = svrconn();
req.open('GET',shrpath+'/dslist.asp?id='+dsid+'&n='+dsfelter+'&s='+dssort+'&k='+dskrit, false);
req.send(null);
var dsdataliste=unescape(req.responseText)

var TAB=document.getElementById(objid)
var linie=dsdataliste.split('|')
for (i=0;i<linie.length-1;i++)  {
	var TR=document.createElement('TR')
	felt=linie[i].split('__')
	for (j=0;j<felt.length-1;j++)  {
		var TD=document.createElement('TD')
		TD.innerHTML=felt[j]
		TR.appendChild(TD)
		}
	TAB.appendChild(TR)
	}
}

function panoxpress(url)	{
re=/ /g
url=url.replace(re,'_')
window.open(url+'/'+'panoxpress.htm','panoxpress','resizable=1,Height=200,Width=200,Top=0,Left=0');
}

function popuppic(pic) {
// compabilitet til webxpress
var rc=window.open('/shr/funktioner/popuppic.asp?id='+escape(pic),'popuppic','width=100,height=100,top=0,left=0,resize=yes,status=no')
if (rc=='failed' || rc==null)
	alert('Du anvender blokering af Popup vinduer. Hold evt. Ctrl+Alt-knapperne nede og prøv igen.')
}

function picloaderror()  {
var obj=event.srcElement
if (obj.src != obj.accessKey)
   obj.src=obj.accessKey
return true
}

function picloaded()  {
var obj=event.srcElement
obj.accessKey=obj.src
}

//function iframeload()  {
// billedtrigger ved load af iframe. billede skal have samme navn som siden der loades
//var obj=event.srcElement
//var navn=obj.dataSrc
//var picnavn=document.getElementById(navn).accessKey
//var filtype=picnavn.substr(picnavn.lastIndexOf('.')+1)
//var picnavn=obj.src.substr(obj.src.lastIndexOf('/')+1).replace('asp',filtype)
//window.status=picnavn
//try {
//   document.getElementById(navn).style.width=''
//   document.getElementById(navn).style.height=''
//   document.getElementById(navn).src='images/'+picnavn
//   }
//catch(e) {}
//}

// anvendes til visse konv. webxpress sider
function checkaudio(obj)  {
var lydobj=document.getElementById(obj.id.replace('lyd','ctl'))
var objx=obj; var xLeft=0; var xTop=0
while (objx)  {	xLeft=xLeft+objx.offsetLeft; xTop=xTop+objx.offsetTop; 	objx=objx.offsetParent	}
lydobj.style.top=xTop+20; lydobj.style.left=xLeft;lydobj.style.display='block'
}

function runSlideShow(){
if (document.all){
//document.images.PictureBox.style.filter="blendTrans(duration=2)";
document.images.PictureBox.style.filter="blendTrans(duration=CrossFadeDuration)";
document.images.PictureBox.filters.blendTrans.Apply();}
document.images.PictureBox.width=preLoad[1].width
document.images.PictureBox.height=preLoad[1].height
document.images.PictureBox.src = preLoad[jss].src;
if (document.getElementById) document.getElementById("CaptionBox").innerHTML= Caption[jss];
if (document.all) document.images.PictureBox.filters.blendTrans.Play();
jss = jss + 1;
if (jss > (pss)) jss=1;
tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

// ticker funktioner (tabel - celler)
var ticcount=0
var refreshdata=false
var TDobj	//tekst

function ticinit()  {
//document.getElementById('tic').style.height=''
try {
var tmp=ticdb.split('_')
if (tmp[1].length>0)  {
	refreshdata=true
	ticrefreshdata(1)
	var odiv=document.createElement('DIV')
	odiv.innerHTML='<embed src="http://easyplanner.dk/dingdong.wav" autostart="false" width=0 height=0 id="ticsound" enablejavascript="true"></embed>'
	document.getElementById('divtic').appendChild(odiv)
	//document.getElementById('ticsound').Play()
	}
}
catch(e)  {}
TDobj=document.getElementById('tic').getElementsByTagName('TBODY')[0].getElementsByTagName('TR')[0].getElementsByTagName('TD')[0]
TDobj.innerHTML='&nbsp;'
if (tictype==1) {
	//document.getElementById('divtic').style.height=TDobj.offsetHeight
	ticmove=TDobj.offsetHeight
	ticmovinit=TDobj.offsetHeight
	TDobj.style.opacity=0
	TDobj.style.filter='alpha(opacity=0)'
	}
if (tictype==2)	{
	document.getElementById('divtic').style.height=TDobj.offsetHeight+4
	var minshiftspeed=parseInt(TDobj.offsetHeight)*ticfadeSpeed
	if (ticshiftspeed<minshiftspeed+100)
		ticshiftspeed=minshiftspeed+100	//mindst 100 millisek slack
	ticmov=TDobj.offsetHeight   
	ticmovinit=ticmov
	TDobj.style.opacity=''
	TDobj.style.filter=''
	TDobj.style.backgroundColor=''
	}
if (tictype==3)	{
	document.getElementById('divtic').style.height=TDobj.offsetHeight+4
	var minshiftspeed=parseInt(TDobj.offsetWidth)*ticfadeSpeed
	if (ticshiftspeed<minshiftspeed+100)
		ticshiftspeed=minshiftspeed+100	//mindst 100 millisek slack
	ticmov=TDobj.offsetWidth
	ticmovinit=TDobj.offsetWidth
	TDobj.style.opacity=''
	TDobj.style.filter=''
	TDobj.style.backgroundColor=''
	}
//document.getElementById('divtic').style.backgroundColor=document.getElementById('tic').style.backgroundColor
//document.getElementById('divtic').style.width=document.getElementById('tic').style.width
//cellspacing=2
//cellpadding=2
//if (document.getElementById('tic').cellSpacing)
//	cellspacing=parseInt(document.getElementById('tic').cellSpacing)
//if (document.getElementById('tic').cellPadding)
//	cellpadding=parseInt(document.getElementById('tic').cellPadding)
//document.getElementById('divtic').style.height=parseInt(TDobj.offsetHeight)+cellpadding+2*cellspacing
ticfunk()
}

var refreshcounter=0
var timerhandl
var initFlag=0
var textArr = new Array()
var aktuelTiccount=0

function ticfunk()  {
if (refreshdata)  {
	refreshcounter=refreshcounter+1
	if (refreshcounter>10)  {
		refreshcounter=0
		refreshdata=false
		if (ticrefreshdata(0) !=0) {
			ticcount=0
			document.getElementById('ticsound').Play()
			}
		//refreshdata=true
		}
	}
if (ticcount==textArr.length) {
	ticcount=0
	}
if (tictype==1)  {
	if (initFlag>0) {
		aktuelTiccount=ticcount
		ticFadeUdText()
		}
	else	{

		TDobj.style.opacity=0
		TDobj.innerHTML=textArr[0]
		ticFadeIndText()
		}
	}
if (tictype==2)	{
	TDobj.innerHTML=textArr[ticcount]
	ticMoveText()
	}
if (tictype==3)	{
	TDobj.innerHTML=textArr[ticcount]
	ticMoveTextV()
	}
if (tictype==4)  {
	ticpos=0
	//TDobj.innerHTML=textArr[ticcount]
	//tictext=ticobj.getElementsByTagName('TR')[ticcount].getElementsByTagName('TD')[0].innerHTML
	tictext=textArr[ticcount]
	//tmpobj=ticobj.getElementsByTagName('TR')[ticcount]
	ticWriteText()
	}
ticcount=ticcount+1
initFlag=1
timerhandl=window.setTimeout(ticfunk,ticshiftspeed)
}

function ticrefreshdata(flag)  {
var req = svrconn();
var tmp=ticdb.split('_')
req.open('GET',shrpath+'/ticdbdata.asp?id='+tmp[0]+'&db='+tmp[1], false);
req.send(null);
var tekster=unescape(req.responseText).split('|')
if (textArr.length==tekster.length-1 && flag==0)  {		//ingen ændring
	return 0
	}
for (i=0;i<tekster.length-1;i++) {
	textArr[i]=tekster[i]
	}
ticcount=0
return 1
}

function ticFadeIndText()	{
var opacity=TDobj.style.opacity*1
if (opacity<1) {
	opacity=opacity+0.05
	TDobj.style.opacity=opacity
	try {TDobj.filters.item('Alpha').opacity=parseInt(opacity*100)}
	catch(e) {}
	setTimeout(ticFadeIndText, ticfadeSpeed);
	}
else	{
	TDobj.style.opacity=1
	}
}


function ticFadeUdText()	{
var opacity=TDobj.style.opacity*1
if (opacity>0) {
	opacity=opacity-0.05
	TDobj.style.opacity=opacity
	try {TDobj.filters.item('Alpha').opacity=parseInt(opacity*100)}
	catch(e) {}
	setTimeout(ticFadeUdText, ticfadeSpeed);
	}
else	{
	TDobj.style.opacity=0
	TDobj.innerHTML=textArr[aktuelTiccount]
	ticFadeIndText()
	}
}

function ticMoveText()  {
if(ticmov>0)  {
	ticmov-=1
	document.getElementById('tic').style.top=ticmov
	setTimeout(ticMoveText, ticfadeSpeed); 
	}
else	{
	document.getElementById('tic').style.top=0
	ticmov=ticmovinit; //reset
	}
}

function ticMoveTextV()  {
if(ticmov>0)  {
	ticmov-=2
	document.getElementById('tic').style.left=ticmov
	setTimeout(ticMoveTextV, ticfadeSpeed); 
	}
else	{
	document.getElementById('tic').style.left=0
	ticmov=ticmovinit; //reset
	}
}

function ticWriteText()  {
if(ticpos<tictext.length-1)  {
	ticpos+=1
	TDobj.innerHTML=tictext.substr(0,ticpos)+'_'
	setTimeout(ticWriteText, ticfadeSpeed);	
	}
else  {
	TDobj.innerHTML=tictext
	if (tictext.substr(tictext.length-3)=='...') {
		window.clearTimeout(timerhandl)
		window.setTimeout(ticfunk,300)
		}
	}	
}

function faqinit() {
var faqobjs=document.getElementsByTagName('TABLE')
for (a=0;a<faqobjs.length;a++)  {
	if (faqobjs[a].id=='FAQ')  {
		faqobj =  (FF) ? faqobjs[a].childNodes[1] : faqobjs[a].childNodes[0] 
		var faqTRcoll=faqobj.rows  
		for (i=0;i<faqTRcoll.length;i++)  {
			faqTRcoll[i].insertCell(0)
			faqTRcoll[i].cells[0].width='20'
			faqTRcoll[i].cells[0].align='center'
			faqTRcoll[i].cells[0].innerHTML='&nbsp;'
			}
		for (i=0;i<faqTRcoll.length;i=i+2)  {
			var faqTR=faqTRcoll[i]	
			var faqTDcoll=faqTR.cells  
			faqTR.id='Q_'+a+'_'+i		
			faqTR.style.cursor='pointer';
			(FF) ? faqTR.addEventListener('click',visfaq,false)  : faqTR.attachEvent('onclick',visfaq);
			faqTDcoll[0].innerHTML='<img src="http://www.easyplanner.dk/images/plus.gif">'
			faqTDcoll[1].style.fontWeight='bold'
			faqTR=faqTRcoll[i+1]
			faqTR.id='A_'+a+'_'+i	 
			faqTR.style.display='none'
			}
		}
	}
}
function visfaq(evt)  {
TRnode = (FF) ? evt['target'].parentNode : evt['srcElement'].parentNode
while (TRnode.id.indexOf('Q')==-1)  {
	TRnode=TRnode.parentNode
	}
var id=TRnode.id.replace('Q','A')
if (document.getElementById(id).style.display.length>0)  {
	document.getElementById(id).style.display=''
	TRnode.cells[0].innerHTML='<img src="http://www.easyplanner.dk/images/minus.gif">'
	}
else  {
	document.getElementById(id).style.display='none'
	TRnode.cells[0].innerHTML='<img src="http://www.easyplanner.dk/images/plus.gif">'
	}
}

var autorc
function autoemnedetail(id)  {
var hjd=window.screen.availHeight-50
var brd=window.screen.availWidth
var left=parseInt(brd/2-250)
if (autorc) 
	autorc.close()
autorc=window.open('http://data.xpress.dk/emnedetail.asp?id='+id,'autodetail','top=0,width=520,left='+left+',height='+hjd)
autorc.focus()
}

function visblog(blogid)  {
var req=svrconn()
req.open('GET',shrpath+'/blogsessdata.asp', false);
req.send(null);
var tmp=window.open('http://blog.easyplanner.dk/easyplannerblog.asp?dataid='+req.responseText+'&id='+blogid,'blog','top=0,width=800,left=0,height=600,scrollbars=yes')
tmp.focus()
}

function visside(id,target)  {
var req=svrconn()
req.open('GET',shrpath+'/sideopslag.asp?id='+id, false);
req.send(null);
if (req.responseText.length>0)  {
	if (req.responseText.length>10)  {
		alert(req.responseText)
		return
		}
	if (target=='main')  {
		try {document.getElementById('main').src=req.responseText; return false}
		catch(e) {parent.document.getElementById('main').src=rootpath+'/'+req.responseText; return false}
		}
	else  {
		var tmp=window.open(req.responseText,'popside','top=0,width=800,left=0,height=600,scrollbars=yes')
		tmp.focus()
		}
	}
else  {
	alert('Sidereference ikke fundet.\nSkyldes normalt manglende logon.')
	}
}

function getHTML(id)  {
var req=svrconn()
req.open('GET',shrpath+'/sideHTML.asp?id='+id, false);
req.send(null);
return req.responseText
}

function embedToObject()  {
return
if (!IE) {return};
var objecttag='<object id="%id%" name="%id%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9.0.115" width="%width%" height="%height%">'
var objectparms='<param name=bgcolor value="%bgcolor%"><param name=movie value="/shr/mediaplayer4.swf"><param name=allowfullscreen value="%allowfullscreen%"><param name=allowscriptaccess value="always"><param name="flashvars" value="%flashvars%"><param name="quality" value="%quality%"><param name="scale" value="%scale%"><param name="WMode" value="opaque">'
var embeds=document.getElementsByTagName('EMBED')
for (i=0;i<embeds.length;i++)  {
	var obj=embeds[i]
	if (obj.src.indexOf('.swf')!=-1)  {
	var tmpOBJ=(objecttag+objectparms+'</object>').replace(/%id%/g,obj.id)
	tmpOBJ=tmpOBJ.replace('%width%',obj.width)
	tmpOBJ=tmpOBJ.replace('%height%',obj.height)
	tmpOBJ=tmpOBJ.replace('%bgcolor%',obj.bgcolor)
	tmpOBJ=tmpOBJ.replace('%allowfullscreen%',obj.allowfullscreen)
	tmp=obj.flashvars
	re=/=0x/g
	tmp=tmp.replace(re,'=#')
	tmpOBJ=tmpOBJ.replace('%flashvars%',tmp)
	tmpOBJ=tmpOBJ.replace('%quality%',obj.quality)
	tmpOBJ=tmpOBJ.replace('%scale%',obj.scale)
	obj.outerHTML=tmpOBJ
	}
	}
}

function help_vis(evt) {
if (FF)  {
	help_evntObj= evt.target
	help_evntObjX=evt.pageX+document.body.scrollLeft
	help_evntObjY=evt.pageY+document.body.scrollTop+20
	}
else  {
	help_evntObj= evt.srcElement	
	help_evntObjX=evt.x+document.body.scrollLeft
	help_evntObjY=evt.y+document.body.scrollTop+20
	}
if (help_evntObj.id.length>0)
	help_evntData=help_evntObj.id.substr(1)
else
	help_evntData=help_evntObj.name.substr(1)
if (help_evntData.indexOf(':') ==-1) 
	help_section=help_sys
else  {
	var tmp=help_evntData.split(':')
	help_section=tmp[0]
	help_evntData=tmp[1]
	}
help_hndl=window.setTimeout('help_vismsg()',500)
}

function help_vismsg()  {
   divHTML='<table width="100%" style="background-color:#F0F0F0;border:1px solid #008000;-moz-border-radius: 5px 5px;font-family:verdana;font-size:11px"><tr><td style="background-color:#8585A3;color:#FFFFFF;font-size:12px;font-weight:bold;-moz-border-radius-topleft: 3px;-moz-border-radius-topright: 3px;text-align:center" align=center">%head%</td></tr><tr><td>%body%</td></tr><tr><td><button id="help_button" onclick="help_skjul2()">Luk</button></td></tr></table>'
   tmp=divHTML.replace('%head%',help_evntData)
	var xmlhttp=svrconn() 
	xmlhttp.open("GET","/shr/gethelp.asp?sys="+help_sys+"&sect="+help_section+"&emne="+help_evntData.replace(/ /g ,'_'),false)
	xmlhttp.send(null)
   tmp=tmp.replace('%body%',xmlhttp.responseText)
   document.getElementById('help').innerHTML=tmp
   window.setTimeout('help_vismsg2()',50)
}
function help_vismsg2()  {
divhelp=document.getElementById('help')
//check for plads
help_width=parseInt(divhelp.style.width)
help_height=parseInt(divhelp.scrollHeight)
//alert(help_evntObjX+' '+help_width+' '+help_pageWidth)
if (help_evntObjX+help_width>help_pageWidth) {
	help_evntObjX=help_evntObjX-help_width
	if (help_evntObjX<0)  {
		help_evntObjX=0
		}
}
if (help_evntObjY+help_height>help_pageHeight) {
	help_evntObjY=help_evntObjY-help_height-40
	if (help_evntObjY<0)  {
		help_evntObjY=0
		}	
}
divhelp.style.left=help_evntObjX+'px';
divhelp.style.top=parseInt(help_evntObjY)+'px';
divhelp.style.visibility='visible'
document.getElementById('help_button').focus()
}

function help_skjul()  {
window.clearTimeout(help_hndl)
}

function help_skjul2()  {
document.getElementById('help').style.visibility='hidden'
}

function help_init()  {
var sys=help_hostURL.split('.')
help_sys=sys[sys.length-2]
help_pageWidth=document.body.scrollWidth
help_pageHeight=document.body.scrollHeight
var divelm=document.createElement('DIV')
divelm.setAttribute('id','help')
var elm=document.body.appendChild(divelm)
elm.style.cssText='position:absolute;top:0px;left:0px;z-index:1000;visibility:hidden;width:250px;overflow-x:hidden'
var elmts=document.getElementsByTagName('img')
for (i=0;i<elmts.length;i++)  {
	if (elmts[i].id.substr(0,1)=='_' || elmts[i].name.substr(0,1)=='_') {
		if (window.attachEvent)  {
			elmts[i].attachEvent('onmouseover',help_vis)
			elmts[i].attachEvent('onmouseout',help_skjul)
			}
		else  {
			elmts[i].onmouseover=help_vis
			elmts[i].onmouseout=help_skjul
			}
		}
	}
}

function visShowPro(navn,ref) {
GB_showCenter(navn,ref,490,508)
}

// rutiner til plugin håndtering
function GetHttpRequest()  {  
if ( window.XMLHttpRequest ) 
	return new XMLHttpRequest() ; 
else if ( window.ActiveXObject )  
	return new ActiveXObject("MsXml2.XmlHttp") ; 
} 
 
function AjaxJS(sId, url) {
//var oXmlHttp = GetHttpRequest() ; 
var oXmlHttp = svrconn() ; 
oXmlHttp.open('GET', url, false); 
oXmlHttp.send(null); 
IncludeJS( sId, url, oXmlHttp.responseText )
}

function AjaxCSS(sId, url) {
//var oXmlHttp = GetHttpRequest() ; 
var oXmlHttp = svrconn() ; 
oXmlHttp.open('GET', url, false); 
oXmlHttp.send(null); 
IncludeCSS( sId, url, oXmlHttp.responseText )
}
  
function IncludeJS(sId, fileUrl, source)  { 
if ( ( source != null ) && ( !document.getElementById( sId ) ) ){  
	var oHead = document.getElementsByTagName('HEAD').item(0); 
	var oScript = document.createElement( "script" ); 
	oScript.language = "javascript"; 
	oScript.type = "text/javascript"; 
	oScript.id = sId; 
	oScript.defer = true; 
	oScript.text = source; 
	oHead.appendChild( oScript );
 	//alert(document.getElementById(sId).tagName)
	}  
}

function IncludeCSS(sId, fileUrl, source)  { 
if ( ( source != null ) && ( !document.getElementById( sId ) ) ){  
	var oHead = document.getElementsByTagName('HEAD').item(0); 
	var oCSS = document.createElement( "link" ); 
	oCSS.setAttribute("rel", "stylesheet");
	oCSS.setAttribute("type", "text/css");
	oCSS.setAttribute("id", sId);
	oCSS.setAttribute("href", fileUrl);
	oHead.appendChild( oCSS ); 
	}  
}

function plugins() {
// undersøg html for kandidater
if (document.body.innerHTML.indexOf('visShowPro') !=-1)  {
	AjaxCSS("GB0", "/shr/greybox/gb_styles.css")
	AjaxJS( "GB1", "/shr/greybox/global.js" );
	AjaxJS( "GB2", "/shr/greybox/AJS.js" );
	AjaxJS( "GB3", "/shr/greybox/gb_scripts.js" );
	}
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function winsize()  {
return  //temp, da problem med IE9
if (document.location.href==top.document.location.href) {
	var tmp=document.cookie.split(';')
	if(tmp[0].indexOf('_docheight') !=-1) {
		if (document.documentElement.clientHeight==tmp[0].split('=')[1])  {
			return
			}
		}
	location.href=location.href
	document.cookie='_docheight='+document.documentElement.clientHeight+';'
	}
}


function iframeLoad(obj)  {
if (obj.id !='main')
	return
try {
var dummy=top.pageRef
// find level
var lvl=0
var topSide=top.document.title
var currSide=obj.contentWindow
try {
   while (currSide.document.title != topSide) {
	lvl=lvl+1
	currSide=currSide.parent
	}
    }
catch(e) {}
if (top.suburl.length>0)  {
	tmp=top.suburl.split('/')
	// hent aktuel side
	if (tmp[lvl].length>0) {
		var side=top.pageRef[tmp[lvl]]
		if (side && obj.src.indexOf(side)==-1)
			obj.src=side+'.asp'
		}
	}
// opbyg aktuel lang URL fra toppen
var URLtop=top.document.location.href.split('#/')[0]+'#/'
var currside=top.document
//URLtop=URLtop+currside.title+'/'
while (currside.getElementById('main'))  {
	var iframObj=currside.getElementById('main').contentWindow.document
	URLtop=URLtop+top.standardStr(iframObj.title)+'/'
	currside=iframObj
}
top.document.location.href=URLtop
}
catch(e) {}

if (obj.id !='main')
	return

// evt. resize iframe
var iframeH=obj.parentNode.offsetHeight
var pageStyle=obj.contentWindow.document.body.style.overflow
var pageH=obj.contentWindow.document.body.scrollHeight
// Firefox BUG
if (navigator.userAgent.indexOf('Firefox') !=-1 && pageH==obj.contentWindow.document.body.offsetHeight) {
	try {
	if (obj.contentWindow.document.body.getElementsByTagName('DIV')[0].scrollHeight>pageH)  {
		pageH=obj.contentWindow.document.body.getElementsByTagName('DIV')[0].scrollHeight
		}
	else {
        pageH=pageH+1
        }
	}
	catch(e) {}	
}
if (pageStyle !='scroll' && pageH>obj.parentNode.offsetHeight)
	obj.data=''
if (obj.data==obj.src)
	return
obj.data=obj.src
obj.style.height=obj.parentNode.offsetHeight+'px'
if (pageStyle=='scroll')  {
	obj.contentWindow.document.body.style.overflowX='hidden'
	obj.parentNode.style.height=obj.contentWindow.document.body.scrollHeight+'px'
	obj.style.height=obj.contentWindow.document.body.scrollHeight+'px'
	obj.contentWindow.document.body.style.overflowY='scroll'
	}
else  {
	if (pageH>=obj.parentNode.offsetHeight) {
		obj.contentWindow.document.body.style.overflowY='scroll'
		obj.contentWindow.document.body.style.overflowX='hidden'
		}
	else	{
		obj.contentWindow.document.body.style.overflowY='hidden'
		obj.contentWindow.document.body.style.overflowX='hidden'
		}
	}

}


function resizeBGimages(n) {
if (n.nodeType == 1) {	 // Check if n is an Element
	try  {
		if (n.currentStyle.backgroundImage != "none") {
			if (n.currentStyle.backgroundImage.indexOf('picmgr') !=-1) {
				var tmp=n.currentStyle.backgroundImage.replace(/height=0/,'height='+n.offsetHeight)
				tmp=tmp.replace(/width=0/,'width='+n.offsetWidth)
				n.style.backgroundImage=tmp
				}
			}
		}	
	catch(e)   {
		if (window.getComputedStyle(n,null).backgroundImage != "none") {
			if (window.getComputedStyle(n,null).backgroundImage.indexOf('picmgr') !=-1) {
				var tmp=window.getComputedStyle(n,null).backgroundImage.replace(/height=0/,'height='+n.offsetHeight)
				tmp=tmp.replace(/width=0/,'width='+n.offsetWidth)
				n.style.backgroundImage=tmp
				}
			}	
		}			
	}
var children = n.childNodes;	 // Now get all children of n
for(var i=0; i < children.length; i++) {	// Loop through the children
	resizeBGimages(children[i]);	 // Recurse on each one
	}
}

function ajaxGet(domnavn,url,funk,id)  {
var xmlhttp=svrconn()
xmlhttp.open("GET",'/shr/includes/'+domnavn+'/'+url+'.asp?funk='+funk+'&id='+id,false)
xmlhttp.send(null)
return xmlhttp.responseText
}

function PopUp(body, style, modal,txt) {
	if (!txt)
		txt='Uden navn'
	this.body = '<div><table class="popHeader" style="width:100%"><tr><td> '+txt+'</td><td width=20 align=right><img src="/shr/images/close.png" style="cursor:pointer" title="Luk" onclick="popSkjul()" align=absmiddle></td></tr></table></div>'+body;
	this.modal = modal;
	this.style = style;
	var h=parseInt(this.style.height)+25
	this.style.height=h+'px'
	this.divEl = null;
	this.modalEl = null;
	this.visible = false;
	this.callback = null;
}
	
PopUp.prototype.show = function() {
	if (this.visible)
		return;

	if (this.modal) {
		this.createModal();
		if (this.modalEl)
			document.body.appendChild(this.modalEl);
	}

	this.createDiv();
	if (this.divEl)
		document.body.appendChild(this.divEl);

	this.visible = true;
}

PopUp.prototype.hide = function() {
	if (!this.visible)
		return;

	if (this.divEl)
		this.divEl.parentNode.removeChild(this.divEl);

	if (this.modalEl)
		this.modalEl.parentNode.removeChild(this.modalEl);

	this.visible = false;
	if (this.callback)
		this.callback();
}

PopUp.prototype.isVisible = function() {
	return this.visible;
}

PopUp.prototype.createModal = function() {
	this.modalEl = document.createElement("div");
	this.modalEl.style.cssText = '-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";filter:alpha(opacity=70);';
	this.modalEl.style.zIndex = "1001";
	this.modalEl.style.height = "100%";
	this.modalEl.style.width = "100%";
	this.modalEl.style.position = "fixed";
	this.modalEl.style.top = "0px";
	this.modalEl.style.left = "0px";
	this.modalEl.style.opacity = ".70";
	this.modalEl.style.background = "#AED4F0";
}

PopUp.prototype.createDiv = function() {
	this.divEl = document.createElement("div");
	this.divEl.style.cssText = this.style;
	this.divEl.style.zIndex = "1002";
	if (!this.divEl.style.overflow)
		this.divEl.style.overflow = "hidden";
	if (!this.divEl.style.position)
		this.divEl.style.position = this.modal ? "fixed" : "relative";
	if (!this.divEl.style.padding)
		this.divEl.style.padding = "5px";
	if (!this.divEl.style.background)
		this.divEl.style.background = "white";
	if (!this.divEl.style.border)
		this.divEl.style.border = "2px solid gray";
	if (!this.divEl.style.display)
		this.divEl.style.display = "block";
	if (this.modal && this.divEl.style.width && !this.divEl.style.left && !this.divEl.style.marginLeft) {
		this.divEl.style.left = "50%";
		this.divEl.style.marginLeft = "-" + (/^\d+/.exec(this.divEl.style.width)[0] / 2) + "px";
		if (!this.divEl.style.top)
			this.divEl.style.top = "10%";
	}
	
	if (typeof(this.body) === "object") {
		this.divEl.appendChild(this.body);
	} else {
		this.divEl.innerHTML = this.body;
	}
}

PopUp.prototype.regCallback = function(cb) {
	if (typeof(cb) == "function")
		this.callback = cb;
}

var pop
var popretur=''

function popVis(w,h,src,header)  {
var avail=document.body.offsetHeight*0.9
var style='width:'+w+'px;height:'+h+'px;padding:0px'
if (avail<h)
	style=style+';top:10px'
var modal=true
var framH=h-25
var body='<iframe frameborder=0 style="width:100%;height:'+framH+'px" src="'+src+'"></iframe>'
pop= new PopUp(body, style, modal,header);
pop.show();
//pop.regCallback(function() {alert('test');});
popretur=''
}

function popSkjul()  {
pop.hide()
pop=null
}

function checkSubmit() {
if (errinfo.length>0) {
	alert(errinfo)
	errinfo=""
	return false
	}
}

var cmenuhtml
function cmenu() {
if (top.document.location.href.indexOf('/cms/')==-1)
	return
cmenuhtml=top.document.body.parentNode.innerHTML+'<||>'
var iframes=top.document.getElementsByTagName('IFRAME')
for (i=0;i< iframes.length;i++) {
	if (iframes[i].id=='main') {
		cmenuhtml+=iframes[i].contentWindow.document.body.parentNode.innerHTML+'<||>'
		var subf=iframes[i].contentWindow.document.getElementsByTagName('IFRAME')
		if (subf.length>0) {
			for (i2=0;i2<subf.length;i2++) {
				if (subf[i2].id='main')
					cmenuhtml+=subf[i2].contentWindow.document.body.parentNode.innerHTML+'<||>'
			}
		}
	}
}
//popVis(450,200,'/cms/siderefgen.asp','Dan reference side')
}
