<!--

Nil = new Image;
	Nil.src = "img/nil.gif";
	More = new Image;
	More.src = "img/more.gif";
	Go = new Image;
	Go.src = "img/go.gif";
	Go1 = new Image;
	Go1.src = "img/go1.gif";
	Hnd = null


	
function On(n,k)
{
	if (Hnd!=null) clearTimeout(Hnd),Hnd = null
	document.images['m'+n].src=Nil.src;
	document.images['m'+k].src=More.src;
};

function No(n)
{
	document.images['m'+n].src=More.src;
	Hnd = null
};

function Out(n,k)
{
	document.images['m'+k].src=Nil.src;
  Hnd = setTimeout("No("+n+")",200)
};

function Ong(n)
{
	document.images['g'+n].src=Go1.src;
};
function Ong1(n)
{
	document.images['g'+n].src="images/go22.gif";
};
function Outg(n)
{
	document.images['g'+n].src=Go.src;
};
function Outg1(n)
{
	document.images['g'+n].src="images/go11.gif";
};
function openIT(theURL,W,H,X,Y, wname) {
	CLOSEdwn 		= "img/close_dwn.gif"
	CLOSEup 		= "img/close_up.gif"
	CLOSEovr 		= "img/close_ovr.gif"
	MINIdwn 		= "img/mini_dwn.gif"
	MINIup 			= "img/mini_up.gif"
	MINIovr 		= "img/mini_ovr.gif"
	NONEgrf 		= "img/none.gif"
	CLOCKgrf		= "img/clock.gif"
	titHTML 	    	= "<font face=verdana size=1>&nbsp; Оконный дизайн</font>"
	titWIN			= "&nbsp;Гостевая книга"
	winBORDERCOLOR   	= "#C3CCD8"
	winBORDERCOLORsel	= "#C3CCD8"
	winBGCOLOR    		= "#C3CCD8"
	winBGCOLORsel 		= "#C3CCD8"
	return openchromeless(theURL, wname, W, H, X, Y, NONEgrf, CLOSEdwn, CLOSEup, CLOSEovr, MINIdwn, MINIup, MINIovr, CLOCKgrf, titHTML, titWIN, winBORDERCOLOR, winBORDERCOLORsel, winBGCOLOR, winBGCOLORsel)
}

	Hnd = null
	function nwin(url, w, h)
	{	if (Hnd!=null && !Hnd.closed) 
			Hnd.close(), 
			Hnd = null	
			Hnd = window.open(url,null,'top=0, left=0, width='+w+',height='+h+',scrollbars=1')	
			Hnd.focus()
	}
	Hnd1 = null
	function nwinm(url, w, h)
	{	if (Hnd1!=null && !Hnd1.closed) 
		Hnd1.close(), 
		Hnd1 = null	
		Hnd1 = window.open(url,null,'top=100, left=100, width='+w+',height='+h+',scrollbars=0')	
		Hnd1.focus()
	}



function MM_openBrWindow(theURL,winName,w,h,s) { //v2.0
var width=w;
 var height=h;
 var top=(screen.height) ? (screen.height-height)/2 : 0;
  var left=(screen.width) ? (screen.width-width)/2 : 0;
 var features = '';
 if (s==1) {features = 'scrollbars=1,width='+width+',height='+height+',top='+top+',left='+left;}
  else {features = 'scrollbars=0,width='+width+',height='+height+',top='+top+',left='+left;};
     window.open(theURL,winName,features);

}




function openIT(theURL,W,H,X,Y, wname) {



	CLOSEdwn 		= "img/close_dwn.gif"



	CLOSEup 		= "img/close_up.gif"



	CLOSEovr 		= "img/close_ovr.gif"



	MINIdwn 		= "img/mini_dwn.gif"



	MINIup 			= "img/mini_up.gif"



	MINIovr 		= "img/mini_ovr.gif"



	NONEgrf 		= "img/none.gif"



	CLOCKgrf		= "img/clock.gif"



	titHTML 	    	= "<font face=verdana size=1>&nbsp; Оконный дизайн</font>"



	titWIN			= "&nbsp;Гостевая книга"



	winBORDERCOLOR   	= "#C3CCD8"



	winBORDERCOLORsel	= "#C3CCD8"



	winBGCOLOR    		= "#C3CCD8"



	winBGCOLORsel 		= "#C3CCD8"



	return openchromeless(theURL, wname, W, H, X, Y, NONEgrf, CLOSEdwn, CLOSEup, CLOSEovr, MINIdwn, MINIup, MINIovr, CLOCKgrf, titHTML, titWIN, winBORDERCOLOR, winBORDERCOLORsel, winBGCOLOR, winBGCOLORsel)



}

var tfW = new Array();

		var tfBD = new Array();

		var table;

		var typeSPValues = new Array(0,13,13,17,30);

		var sandColValues = new Array(0, 30,70,130);

		var colrValues = new Array(0, 20, 25);

		 

		function field(obj, intVal, type){

			this.obj = obj;

			this.intVal = intVal;

			this.type = type;

		}

		

		function init() {

			tfW[5] = new field(document.main.widthW, parseInt(document.main.widthW.value), "text"); 								//C5

			tfW[6] = new field(document.main.heightW, parseInt(document.main.heightW.value), "text");								//C6

			tfW[7] = new field(document.main.impostLengthW, parseInt(document.main.impostLengthW.value), "text");					//C7

//			tfW[8] = new field(document.main.shtulpLengthW, parseInt(document.main.shtulpLengthW.value), "text");					//C8

			tfW[8] = new field(document.main.povNumW, parseInt(document.main.povNumW.value), "text");								//C9

			tfW[9] = new field(document.main.povOtW, parseInt(document.main.povOtW.value), "text");								//C10

			tfW[10] = new field(document.main.framugsNumberW, parseInt(document.main.framugsNumberW.value), "text");				//C11

//			tfW[11] = new field(document.main.addSPW, parseInt(document.main.addSPW.value), "text");								//C12

			tfW[11] = new field(document.main.typeSPW, typeSPValues[document.main.typeSPW.selectedIndex], "select");							//C12

			tfW[12] = new field(document.main.sandwichW, parseInt(document.main.sandwichW.value), "text");							//C13

			tfW[13] = new field(document.main.sandwichColorW, sandColValues[document.main.sandwichColorW.selectedIndex], "select");	//C14

			tfW[14] = new field(document.main.arksW, parseInt(document.main.arksW.value), "text");									//C15

			if (document.main.trW.checked) tfW[15] = new field(document.main.trW, parseInt(document.main.trW.value), "checkbox");		//C16			

			else tfW[15] = new field(document.main.trW, 0, "checkbox");																	//C16	

			tfW[16] = new field(document.main.colorsW, colrValues[document.main.colorsW.selectedIndex], "select");					//C17

			

			tfBD[5] = new field(document.main.widthBD, parseInt(document.main.widthBD.value), "text"); 									//D5

			tfBD[6] = new field(document.main.heightBD, parseInt(document.main.heightBD.value), "text");								//D6

			tfBD[7] = new field(document.main.impostLengthBD, parseInt(document.main.impostLengthBD.value), "text");					//D7

//			tfBD[8] = new field(document.main.shtulpLengthBD, parseInt(document.main.shtulpLengthBD.value), "text");					//D8

			tfBD[8] = new field(document.main.povNumBD, parseInt(document.main.povNumBD.value), "text");								//D9

			tfBD[9] = new field(document.main.povOtBD, parseInt(document.main.povOtBD.value), "text");									//D10

			tfBD[10] = new field(document.main.framugsNumberBD, parseInt(document.main.framugsNumberBD.value), "text");					//D11

//			tfBD[11] = new field(document.main.addSPBD, parseInt(document.main.addSPBD.value), "text");									//D12

			tfBD[11] = new field(document.main.typeSPBD, typeSPValues[document.main.typeSPBD.selectedIndex], "select");							//D12

			tfBD[12] = new field(document.main.sandwichBD, parseInt(document.main.sandwichBD.value), "text");							//D13

			tfBD[13] = new field(document.main.sandwichColorBD, sandColValues[document.main.sandwichColorBD.selectedIndex], "select");	//D14

			tfBD[14] = new field(document.main.arksBD, parseInt(document.main.arksBD.value), "text");									//D15

			if (document.main.trBD.checked) tfBD[15] = new field(document.main.trBD, parseInt(document.main.trBD.value), "checkbox");		//D16			

			else tfBD[15] = new field(document.main.trBD, 0, "checkbox");																	//D16	

			tfBD[16] = new field(document.main.colorsBD, colrValues[document.main.colorsBD.selectedIndex], "select");					//D17

			table = new Array(tfW, tfBD);

		}

		

		function makeValues(ind){

			for (i=5; i<table[ind].length; i++){

				if (table[ind][i].type == "text" && (table[ind][i].obj.value=="" || isNaN(table[ind][i].obj.value))) table[ind][i].obj.value=0;

				table[ind][i].obj.value = Math.abs(Math.round(table[ind][i].obj.value));

				table[ind][i].intVal = parseInt(table[ind][i].obj.value);

			}

			

			if (table[ind][15].obj.checked) table[ind][15].intVal = parseInt(table[ind][15].obj.value);

			else table[ind][15].intVal = 0;

			table[ind][11].intVal = typeSPValues[table[ind][11].obj.selectedIndex];

			table[ind][13].intVal = sandColValues[table[ind][13].obj.selectedIndex];

			table[ind][16].intVal = colrValues[table[ind][16].obj.selectedIndex];

		}

		

		function calcTotal(){

			//Расчёт стоимости

			/* Формула:				

			=((C5+C6)*24,611/1000+15,563*C5*C6/1000000+C7*16,648/1000+C8*18,096/1000+C9*68,041+C10*77,451+C11*47,05)*(1+C16/100)*(1+C17/100)+C5*C6*C12/1000000+C5*C13*C14/1000000-C5*C13*C12/1000000+55*C15

			*/

			var col = "";

			for (j=0; j<2; j++) {

				tot = (((table[j][5].intVal+table[j][6].intVal)*24.611/1000+15.563*table[j][5].intVal*table[j][6].intVal/1000000+table[j][7].intVal*16.648/1000+table[j][8].intVal*68.041+table[j][9].intVal*77.451+table[j][10].intVal*47.05)*(1+table[j][15].intVal/100)*(1+table[j][16].intVal/100)+table[j][5].intVal*table[j][6].intVal*table[j][11].intVal/1000000+table[j][5].intVal*table[j][12].intVal*table[j][13].intVal/1000000-table[j][5].intVal*table[j][12].intVal*table[j][11].intVal/1000000+55*table[j][14].intVal)*1.4;

				basicTot = Math.abs(Math.round(tot*0.94));

				thermoTot = Math.abs(Math.round(tot));

				brTot = Math.abs(Math.round(tot+tot*0.19));

				ar = Math.round((table[j][5].intVal*table[j][6].intVal/1000000)*100)/100



				if (j == 0) col="W"

				else col="BD"

				

				switch (document.main.variant.selectedIndex){

					case 0: eval("document.main.summary"+col+".value = basicTot")

					break;

					case 1: eval("document.main.summary"+col+".value = thermoTot")

					break;

					case 2: eval("document.main.summary"+col+".value = brTot")

					break;

				}

				eval("document.main.area"+col+".value = ar")

				if (ar != 0) eval("document.main.meterCost"+col+".value = parseInt(document.main.summary"+col+".value)/ar")

			}

		}






	
	
-->
