var holdContent = "";

function pop_ulate(myUrl) {
	a1 = parent.document.getElementById("dv_topbar");
	a2 = parent.document.getElementById("dv_modulet_m");
	a3 = parent.document.getElementById("pop_parent");
	a4 = parent.document.getElementById("prevent_dv");
	a1.style.backgroundColor == "#D2D6DA".toLowerCase() ? a1.style.backgroundColor = "#A4B1BD".toLowerCase() : a1.style.backgroundColor = "#D2D6DA".toLowerCase();
	a2.style.color == "#B4BFC8".toLowerCase() ? a2.style.color = "#F4862B".toLowerCase() : a2.style.color = "#B4BFC8".toLowerCase();
	a3.style.display == "none" ? a3.style.display = "block" : a3.style.display = "none" ;
	a4.style.display == "none" ? a4.style.display = "block" : a4.style.display = "none" ;
	a3.style.left = (top.document.body.clientWidth / 2) - (a3.offsetWidth / 2) + top.document.body.scrollLeft;
	a3.style.top = (top.document.body.clientHeight / 2) - (a3.offsetHeight/ 2) + top.document.body.scrollTop - 50;
	parent.document.frames["pop"].location.href = myUrl;
}

function toggle_av_dv(myUrl) {
	a1 = parent.document.getElementById("float_topbar");
	a2 = parent.document.getElementById("modulet_m");
	a3 = parent.document.getElementById("dv_parent");
	a4 = parent.document.getElementById("test_div");
	a1.style.backgroundColor == "#D2D6DA".toLowerCase() ? a1.style.backgroundColor = "#A4B1BD".toLowerCase() : a1.style.backgroundColor = "#D2D6DA".toLowerCase();
	a2.style.color == "#B4BFC8".toLowerCase() ? a2.style.color = "#F4862B".toLowerCase() : a2.style.color = "#B4BFC8".toLowerCase();
	a3.style.display == "none" ? a3.style.display = "block" : a3.style.display = "none" ;
	a4.style.display == "none" ? a4.style.display = "block" : a4.style.display = "none" ;
	a3.style.width = "0px";
	a3.style.height = "100px";
	parent.document.frames["dv"].location.href = myUrl;
}

function toggle_av_dv_parent(myUrl) {
	a1 = parent.document.getElementById("float_topbar");
	a2 = parent.document.getElementById("modulet_m");
	a3 = parent.document.getElementById("dv_parent");
	a4 = parent.document.getElementById("test_div");
	a1.style.backgroundColor = "#D2D6DA";
	a2.style.color = "#B4BFC8";
	a3.style.display = "block";
	a4.style.display = "block";
	a3.style.width = "0px";
	a3.style.height = "100px";
	parent.document.frames["dv"].location.href = myUrl;
}

function initFrame() {
	tmpFrame = parent.document.frames["mitFelt"]
	tmpFrame.document.body.innerHTML = parent.document.getElementById("iframe_content").innerHTML;
	holdContent = tmpFrame.document.body.innerHTML;
	tmpFrame.document.body.contentEditable = "true";
	tmpFrame.document.execCommand("liveresize",null,true);
}

strSrc = top.location.search;
result = strSrc.search(/nyhedsbrev/)
if (result != -1) {
	var main_frame_link = document;
}
else {
	var main_frame_link = parent.document;
}

function moveDaShit(whichText) {
	main_frame_link.forms["f"].elements["t"].value = whichText;
}

function doplaceFloater() {
	tmpFloater = document.getElementById("floater_teaser").style;
	tmpFloater2 = document.getElementById("floater").style;
	tmpFloater3 = document.getElementById("test_div").style;
	tmpFloater4 = document.getElementById("dv_parent").style;
	tmpFloater5 = document.getElementById("prevent_Dv").style;
	setTimeout("tmpFloater.top = document.body.scrollTop + 2",300);
	setTimeout("tmpFloater.left = document.body.scrollLeft + 2",300);
	setTimeout("tmpFloater2.top = document.body.scrollTop + 2",300);
	setTimeout("tmpFloater2.left = document.body.scrollLeft + 2",300);
	setTimeout("tmpFloater3.top = document.body.scrollTop",300);
	setTimeout("tmpFloater3.left = document.body.scrollLeft",300);
	setTimeout("tmpFloater4.top = document.body.scrollTop + 22",300);
	setTimeout("tmpFloater4.left = document.body.scrollLeft + 22",300);
	setTimeout("tmpFloater5.top = document.body.scrollTop",300);
	setTimeout("tmpFloater5.left = document.body.scrollLeft",300);
}

function swthCol(elem,val) {
	document.getElementById(elem).value = val;
	document.getElementById(elem).style.backgroundColor = val;
}

function unChkRadio(elem) {
	elem.checked = false;
}

function chk4radio(elem,what) {
	if (elem.checked) {
		newelem = elem;
		setTimeout("unChkRadio(newelem)",100); }
}

function getDiv(divname,mode) {
	if (mode == 0) { document.getElementById(divname).style.display = "block"; }
	else { document.getElementById(divname).style.display = "none"; }
}

function ll(size,id,fld) {
	id.innerText = size - fld.value.length + " anslag tilbage";
}

function onemorediv(div) {
	document.getElementById("uplfld" + (div + 1)).style.display = "inline";
}

function addinputfld(div) {
	document.getElementById("oplspan" + (div + 1)).style.display = "inline";
}

function menuskift(nr,billede){
	document.images["billede" + nr].src = "skab1/pics/menu" + billede + ".gif";
}

function markeralle() {
	for (i=1; i<markeralle.arguments.length; i++ )
		document.tilladelser.elements[markeralle.arguments[i]].checked = true;
}

var allemarkeret = "ja"

function markerallebrugere() {
	if (allemarkeret == "ja")
		{ allemarkeret = "nej";checkalle = false; }
	else
		{ allemarkeret = "ja";checkalle = true; }
	for (i=0; i<markerallebrugere.arguments.length; i++)
		document.opretmenupunkt.elements[markerallebrugere.arguments[i]].checked = checkalle;
}

var allemarkeret2 = "ja"

function markerallebrugere2() {
	if (allemarkeret2 == "ja")
		{ allemarkeret2 = "nej";checkalle2 = false; }
	else
		{ allemarkeret2 = "ja";checkalle2 = true; }
	for (i=0; i<markerallebrugere2.arguments.length; i++)
		document.lavunderpunkt.elements[markerallebrugere2.arguments[i]].checked = checkalle2;
}

function vaelginternegrupper(child) {
	if (document.getElementById(child).style.display == "block")
	{ document.getElementById(child).style.display = "none"; }
	else
	{ document.getElementById(child).style.display = "block"; }
}

function foldChild(child) {
	if (document.getElementById(child).style.display == "inline")
	{ document.getElementById(child).style.display = "none"; }
	else
	{ document.getElementById(child).style.display = "inline"; }
}

function foldMyID(child) {
	if (document.getElementById(child).style.display == "block")
	{	
		document.getElementById(child).style.display = "none";
		document.images["file" + child].src = "common/symboler/arrow_down.gif"
	}
	else
	{
		document.getElementById(child).style.display = "block";
		document.images["file" + child].src = "common/symboler/arrow_up.gif"
	}
}

function chkBrugerInfo() {
	holdLogin = document.bruger.login.value;
	holdPass = document.bruger.password.value;
	holdPassII = document.bruger.passwordII.value;
	if (holdLogin == "")
		{
			alert("Du skal skrive et brugernavn");
			return false;
		}
	else if (holdPass == "")
		{
			alert("Du skal skrive et kodeord");
			return false;
		}
	else if (holdPass != holdPassII)
		{
			alert("Dine kodeord matcher ikke hinanden");
			return false;
		}
}


function submitBrugervalg(valg) {
	document.adminValg.action = "?mode=edit&valg=" + valg;
	document.adminValg.submit();
}

function submitBrugervalg2() {
	parent.document.adminValg.action = "?mode=edit&valg=moID" + parent.document.adminValg.moID.value
	parent.document.adminValg.submit();
}

function submitBrugervalg3() {
	document.adminValg.action = "?mode=edit&valg=moID" + document.adminValg.moID.value + "&do=tilfoej"
	document.adminValg.submit();
}

function submitBrugervalg4(mymoid,mymeid) {
	parent.document.adminValg.meID.value = mymeid;
	parent.document.adminValg.action = "?mode=edit&valg=moID" + mymoid;
	parent.document.adminValg.submit();
}

function submitBrugervalg5() {
	parent.document.location.href = "index.asp?mode=edit&valg=moID5&do=redigertop&meID=" + parent.document.adminValg.meID.value
}

function submitBrugervalg6(mymoid,mymeid) {
	parent.document.adminValg.meID.value = mymeid;
	parent.document.adminValg.action = "?mode=edit&do=redigertop&valg=moID" + mymoid;
	parent.document.adminValg.submit();
}

function submitBrugervalgMenupunkt(valg) {
	toggle_av_dv_parent("common/menuer/iframes/" + valg + parent.document.adminValg.meID.value + "&moID=" + parent.document.adminValg.moID.value);
}

function submitBrugervalgMenupunkt2(valg) {
	toggle_av_dv_parent(valg);
}

function submitAdminvalg(adminFilNavn,valg) {
	document.adminKontrolForm.action = "index.asp?mode=adminkontrol&do=" + valg + "&sortby=niveau";
	document.adminKontrolForm.submit();
}

function showDiv(navn,navn2) {
	document.getElementById(navn).style.display = "inline";
	document.getElementById(navn2).style.display = "inline";
}

function visloginboks() {
	if (document.getElementById("loginboks").style.display == "inline")
	{ document.getElementById("loginboks").style.display = "none"; }
	else
	{ document.getElementById("loginboks").style.display = "inline"
		document.logindiv.login.focus();}
}

function adminkontrolDiv() {
	if (document.getElementById("adminKontrol").style.display == "inline")
	{ document.getElementById("adminKontrol").style.display = "none"; }
	else
	{ document.getElementById("adminKontrol").style.display = "inline"; }
}

function checkAktivitet() {
	holdDato = document.f.StartDato.value
	holdTid = document.f.StartTid.value
	holdOS = document.f.Overskrift.value
	if (holdDato == "")
		{
			alert("Du skal udfylde startdatoen");
			return false;
		}
	else if (holdDato.indexOf ('-',0) == -1)
		{
			alert("Den korrekte måde at udfylde dato er: 28-10-2001");
			return false;
		}
	else if (holdDato.length < 8)
		{
			alert("Den korrekte måde at udfylde dato er: 28-10-2001");
			return false;
		}
	else if (holdTid == "")
		{
			alert("Du skal udfylde startdatoen");
			return false;
		}
	else if (holdTid.indexOf ('.',0) == -1)
		{
			alert("Den korrekte måde at udfylde tid på er: 10.30");
			return false;
		}
	else if (holdTid.length < 4)
		{
			alert("Den korrekte måde at udfylde tid på er: 10.30");
			return false;
		}
	else if (holdOS == "")
		{
			alert("Du skal skrive en overskrift");
			return false;
		}
	return true;
}

/*
function visBillede(url,billedenavn)
{
    window.open("../dv/billeder/popupwin.asp?title=" + billedenavn + "&url=" + url + "","picWin","top=" + screen.height / 5 + "px,left=" + screen.width / 5 + "px,toolbar='0',status='0',resizable='0',directories='0',menubar='0'");
}
*/

function ommodulet()
{
    newwin = window.open("http://modulet.dk/ommodulet.asp","newwin","width=200,height=300,toolbar=0,status=0,resizable=0,directories=0,menubar=0");
}

/*
function dl_file(id) {
	url = "common/menuer/dv/filer/download.asp?id=" + id + "&type=name";
	window.open(url,"downloadFile","width=10px,height=10px,top=" + screen.height / 2 + ",left=" + screen.width / 2 + ",toolbar=0,status=0,resizable=0,directories=0,menubar=0");
}
*/