//
// Create center popupwindow, with a given size
//
function popup_window(url,name,win_width,win_height)
{
	pos_horizon = ((screen.width/2)-(win_width/2));
	pos_vertical = ((screen.height/2)-(win_height/2));
	window.open(url,name,"width="+win_width+",height="+win_height+",left="+pos_horizon+",top="+pos_vertical+",scrollbars=yes");
}

//
// Here validationfunctions of the inputfield
//
// This checks for empty fields
function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
		{
			alert(alerttxt);return false
		}
		else {return true}
	}
}

//
// Validate fields in contact form
//
function validate_emailform(thisform)
{
	with (thisform)
	{
		if (validate_required(navn,"De har ikke angivet noget navn!")==false)
	  	{
			navn.focus();return false
		}
		if (validate_required(email,"Email feltet skal udfyldes!")==false)
	  	{
			email.focus();return false
		}
		if (validate_required(tekst,"De har ikke angivet nogen tekst-besked!")==false)
	  	{
			tekst.focus();return false
		}
	}
}

//
// This validates the email input for incorrect emailadressing
//
function checkEmail(email)
{
if(email.length > 0)
   {
   if (email.indexOf(' ') >= 0)
      alert("En emailadresse m&aring ikke indeholder mellemrum!");
   else if (email.indexOf('@') == -1)
      alert("En emailadresse skal indeholde et @!");
   }
}
