function number_format(number, decnumbers, decpoint, thousandpoint) {
	a = number;
	b = decnumbers;
	c = decpoint;
	d = thousandpoint;
	a = Math.round(a * Math.pow(10, b)) / Math.pow(10, b);
	e = a + '';
	f = e.split('.');
	if (!f[0]) f[0] = '0';
	if (!f[1]) f[1] = '';
	if (f[1].length < b) {
		g = f[1];
		for (i=f[1].length + 1; i <= b; i++) g += '0';
		f[1] = g;
	}
	if(d != '' && f[0].length > 3) {
		h = f[0];
		f[0] = '';
		for(j = 3; j < h.length; j+=3) {
			i = h.slice(h.length - j, h.length - j + 3);
			f[0] = d + i +  f[0] + '';
		}
		j = h.substr(0, (h.length % 3 == 0) ? 3 : (h.length % 3));
		f[0] = j + f[0];
	}
	c = (b <= 0) ? '' : c;
	return f[0] + c + f[1];
}

function str_replace(search, replace, subject) {
	return subject.split(search).join(replace);
}

function allcheck(obj,main){
	for(var i=0; i < obj.elements.length ; i++){		
		if(main.checked==true){
			obj[i].checked=true;
		}else{
			obj[i].checked=false;
		}
	}
}


function EmailConfirm(obj){
	var status=false;
	for(var i=0 ; i < obj.elements.length ; i++ ){
		if(obj[i].name=='Mail[]'){
			if(obj[i].checked==true){
				status=true;
			}
		}
	}
	if(status==false){
		alert('Please check one or more!');
		return false;
	}else{
		//if(confirm('Are you sure?')){
			return true;
		//}else{
			//return false;
		//}
	}
}


function delConfirm(obj){
	var status=false;
	for(var i=0 ; i < obj.elements.length ; i++ ){
		if(obj[i].name=='Del[]'){
			if(obj[i].checked==true){
				status=true;
			}
		}
	}
	if(status==false){
		alert('Du skal v\u00E6lge mindst 1');
		return false;
	}else{
		return confirm('Er du sikker?');
	}
}



function newwin(URLStr,width, height)
{
	  var popUpWin=0;
	  var left = (screen.width/2) - width/2;
	  var top = (screen.height/2) - height/2;
	  if(popUpWin)
	  {
		  if(!popUpWin.closed) popUpWin.close();
	   }
	   popUpWin = open(URLStr, 'popUpWin', 'toolbar=0,location=0,directories=0,status=0,menub ar=0,scrollbars=1,resizable=0,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function Confirm(link,text) 
{
  if (confirm(text))
     window.location=link
}


