function NoError (){
	return (true);
}
//onError = NoError;

function pointerOn (buttonName)
{
	document[buttonName].src = ("img/pointer_on.gif");
}
function pointerOff (buttonName)
{
	intervalID = setTimeout ("document['"+buttonName+"'].src = ('img/pointer_off.gif')", 100);
}


function newImage(arg) {
	rslt = new Image();
	rslt.src = arg;
	return rslt;
}

if (document.images) {
	pointer_on = newImage ("img/pointer_on.gif");
	pointer_active = newImage ("img/pointer_active.gif");
}


function checkNumber(fieldName, fieldValue, limitMin, limitMax)
{
	if (isNaN (fieldValue))
	{
		alert ("Please, insert number.");
		setTimeout ("document.forms(0)."+fieldName+".focus()",1);// setTimeout приходится использовать для исправления бага ИЕ
		setTimeout ("document.forms(0)."+fieldName+".select()",2);
	}
	else if ((typeof limitMax != "undefined") && parseInt (fieldValue) > limitMax)
	{
		alert ("Maximum possible value - "+limitMax+".\nCorrect input.");
		setTimeout ("document.forms(0)."+fieldName+".focus()",1);
		setTimeout ("document.forms(0)."+fieldName+".select()",2);
	}
		else if ((typeof limitMin != "undefined") && parseInt (fieldValue) < limitMin)
	{
		alert ("Minimum possible value - "+limitMin+".\nCorrect input.");
		setTimeout ("document.forms(0)."+fieldName+".focus()",1);
		setTimeout ("document.forms(0)."+fieldName+".select()",2);
	}
}

/*
Проверка формы "Калькулятор" на заполненность
Тонкость функции - если количество перегородок равно 0, то не проверяем на заполненность глубину.
*/
function verifyForm()
{
	var form = document.calc;
	if (form.facade_width.value == "")
	{
		Punish ('facade_width');
		return false;
	}
	else if (form.partition_number.value == "")
	{
		Punish ('partition_number');
		return false;
	}
	else if (form.partition_number.value != "0" && form.partition_depth.value == "")
	{
		Punish ('partition_depth');
		return false;
	}
	else
	{
		return true;
	}
}

function Punish(fieldName)
{
	alert ('The cell is not filled!');
	el = eval ("document.calc."+fieldName);
	el.focus();
}

// если количество перегородок равно 0, то делаем недоступным поле "глубина"
function Synhronize()
{
	if (document.calc.partition_number.value == "0" || document.calc.partition_number.value == "00")// если в поле "0"
	{
		document.calc.partition_depth.disabled = true;
		document.calc.partition_depth.value = "";
		document.calc.partition_depth.style.backgroundColor = '#F2F7FF';
	}
	else
	{
		document.calc.partition_depth.disabled = false;
		document.calc.partition_depth.style.backgroundColor = '#FFFFFF';
	}
}

function popUp(url, target, width, height)
{
	var left = (screen.width - width) / 2;
	var top = (screen.height - height) / 2;
	popupWindow = window.open(url, target, "toolbar=no,menubar=no,scrollbars=yes,resizable=no,status=no,location=no,directories=no,copyhistory=no,height="+height+",width="+width+",left="+left+",top="+top+",screenX="+left+",screenY="+top);
	popupWindow.focus();
}

function imgOpen(imgURL,Targ,imgWidth,imgHeight,title) {
newWin=window.open("",Targ,'width='+parseInt(imgWidth)+',height='+parseInt(imgHeight));
t='<HTML><HEAD><TITLE>'+title+'</TITLE></HEAD><BODY TOPMARGIN="0" LEFTMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0"><img src="'+imgURL+'"></BODY></HTML>';
newWin.document.write(t);
newWin.document.close();
newWin.moveTo((screen.width-imgWidth)/2, (screen.height-imgHeight)/2);
}
