function newwindow(url) {
	window.open(url);
}


function dealer_open(id) {
	var trObj;
	if(trObj = document.getElementById(id)){
		if(trObj.style.display == 'none') {
			trObj.style.display = '';

		}
		else {
			trObj.style.display = 'none';
		}
	}
}
function form_submit() {
	var obj = document.getElementById("dform");
	obj.submit();
}

var tabStyle= 'none'

function showAll() {
	for(var i=0;i<catTabId.length;i++) {
		if(!document.getElementById(catTabId[i])){ continue;}else {o=document.getElementById(catTabId[i])}
		o.style.display = '';
	}

}

function hideAll() {
	for(var i=0;i<catTabId.length;i++) {
		if(!document.getElementById(catTabId[i])){ continue;}else {o=document.getElementById(catTabId[i])}
		o.style.display = 'none';
	}
}


function checkquan(id){
	var inp = document.getElementById(id);
	if(inp.value != '') {
		document.getElementById(id + '_1').style.fontWeight = "bold";
		document.getElementById(id + '_2').style.fontWeight = "bold";
		document.getElementById(id + '_3').style.fontWeight = "bold";
		document.getElementById(id + '_4').style.fontWeight = "bold";
		document.getElementById(id + '_5').style.fontWeight = "bold";

		var str = inp.value;

		var match = "[A-Za-z]";
		reg = new RegExp(match, "i");
		result = str.match(reg);

		if(result){
			inp.value = '';
			alert('Введите число!');
			inp.focus();
		}
		else {
			var match = "^[0-9]{1,}[.]?[0-9]*$";
			reg = new RegExp(match, "i");
			result = str.match(reg);
			if(!result){
				alert('В качестве дробного разделителя используйте точку!');
				inp.value = '';
				inp.focus();
				inp.select();
			}
		}
	}
	else {
		document.getElementById(id + '_1').style.fontWeight = "normal";
		document.getElementById(id + '_2').style.fontWeight = "normal";
		document.getElementById(id + '_3').style.fontWeight = "normal";
		document.getElementById(id + '_4').style.fontWeight = "normal";
		document.getElementById(id + '_5').style.fontWeight = "normal";
	}

	recount();
}
var k = 0;
var fields = new Array;
function recount()
{
	totalQ = 0;
	totalP = 0;
	for(i = 0; i < fields.length; i++){
		price = document.getElementById(fields[i] + '_hidden').value;
		quantity = document.getElementById(fields[i]).value;
		if(price == '') price = 0;
		if(quantity == '') quantity = 0;
		totalQ = totalQ + quantity;
		totalP =  totalP + parseFloat(quantity) * parseFloat(price);
	}
	str = totalP.toString();
	ind =  str.indexOf('.', 0);
	if(ind != (-1)) {
		result = str.substr(0, ind + 3);
	}
	else {
		result = str;
	}
	document.getElementById('totalPrice').innerHTML = '<b>ИТОГО: ' + result + '$</b>';
}
function addId(id) {
	for(j = 0; j<fields.length;j++) {
		if(fields[j] == id) return false;
	}

	fields[k] = id;
	k++;
}
function getChar() {

}



