var helpWin;
function inContext(curfile) {
	helpWin = open(curfile, 'Увеличенное фото', 'width=' 
		+ 420 + ',height=' + 200 + ',left=250,top=250,scrollbars=yes');
	}


function openimage(numb, cont) 
{
var doc = window.open().document;
doc.open();
doc.writeln('<HTML>\n<HEAD>\n<TITLE>' + cont + '</TITLE>\n</HEAD>' + 
		'<BODY BGCOLOR=#FFFFFF TEXT=BLACK><CENTER><IMG border=1 src = ' + numb + '></center></BODY></HTML>');
doc.close();
}

function resetLogo() {
            document.all.Logo.style.posTop = document.body.scrollTop+120;
		if (document.body.clientWidth>=686)
            document.all.Logo.style.posLeft = document.body.scrollLeft+(document.body.clientWidth-686)/2+25;
		else document.all.Logo.style.posLeft = document.body.scrollLeft+22;
         }

function SizePosLogo() {
            document.all.Logo.style.posTop = document.body.scrollTop+120;
		if (document.body.clientWidth>=686)
            document.all.Logo.style.posLeft = document.body.scrollLeft+(document.body.clientWidth-686)/2+25;
		else document.all.Logo.style.posLeft = document.body.scrollLeft+22;
         }


function clear() 
{
	for (k=1;k<=4;k++)
	{
		for (i=1;i<=7;i++)
		{
			for (j=1;j<=7;j++)
		  	{
			eval("fxm.n"+k+"e"+i+"n"+j+".checked=false");
			}
		}
	}


}

function fill(mycost) 
{
	kol=1;
	for (k=0;k<=3;k++)
	{
		if (document.forms.fxm.tt[k].checked==true)
		{
		kol=document.forms.fxm.tt[k].value;
		}
	}
	kek = 0;
	kek = (document.forms.fxm.ch1.checked==true)+(document.forms.fxm.ch2.checked==true)+(document.forms.fxm.ch3.checked==true)+(document.forms.fxm.ch4.checked==true)+(document.forms.fxm.ch5.checked==true)+(document.forms.fxm.ch6.checked==true)+(document.forms.fxm.ch7.checked==true)+(document.forms.fxm.ch8.checked==true);
	switch (kek)
		{
		case 0: pr2=0; break;
		case 1: pr2=0; break;
		case 2: pr2=2; break;
		case 3: pr2=4; break;
		case 4: pr2=5; break;
		case 5: pr2=8; break;
		case 6: pr2=10; break;
		case 7: pr2=11; break;
		case 8: pr2=12; break;
               	}
        //alert(pr2);
	for (k=1;k<=kol;k++)
	{
		for (i=1;i<=7;i++)
		{
			for (j=1;j<=7;j++)
		  	{
			eval("(fxm.ch"+i+".checked==true)?(fxm.n"+k+"e"+i+"n"+j+".checked=true):(fxm.n"+k+"e"+i+"n"+j+".checked=false)");
			}
		}
	}
	switch (kol)
		{
		case '1': pr=5; break;
		case '2': pr=7; break;
		case '3': pr=10; break;
		case '4': pr=15; break;
		}

	document.forms.fxm.itog.value = ((document.forms.fxm.sek.value/10) * mycost * (kol*7) * kek * (100-pr2)/100)*(100-pr)/100;
}


function calc(cost)
{
	clear();
	fill(cost);
}

function checkplan()
{
 if ((document.forms.fxm.name_client.value=='') || (document.forms.fxm.name_rolic.value=='') || (document.forms.fxm.tel.value=='') || (document.forms.fxm.chel.value=='') || (document.forms.fxm.itog.value==''))
	{
	alert("Не заполнены необходимые поля"); 
	return false;
	}       
else
	{
	return true;
	}
}


function checkquest()
{
 if ((document.forms.fxm.user.value=='') || (document.forms.fxm.email.value=='') || (document.forms.fxm.question.value==''))
	{
	alert("Все поля должны быть заполнены!"); 
	return false;
	}       
else
	{
	return true;
	}
}

function fill2(mycost) 
{
	kek = (document.forms.fxm.ch1.checked==true)+(document.forms.fxm.ch2.checked==true)+(document.forms.fxm.ch3.checked==true)+(document.forms.fxm.ch4.checked==true)+(document.forms.fxm.ch5.checked==true)+(document.forms.fxm.ch6.checked==true)+(document.forms.fxm.ch7.checked==true)+(document.forms.fxm.ch8.checked==true);

	document.forms.fxm.itog.value = (document.forms.fxm.sek.value/10) * mycost * (document.forms.fxm.tt.value * 7) * kek;

         if (document.forms.fxm.skidka.checked==true)
		{
		document.forms.fxm.itog.value=document.forms.fxm.itog.value * 0.50;
		}



}


function calc2(cost)
{
	clear2();
	fill2(cost);
}


function clear2() 
{

}

