var PTH="http://www.fizlabpribor.ru/"
function FM(e,C,C1)
{

e.style.fontWeight = C;
e.style.color=C1
}
function tla(idList0, figura1)
{
et=document.all(idList0);
et.style.display=="none" ? et.style.display="block": 
et.style.display="none"
et.display=="none" ? et.display="block": et.display="none";
et.style.display=="none" ?  document.images(figura1).src = fig1 :document.images(figura1).src =fig2 ;
document.images(figura1).width="16";
document.images(figura1).height="16";
}
function tla1(idList0) {
et=document.all(idList0);
et.style.display="none"
et.display="none"
}
function Price(Obg,C) {   
Obg.Filter='Article='+C
Obg.Reset()
}

function Opn() {
adr =window.document.referrer

adrT=adr+'1'
if (adrT!=1) {
adr1 = adr.substring(0,26)
adrT1='http://www.fizlabpribor.ru' 
adr2 = adr.substring(0,22)
adrT2='http://fizlabpribor.ru'


if (adr1==adrT1 || adr2==adrT2) { }
else {

adrS= new String(self.location)
Ls = adrS.length
adrS=adrS.substr(0,Ls-4)
Ls = adrS.length
adrSwww=adrS.substr(7,3)
if (adrSwww=='www') {LsW=27}
else {LsW=23}

adrS=adrS.substr(LsW,Ls)
Ls = adrS.length
adrK=""
I=0
while (I < Ls) {
x = adrS.substr(I,1)
if (x=="/") {x='_314_'}
if (x==".") {x='_271_'}
adrK +=x
I++}
adrK=adrK + '740'

Nwind=window.open("http://www.fizlabpribor.ru/index.html", adrK)
close()
}
}
}
function opg() {
prmotkr=document.location.search
if (prmotkr!="?prm='gmain'") {
adrK=self.name
adrKT = "1" + adrK
L=adrK.length
if (L!=1) {
if (adrK.substr(L-3,3)=='740') {
adrK=adrK.substr(0,L-3)
adrKT = "1" + adrK
}
else {
adrK=""
adrKT = "1"
}
}
adrS=""
I=0
while (I < adrK.length) {
x = adrK.substr(I,1)
if (x=="_") {
y = adrK.substr(I,5)
if (y=="_314_") {x="/"; I+=4}
if (y=="_271_") {x="."; I+=4}
}
adrS +=x
I++}
adrS += ".htm"


if (adrKT==1) {window.frames.pages.location="main.htm" }
else {
window.frames.pages.location=adrS  }
}
}

function obr() {
window.history.go(-1)

}

function opnF() { 
adrL =window.document.referrer
adrLT=adrL+'1'
if (adrLT!=1) {
adrL1 = adrL.substring(0,26)
adrLT1='http://www.fizlabpribor.ru' 
adrL2 = adrL.substring(0,22)
adrLT2='http://fizlabpribor.ru'


if (adrL1==adrLT1 || adrL2==adrLT2 ) { }
else {

NwindL=window.open("http://www.fizlabpribor.ru/index.html")
close()
}
}
}

function PGS(et) {
et.target=NP
}
function PageChange() {
NP=="pages" ? NP="_blank":NP="pages"
}
function stopErrors() {
 return true;
}
function oninfor() {
window.onerror = stopErrors
adself=document.location
adr =window.document.referrer
adr+='&adself='+adself
document.write('<img src=' + PTH + 'cgi-bin/scr_log.cgi?'+adr+'" width=0 height=0>')
}

function SVR1() {
document.all("hhhh").style.display="none"

document.all("hhhh2").style.display="block"
}
function  SVR2() {
document.all("hhhh").style.display="block"

document.all("hhhh2").style.display="none"
}


function  SVR() {
LLF2=window.parent.frames.juy.cols

if (LLF2=="25%,*") {
LLF2="46,*"
document.all("TTT2").style.display="none"
document.all("TTT3").style.display="block"
document.all("Vse").style.display="none"

}
else {
LLF2="25%,*"
document.all("TTT2").style.display="block"
document.all("TTT3").style.display="none"
document.all("Vse").style.display="block"
}
window.parent.frames.juy.cols=LLF2
}

function ColumColor() {
N=FormCol.Sorb.length;
CID0=1;

BgW0=new Array("#FFFFFF", "#EEEFF6");

for (I=1; I<N+1; I++) {

FormCol.elements["ID_SORB_"+I].disabled=true
FormCol.elements["L_SORB_"+I].disabled=true


CID=FormCol.elements["Sorb_"+I].value
document.all("TRS_"+I).bgColor=BgW0[CID-1];

if(CID0!=CID || I==1) {
CID0=CID;

if(document.all("TRS0_"+I)) {
document.all("TRS0_"+I).bgColor=BgW0[CID0-1];
}

if(document.all("TRS1_"+I)) {
document.all("TRS1_"+I).bgColor=BgW0[CID0-1];
}
if(document.all("TRS2_"+I)) {
document.all("TRS2_"+I).bgColor=BgW0[CID0-1];
}
if(document.all("TRS3_"+I)) {

document.all("TRS3_"+I).bgColor=BgW0[CID0-1];
}

}
}
return N
}

function ColumKlik(S,Cs) {

K=ColumColor()

FormCol.elements["ID_SORB_"+S].disabled=false
FormCol.elements["L_SORB_"+S].disabled=false

document.all("TRS_"+S).bgColor="#AAFFAA";

if(document.all("TRS0_"+Cs)) {
document.all("TRS0_"+Cs).bgColor="#AAFFAA";
}


if(document.all("TRS1_"+Cs)) {
document.all("TRS1_"+Cs).bgColor="#AAFFAA";
}

if(document.all("TRS2_"+Cs)) {
document.all("TRS2_"+Cs).bgColor="#AAFFAA";
}
if(document.all("TRS3_"+Cs)) {
document.all("TRS3_"+Cs).bgColor="#AAFFAA";
}

FormCol2.T1.value=document.all("Col_"+S).value + " " + document.all("L_SORB_"+S).value + " x " + document.all("ID_SORB_"+S).value + "mm";
FormCol2.T10.value=document.all("Col_"+S).value + " " + document.all("L_SORB_"+S).value + " x " + document.all("ID_SORB_"+S).value + "mm";
FormCol2.T2.value=document.all("Col_"+S).value
FormCol2.T3.value=document.all("L_SORB_"+S).value
FormCol2.T4.value=document.all("ID_SORB_"+S).value
FormCol2.TX.value=S
}

function LL(Nm) {

X=Nm.substr(Nm.search("B_")+2);
if(document.all("ID_SORB_"+X)) {
DIAM=document.all("ID_SORB_"+X).value;
} else {
DIAM="4,6";
}
if(document.all("L_SORB_"+X)) {
DL=document.all("L_SORB_"+X).value;
} else {
DL="250";
}
FormCol2.T1.value=document.all("Col_"+X).value + " " + DL + " x " + DIAM + "mm" +X;
FormCol2.T1.value=document.all("Col_"+X).value + " " + document.all("L_SORB_"+X).value + " x " + document.all("ID_SORB_"+X).value + "mm";
FormCol2.T10.value=document.all("Col_"+X).value + " " + document.all("L_SORB_"+X).value + " x " + document.all("ID_SORB_"+X).value + "mm";
FormCol2.T2.value=document.all("Col_"+X).value
FormCol2.T3.value=document.all("L_SORB_"+X).value
FormCol2.T4.value=document.all("ID_SORB_"+X).value
FormCol2.TX.value=X
}

function ColumKlikB() {

if(document.all("TX")) {if(document.all("TRS_"+FormCol2.TX.value)) {
S=FormCol2.TX.value; 
document.all("TRS_"+S).bgColor="#AAFFAA"; 
CID0=FormCol.elements["Sorb_"+S].value;
CID1=CID0;
I=S-1;
if(I==0){I=1}

while(CID1==CID0) {
CID1=FormCol.elements["Sorb_"+I].value;
I--;
if(I==0) {
CID1=-8;
I=-1;
}
}
K=I+2;
ColumKlik(S, K);
}
}
}

function tlaBP(idList0)
{
et=document.all(idList0);
et.style.display=="none" ? et.style.display="block": 
et.style.display="none"
et.display=="none" ? et.display="block": et.display="none";

}

function   TabRez(N,I0, Tab0, Wcrit, NewTabID)
 {
//Wcrit - критерий выбора > 0 опускаем вниз, меньше нуля - справа
//N-это количество неизменяемых ячеек в строке, если colSpan отсутствовал бы!!!!
//I0=0 строка заглавия (или сколько строк сверху не менять (пустые строки если не 0 переедут в новую таблицу!!!
//Tab0  изменяемой таблицы id
// NewTabID создаваемой таблицы id


if(Wcrit > 0 ) {
  
    if (document.getElementById(NewTabID)==null) {
  

//N-это количество неизменяемых ячеек если colSpan отсутствовал бы!!!!


RezElemTB=document.getElementById(Tab0);
RezElemTR=RezElemTB.insertRow();
ParElem=RezElemTR.insertCell();
k=0;
RezM=new Array();
RezS=new Array();
NC=1;

//I0 строка заглавия или сколько строк оставить!!!

for(i=I0;i<RezElemTB.rows.length; i++) {

NT=0;
iff=0;
   for(m=0; m<RezElemTB.rows[i].cells.length; m++) {
   NT=NT+parseInt(RezElemTB.rows[i].cells[m].colSpan);
    if(NT>N  ) {
     if(iff==0) {
      RezM[k]=new Array();
      RezS[k]=new Array();
      p=0;
      k++;
      iff=1;
       }
    RezM[k-1][p]=RezElemTB.rows[i].cells[m];
   
    RezS[k-1][p]=parseInt(RezElemTB.rows[i].cells[m].colSpan);
    p++;
    }
   }
   NC=(NC>NT)?NC:NT;
}

ParElem.colSpan=NC;


NewTab=document.createElement("TABLE");

ParElem.applyElement(NewTab, "inside");
NewTab.id=NewTabID;

NewRow=NewTab.insertRow;


for(i=0;i<RezM.length; i++) {
NewRow=NewTab.insertRow(i);



for(k=0;k<RezM[i].length; k++) {

NewCell=NewRow.insertCell(k);
NewCell.colSpan= RezS[i][k];
NewCell.innerHTML=RezM[i][k].innerHTML;

RezM[i][k].style.display="none";
}
}


    
     } else {
      
              if(document.getElementById(NewTabID).style.display="none") {
               document.getElementById(NewTabID).style.display="block";
                    for(i=0;i<RezM.length; i++) {
                    for(k=0;k<RezM[i].length; k++) {
                   RezM[i][k].style.display="none";
                    }
                   }

                }

        }

} else {
if (document.getElementById(NewTabID)!=null) {
 document.getElementById(NewTabID).style.display="none";
                    for(i=0;i<RezM.length; i++) {
                    for(k=0;k<RezM[i].length; k++) {
                   RezM[i][k].style.display="block";
                    }
                    }
} else {

RezM=false;
}
return RezM;
}

}
 
function dragIt(evt) {
     
         evt = (evt) ? evt : (window.event) ? window.event : "";
         var targElem = (evt.target) ? evt.target : evt.srcElement;
         if (draggedElem) {
            targElem = draggedElem;
        while (targElem.className != "draggable" && targElem.parentNode) {
               targElem = targElem.parentNode;
            }
           if (targElem.className == "draggable") {
               if (evt.pageX) {
               targElem.style.left = evt.pageX - offsetX + "px";
               targElem.style.top = evt.pageY - offsetY + "px";
               } else {
       
                  X1=parseInt(evt.clientX- document.body.scrollLeft);
                  Y1=parseInt(evt.clientY- document.body.scrollTop);
                  dX=X1-X;
                  dY=Y1-Y;
                targElem.style.left=L1+ "px";
                targElem.style.top=T1+ "px";
 
                X=X1;
                Y=Y1;

               L1=parseInt(L1+dX);
               T1=parseInt(T1+dY);
         
                
               }
               return false;
            }
        }
      }
      function engage(evt) {
         evt = (evt) ? evt : (window.event) ? window.event : "";
         var targElem = (evt.target) ? evt.target : evt.srcElement;
         
     
            while (targElem.className != "draggable" && targElem.parentNode) {
               targElem = targElem.parentNode;
            }
         
         
         
         if (targElem.className == "draggable") {
     
               draggedElem = targElem;
               if (evt.pageX) {
                  offsetX = evt.pageX - targElem.offsetLeft;
                  offsetY = evt.pageY - targElem.offsetTop;
               } else {
 

                 
                  X=evt.clientX- document.body.scrollLeft;
                  Y=evt.clientY- document.body.scrollTop;

                   L1=targElem.style.left;
                   L1=parseInt(L1);
                   T1= targElem.style.top;
                   T1=parseInt(T1);
  
                  if (navigator.userAgent.indexOf("Win") == -1) {
                     offsetX += document.body.scrollLeft;
                     offsetY += document.body.scrollTop;
                  }
               }
               return false;
          
         }
      }
      function release(evt) {
  
         evt = (evt) ? evt : (window.event) ? window.event : "";
         var targElem = (evt.target) ? evt.target : evt.srcElement;
           while (targElem.className != "draggable" && targElem.parentNode) {
               targElem = targElem.parentNode;
            }
           if (targElem.className == "draggable") {
           draggedElem = null;

          }
           }
           
 function  GF(evt, GG, X, Y) {
           // Координаты left top вызываемого объекта, если нет то координаты события
RR=document.getElementById(GG);

X=(!X)?((X!=0)?evt.clientX + document.body.scrollLeft:0):X + document.body.scrollLeft;

Y=(!Y)?((Y!=0)?evt.clientY + document.body.scrollTop:0):Y + document.body.scrollTop;

X=(X<0)?X=0:X;
RR.style.display="block";

X=((X+RR.clientWidth+10)>document.body.clientWidth || document.body.clientWidth<RR.clientWidth)?document.body.clientWidth-RR.clientWidth:X;
X=(X<0)?0:X;

RR.style.top=Y;
RR.style.left=X;

IZ++;
RR.style.zIndex=IZ;

} 
	

function  setImageInImagePosition2(Pic, Pic2, X, Y) {
	//X, Y=координаты в %  от рисунка (0-1) если вне диапазона, то на край внутри картинки Pic
	//
		
		
		Obj=document.getElementById(Pic).offsetParent;
		Htot=parseInt(document.getElementById(Pic).offsetTop);
		Wtot=parseInt(document.getElementById(Pic).offsetLeft);
		
	while (Obj.offsetTop) {
	
	Htot = Htot + Obj.offsetTop;
	Wtot = Wtot + Obj.offsetLeft;
		Obj=Obj.offsetParent;
	
	}
	
	if(!Y && Y!=0) {
	document.getElementById(Pic2).style.top=Htot;
	
	} else {
	
	Y=parseFloat(Y);
Y=(Y<=0)?0:Y;

Xpol= (document.getElementById(Pic).offsetHeight*(Y-1)
+document.getElementById(Pic2).offsetHeight>=0)?document.getElementById(Pic).offsetHeight-document.getElementById(Pic2).offsetHeight:document.getElementById(Pic).offsetHeight*Y;
document.getElementById(Pic2).style.top=Htot+Xpol;	
	}

	
	if(!X && X!=0) {
	document.getElementById(Pic2).style.left =Wtot + document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth;
	
	} else {
X=parseFloat(X);

X=(X<=0)?0:X;
Xpol= (document.getElementById(Pic).offsetWidth*(X-1)
+document.getElementById(Pic2).offsetWidth>=0)?document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth:document.getElementById(Pic).offsetWidth*X;
document.getElementById(Pic2).style.left=Wtot+Xpol;	
}
}

function GFF(GG, Figg) {
// Подгоняет размер изображения под размер экрана по высот или шир что меньше
//Figg изображ в кеше ImPic[i]=new Image(); для начального размера
RR=document.getElementById(GG);
H=document.body.offsetHeight;
W=document.body.offsetWidth;

if(!!Figg) {
RR.style.width=Figg.width;
RR.style.height=Figg.height;

}

DH=RR.offsetHeight;
DW=RR.offsetWidth;
Kapp=DH/DW;
DH=(DH>H)?H:DH;
DW=DH/Kapp;

DW=(DW>W)?W:DW;
DH=DW*Kapp;

RR.style.width=DW;
RR.style.height=DH;

}


function  setImageInImagePosition66steret(Pic, Pic2, X, Y) {
	//X, Y=координаты в %  от рисунка (0-1) если вне диапазона, то на край внутри картинки Pic
	
	    Obj=document.getElementById(Pic);
		Htot=0;
		Wtot=0;
	te=Obj.offsetTop;	
	while ( Obj ) {
    Htot = Htot + Obj.offsetTop;
	Wtot = Wtot + Obj.offsetLeft;
	
    Obj=Obj.offsetParent;
	}


	if(!Y && Y!=0) {
	document.getElementById(Pic2).style.top=Htot;
	
	} else {
	
	Y=parseFloat(Y);
Y=(Y<=0)?0:Y;

Xpol= (document.getElementById(Pic).offsetHeight*(Y-1)
+document.getElementById(Pic2).offsetHeight>=0)?document.getElementById(Pic).offsetHeight-document.getElementById(Pic2).offsetHeight:document.getElementById(Pic).offsetHeight*Y;
document.getElementById(Pic2).style.top=Htot+Xpol;	
	}

	
	if(!X && X!=0) {
	document.getElementById(Pic2).style.left =Wtot + document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth;
	
	} else {
X=parseFloat(X);

X=(X<=0)?0:X;
Xpol= (document.getElementById(Pic).offsetWidth*(X-1)
+document.getElementById(Pic2).offsetWidth>=0)?document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth:document.getElementById(Pic).offsetWidth*X;
document.getElementById(Pic2).style.left=Wtot+Xpol;	
}
}


        function engage1(evt) {
          evt1=evt;
         evt = (evt) ? evt : (window.event) ? window.event : "";
         var targElem = (evt.target) ? evt.target : evt.srcElement;
         while (targElem.className != "draggable1" && targElem.parentNode) {
         targElem = targElem.parentNode;
            }
 if(targElem.className == "draggable1") {
         engage(evt1);
         }
     return false;
         }


function  setImageInImagePosition(Pic, Pic2, X, Y) {
	//X, Y=координаты в %  от рисунка (0-1) если вне диапазона, то на край внутри картинки Pic
	// с учетом abs слоев
	
	    Obj=document.getElementById(Pic);
		Htot=0;
		Wtot=0;
		te=true;
		
	while ( Obj && te ) {
   
 Htot = Htot + Obj.offsetTop;
Wtot = Wtot + Obj.offsetLeft;
    Obj=Obj.offsetParent;
    if(Obj ) {
      if (Obj.style.position==="absolute") {
      te=false;
   var NewChild=document.getElementById(Pic2);
    Obj.insertBefore(NewChild);
      } else {
      te=true;
      }
     }
	}

	if(!Y && Y!=0) {
	document.getElementById(Pic2).style.top=Htot;
	
	} else {
	
	Y=parseFloat(Y);
Y=(Y<=0)?0:Y;
Xpol= (document.getElementById(Pic).offsetHeight*(Y-1)
+document.getElementById(Pic2).offsetHeight>=0)?document.getElementById(Pic).offsetHeight-document.getElementById(Pic2).offsetHeight:document.getElementById(Pic).offsetHeight*Y;
document.getElementById(Pic2).style.top=Htot+Xpol;	

	}

	if(!X && X!=0) {
	document.getElementById(Pic2).style.left =Wtot + document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth;
	
	} else {
X=parseFloat(X);
X=(X<=0)?0:X;
Xpol= (document.getElementById(Pic).offsetWidth*(X-1)
+document.getElementById(Pic2).offsetWidth>=0)?document.getElementById(Pic).offsetWidth-document.getElementById(Pic2).offsetWidth:document.getElementById(Pic).offsetWidth*X;
document.getElementById(Pic2).style.left=Wtot+Xpol;	
}
}
