function number_format (number, decimals, dec_point, thousands_sep) {

 var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;

 var d = dec_point == undefined ? "," : dec_point;

 var t = thousands_sep == undefined ? "." : thousands_sep, s = n < 0 ? "-" : "";

 var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;

 return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");

}

function get_after_tax(_value, _after_tax, obj) {

 _value = number_format(_value.toString(_value).split(",").join("."), 2, '.', '');

 _value = number_format(_value / ((_after_tax / 100) + 1), 2, ',', '.');

 if (obj) document.getElementById(obj).value = _value;
 else return _value;

}

function isnumeric(sText) {

 var ValidChars = "0123456789.";
 var IsNumber = true;
 var Char;

 for (i = 0; i < sText.length && IsNumber == true; i++) { 

	Char = sText.charAt(i); 

	if (ValidChars.indexOf(Char) == -1) IsNumber = false;

 }

 return IsNumber;

}

function load_module(n) { incJS("scripts/select_kategorie.php?sel=0&module_id=" + n); }

function open_upload_window(m_id, e_id, i_id) { win = window.open("acp/eintraege_upload_image.php?module_id=" + m_id + "&entry_id=" + e_id + "&image_id=" + i_id, "", "width=480,height=320,scrollbars=yes,status=yes"); }

function gallery_upload_window(e_id, i_id) { win = window.open("acp/seiten_tpl_upload_image.php?menu_link_id=" + e_id + "&image_id=" + i_id, "", "width=480,height=320,scrollbars=yes,status=yes"); }

function open_entry_permission(m_id, k_id) { win = window.open("acp/eintraege_permission.php?module_id="+ m_id +"&kategorie_id=" + k_id, "", "width=480,height=320,scrollbars=yes,status=yes"); }

function load_google_map(address, div_map) {

 var map = null;

 var geocoder = null;

 if (GBrowserIsCompatible()) {

	map = new GMap2(document.getElementById(!div_map ? "map" : div_map));

	map.addControl(new GMapTypeControl());

	map.addControl(new GSmallMapControl());

	if (typeof(address) != 'object') {

	 geocoder = new GClientGeocoder();

	 if (geocoder) geocoder.getLatLng(address, function(point) { if (point) { map.setCenter(point, 13); var marker = new GMarker(point); map.addOverlay(marker); } });

	}
	else {

	 gdir = new GDirections(map, document.getElementById((!div_map ? "map" : div_map) + '_directions'));

	 sTo = ''; for(x = 1; x < address.length; x++) sTo += " to: " + address[x] + " ";

	 gdir.load("from: " + address[0] + sTo);

	}

 }

}
