
function Showtopmmenusub(DivID) {
		document.getElementById('topmenusub'+DivID).style.display = 'block'; 
	}
	function Hidetopmmenusub(DivID) {
		document.getElementById('topmenusub'+DivID).style.display = 'none'; 
	}
	
function printpage(DivID)
{ 
  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(DivID).innerHTML.replace(/(<script.*?\/script>)/ig,"");
  
  var docprint=window.open("","",disp_setting); 
   docprint.document.open(); 
   docprint.document.write('<html><head><title>Udskrift fra '+window.location+'</title>'); 
   docprint.document.write('<link rel="stylesheet" type="text/css" href="filer/css/UserStyle.css" media="all">');
   docprint.document.write('<link rel="stylesheet" type="text/css" href="StandardStyle.css" media="all">');
   docprint.document.write('<style>');
   docprint.document.write('body {background-image: none;background-color: #ffffff;}');
   docprint.document.write('.pagefunctions {display: none;}');
   docprint.document.write('#CommentHeader {display: none;}');
   docprint.document.write('#CommentArea {display: none;}');
   docprint.document.write('</style>');
   docprint.document.write('</head><body>');          
   docprint.document.write(content_vlue);          
   docprint.document.write('</body></html>'); 
   docprint.document.close(); 
   docprint.focus(); 
   docprint.print();
}


function SearchFormCheck() {
var strWords=document.SearchForm.Searchwords.value;

	if (strWords=='' || strWords==' ') {
		document.getElementById('Searchwords').style.backgroundColor = '#FFF0A5'; 
		return false;
	}

	else {
		document.getElementById('Searchwords').style.backgroundColor = '#ffffff';
		return true;
	}
}

 $(document).ready(function(){
  
 	$('#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.getElementById('emailnewsform').style.display = 'none';
			document.getElementById('CloseButton').style.display = 'block';
			document.emailnewsform.EmailNewsEmail.value = '';
				if (document.emailnewsform.Action[0].checked) {
					document.getElementById('EmailThankYou').style.display = 'block';
				}
				else {
					document.getElementById('EmailUnSub').style.display = 'block';
				}
        } 
    });	

   $('#ShowEmailNews').click(function(){
     $('#EmailNews').toggle(400);
	 document.getElementById('emailnewsform').style.display = 'block';
   });
   
   $('#frontendhelp, #frontendhelpclose').click(function(){
			$('#frontendhelptext').toggle(400);
	});
   
   
   $(function() {
	$('a.galleri').lightBox(); // Select all links with lightbox class
});
		
  });
  
function validateTop(formData, jqForm, options) { 
 
    var form = jqForm[0]; 
	var regexp = /^[\w\.\-_]+@[\w\-_]+\.[\w\.\-_]{2,}$/i;
	var EmailNewsEmail=form.EmailNewsEmail.value;

	if (!regexp.test(EmailNewsEmail)) {
		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) { 
 
    var form = jqForm[0]; 
	var regexp = /^[\w\.\-_]+@[\w\-_]+\.[\w\.\-_]{2,}$/i;
	var SenderEmail=form.SenderEmail.value;
	var RecipientEmail=form.RecipientEmail.value;
	var SenderEmailStatus = "true";
	var RecipientEmailStatus = "true";

	if (!regexp.test(SenderEmail)) {
		document.getElementById("SenderEmail").style.backgroundColor = "#FFFFAA";
		var SenderEmailStatus = "false";
	} 
	else {
		document.getElementById("SenderEmail").style.backgroundColor = "#FFFFFF";
	}
	if (!regexp.test(RecipientEmail)) {
		document.getElementById("RecipientEmail").style.backgroundColor = "#FFFFAA";
		var RecipientEmailStatus = "false";
	} 
	else {
		document.getElementById("RecipientEmail").style.backgroundColor = "#FFFFFF";
	}
	if ((SenderEmailStatus=="false")||(RecipientEmailStatus=="false")) {
		document.getElementById("RecommendError").style.display = "block";
		document.getElementById('RecommendThankYou').style.display = 'none';
		return false;
	}
}

function CloseEmailNews() {
	$('#EmailNews').toggle(400);
	document.emailnewsform.EmailNewsEmail.value = '';
	document.getElementById('EmailError').style.display = 'none';
	document.getElementById('EmailUnSub').style.display = 'none';
	document.getElementById('EmailThankYou').style.display = 'none';
	document.getElementById('CloseButton').style.display = 'none';
}

function CloseRecommend() {
	$('#Recommend').toggle(400);
	document.recommendform.SenderEmail.value = '';
	document.recommendform.RecipientEmail.value = '';
	document.recommendform.RecommendMessage.value = '';
	document.getElementById('RecommendError').style.display = 'none';
	document.getElementById('RecommendThankYou').style.display = 'none';
	document.getElementById('CloseRecommendButton').style.display = 'none';
	document.getElementById("SenderEmail").style.backgroundColor = "#FFFFFF";
	document.getElementById("RecipientEmail").style.backgroundColor = "#FFFFFF";
}
