function formcheck()
{
	for(i=0;i<arguments.length;i++)
	{
		sValue=arguments[i].value;
		sType=arguments[i].type;
		sName=arguments[i].name;
		if((sType=="text" || sType=="textarea")&&(sValue=="")){
			alert("Husk at udfylde alle felter, hvor der er markeret med r&#248;dt!");
			arguments[i].focus();
			return false;
		}
		if((arguments[i].length != undefined)){
			var list = arguments[i];
			var anyChecked = false;

			for (j=0; j<list.length;j++) {
				if (list[j].checked) anyChecked = true;
			}
			if(anyChecked==false){
				alert("Husk at v&#230;lge mindst een mulighed hvor der er markeret med r&#248;dt"); 
				return false;
			}
		}
	}
	//check EAN
	if(document.form1 && !checkEAN(form1.EAN.value)) 
	{
		form1.EAN.focus();
		alert('EAN lokationsnummer skal indeholde 13 cifre!');
		
		return false;
	}
	
return true;
}

function emailCheck( str )
{
	if ( !validateEmail( str ) )
	{
		alert("Der opstod et problem. Den indtastede e-mail ser ikke ud til at v&#230;re korrekt indtastet! \r\nPr&#248;v venligst igen.");
		return false;
	}
	else
		return true;
}

function integerCheck( str )
{
	if ( !isInteger( str ) )
	{
		alert("Indtast venligst udelukkende tal i postnummer feltet!");
		return false;
	}
	else
		return true;
}


function validateEmail( strValue) 
{
	var pattern  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,4}(\.[a-z]{2}){0,2})$/i;
 
  	return pattern.test(strValue);
}

function isInteger ( str )
{
	var pattern = /^\d+$/;
	
	return pattern.test ( str );
}
function checkEAN(str)
{
	if(str=="") return true;
	//if EAN is filled out it must be numeric and 13 ciphers
	var rexp = new RegExp("^\\d{13}$","gi");
	return rexp.test(str);
}

function popUp(file,strWidth,strHeight) {
	popup = window.open(file,'popup','resizable=1,scrollbars,width='+strWidth+',height='+strHeight+'');
	popup.window.focus();
}

/*
simpleTip for jQuery
By Bj&#246;rn Rixman, Kraftvaerk 2008
Feel free to modify and redistribute with credit.

- displays the title attribute of an element in a styled tooltip.
*/
(function($) {

					
	$.fn.simpleTip = function(options) {
			
		var opts = $.extend({}, $.fn.simpleTip.defaults, options);
		
		if($('#simpleTipWrap').length==0){
			$("body").append(
				'<div id="simpleTipWrap" class="simpleTipWrap"><div class="simpleTipTop"></div>'
				+'<div class="simpleTipMid" id="simpleTipText">'
				+'</div>'
				+'<div class="simpleTipBtm"></div></div>'
			);
		}

			
		$(this).each(function(){
			$(this).hover(
				function(e) {
					this.tip = this.title;
					this.title = "";
					$("#simpleTipText").text(this.tip);
					$tip = $('#simpleTipWrap');
					$tip.css({left:e.pageX-10, top: e.pageY-$tip.height()-10, opacity:0.9 }).fadeIn(200);
					if(opts.follow){
						$(this).mousemove(function(e){
							$tip.css({left:e.pageX-10, top: e.pageY-$tip.height()-10});
					    });
					}
				},
				function() {
					this.title = this.tip;
					$(this).unbind('mousemove')
					//$tip.remove();
					$('#simpleTipWrap').hide();
				}
			);
		})
	}
	$.fn.simpleTip.defaults = {
		id: 'simpleTipWrap',
		follow:true
	};
})(jQuery);