function deleteconfirm(msg, urladress) {
	if (window.confirm(msg)) {
		location.href=urladress;
	}
}

// A replacement for ToFixed without the errors // http://www.merlyn.demon.co.uk/js-rndg1.htm#toF
Number.prototype.toFixxed = function(f) {
  f = parseInt(f/1 || 0)
  if (f<0 || f>20) // next line was throw ...
    alert("The number of fractional digits is out of range")
  if (isNaN(this)) return "NaN"
  var s = this<0 ? "-" : "", x = Math.abs(this)
  if (x>Math.pow(10,21)) return s + x.toString()
  var m = Math.round(x*Math.pow(10,f)).toString()
  if (!f) return s + m
  while (m.length<=f) m = "0" + m
  return s + m.substring(0,m.length-f)+"."+m.substring(m.length-f)
}

function number_format( number, decimals, dec_point, thousands_sep ) {
    // Formats a number with grouped thousands  
    // 
    // version: 902.1517
    // discuss at: http://phpjs.org/functions/number_format
    // +   original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     bugfix by: Michael White (http://getsprink.com)
    // +     bugfix by: Benjamin Lupton
    // +     bugfix by: Allan Jensen (http://www.winternet.no)
    // +    revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
    // +     bugfix by: Howard Yeend
    // +    revised by: Luke Smith (http://lucassmith.name)
    // +     bugfix by: Diogo Resende
    // +     bugfix by: Rival
    // %        note 1: For 1000.55 result with precision 1 in FF/Opera is 1,000.5, but in IE is 1,000.6
    // *     example 1: number_format(1234.56);
    // *     returns 1: '1,235'
    // *     example 2: number_format(1234.56, 2, ',', ' ');
    // *     returns 2: '1 234,56'
    // *     example 3: number_format(1234.5678, 2, '.', '');
    // *     returns 3: '1234.57'
    // *     example 4: number_format(67, 2, ',', '.');
    // *     returns 4: '67,00'
    // *     example 5: number_format(1000);
    // *     returns 5: '1,000'
    // *     example 6: number_format(67.311, 2);
    // *     returns 6: '67.31'
    var n = number, prec = decimals;
    n = !isFinite(+n) ? 0 : +n;
    prec = !isFinite(+prec) ? 0 : Math.abs(prec);
    var sep = (typeof thousands_sep == "undefined") ? ',' : thousands_sep;
    var dec = (typeof dec_point == "undefined") ? '.' : dec_point;

    var s = (prec > 0) ? n.toFixxed(prec) : Math.round(n).toFixxed(prec); //fix for IE parseFloat(0.55).toFixed(0) = 0;

    var abs = Math.abs(n).toFixxed(prec);
    var _, i;
	
    if (abs >= 1000) {
        _ = abs.split(/\D/);
        i = _[0].length % 3 || 3;

        _[0] = s.slice(0,i + (n < 0)) +
              _[0].slice(i).replace(/(\d{3})/g, sep+'$1');

        s = _.join(dec);
    } else {
        s = s.replace('.', dec);
    }

    return s;
}

function validateNumericInput(field) {
	var re = /^[0-9-,\.]*$/;
	field.value = field.value.replace(/,/g,".");
	
	if (!re.test(field.value)) {
		field.value = field.value.replace(/[^0-9-,\.]/g,"");
		return false;
	}
	
	return true;
}
function validateEmail(elementValue){  
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;  
	return emailPattern.test(elementValue);
}
