window.onerror = null;


function over(id, color, menu) {
	if (id == "") {return false;}
	if (color != "") 	{document.getElementById(id).style.backgroundColor = '#'+color;}
	else 				{document.getElementById(id).style.backgroundColor = '';}
	if (menu != "no") 	{document.getElementById(id).style.cursor = 'pointer';}
	}
function out(id, color, menu) {
	if (id == "") {return false;}
	if (color != "") 	{document.getElementById(id).style.backgroundColor = '#'+color;}
	else 				{document.getElementById(id).style.backgroundColor = '';}
	if (menu != "no") 	{document.getElementById(id).style.cursor = '';}
	}


function number_format(number, decimals, dec_point, thousands_sep) {
	var exponent = "";
	var numberstr = number.toString ();
	var eindex = numberstr.indexOf ("e");
	var i, z;
	if(eindex > -1){
		exponent = numberstr.substring (eindex);
		number = parseFloat (numberstr.substring (0, eindex));
		}
	if(decimals != null){
		var temp = Math.pow (10, decimals);
		number = Math.round (number * temp) / temp;
		}
	var sign = number < 0 ? "-" : "";
	var integer = (number > 0 ? 
		Math.floor (number) : Math.abs (Math.ceil (number))).toString ();
	var fractional = number.toString ().substring (integer.length + sign.length);
	dec_point = dec_point != null ? dec_point : ".";
	fractional = decimals != null && decimals > 0 || fractional.length > 1 ? (dec_point + fractional.substring (1)) : "";
	if(decimals != null && decimals > 0){
		for(i = fractional.length - 1, z = decimals; i < z; ++i)
			fractional += "0";
		}
	thousands_sep = (thousands_sep != dec_point || fractional.length == 0) ? 
		thousands_sep : null;
	if(thousands_sep != null && thousands_sep != ""){
	for (i = integer.length - 3; i > 0; i -= 3)
		integer = integer.substring (0 , i) + thousands_sep + integer.substring (i);
		}
	return sign + integer + fractional + exponent;
	}


function formatDigits(digit, p1, p2, p3, show) {
	var digit = digit+"";
	var len = digit.length;

	if (len == 1) {
		var test1 = digit * 1;
		var test2 = "";
		}
	if (len == 2) {
		var test1 = digit.substr(-1) * 1;
		var test2 = digit * 1;
		}
	else {
		var test1 = digit.substr(-1) * 1;
		var test2 = digit.substr(-2) * 1;
		}

	if (show!="1") {var digit="";}

	if (test1>=5 || test1==0 || (test2>=10 && test2<=20)) {return digit + " " + p3;}
	if (test1==1) {return digit + " " + p1;}
	if (test1>=2 && test1<=5) {return digit + " " + p2;}
	return false;
	}


function liFormat (row, i, num) {
	if (row[2]=="red") {result = "<b class='red'>" + row[0] + "</b><i class='red qnt'>" + row[1] + "</i>";}
	else if (row[2]=="green") {result = "<b class='green'>" + row[0] + "</b><i class='green qnt'>" + row[1] + "</i>";}
	else if (row[1]!="") {result = row[0] + "<i class='qnt'>" + row[1] + "</i>";}
	else {result = row[0];}
	return result;
	}
function isAsci(cCode){
	return /[a-яА-Яa-zA-Z0-9ёЁ\.\,\-\s]/.test(String.fromCharCode(cCode));
	}

