function openimage(file) {
	if (file) {
		window.open('image_popup.html?file='+ file,'imagepopup','width=400,height=400,top=100,left=100');
	} else {
		return false;
	}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function menuBg(element,mode) {
	if (mode) {
		var cursor = 'hand';
		element.className = 'menuAct';
	} else {
		var cursor = '';
		element.className = 'menu';
	}
	element.style.cursor = cursor;
}

function smenuBg(element,mode) {
	if (mode) {
		var cursor = 'hand';
		element.className = 'submenuOver';
	} else {
		var cursor = '';
		element.className = 'submenu';
	}
	element.style.cursor = cursor;
}

function menuGo(url,target) {
	if (url) {
		if (target.length > 0)
			window.open(url,target);
		else
			document.location.href = url;
	}
}

function menuBoxGo(frm) {
//	var foo = frm.menuSelectBox.options[frm.menuSelectBox.selectedIndex].value;

	for (var i = 0; i < frm.menuSelectBox.options.length ; i++) {
		if (frm.menuSelectBox.options[i].selected == true)
			var foo = frm.menuSelectBox.options[i].value;
	}

	if (!foo) {
		alert("Vælg først et emne i boksen!");
		return false;
	} else {
		var arr_temp = foo.split("#");
		if (arr_temp[1].length > 0)
			window.open(arr_temp[0],arr_temp[1]);
		else
			document.location.href = arr_temp[0];
	}
}

function openprint (file) {
	width = 500;
	height = 550;
	leftmargin = 50;
	topmargin = 50;
	statusbar = "no";
	toolbar = "yes";
	menubar = "yes";
	title = "printing";
	window.open(file,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}

function goNews(area) {
	if (area) {
		if (area < 99)
			document.location.href = '/' + area + '/news';
		else
			document.location.href = '/news';
	}
}

function openPopup(id,width,height,area) {
	leftmargin = 50;
	topmargin = 50;
	statusbar = "no";
	toolbar = "no";
	menubar = "no";
	title = "eucPopup";
	url = "modules/popups/popups.php?id=" + id;
	window.open(url,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}

	function check_nl_form(frm) {
		var f = new Array; // Field array
		var m = new Array; // Message array
		var error = "";

		// Field array
		f[0] = frm['fData[user_name]'].value;
		f[1] = frm['fData[user_email]'].value;

		// Field title array
		m[0] = "Navn";
		m[1] = "E-mail";


		// Checking all fields
		for (var i = 0; i < f.length; i++) {
			if ((f[i].length == 0) || (f[i] == 0)) {
				error += '  - ' + m[i] + '\n';
			}
		}
		
		// If error, returning an error message
		if (error) {
			alert('Følgende felter er ikke udfyldt:\n\n' + error);
			return false;
		}

		var reg_em = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;
		if (!reg_em.test(f[1])) {
			alert('Den indtastede "E-mail" er ikke gyldig.');
			return false;
		}
		return true;
	}


function openInteresse () {
	width = 480;
	height = 500;
	leftmargin = 100;
	topmargin = 75;
	statusbar = "yes";
	toolbar = "no";
	menubar = "no";
	title = "interesse";
	url = 'interesse.php';
	window.open(url,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}

function openKontakt () {
	width = 400;
	height = 400;
	leftmargin = 100;
	topmargin = 75;
	statusbar = "yes";
	toolbar = "no";
	menubar = "no";
	title = "contact";
	url = 'contact.php';
	window.open(url,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);
}



function OpenCCGW()

{

	file = "modules/shop/quickpay_form.php";

	width = 375;

	height = 350;

	leftmargin = 200;

	topmargin = 200;

	statusbar = "yes";

	toolbar = "no";

	menubar = "no";

	title = "ccgw";

	var winCCGW = window.open(file,title,'width='+width+',height='+height+',left='+leftmargin+',top='+topmargin+',scrollbars=yes,status='+statusbar+',toolbar='+toolbar+',menubar='+menubar);

	winCCGW.focus();

}