
if (typeof window.event == 'undefined') {
	window.addEventListener('mousedown',function(e){window.event={x:e.clientX,y:e.clientY}},false);
}
/* 
	Personal links script - begin
*/

function ShowStress() {
	
	document.getElementById("mDivStressBar").style.display = 'block';
}

var aIsLayerShown = false;
function MouseOverTimeout() {
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 130;		
	}
	if (yMousePos > document.getElementById('PersonalLinksLayer').height) {
		setTimeout("HidePersonalLinksLayer()", 2000);
	}
}
function AddPersonalLink(iUrl) {
	var aTitle = document.title
	aTitle = aTitle.replace('\&amp;','%26');
	aTitle = aTitle.replace('\&amp;','%26');
	aTitle = aTitle.replace('\&','%26');
	aTitle = aTitle.replace('\&','%26');
	document.location.href=iUrl + '&Title=' + aTitle;
	
}
function HidePersonalLinksLayer(aObjLayerId) {
	try {
		if (aIsLayerShown == true) {
			document.getElementById(aObjLayerId).style.display = 'none';	
			aIsLayerShown = false;	
		}
	} catch (err) {};

}
function ShowPersonalLinksLayer(aObjLayerId) {
	if (aIsLayerShown == false) {
		document.getElementById(aObjLayerId).style.display = 'block';	
		aIsLayerShown = true;
	}
}
/* 
	Personal links script - begin
*/
var mIsRegistrationFormValid = true;

function ValidateFormField(iFieldId, iFormId, WebControlName) {
	
	var aObjField = document.getElementById(iFieldId);
	var aValidationImg = document.getElementById(iFieldId + 'img');
	
	var regExp = null;
	var aResult = null;
	
	if (document.getElementById(iFieldId + 'RegExp').value != '') {
		
		regExp = new RegExp(document.getElementById(iFieldId + 'RegExp').value);
		aResult = regExp.exec(aObjField.value);
	}
	
	if (aResult == null) {
		aValidationImg.src = '/images/gen/validate_ERR.gif';
		aObjField.setAttribute('isvalid', 'false');
		
		
	} else {
		aValidationImg.src = '/images/gen/validate_OK.gif';	
		aObjField.setAttribute('isvalid', 'true');	
		
	}
	//alert(document.getElementById('mDivValidationSummaryHolder').innerHTML)
	//alert(iFormId)
	ValidateForm(iFormId, WebControlName);
}

function ValidateForm(iFormId, WebControlName) {
	if (WebControlName != null) {
		document.getElementById(WebControlName + 'mDivValidationSummaryHolder').innerHTML = '';
	} else {
		document.getElementById('mDivValidationSummaryHolder').innerHTML = '';
	}
	
	var aTempIsValid = true;
	var errMsg = '';
	
	errMsg = '<br/><div style="color:red;"><b>Der opstod en eller flere fejl!</b></div>'
	errMsg += '<ul style="color:red;">';
	
	for (var i = 0; i < document.forms['RegistrationForm'].length;i++) {
		if (document.forms['RegistrationForm'].item(i).isvalid != 'undefined') {
			if (document.forms['RegistrationForm'].item(i).isvalid == 'false') {
				var aObjId = document.forms['RegistrationForm'].item(i).id;
				errMsg += '<li style="color:red;">' + document.getElementById(aObjId + 'ErrMsg').value + '</li>';
				mIsRegistrationFormValid = false;
				
			} else {
				if (WebControlName != null) {
					document.getElementById(WebControlName+'mBtnSubmit').disabled = true;
				} else {
					document.getElementById('mBtnSubmit').disabled = true;
				}
			}
		} 
	}
	errMsg += '</ul>'

	for (var i = 0; i < document.forms['RegistrationForm'].length;i++) {
		if (document.forms['RegistrationForm'].item(i).isvalid != 'undefined') {
			if (document.forms['RegistrationForm'].item(i).isvalid == 'false') {
				var aObjId = document.forms['RegistrationForm'].item(i).id;
				//errMsg += '<li type="Circle" style="color:red;">' + document.getElementById(aObjId + 'ErrMsg').value + '</li>';
				aTempIsValid = false;
			} 	
		}
	}

	if (mIsRegistrationFormValid == false) {
		if (WebControlName != null) {
			document.getElementById(WebControlName + 'mDivValidationSummaryHolder').innerHTML = errMsg;
		} else {
			document.getElementById('mDivValidationSummaryHolder').innerHTML = errMsg;
		}	
	} else {
		if (WebControlName != null) {
			document.getElementById(WebControlName + 'mDivValidationSummaryHolder').innerHTML = '';
		} else {
			document.getElementById('mDivValidationSummaryHolder').innerHTML = '';
		}	
	}
	
	if (aTempIsValid) {
		if (WebControlName != null) {
			document.getElementById(WebControlName + 'mDivValidationSummaryHolder').innerHTML = '';
			document.getElementById(WebControlName + 'mBtnSubmit').disabled = false;
		} else {
			document.getElementById('mDivValidationSummaryHolder').innerHTML = '';
			document.getElementById('mBtnSubmit').disabled = false;
		}		
		//alert('disabled = false');	
	}	
	
}
function OnloadAllPages() {
	JustifyAdvSearch();
	TestIfFramed();
}

function OpenHelpWin() {
	var xMousePos = 0; // Horizontal position of the mouse on the screen
	var yMousePos = 0; // Vertical position of the mouse on the screen
	var xMousePosMax = 0; // Width of the page
	var yMousePosMax = 0; // Height of the page	
	
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 130;		
	}	
	

    
	var PosLeft = xMousePos - 740;
	var PosTop = yMousePos - 60;
	
	var myWin;
	myWin = window.open('Show.aspx?docid=help&keyid=17','MyHelpWin','left='+PosLeft+',top='+PosTop+',width=550,height=650,scrollbars=yes,resizable=yes',true);
	myWin.focus();
}

// Funktioner til parsing af Querystring - Start
function PageQuery(q) {
	if(q.length > 1) 
		this.q = q.substring(1, q.length);
		else 
		this.q = null;
		this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { 
		return this.keyValuePairs; 
	}
	this.getValue = function(s) {
	for(var j=0; j < this.keyValuePairs.length; j++) {
		if(this.keyValuePairs[j].split("=")[0] == s)
		return this.keyValuePairs[j].split("=")[1];
	}
	return false;
	}
	this.getParameters = function() {
	var a = new Array(this.getLength());
	for(var j=0; j < this.keyValuePairs.length; j++) {
		a[j] = this.keyValuePairs[j].split("=")[0];
	}
	return a;
	}
	this.getLength = function() { 
		return this.keyValuePairs.length; 
	} 
}
function queryString(key) {
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}
// Funktioner til parsing af Querystring - Slut
// Funktioner til Reload af frameset - Start
function TestIfFramed() {
	try {
			if (parent.top.frames['Toppen'] == null) {
				
				var aDocUrl = document.location.href;
				var aDocUrlReplaced = aDocUrl;
				
				if (aDocUrlReplaced.indexOf('PageUrl') == -1) {
					if ((aDocUrl.indexOf('popup_flash') == -1) && (aDocUrl.indexOf('help') == -1)) {
						if (aDocUrlReplaced.indexOf('olddocid\=frameset') != -1) {
							aDocUrlReplaced = aDocUrlReplaced.replace('\&docid\=','\&subdoc\=');							
							aDocUrlReplaced = aDocUrlReplaced.replace('olddocid\=frameset','docid\=frameset');						
							document.location.href = aDocUrlReplaced;
						} else {
							if (aDocUrlReplaced.indexOf('frameset') == -1) {
								aDocUrlReplaced = aDocUrlReplaced.replace('docid','subdoc');
								if (aDocUrlReplaced.indexOf('\?') != -1) {
									aDocUrlReplaced = aDocUrlReplaced + '\&docid\=frameset';
								} else {						
									aDocUrlReplaced = aDocUrlReplaced + '\?docid\=frameset';
								}
								document.location.href = aDocUrlReplaced;
							}					
						}	
					}
					/*
					var atest = parent.frames[1]
					alert(atest.parent.frames['content'].location.href.indexOf('frame'))
					var aDocUrl = document.location.href;
					var aDocUrlReplaced = aDocUrl.replace('docid','subdoc');				
					if (atest.parent.top.frames['content'].location.href.indexOf('frame') != -1) {
						
						if ((aDocUrl.indexOf('popup_flash') == -1) && (aDocUrl.indexOf('help') == -1)) {
							if (aDocUrlReplaced.indexOf('frameset') == -1) {
								if (aDocUrlReplaced.indexOf('\?') != -1) {
									aDocUrlReplaced = aDocUrlReplaced + '\&docid\=frameset';
								} else {
									aDocUrlReplaced = aDocUrlReplaced + '\?docid\=frameset';
								}
								parent.top.document.location.href = aDocUrlReplaced	
							}			
						}	
					}
					*/
													
				}			
			}
		} catch (err) {
	}
}
// Funktioner til Reload af frameset - Slut


function SetPraeparatTextForPrint() {
	//document.getElementById('mObjPraeparatTextDiv').style.display = 'block';
	document.getElementById('mObjPraeparatTextDiv').innerText = document.getElementById('pnotetext').innerText
	
	//alert(document.getElementById('mObjPraeparatTextDiv').innerHtml);
	//alert('hej!');
}
function ConfirmDelete (iUrl) {
	var dialogen = confirm('Vil du slette denne post\?');
	if (dialogen) {
		location.href=iUrl;
		return true;
	} else {
		return false;
	}
}
//////////////////////////// -- Sammenstilling start
function ShowHideSammenstilBtn(aObjForm) {
	if (aObjForm.mSubmit.value=='Sammenstil') {
		aObjForm.mSubmit.disabled = true;
	}
	if ((aObjForm.Praeparat1Nr) && (aObjForm.Praeparat2Nr)) {
		if (aObjForm.Praeparat1Nr.value && aObjForm.Praeparat2Nr.value) {
			aObjForm.mSubmit.disabled = false;
		}	
	}
	if (aObjForm.Praeparat2Nr && aObjForm.Praeparat3Nr) {
		if (aObjForm.Praeparat2Nr.value && aObjForm.Praeparat3Nr.value) {
			aObjForm.mSubmit.disabled = false;		
		}	
	}
	if (aObjForm.Praeparat1Nr && aObjForm.Praeparat3Nr) {
		if (aObjForm.Praeparat1Nr.value && aObjForm.Praeparat3Nr.value) {
			aObjForm.mSubmit.disabled = false;		
		}	
	}			
}
//////////////////////////// -- Sammenstilling 


function DoSubmitPraeparat1(aObjSelectBox1) {
	document.getElementById('Praeparat1Nr').value = aObjSelectBox1.options[aObjSelectBox1.selectedIndex].value;
	document.forms['SammenstilForm'].submit();
	return true;
}
function AdjustHtmlTables() {
	var aMaxWidth = 0;
	var aWidth = 0;
	var aTables = document.getElementsByTagName('TABLE');
	
	for (var i = 0; i < aTables.length; i++) {
		if (aTables[i].getAttribute('IsAdjustable')) {
			if (aTables[i].getAttribute('IsAdjustable') != '') {
				aWidth = aTables[i].offsetWidth;
				if (aTables[i].getAttribute('width') != '') {
					if (aTables[i].getAttribute('width') == '50%') {
						if (aWidth < 500) {
							aWidth = 500;
						}
					}
				}
				if (aWidth > aMaxWidth) {
					aMaxWidth = aWidth;
				}
			}
		}
	}
	//Resize tables
	var aWindowWidth;
	try {
		aWindowWidth = Math.round(70/100 * document.body.scrollWidth);
		} catch (err) {
	}
	for (var i = 0; i < aTables.length; i++) {
		if (aTables[i].getAttribute('IsAdjustable')) {
			if (aMaxWidth!=0) {
				if (aTables[i].getAttribute('IsAdjustable') != '') {
					try { 
						if (aMaxWidth > aWindowWidth) {
							aMaxWidth = aWindowWidth;
						}
					} catch (err) {
					}
					aTables[i].style.width = aMaxWidth+'px';
				}
			}
		}
	}
} 

function goE(mainID, iLevel, iOrdningsNr, iOrdningsNr2, iRootNr) {

	
	if (mainID == 3) {

	} else { //---- DISPLAY

		if (mainID != null) {
		
			if(document.getElementById('chld'+mainID).style.display == 'none') {
				document.getElementById('chld'+mainID).style.display = 'block';			
				document.images['tIMG'+mainID].src = '/images/Gen/PilMinus.gif';
				
				if (mainID > '0') {
					//window.open('Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level='+iLevel+'&OrdningsNr='+iOrdningsNr)
					//window.frames['NCBuilder'].src = 'Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level='+iLevel+'&OrdningsNr='+iOrdningsNr+'&OrdningsNr2='+iOrdningsNr2+'&RootNr='+iRootNr; 
					
					window.frames['NCBuilder'].location.href = 'Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level='+iLevel+'&OrdningsNr='+iOrdningsNr+'&OrdningsNr2='+iOrdningsNr2+'&RootNr='+iRootNr; 
					//alert(window.frames['NCBuilder'].location.href)
					
					//document.frames('NCBuilder').document.location.href = 'Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level='+iLevel+'&OrdningsNr='+iOrdningsNr+'&OrdningsNr2='+iOrdningsNr2+'&RootNr='+iRootNr; 
					}
			} else {
				document.getElementById('chld'+mainID).style.display = 'none';
				document.images['tIMG'+mainID].src = '/images/Gen/PilPlus.gif';
			} 
		} 
	} 
}
function goSE(mainID, iLevel, iOrdningsNr, iOrdningsNr2, iRootNr) {

	if (mainID == 3) {

	} else { //---- DISPLAY

		if (mainID != null) {
			if(document.getElementById('chld'+mainID).style.display == 'none') {
				document.getElementById('chld'+mainID).style.display = 'block';
				document.images['tIMG'+mainID].src = '/images/Gen/PilMinus.gif';
				if (mainID > '0') {
					//window.open('Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level='+iLevel+'&OrdningsNr='+iOrdningsNr)
					window.frames['NCBuilder'].location.href = 'Hidden_Iframe.aspx?GruppeNr='+mainID+'&Level=2&OrdningsNr='+iOrdningsNr+'&OrdningsNr2='+iOrdningsNr2+'&IsSpecialEmne=True&RootNr='+iRootNr; 
					}
			} else {
				document.getElementById('chld'+mainID).style.display = 'none';
				document.images['tIMG'+mainID].src = '/images/Gen/PilPlus.gif';
			} 
		} 
	} 
}

// Vis Advanced Search - Start
				try {
					if (parent.frames['Toppen']) {
						if (parent.frames['Toppen'].mTopSoegefelt) {
							if (parent.frames['Toppen'].mTopSoegefelt.style.display == 'none') {
								try {
									if (parent.frames['content'].queryString('docid') == 'search_all') {
										setTimeout("try {parent.frames['content'].ShowHideAdvancedSearch();} catch (err) {}", 600);
										// Midlertidigt skjuler vi også advanced-search ved "Search_all" ... :
										//setTimeout("try {parent.frames['content'].HideAdvSearch();} catch (err) {}", 600);
									} else {
										//HideAdvSearch()
										setTimeout("try {parent.frames['content'].HideAdvSearch();} catch (err) {}", 600);
									}
									} catch (err) {
								}			
							} else {
								
							}
						}
					}
				} catch (err) {
			}	
// Vis Advanced Search - Slut
var mIsAdvancedSearchVisible = false;
var mReloadAdvancedSearch = false;
var mObjAdvancedSearchId = 'mObjAdvancedSearch';


function CheckFonetic(iObjId) {
	var mSelectDetSoegte = parent.frames['content'].document.getElementById('mSelectDetSoegte');
	var mSelectOgTxt = document.getElementById('mSelectOg').options.value;
	if (iObjId == 'Fonetic') {
		if (document.getElementById('Fonetic').checked == true) {
			document.getElementById('mSelectOg').options[0].selected = true;
		}		
	} else {

		if (mSelectOgTxt != 'start') {
			document.getElementById('Fonetic').checked = false;
			document.getElementById('Fonetic').disabled = true;
			document.getElementById('Fonetic').style.visibility= 'hidden';
		}
		if (mSelectOgTxt == 'start') {
			document.getElementById('Fonetic').style.visibility= 'visible';		
			document.getElementById('Fonetic').disabled = false;
			document.getElementById('Fonetic').checked = true;
		}
		if (mSelectDetSoegte.options[2].selected || mSelectDetSoegte.options[3].selected) {
			document.getElementById('Fonetic').checked = false;
			document.getElementById('Fonetic').disabled = true;
			document.getElementById('Fonetic').style.visibility= 'hidden';		
		} else {
			document.getElementById('Fonetic').style.visibility= 'visible';	
			document.getElementById('Fonetic').disabled = false;		
			document.getElementById('Fonetic').checked = true;
		}									
	}
}
function JustifyAdvSearch() {
	
	if (mIsAdvancedSearchVisible) {
		try {
				if (document.body.scroll) {
					document.getElementById('mObjAdvancedSearch').style.top=document.body.scrollTop;
					document.getElementById('mObjAdvancedSearch').style.left=(document.body.scrollLeft - 263);
				} else {
					document.getElementById('mObjAdvancedSearch').style.top=document.body.scrollTop;
					document.getElementById('mObjAdvancedSearch').style.left=(document.body.offsetWidth - 263);
				}
		
			} catch (err) {
		}		
	} else {	
		try {
				if (document.body.scroll) {
					document.getElementById('mObjAdvancedSearch').style.top=document.body.scrollTop;
					document.getElementById('mObjAdvancedSearch').style.left=(document.body.scrollLeft - 263);
				} else {
					//document.getElementById('mObjAdvancedSearch').style.top=document.body.offsetHeight;
					document.getElementById('mObjAdvancedSearch').style.left=(document.body.offsetWidth - 263);
				}
		
			} catch (err) {
		}			
	}
}



function DoTopBtnMouseOver() {
	var mTopSoegeBtn = parent.frames['Toppen'].document.getElementById('mTopSoegeBtn');
	
	if (mTopSoegeBtn.imagename=='advsoeg_knap_0.gif') {
		mTopSoegeBtn.src='/images/LKMenu/advsoeg_knap_1.gif';
		mTopSoegeBtn.imagename='advsoeg_knap_1.gif'
		return;
	}
	if (mTopSoegeBtn.imagename=='stsoeg_knap_0.gif') {
		mTopSoegeBtn.src='/images/LKMenu/stsoeg_knap_1.gif';
		mTopSoegeBtn.imagename='stsoeg_knap_1.gif'
		return;
	}	
}
function DoTopBtnMouseOut() {
	var mTopSoegeBtn = parent.frames['Toppen'].document.getElementById('mTopSoegeBtn');
	if (mTopSoegeBtn.imagename=='advsoeg_knap_1.gif') {
		mTopSoegeBtn.src='/images/LKMenu/advsoeg_knap_0.gif';
		mTopSoegeBtn.imagename='advsoeg_knap_0.gif'
	}
	if (mTopSoegeBtn.imagename=='stsoeg_knap_1.gif') {
		mTopSoegeBtn.src='/images/LKMenu/stsoeg_knap_0.gif';
		mTopSoegeBtn.imagename='stsoeg_knap_0.gif'
	}	
}
function DoAdvPilMouseOver() {
	
	var mImgSoegepil = parent.frames['Toppen'].document.getElementById('mImgSoegepil');
	
	if (mImgSoegepil.imagename=='advsoeg_pil_0.gif') {
		mImgSoegepil.src='/images/LKMenu/advsoeg_pil_1.gif';
		mImgSoegepil.imagename='advsoeg_pil_1.gif'
		return;
	}
	if (mImgSoegepil.imagename=='stsoeg_pil_0.gif') {
		mImgSoegepil.src='/images/LKMenu/stsoeg_pil_1.gif';
		mImgSoegepil.imagename='stsoeg_pil_1.gif'
		return;
	}	
}
function DoAdvPilMouseOut() {
	var mImgSoegepil = parent.frames['Toppen'].document.getElementById('mImgSoegepil');
	if (mImgSoegepil.imagename=='advsoeg_pil_1.gif') {
		mImgSoegepil.src='/images/LKMenu/advsoeg_pil_0.gif';
		mImgSoegepil.imagename='advsoeg_pil_0.gif'
	}
	if (mImgSoegepil.imagename=='stsoeg_pil_1.gif') {
		mImgSoegepil.src='/images/LKMenu/stsoeg_pil_0.gif';
		mImgSoegepil.imagename='stsoeg_pil_0.gif'
	}	
}
function ConfirmAdvSearch() {
	var mSelectDetSoegte = parent.frames['content'].document.getElementById('mSelectDetSoegte');
	var mSelectOg = parent.frames['content'].document.getElementById('mSelectOg');
	if (mSelectDetSoegte.options[1].selected || mSelectDetSoegte.options[3].selected) {
		mSelectOg.options[0].selected = true;
		mSelectOg.options[0].value = 'na';
		mSelectOg.options[0].innerText = 'Ej relevant';
		mSelectOg.disabled = true;
		
	} else {
		mSelectOg.options[0].value = 'start';
		mSelectOg.options[0].innerText = 'starter med ordet/ordene';
		mSelectOg.disabled = false;	
	}
	if (mSelectDetSoegte.options[2].selected || mSelectDetSoegte.options[3].selected) {
		document.getElementById('Fonetic').checked = false;
		document.getElementById('Fonetic').disabled = true;
		document.getElementById('Fonetic').style.visibility= 'hidden';		
	} else {
		document.getElementById('Fonetic').style.visibility= 'visible';	
		document.getElementById('Fonetic').disabled = false;		
		document.getElementById('Fonetic').checked = true;
	}
}
function GoAdvancedSearch(iObjForm) {
	iObjForm.submit()
}
function GoSearch(iObjForm) {
	iObjForm.submit()

}
function SetAdvancedSearchVisibleParam(iValue) {

	mIsAdvancedSearchVisible = iValue;

}

function ShowHideAdvancedSearch() {

	if (document.all) {
		var mRightMenuBottom = parent.frames['content'].document.getElementById('mRightMenuBottom');
		var mImgSoegepil = parent.frames['Toppen'].document.getElementById('mImgSoegepil');
		var mRightMenuBottom = parent.frames['Toppen'].document.getElementById('mRightMenuBottom');
		var mObjAdvancedSearch = parent.frames['content'].document.getElementById('mObjAdvancedSearch');
		var mObjSpacer = parent.frames['Toppen'].document.getElementById('spacer_hoejre');	
		var mTopSoegefelt = parent.frames['Toppen'].document.getElementById('mTopSoegefelt');
		var mTopSoegefeltImage = parent.frames['Toppen'].document.getElementById('mTopSoegefeltImage');
		var mLogoSpacer = parent.frames['Toppen'].document.getElementById('mLogoSpacer');
		var mSearchStringTop = parent.frames['Toppen'].document.getElementById('SearchString');
		var mSearchStringContent = parent.frames['content'].document.getElementById('SearchString');	
		var mTopSoegeBtn = parent.frames['Toppen'].document.getElementById('mTopSoegeBtn');
				
		if (mIsAdvancedSearchVisible) {
			mRightMenuBottom.className = 'LKMenuDarkGreen';	
			mObjAdvancedSearch.style.display = 'none';
			mObjSpacer.style.display = 'none';
			mIsAdvancedSearchVisible = false;
			mReloadAdvancedSearch = false;
			mImgSoegepil.src='/images/LKMenu/stsoeg_pil_0.gif';
			mImgSoegepil.imagename='stsoeg_pil_0.gif'
			mImgSoegepil.alt = 'Avanceret s\u00F8gning';
			mTopSoegefelt.style.display = 'block';
			mTopSoegefeltImage.style.display = 'none';
			mLogoSpacer.style.display = 'none';
			mTopSoegeBtn.src='/images/LKMenu/stsoeg_knap_0.gif';
			mTopSoegeBtn.imagename='stsoeg_knap_0.gif';
			mSearchStringTop.focus();
		} else {
			mRightMenuBottom.className = 'LKMenuGreen';
			mObjAdvancedSearch.style.display = 'block';
			mObjSpacer.style.display = 'block';
			mIsAdvancedSearchVisible = true;
			mReloadAdvancedSearch = true;
			mImgSoegepil.src='/images/LKMenu/advsoeg_pil_0.gif';
			mImgSoegepil.imagename='advsoeg_pil_0.gif'
			mImgSoegepil.alt = 'Standard s\u00F8gning';
			mTopSoegefelt.style.display = 'none';
			mTopSoegefeltImage.style.display = 'block';
			mLogoSpacer.style.display = 'block';
			mTopSoegeBtn.src='/images/LKMenu/advsoeg_knap_0.gif';
			mTopSoegeBtn.imagename='advsoeg_knap_0.gif';
			mSearchStringContent.focus();			
		}	
	} else {
		parent.frames['content'].location.href = 'Show.aspx?docid=Search_Adv';
	}			
}

function HideAdvSearch() {
	var mRightMenuBottom = parent.frames['content'].document.getElementById('mRightMenuBottom');
	var mImgSoegepil = parent.frames['Toppen'].document.getElementById('mImgSoegepil');
	var mRightMenuBottom = parent.frames['Toppen'].document.getElementById('mRightMenuBottom');
	var mObjAdvancedSearch = parent.frames['content'].document.getElementById('mObjAdvancedSearch');
	var mObjSpacer = parent.frames['Toppen'].document.getElementById('spacer_hoejre');	
	var mTopSoegefelt = parent.frames['Toppen'].document.getElementById('mTopSoegefelt');
	var mTopSoegefeltImage = parent.frames['Toppen'].document.getElementById('mTopSoegefeltImage');
	var mLogoSpacer = parent.frames['Toppen'].document.getElementById('mLogoSpacer');
	var mSearchStringTop = parent.frames['Toppen'].document.getElementById('SearchString');
	var mSearchStringContent = parent.frames['content'].document.getElementById('SearchString');	
	var mTopSoegeBtn = parent.frames['Toppen'].document.getElementById('mTopSoegeBtn');					
	mRightMenuBottom.className = 'LKMenuDarkGreen';	
	mObjAdvancedSearch.style.display = 'none';
	mObjSpacer.style.display = 'none';
	mIsAdvancedSearchVisible = false;
	mReloadAdvancedSearch = false;
	mImgSoegepil.src='/images/LKMenu/stsoeg_pil_0.gif';
	mImgSoegepil.imagename='stsoeg_pil_0.gif'
	mImgSoegepil.alt = 'Avanceret s\u00F8gning';
	mTopSoegefelt.style.display = 'block';
	mTopSoegefeltImage.style.display = 'none';
	mLogoSpacer.style.display = 'none';
	mTopSoegeBtn.src='/images/LKMenu/stsoeg_knap_0.gif';
	mTopSoegeBtn.imagename='stsoeg_knap_0.gif';
	mSearchStringTop.focus();
}


function SubmitLkSearchTop() {
 if (mIsAdvancedSearchVisible) {
	parent.frames['content'].document.forms[0].submit();
	//alert('Advanced Search is visible');
 } else {
	parent.frames['Toppen'].document.forms[0].submit(); 
	//alert('Advanced Search is hidden');	
 }
}

function ShowHide(iGuid,iVisButton) {
	var TrRow = document.getElementById(iGuid)
	var VisButton = document.getElementById(iVisButton)
	if (TrRow.style.display) {
		if (TrRow.style.display == 'block') {
			TrRow.style.display = 'none';
			VisButton.src = '/images/Gen/arrow_vis.gif';
		} else {
			TrRow.style.display = 'block';
			VisButton.src = '/images/Gen/arrow_skjul.gif'
		}
	} else {
		TrRow.style.display = 'block';
	}		
}

function OpenAnimFlashWindow(Src) {

	var xMousePos = 0; // Horizontal position of the mouse on the screen
	var yMousePos = 0; // Vertical position of the mouse on the screen
	var xMousePosMax = 0; // Width of the page
	var yMousePosMax = 0; // Height of the page	
	
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 180;		
	}
  
	var PosTop = yMousePos - 700;
	var PosLeft = xMousePos - 275;

	var myWin;
	myWin = window.open('Show.aspx?docid=popup_flash&FlashFile='+Src+'','MyFlashWin','left='+PosLeft+',top='+PosTop+',width=450,height=550,scrollbars=no,resizable=yes',true);
	myWin.focus();
}

function OpenFlashWindow(Src) {

	var xMousePos = 0; // Horizontal position of the mouse on the screen
	var yMousePos = 0; // Vertical position of the mouse on the screen
	var xMousePosMax = 0; // Width of the page
	var yMousePosMax = 0; // Height of the page	
	
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 180;		
	}
    
	var PosTop = yMousePos - 700;
	var PosLeft = xMousePos - 275;

	var myWin;
	myWin = window.open('Show.aspx?docid=popup_flash&FlashFile='+Src+'','MyFlashWin','left='+PosLeft+',top='+PosTop+',width=550,height=650,scrollbars=no,resizable=yes',true);
	myWin.focus();
}

function OpenPilleWindow(DrugId, HeaderText, Token) {
	
	var xMousePos = 0; // Horizontal position of the mouse on the screen
	var yMousePos = 0; // Vertical position of the mouse on the screen
	var xMousePosMax = 0; // Width of the page
	var yMousePosMax = 0; // Height of the page	
	
	//alert(window.screenLeft)
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 180;		
	}

	
	//xMousePos = window.event.x
    //yMousePos = window.event.y
	
	//xMousePos = window.event.x+document.body.scrollLeft;
    //yMousePos = window.event.y+document.body.scrollTop;
    xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
    yMousePosMax = document.body.clientHeight+document.body.scrollTop;

	//var PosTop = screen.height/2 - 300;
	//var PosLeft = screen.width/2 - 100;
	//alert('Horizontal:'+xMousePos+'px')				
	//alert('Vertical:'+yMousePos+'px')
	var PosTop = yMousePos - 390;
	var PosLeft = xMousePos - 100;
	var myWin;
	
	myWin = window.open('Show.aspx?docid=popup_pille&DrugId='+DrugId+'&HeaderText='+HeaderText+'&token='+Token+'','MyPilleWin','left='+PosLeft+',top='+PosTop+',width=200,height=275,scrollbars=no,resizable=no,addressbar=no',true);
	myWin.focus();
}

function OpenNisPilleWindow(Id_Short, HeaderText, Token) {
	
	var xMousePos = 0; // Horizontal position of the mouse on the screen
	var yMousePos = 0; // Vertical position of the mouse on the screen
	var xMousePosMax = 0; // Width of the page
	var yMousePosMax = 0; // Height of the page	
	
	//alert(window.screenLeft)
	if (document.all) {
		xMousePos = window.event.x + window.screenLeft;
		yMousePos = window.event.y + window.screenTop;	
	} else {
		xMousePos = window.event.x + window.screenX;
		yMousePos = window.event.y + window.screenY + 180;		
	}

	
	//xMousePos = window.event.x
    //yMousePos = window.event.y
	
	//xMousePos = window.event.x+document.body.scrollLeft;
    //yMousePos = window.event.y+document.body.scrollTop;
    xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
    yMousePosMax = document.body.clientHeight+document.body.scrollTop;

	//var PosTop = screen.height/2 - 300;
	//var PosLeft = screen.width/2 - 100;
	//alert('Horizontal:'+xMousePos+'px')				
	//alert('Vertical:'+yMousePos+'px')
	var PosTop = yMousePos - 390;
	var PosLeft = xMousePos - 100;
	var myWin;
	
	myWin = window.open('WSPhotoFrame.aspx?Id_Short='+Id_Short+'&HeaderText='+HeaderText+'&token='+Token+'','MyPilleWin','left='+PosLeft+',top='+PosTop+',width=453,height=227,scrollbars=no,resizable=no,addressbar=no',true);
	myWin.focus();
}

var helpID = 'generel';
var notepage='';
var noteid='';
var notedesc='';
// Calculate expiration date
function makeYearExpDate(yr)
{
  var expire = new Date();
  expire.setTime (expire.getTime() + ((yr*365) * 24 * 60 * 60 * 1000));
  expire = expire.toGMTString()
  return expire
}
// Write a cookie value
function setCookie(name, value, expires, path, domain, secure) {
	var curCookie = name + '=' + escape(value) + '; expires=' + expires + '; path=' + path + ';'
	document.cookie = curCookie;
}
// Retrieve a named cookie value
function getCookie(name) {
	var dc = document.cookie;
	// find beginning of cookie value in document.cookie
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	}
	else begin += 2;
	// find end of cookie value
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) end = dc.length;
	// return cookie value
	return unescape(dc.substring(begin + prefix.length, end));
}
function getNoter(name, nr, desc) {
try {
notepage = name;
noteid = nr;
var note = getCookie(name + nr);
document.write ('<A NAME="egnenoter"></A>');
document.write ('<B>Egne noter</B><BR>');

if (note !=null) {
   lf = note.search(/\n/);
   while(lf != -1)
   {
      note = note.replace(/\n/,'<BR>');
      lf = note.search(/\n/);
   }

   lf = note.search(/\+/);
   while(lf != -1)
   {
      note = note.replace(/\+/,'&nbsp;');
      lf = note.search(/\+/);
   }

   document.write('<BR><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="250">');
   document.write('<TR><TD COLSPAN="5" WIDTH="250" HEIGHT="14"><IMG SRC="../images/Gen/note_top.gif" WIDTH="250" HEIGHT="14"></TD></TR>');
   document.write('<TR><TD WIDTH="1" BGCOLOR="BLACK"><IMG SRC="../images/Gen/note_1x1black.gif" HEIGHT="1" WIDTH="1"></TD><TD WIDTH="3" BGCOLOR="#FFFF99"><IMG SRC="../images/Gen/note_1x1TRans.gif" HEIGHT="1" WIDTH="3"></TD><TD BGCOLOR="#FFFF99" WIDTH="242">');
   document.write(note);
   document.write('<BR><BR>[ <A HREF=../mynote.asp?action=delete&page='+name+'&nr='+nr+'&navn='+desc+'&docid=*note*'+'>slet</A>');
   document.write(' | <A HREF=../mynote.asp?action=edit&page='+name+'&nr='+nr+'&navn='+desc+'&docid=*note*'+'>ret</A>');
   document.write(' ]</TD><TD WIDTH="3" BGCOLOR="#FFFF99"><IMG SRC="../images/Gen/note_1x1TRans.gif" HEIGHT="1" WIDTH="3"></TD><TD WIDTH="1" BGCOLOR="BLACK"><IMG SRC="../images/Gen/note_1x1black.gif" HEIGHT="1" WIDTH="1"></TD></TR>'); 
   document.write('<TR><TD COLSPAN="5" WIDTH="250" HEIGHT="14"><IMG SRC="../images/Gen/note_bottom.gif" WIDTH="250" HEIGHT="14"></TD></TR>');
   document.write('</TABLE>');
   } 
else {
   document.write('<I>Der er ikke oprettet nogle noter.</I><BR>');
   document.write('<A href="javascript:AddEditNote(\'' + desc + '\');">Opret note</A>');
   }
} catch (err) {}
}
function AddEditNote(desc) {
	try {
		var note = getCookie(notepage + noteid);
		if (desc > '') notedesc=desc;
		if (note==null) {
		var loc = '../mynote.asp?action=new&page=' + notepage + '&nr=' + noteid + '&navn=' + notedesc; }
		else {
		var loc = '../mynote.asp?action=edit&page=' + notepage + '&nr=' + noteid + '&navn=' + notedesc; }
		top.frames[1].window.location = loc;
	} catch (err) {}
}

function setNoteKey(name, id, desc)
{
notepage = name;	
noteid = id;
notedesc = desc;
}


function udskrivMidt() {
	try {
	top.frames[1].focus();
	top.frames[1].print();
	}
	catch(err) {
	};
}
function preloadImages() {
   document.preload = new Array();
   if (document.images) {
      for (var i = 0; i < preloadImages.arguments.length; i++) {
          document.preload[i] = new Image();
          document.preload[i].src = preloadImages.arguments[i];
      }
   }
}
function ShowHelp() {
	try {
		var loc = 'Show.aspx?docid=help&amp;keyid=' + helpID
		top.frames[1].window.location = loc;
	} catch (err) {}
}

function ShowHelpMH() {
	try {
		var loc = 'Show.aspx?docid=help&amp;keyid=' + helpID
		document.location = loc;
	} catch (err) {}
}

function SetFontSize(ifntsize) {
	try {
		
		setCookie('mhfontsize', ifntsize, makeYearExpDate(5), '/', '', 0);
		
		SetFontImage(ifntsize);
		
		top.frames[1].window.location.reload(true);
	} catch (err) {}
}

function SetFontSizeMH(ifntsize) {
	try {
		
				
		setCookie('mhfontsize', ifntsize, makeYearExpDate(5), '/', '', 0);
		
			
		SetFontImageMH(ifntsize);
		
		document.location.reload(true);
	} catch (err) {}
}

function SetFontImage(ifntsize) {
	try {
		if (ifntsize=='1')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_s.gif'
		}
		if (ifntsize=='2')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_m.gif'
		}
		if (ifntsize=='3')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_l.gif'
		}
	} catch (err) {}
}
function SetFontImageMH(ifntsize) {
	 try { 
	
		if (ifntsize=='1')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_s.gif'
		}
		if (ifntsize=='2')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_m.gif'
		}
		if (ifntsize=='3')
		{
		   document.fntselectimg.src='/images/interface/mh/mh07_textsize_l.gif'
		}
	} catch (err) {} 
}
function SetHelpID(ihelpID) {
	helpID = ihelpID;
}

function SetIntetPraeg () {
        var aObjintetprgchkbox = document.getElementById('intetprgchkbox');
	if (aObjintetprgchkbox.checked) {
		SetElementActive('Img000');
		SetElementActive('Imk000');
		document.getElementById('pnum').selectedIndex=0;
		document.getElementById('palf').selectedIndex=0;
	}
	SetHiddenValue ('intetpraeg', aObjintetprgchkbox.checked);
}
function SetElementActive(iId) {
    var Iskaerv = false;
    
	var thisEle=document.getElementById(iId);
	//alert(iId);
	if (iId.substring(0, 3)=='Img') {
		frmEle = document.getElementById('psym');
		//if (iId!='Img000') {
			//document.getElementById('intetprgchkbox').checked = false;
		//}
	} else {
		frmEle = document.getElementById('krv');
                Iskaerv = true;
	}
	var aObjAllTables = document.getElementsByTagName('TABLE');
	if (iId.substring(0, 3)=='Img') {
		var tbl = document.getElementById('grtbl');
	}
	if (Iskaerv) {
		var tbl = document.getElementById('kvtbl');
	}
	var allTDs = tbl.getElementsByTagName('IMG');
	for (i=0;i<allTDs.length;i++) {

		if (Iskaerv) {
			document.getElementById(allTDs[i].id).className = 'ImgIdentKaerv';
			//allTDs[i].className = 'ImgIdentKaerv';
			//allTDs[i].setAttribute('class','ImgIdentKaerv');
			//allTDs[i].style.borderColor='000000';
			//allTDs[i].style.borderColor='D0D4CA';
		} else {
			document.getElementById(allTDs[i].id).className = 'ImgIdentKaervSelected';
			//allTDs[i].className = 'ImgIdentKaervSelected';
			
			//allTDs[i].setAttribute('class','ImgIdentKaervSelected');
			//allTDs[i].style.borderColor='ffffff';
		}
	}
	thisEle.className = 'ImgIdentKaerv5b6250l';
	//thisEle.style.borderColor='5b6250';
	frmEle.value=iId;
}

function CheckSelectValgt(iObj) {
	if (iObj.selectedIndex>0) {
		document.getElementById('intetprgchkbox').checked = false;
	}
}
function SetHiddenValue (iId, iValue) {
	var thisEle=document.getElementById(iId);
	thisEle.value=iValue;
}

function ConfirmDeletePersonalisation (iUrl, iTxt) {

var dialogen = showModalDialog('ConfirmBox.aspx?txt='+iTxt,'','dialogHeight: 200px; dialogWidth: 260px; scroll: no; status: no;');
	
	if (dialogen) {
		location.href=iUrl;
		return true;
	} else {
		return false;
	}
}

function SetElementOpacity (element, opacity) {

try {
        aObj = document.getElementById(element);
        
        if (aObj.filters) {
		    aObj.style.filter="alpha(opacity=0)";
		    aObj.filters.alpha.opacity = opacity;
		} else {
		    aObj.style.opacity = opacity * 0.01;
		}
		
		} catch (err) {}

}


