 
 $(document).ready(function(){
	
	//$('#recommend').click(function(){
    // $('#recommend-form').toggle(400);
   //});
   
   //$('#recommend-cancel').click(function(){
//     $('#recommend-form').toggle(400);
		//document.getElementById("SenderEmail").style.backgroundColor = "#FFFFFF";
		//document.getElementById("RecipientEmail").style.backgroundColor = "#FFFFFF";
		//document.getElementById("SenderName").style.backgroundColor = "#FFFFFF";
   //});
   
   $('#ContactForm').ajaxForm({ 
        beforeSubmit: validateRecommend, 
		success: function() { 
			//document.getElementById('ContactForm').style.display = 'none';
			document.getElementById('ContactThankYou').style.display = 'block';
			//setTimeout("$('#ContactForm').toggle(400)",2500);
			//setTimeout("document.getElementById('ContactForm').style.display = 'block'",3000);
			setTimeout("document.getElementById('ContactThankYou').style.display = 'none'",4000);
			document.ContactForm.Name.value = '';
			document.ContactForm.Email.value = '';
			document.ContactForm.Phone.value = '';
			document.ContactForm.Comment.value = '';
        } 
    });
	
	$('#emailnewsform').ajaxForm({ 
        beforeSubmit: validateTop, 
		success: function() { 
			document.getElementById('EmailError').style.display = 'none';
			document.getElementById('EmailUnSub').style.display = 'none';
			document.getElementById('EmailThankYou').style.display = 'none';
			document.emailnewsform.EmailNewsEmail1.value = '';
				if (document.emailnewsform.Action[0].checked) {
					document.getElementById('EmailThankYou').style.display = 'block';
				}
				else {
					document.getElementById('EmailUnSub').style.display = 'block';
				}
        } 
    });	   
		
  });
  
  function validateTop(formData, jqForm, options) { 
 
    var form = jqForm[0]; 
	var regexp = /^[\w\.\-_]+@[\w\-_]+\.[\w\.\-_]{2,}$/i;
	//var Name=form.Name.value;
	var EmailNewsEmail1=form.EmailNewsEmail1.value;

	if (!regexp.test(EmailNewsEmail1)) {
		document.getElementById("EmailError").style.display = "block";
		document.getElementById('EmailThankYou').style.display = 'none';
		document.getElementById('EmailUnSub').style.display = 'none';
		return false;
	} 
}

  function validateRecommend(formData, jqForm, options) { 
	
	//document.getElementById("Email").style.backgroundColor = "#FFFFFF";
	//document.getElementById("RecipientEmail").style.backgroundColor = "#FFFFFF";
	//document.getElementById("SenderName").style.backgroundColor = "#FFFFFF";
	
    var form = jqForm[0]; 
	var regexp = /^[\w\.\-_]+@[\w\-_]+\.[\w\.\-_]{2,}$/i;
	var Name=form.Name.value;
	var Phone=form.Phone.value;
	var Email=form.Email.value;
	//var RecipientEmail=form.RecipientEmail.value;
	var strErrorMsg='';

	if (Name == '') {
		strErrorMsg+='Navn \n';
	} 
	if (!regexp.test(Email)) {
		strErrorMsg+='Email (ikke gyldig) \n';
	} 
	if (Phone == '') {
		strErrorMsg+='Telefon \n';
	} 
	if (strErrorMsg!='') {
		strErrorMsg ='Følgende felter er ikke udfyldt korrekt:\n\n' + strErrorMsg
		alert(strErrorMsg);
		return false;
		}
	else {
		//alert('true');
		return true;
	}
}

function PrintPage()
{ 
  var disp_setting="toolbar=no,location=no,directories=no,menubar=no,"; 
      disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25"; 
  //var content_vlue = document.getElementById("content").innerHTML; 
  var content_vlue=document.getElementById("content").innerHTML.replace(/(<script.*?\/script>)/ig,"");
  var breadcrumb_vlue = document.getElementById("breadcrumb").innerHTML; 
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Udskrift fra '+location.host+'</title>'); 
   docprint.document.write('<link rel="stylesheet" type="text/css" href="admin/design/css/style.css" media="all">');
   docprint.document.write('<link rel="stylesheet" type="text/css" href="admin/write/css/UserDefined.css" media="all">');
   docprint.document.write('</head><body>');          
   docprint.document.write(breadcrumb_vlue);
   docprint.document.write('<br><br>'); 
   docprint.document.write(content_vlue);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
   docprint.print();
}

function OpenLogin() {
	win_width = 450;
	win_height = 300;
	pos_horizon = ((screen.width/2)-(win_width/2));
	pos_vertical = ((screen.height/2)-(win_height/2));
	win = window.open("LoginPopup.asp", "Login", "Width="+win_width+",Height="+win_height+",Top="+pos_vertical+",Left="+pos_horizon+"");
	win.focus();
}

var winSepius = null;


function CloseSepius(){
		winSepius = window.open("sepius/default.asp", "Sepius","Width=2,Height=2,Top=0,Left=0,Scrollbars=yes,status=no,resizable");
		winSepius.close();
}


function SearchFormCheck() {
var strWords=document.SearchForm.Searchwords.value;
var strErrorMsg=''

  if (strWords=='' || strWords==' ' || strWords=='Søg...') {
  strErrorMsg+='Søgefeltet er ikke udfyldt'
}

if (strErrorMsg!='') {
  alert (strErrorMsg);
  return false;
}
else {
  return true;
}
}

function ConsoleOver(obj){
	obj.className='AdminConsole_cell_over'
}

function ConsoleOut(obj){
	obj.className='AdminConsole_cell_out'
}


function submitFormToPopup(formref,height,width) {
	win_width = ""+width+"";
	win_height = ""+height+"";
	pos_horizon = ((screen.width/2)-(win_width/2));
	pos_vertical = ((screen.height/2)-(win_height/2));
    newwin = window.open("about:blank","formvindue","width="+win_width+",height="+win_height+",Top="+pos_vertical+",Left="+pos_horizon+",Scrollbars=yes,status=no,resizable");
}

function PopUpWindow(url,height,width) {
	win_width = ""+width+"";
	win_height = ""+height+"";
	pos_horizon = ((screen.width/2)-(win_width/2));
	pos_vertical = ((screen.height/2)-(win_height/2));
	win = window.open(""+url+"", "WindowName", "Width="+win_width+",Height="+win_height+",Top="+pos_vertical+",Left="+pos_horizon+",Scrollbars=yes,status=no,resizable");
	win.focus();
}

function ConfirmLogOut()
	{ 	
		var agree=confirm(" Ønsker du at logge ud fra administrationssystemet?");
		if (agree)
		setTimeout("window.location = 'login.asp?Action=Logout'", 10);
		else
		return false; 
	}
	 
<!-- sletning skal bekræftes - bruges evt. ved gæstebog og lign.

function Confirm()
	{ 	
		var agree=confirm("Er du sikker på, at sletning skal foretages?");
		if (agree)
		return true;
		else
		return false; 
	}
 //-->

function mrfixit()
{
var fc = document.getElementById('fixedcell'); fc_top = fc.offsetParent.offsetTop; fc.style.top = document.documentElement.scrollTop + 
fc_top;
}
onscroll = mrfixit; 

var focusElem = null;
function dropdown( obj )
{
	if( focusElem != null )
	{
		focusElem.className = focusElem.className.replace(" over", "");
	}
	focusElem = obj.parentElement;
	focusElem.className += ' over';
}

function SyncDiv() //sørger for, at venstremenuen går helt til bund 
	{
	var iHeight;

	iHeight = document.getElementById('content').offsetHeight;
	bSync = false;

	if(document.getElementById('leftcolumn')) {
		if (document.getElementById('leftcolumn').offsetHeight>iHeight) {
				iHeight = document.getElementById('leftcolumn').offsetHeight;
				bSync = true;
				}
	}
	if(document.getElementById('rightcolumn')) {
		if (document.getElementById('rightcolumn').offsetHeight>iHeight) {
				iHeight = document.getElementById('rightcolumn').offsetHeight;
				bSync = true;
				}
	}

	if(bSync = true) {
		document.getElementById('content').style.height = iHeight + 'px';

		if(document.getElementById('leftcolumn')) {
			document.getElementById('leftcolumn').style.height = iHeight + 'px';
		}
		if(document.getElementById('rightcolumn')) {
			document.getElementById('rightcolumn').style.height = iHeight + 'px';
		}
	}
}

DropMenu = function() {
	if (document.getElementById) {
		navRoot = document.getElementById("DropMenu");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.className == "Drop") 
				node.firstChild.onfocus = function() {dropdown(this)}; // JWJ
			{
				node.onmouseover = function() 
				{
					this.className += " over";
					this.firstChild.className += " expanded";
				}
				node.onmouseout = function()
				{
					this.className = this.className.replace(" over", "");
					if (this.firstChild.className == "selected expanded") this.firstChild.className = "selected";
					if (this.firstChild.className == " expanded" || this.firstChild.className == "expanded") this.firstChild.className = "";
				}
			}
		}
	}
}
/* window.onload = DropMenu; */
