function LavInUrl(formular) {
	if( formular.in_url != null )  {
	  if( formular.in_url.value != "" ) {
		 formular.q.value += " inurl:"+ formular.in_url.value;
     return true;
	  }
	}
	return false;
}

function Nyhedsbrev_tilmeld (formular) {
	if(!validateEmail(formular.email.value)) {
		return false;
	}
	addButton(formular, 'handling', 'Tilmeld');
	formular.submit();
	return true;
};

function Nyhedsbrev_frameld (formular) {
	if(!validateEmail(formular.email.value)) {
		return false;
	}
	addButton(formular, 'handling', 'Afmeld');
	formular.submit();
	return true;
};

function addButton (form, name,value) {
	var b = document.createElement('input');
	b.setAttribute('type', 'hidden');
	b.setAttribute('name', name);
	b.setAttribute('value',value);
	form.appendChild(b);
};

function validateEmail(strIn) {
	if(strIn == '') {
		return false;
	} else {
		return true;
	}
};
		
function showhide (id)
{ 
	if (document.getElementById) { 
		var obj = document.getElementById(id);
		if (obj.style.display == "none") { 
		  if (id == "helpIcon") { obj.style.display = "inline"; } else { obj.style.display = "block"; }
			obj.style.display = "block"; 
		} else { 
			obj.style.display = "none"; 
		}
	}
}

function show (id)
{ 
	if (document.getElementById) { 
		var obj = document.getElementById(id);
		if (id == "helpIcon") { obj.style.display = "inline"; } else { obj.style.display = "block"; }
	}
}

function hide (id)
{ 
	if (document.getElementById) { 
		document.getElementById(id).style.display = "none";
	}
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/
  var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	
	if ((version >= 5.5) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
	      var img = document.images[i]
	      var imgName = img.src.toUpperCase()
	      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	      {
	         var imgID = (img.id) ? "id='" + img.id + "' " : ""
	         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
	         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
	         var imgStyle = "display:inline-block;" + img.style.cssText 
	         if (img.align == "left") imgStyle = "float:left;" + imgStyle
	         if (img.align == "right") imgStyle = "float:right;" + imgStyle
	         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
	         var strNewHTML = "<span " + imgID + imgClass + imgTitle
	         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
	         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	         img.outerHTML = strNewHTML
	         i = i-1
	      }
	   }
	}
}

function FormClearField(field, thisDefault)
{
	if (field.value == thisDefault) field.value = '';
}

function addListeners(e) {
}

addEvent(window, 'load', addListeners, false);
if (window.attachEvent) {
	window.attachEvent("onload", correctPNG);
}

function addEvent(elm, evType, fn, useCapture)
// cross-browser event handling for IE5+, NS6+ and Mozilla/Gecko
// By Scott Andrew
{
	if (elm.addEventListener) {
	  elm.addEventListener(evType, fn, useCapture); 
	  return true; 
	} else if (elm.attachEvent) {
	  var r = elm.attachEvent('on' + evType, fn); 
	  return r; 
	} else {
	  elm['on' + evType] = fn;
	  return true; 
	}
}

function openWindow(link) {
	window.open(link, "help", "height=480,width=640,resizable=1");
	return false;
}

function openWindowArg(link, height, width) {
	window.open(link, "help", "height="+height+",width="+width+",resizable=1");
	return false;
}

function unicHideClass(className) {

  if(document.getElementsByClassName) {
		var list = document.getElementsByClassName(className);
		for (var i=0; i<list.length; i++) {
			Element.hide( list[i] );
		}
  }
}

function unicToggleClass(className) {

  if(document.getElementsByClassName) {
		var list = document.getElementsByClassName(className);
		for (var i=0; i<list.length; i++) {
			Element.toggle( list[i] );
		}
  }
}
function unicOnLoad () {
	unicHideClass("unicHide");
}

function unicToggleContent (e, c1, c2) {

    if(e.innerHTML == c1) {
	e.innerHTML = c2;
    } else {
	e.innerHTML = c1;
    }
}
