//var MSIE=navigator.userAgent.indexOf("MSIE");
//var NETS=navigator.userAgent.indexOf("Netscape");
//var OPER=navigator.userAgent.indexOf("Opera");
var ClickOnCb=0;
bn_t=navigator.appName;
bv_t=parseInt( navigator.appVersion );
var ms = navigator.appVersion.indexOf("MSIE");
if (!document.layers)
  bv_t=parseInt(navigator.appVersion.substring(ms+5, ms+6));
var Use5=true;
if( bn_t == 'Microsoft Internet Explorer' && bv_t <4)
 {
  Use5=false;
  window.alert("Необходима более современная версия браузера");
 }

//bv_t=Math.round(parseFloat(navigator.appVersion)*100);
//bv_t=escape(navigator.appVersion);
//document.title);W+="&url="+window.document.URL;
//W+="&referrer="+window.document.referrer;
//W+="&appname="+escape(navigator.appName);
//W+="&appversion="+escape(navigator.appVersion);
//W+="&cookieOK="+(navigator.cookieEnabled?"Yes":"No");
//W+="&userLanguage="+(navigator.appName=="Netscape"?navigator.language:navigator.userLanguage);
//W+="&platform="+navigator.platform;W+="&bgColor="+escape(document.bgColor);
//W+="&javaOK=Yes";if(typeof(screen)=="object"){
//W+="&screenResolution="+screen.width+"x"+screen.height;W+="&colorDepth="+screen.colorDepth;
//W+="&NSpluginList=";for( var i=0; i< navigator.plugins.lengt

//window.alert(bv_t);

//if((MSIE>-1) || (OPER>-1)){}
//if (OPER>-1)
//  {alert("OO");}

//document.forms[0]=MForm

var Img0="Images/Ch0.gif";
var Img1="Images/Ch1.gif";
var Img2="Images/Ch2.gif";
var Img3="Images/Ch3.gif";
var Img4="Images/Ch4.gif";
var Img5="Images/Ch5.gif";

var ArrSt=new Array(); //Array of all Check state
var ArrCN=new Array(); //Category Num
var ArrPL=new Array(); //PriceList Num
var ArrPA=new Array(); //All Parent
var ArrFT=new Array(); //for TestI
var ArrCC=new Array(); //Child Count
var ArrIN=new Array(); //Num Img Child
var ArrBL=new Array(); //Bliznetsi
var WC=false; //On/off initialization
ArrSt[0]="";
ArrCN[0]="";
ArrPA[0]="";
ArrPL[0]="";
ArrFT[0]="";
ArrCC[0]="";
ArrIN[0]="";
ArrBL[0]="";

function LoadPriceList()
{
        var NDate= new Date();
        var TNum=NDate.getTime();
        FN="pl_n"+TNum+".zip";

var a_frm=null;

 if (document.all || document.getElementById) 
  {
   GlDiv.style.visibility="hidden";
//   ChoiceThis(3);                                                            //f
   ChoiceThis3();                                                            //f
   a_frm=document.forms[1];
 }
 else if (document.layers) 
  {
   document.GlDiv.visibility="hide";
//   ChoiceThis(3);
   ChoiceThis3();
   a_frm=document.GlDiv.document.forms[0];
  }
if (a_frm!=null)
  {
   a_frm.action+="&FN="+FN;
   a_frm.HisPLMPS.value=document.forms[0].HisPLMPS.value;
   a_frm.HisPLMP.value=document.forms[0].HisPLMP.value;
   a_frm.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
   a_frm.HisPLMPF.value=document.forms[0].HisPLMPF.value;
   a_frm.ChoCats.value=document.forms[0].ChoCats.value;

   a_frm.TestI.value=document.forms[0].TestI.value;
   a_frm.FindThisWords.click();
  }
}

function LoadPriceList1()
{
var FN=document.forms[0].FN.value;
document.forms[0].FN.value="";
if (FN!="")
 {
  var l_frm=null;
  if (document.all || document.getElementById)
   {
    l_frm=document.LoadFile;
   }
  else if (document.layers) 
   {
    l_frm=document.forms[document.forms.length-1];
   }
  if (l_frm!=null)
   { 
    l_frm.action=FN;
    l_frm.submit();
   }
  }
}

function ClearZast()
{
document.Zast.visibility="hide";
//SetTimeout('ChoiceThis1()',2000)
}

function ChoiceThis(Ind)
{
var NoNav=false;
//window.alert("Ind="+Ind);
//window.alert("parseInt(Ind)="+parseInt(Ind));
if (!Use5 && NoNav!=true)
  {
   var red="pricelist.phtml?Who="+Ind;
   window.navigate(red);
  }
else
{
if (ClickOnCb>0 && parseInt(document.forms[0].Who.value)==2 && parseInt(Ind)!=2)
   {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}
     MemStImages(CBC);
   }
document.forms[0].Who.value=Ind;
var Find=document.forms[0].Find.value;
var St=document.forms[0].H4.value;
var StDD=document.forms[0].d1.value;
if (parseInt(Ind)==1) 
  {
   St=document.forms[0].H4.value;
   StDD=document.forms[0].d1.value;
  }
if (parseInt(Ind)==2) 
  {
   St=document.forms[0].H2.value;
   StDD=document.forms[0].d2.value;
  }
if (parseInt(Ind)==3) 
  {
   if (Find=="T")
     {St=document.forms[0].H3.value+document.forms[0].H1.value;}
   else
     {St=document.forms[0].H3.value;}
   StDD=document.forms[0].d3.value;
  }
if (parseInt(Ind)==4) 
  {
   St=document.forms[0].H5.value;
   StDD=document.forms[0].d4.value;
  }

if (document.all) 
  {
//window.alert("document.all");
//window.alert("St="+St);
//window.alert("StDD="+StDD);
//window.alert("document.all.GlDiv.innerHTML="+document.all.GlDiv.innerHTML);
    document.all.GlDiv.innerHTML=St;
//window.alert("document.all.GlDiv.innerHTML="+document.all.GlDiv.innerHTML);
//window.alert("document.all.DD.innerHTML="+document.all.DD.innerHTML);
    document.all.DD.innerHTML=StDD;
//window.alert("document.all.DD.innerHTML="+document.all.DD.innerHTML);
  }
 else if (document.layers)
  {
    document.GlDiv.document.open();
    document.GlDiv.document.write(St);
    document.GlDiv.document.close();
    document.DD.document.open();
    document.DD.document.write(StDD);
    document.DD.document.close();
  }
 else if (document.getElementById)
  {
    window.alert("getElementById");
    document.getElementById("GlDiv").innerHTML=St;
    document.getElementById("DD").innerHTML=StDD;
  } 
if (parseInt(Ind)==2)                                 //form2
  {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}

    if (!WC)
      {
        WC=true;
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}
            var HisNV="";
            var F=true;
            var HisPL="";
            var FPL=true;
	    var TS="";
	    var Sc=0;
            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") Sc++;
                if (Sc==1 && FPL)
                  {HisPL=TS;TS="";FPL=false;} 
                TS+=St1;
	        if (Sc==2 && F) {HisNV=TS;F=false;a=CBVal.length}
              }
            ArrPA[u]=",";
            ArrCN[u]=HisNV;
            ArrPL[u]=HisPL;
          }
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}

    	    HisBL="";
	    for (m=1;m<=CBC;m++)
  	     {
    		if (m!=u && ArrCN[m]==ArrCN[u])
		  {
 		    HisBL+=m+",";
		  } 
	     }

            var HisFT="";
            var HisIN="";
	    var Sc=0;
            var St="";
	    ChildCount=-1;	

            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") 
                 {
                   Sc++;
                   if (Sc>1 && St!="")
                     {
                       var Ind=0;
                       for (p=1;p<=CBC;p++)
                        {
                          if (ArrCN[p]==","+St+",") {Ind=p;p=CBC}
                        }

                       if (Ind>0)
                         { 
                           if (Ind!=u)
                             {if (ArrPA[Ind].indexOf(","+u+",")<0) ArrPA[Ind]+=u+",";}
                           ChildCount++; 
                           var NPL=ArrPL[Ind];
                           HisFT+=NPL+"t"; 
                           HisIN+=Ind+",";
                         }
                       St="";
                     }
                 }
                else if (Sc>0) St+=St1;                 
              }
            ArrFT[u]=HisFT;
            ArrIN[u]=HisIN;
            ArrBL[u]=HisBL;
            ArrCC[u]=ChildCount;
          }
      }
//window.alert(ArrPA);

    if (ClickOnCb>0)
      {
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBI=document.images["imgt"+u];}
    	    else
	    if (document.layers)
    	      {var CBI=document.GlDiv.document.images["imgt"+u];}
            CBI.src=ArrSt[u];
	  }
      }
  }
}//Use5
}

function ChoiceThis4()
{
var Ind=4;
//window.alert("Ind="+Ind);
//window.alert("parseInt(Ind)="+parseInt(Ind));
if (!Use5 && NoNav!=true)
  {
   var red="pricelist.phtml?Who="+Ind;
   window.navigate(red);
  }
else
{
if (ClickOnCb>0 && parseInt(document.forms[0].Who.value)==2 && parseInt(Ind)!=2)
   {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}
     MemStImages(CBC);
   }
document.forms[0].Who.value=Ind;
var Find=document.forms[0].Find.value;
var St=document.forms[0].H4.value;
var StDD=document.forms[0].d1.value;
if (parseInt(Ind)==1) 
  {
   St=document.forms[0].H4.value;
   StDD=document.forms[0].d1.value;
  }
if (parseInt(Ind)==2) 
  {
   St=document.forms[0].H2.value;
   StDD=document.forms[0].d2.value;
  }
if (parseInt(Ind)==3) 
  {
   if (Find=="T")
     {St=document.forms[0].H3.value+document.forms[0].H1.value;}
   else
     {St=document.forms[0].H3.value;}
   StDD=document.forms[0].d3.value;
  }
if (parseInt(Ind)==4) 
  {
   St=document.forms[0].H5.value;
   StDD=document.forms[0].d4.value;
  }

if (document.all) 
  {
    document.all.GlDiv.innerHTML=St;
    document.all.DD.innerHTML=StDD;
  }
 else if (document.layers)
  {
    document.GlDiv.document.open();
    document.GlDiv.document.write(St);
    document.GlDiv.document.close();
    document.DD.document.open();
    document.DD.document.write(StDD);
    document.DD.document.close();
  }
 else if (document.getElementById)
  {
    document.getElementById("GlDiv").innerHTML=St;
    document.getElementById("DD").innerHTML=StDD;
  } 
}//Use5
}

function ChoiceThis3()
{
var Ind=3;
//window.alert("Ind="+Ind);
//window.alert("parseInt(Ind)="+parseInt(Ind));
if (!Use5 && NoNav!=true)
  {
   var red="pricelist.phtml?Who="+Ind;
   window.navigate(red);
  }
else
{
if (ClickOnCb>0 && parseInt(document.forms[0].Who.value)==2 && parseInt(Ind)!=2)
   {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}
     MemStImages(CBC);
   }
document.forms[0].Who.value=Ind;
var Find=document.forms[0].Find.value;
var St=document.forms[0].H4.value;
var StDD=document.forms[0].d1.value;
if (parseInt(Ind)==1) 
  {
   St=document.forms[0].H4.value;
   StDD=document.forms[0].d1.value;
  }
if (parseInt(Ind)==2) 
  {
   St=document.forms[0].H2.value;
   StDD=document.forms[0].d2.value;
  }
if (parseInt(Ind)==3) 
  {
   if (Find=="T")
     {St=document.forms[0].H3.value+document.forms[0].H1.value;}
   else
     {St=document.forms[0].H3.value;}
   StDD=document.forms[0].d3.value;
  }
if (parseInt(Ind)==4) 
  {
   St=document.forms[0].H5.value;
   StDD=document.forms[0].d4.value;
  }

if (document.all) 
  {
    document.all.GlDiv.innerHTML=St;
    document.all.DD.innerHTML=StDD;
  }
 else if (document.layers)
  {
    document.GlDiv.document.open();
    document.GlDiv.document.write(St);
    document.GlDiv.document.close();
    document.DD.document.open();
    document.DD.document.write(StDD);
    document.DD.document.close();
  }
 else if (document.getElementById)
  {
    document.getElementById("GlDiv").innerHTML=St;
    document.getElementById("DD").innerHTML=StDD;
  } 
}
}

function ChoiceThis2()
{
var Ind=2;
if (!Use5 && NoNav!=true)
  {
   var red="pricelist.phtml?Who="+Ind;
   window.navigate(red);
  }
else
{
if (ClickOnCb>0 && parseInt(document.forms[0].Who.value)==2 && parseInt(Ind)!=2)
   {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}
     MemStImages(CBC);
   }
document.forms[0].Who.value=Ind;
var Find=document.forms[0].Find.value;
var St=document.forms[0].H4.value;
var StDD=document.forms[0].d1.value;
if (parseInt(Ind)==1) 
  {
   St=document.forms[0].H4.value;
   StDD=document.forms[0].d1.value;
  }
if (parseInt(Ind)==2) 
  {
   St=document.forms[0].H2.value;
   StDD=document.forms[0].d2.value;
  }
if (parseInt(Ind)==3) 
  {
   if (Find=="T")
     {St=document.forms[0].H3.value+document.forms[0].H1.value;}
   else
     {St=document.forms[0].H3.value;}
   StDD=document.forms[0].d3.value;
  }
if (parseInt(Ind)==4) 
  {
   St=document.forms[0].H5.value;
   StDD=document.forms[0].d4.value;
  }

if (document.all) 
  {
    document.all.GlDiv.innerHTML=St;
    document.all.DD.innerHTML=StDD;
  }
 else if (document.layers)
  {
    document.GlDiv.document.open();
    document.GlDiv.document.write(St);
    document.GlDiv.document.close();
    document.DD.document.open();
    document.DD.document.write(StDD);
    document.DD.document.close();
  }
 else if (document.getElementById)
  {
    window.alert("getElementById");
    document.getElementById("GlDiv").innerHTML=St;
    document.getElementById("DD").innerHTML=StDD;
  } 
if (parseInt(Ind)==2)                                 //form2
  {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}

    if (!WC)
      {
        WC=true;
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}
            var HisNV="";
            var F=true;
            var HisPL="";
            var FPL=true;
	    var TS="";
	    var Sc=0;
            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") Sc++;
                if (Sc==1 && FPL)
                  {HisPL=TS;TS="";FPL=false;} 
                TS+=St1;
	        if (Sc==2 && F) {HisNV=TS;F=false;a=CBVal.length}
              }
            ArrPA[u]=",";
            ArrCN[u]=HisNV;
            ArrPL[u]=HisPL;
          }
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}

    	    HisBL="";
	    for (m=1;m<=CBC;m++)
  	     {
    		if (m!=u && ArrCN[m]==ArrCN[u])
		  {
 		    HisBL+=m+",";
		  } 
	     }

            var HisFT="";
            var HisIN="";
	    var Sc=0;
            var St="";
	    ChildCount=-1;	

            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") 
                 {
                   Sc++;
                   if (Sc>1 && St!="")
                     {
                       var Ind=0;
                       for (p=1;p<=CBC;p++)
                        {
                          if (ArrCN[p]==","+St+",") {Ind=p;p=CBC}
                        }

                       if (Ind>0)
                         { 
                           if (Ind!=u)
                             {if (ArrPA[Ind].indexOf(","+u+",")<0) ArrPA[Ind]+=u+",";}
                           ChildCount++; 
                           var NPL=ArrPL[Ind];
                           HisFT+=NPL+"t"; 
                           HisIN+=Ind+",";
                         }
                       St="";
                     }
                 }
                else if (Sc>0) St+=St1;                 
              }
            ArrFT[u]=HisFT;
            ArrIN[u]=HisIN;
            ArrBL[u]=HisBL;
            ArrCC[u]=ChildCount;
          }
      }
//window.alert(ArrPA);

    if (ClickOnCb>0)
      {
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBI=document.images["imgt"+u];}
    	    else
	    if (document.layers)
    	      {var CBI=document.GlDiv.document.images["imgt"+u];}
            CBI.src=ArrSt[u];
	  }
      }
  }
}//Use5
}

function ChoiceThis1()
{
var Ind=1;
//window.alert("Ind="+Ind);
//window.alert("parseInt(Ind)="+parseInt(Ind));
if (!Use5 && NoNav!=true)
  {
   var red="pricelist.phtml?Who="+Ind;
   window.navigate(red);
  }
else
{
if (ClickOnCb>0 && parseInt(document.forms[0].Who.value)==2 && parseInt(Ind)!=2)
   {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}
     MemStImages(CBC);
   }
document.forms[0].Who.value=Ind;
var Find=document.forms[0].Find.value;
var St=document.forms[0].H4.value;
var StDD=document.forms[0].d1.value;
if (parseInt(Ind)==1) 
  {
   St=document.forms[0].H4.value;
   StDD=document.forms[0].d1.value;
  }
if (parseInt(Ind)==2) 
  {
   St=document.forms[0].H2.value;
   StDD=document.forms[0].d2.value;
  }
if (parseInt(Ind)==3) 
  {
   if (Find=="T")
     {St=document.forms[0].H3.value+document.forms[0].H1.value;}
   else
     {St=document.forms[0].H3.value;}
   StDD=document.forms[0].d3.value;
  }
if (parseInt(Ind)==4) 
  {
   St=document.forms[0].H5.value;
   StDD=document.forms[0].d4.value;
  }

if (document.all) 
  {
    document.all.GlDiv.innerHTML=St;
    document.all.DD.innerHTML=StDD;
  }
 else if (document.layers)
  {
    document.GlDiv.document.open();
    document.GlDiv.document.write(St);
    document.GlDiv.document.close();
    document.DD.document.open();
    document.DD.document.write(StDD);
    document.DD.document.close();
  }
 else if (document.getElementById)
  {
    window.alert("getElementById");
    document.getElementById("GlDiv").innerHTML=St;
    document.getElementById("DD").innerHTML=StDD;
  } 
if (parseInt(Ind)==2)                                 //form2
  {
    if (document.all || document.getElementById)
      {var CBC=document.forms[1].CBC.value;}
    else
    if (document.layers)
      {var CBC=document.GlDiv.document.forms[0].CBC.value;}

    if (!WC)
      {
        WC=true;
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}
            var HisNV="";
            var F=true;
            var HisPL="";
            var FPL=true;
	    var TS="";
	    var Sc=0;
            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") Sc++;
                if (Sc==1 && FPL)
                  {HisPL=TS;TS="";FPL=false;} 
                TS+=St1;
	        if (Sc==2 && F) {HisNV=TS;F=false;a=CBVal.length}
              }
            ArrPA[u]=",";
            ArrCN[u]=HisNV;
            ArrPL[u]=HisPL;
          }
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBVal=document.forms[1].elements[u-1].value;}
    	    else
	    if (document.layers)
    	      {var CBVal=document.GlDiv.document.forms[0].elements[u-1].value;}

    	    HisBL="";
	    for (m=1;m<=CBC;m++)
  	     {
    		if (m!=u && ArrCN[m]==ArrCN[u])
		  {
 		    HisBL+=m+",";
		  } 
	     }

            var HisFT="";
            var HisIN="";
	    var Sc=0;
            var St="";
	    ChildCount=-1;	

            for (a=0;a<CBVal.length;a++)
              {
                St1=CBVal.substring(a,a+1);
                if (St1==",") 
                 {
                   Sc++;
                   if (Sc>1 && St!="")
                     {
                       var Ind=0;
                       for (p=1;p<=CBC;p++)
                        {
                          if (ArrCN[p]==","+St+",") {Ind=p;p=CBC}
                        }

                       if (Ind>0)
                         { 
                           if (Ind!=u)
                             {if (ArrPA[Ind].indexOf(","+u+",")<0) ArrPA[Ind]+=u+",";}
                           ChildCount++; 
                           var NPL=ArrPL[Ind];
                           HisFT+=NPL+"t"; 
                           HisIN+=Ind+",";
                         }
                       St="";
                     }
                 }
                else if (Sc>0) St+=St1;                 
              }
            ArrFT[u]=HisFT;
            ArrIN[u]=HisIN;
            ArrBL[u]=HisBL;
            ArrCC[u]=ChildCount;
          }
      }
//window.alert(ArrPA);

    if (ClickOnCb>0)
      {
        for (u=1;u<=CBC;u++)
          {
            if (document.all || document.getElementById)
	      {var CBI=document.images["imgt"+u];}
    	    else
	    if (document.layers)
    	      {var CBI=document.GlDiv.document.images["imgt"+u];}
            CBI.src=ArrSt[u];
	  }
      }
  }
}//Use5
}

function MemStImages(CBC)
{
    for (u=1;u<=CBC;u++)                           //form2
     {
        if (document.all || document.getElementById)
   	  {var CBImN=document.images["imgt"+u].src;}
   	else 
	if (document.layers)
	  {var CBImN=document.GlDiv.document.images["imgt"+u].src;}
        ArrSt[u]=CBImN;
     }
}

function ClickOnBliz(aNumIm,NeedTest)
{
var res="";

if (document.all || document.getElementById)
 {var ThisImga=document.images["imgt"+aNumIm];}
else
if (document.layers)
 {var ThisImga=document.GlDiv.document.images["imgt"+aNumIm];}

        var BLStra=ArrBL[aNumIm];
        var aArrNIa=new Array();
	var aNICa=0;
        var NumIa="";
        for (mla=0;mla<BLStra.length;mla++)
          {
            var TCa=BLStra.substring(mla,mla+1);
            if (TCa==",")
              {
		if (NumIa!="")
 		 {
                   aNICa++;aArrNIa[aNICa]=NumIa;NumIa="";
		 }
	      }
            else NumIa+=TCa;  
          } 
        for (mla=1;mla<=aNICa;mla++)
 	  {
            var gt=aArrNIa[mla];  
            if (NeedTest.indexOf(ArrPA[gt])<0)
              {res+=ArrPA[gt];}
            if (document.all || document.getElementById)
            {
	      var CBImga=document.images["imgt"+gt];
  	    }
 	    else
	    if (document.layers)
            {
	      var CBImga=document.GlDiv.document.images["imgt"+gt];
  	    }
            CBImga.src=ThisImga.src;
          }
return (res);
}

function CheckN4(NumIm)
{
var ExChild=0;
if (document.all || document.getElementById)
 {var ThisImg=document.images["imgt"+NumIm];}
else
if (document.layers)
 {var ThisImg=document.GlDiv.document.images["imgt"+NumIm];}

     if (document.all || document.getElementById)
       {var ThisVal=document.forms[1].elements[NumIm-1].value;}
     else
     if (document.layers)
       {var ThisVal=document.GlDiv.document.forms[0].elements[NumIm-1].value;}

        if (document.all || document.getElementById)
          {var CBC=document.forms[1].CBC.value;}
	else
	if (document.layers)  
          {var CBC=document.GlDiv.document.forms[0].CBC.value;}

        var ChildStr=ArrIN[NumIm];
        var NumI="";
        var aArrNI=new Array();
	var aNIC=0;
        for (ml=0;ml<ChildStr.length;ml++)
          {
            var TC=ChildStr.substring(ml,ml+1);
            if (TC==",")
              {
		if (NumI!="")
 		 {
                   aNIC++;aArrNI[aNIC]=NumI;NumI="";
		 }
	      }
            else NumI+=TC;  
          } 

        var LastNoCheck="";
        for (ml=1;ml<=aNIC;ml++)
 	  {
            g=aArrNI[ml];  
            if (document.all || document.getElementById)
            {
	      var CBImg=document.images["imgt"+g];
	      var CBName=document.forms[1].elements[g-1].name;
	      var CBVal=document.forms[1].elements[g-1].value;	
  	    }
 	    else
	    if (document.layers)
            {
	      var CBImg=document.GlDiv.document.images["imgt"+g];
	      var CBName=document.GlDiv.document.forms[0].elements[g-1].name;
	      var CBVal=document.GlDiv.document.forms[0].elements[g-1].value;	
  	    }
            var HisNV=ArrCN[g];
            if (g!=NumIm && ArrCN[NumIm]!=ArrCN[g])
	      {
		var CBIN=CBImg.src;
                if (CBIN.indexOf(Img2)>=0 || CBIN.indexOf(Img3)>=0)
                  {
                    ExChild++;
                  }
                else
                  {LastNoCheck=g;}
	      }
	  }
//window.alert(NumIm+":"+ExChild+":"+ArrCC[NumIm]);
var WIm=ThisImg.src;
if (ExChild>0)
  {
    if (ArrCC[NumIm]==ExChild && WIm.indexOf(Img2)<0)
      {
       ThisImg.src=Img2;
       document.forms[0].TestI.value+=ArrPL[NumIm]+"t";
      } 
    if (ArrCC[NumIm]!=ExChild) 
      {
       if (WIm.indexOf(Img2)>0)
         {
           document.forms[0].TestI.value+=ArrFT[NumIm]+ArrPL[LastNoCheck]+"t";
         }
       ThisImg.src=Img4;

      }
  }
else
  {if (ArrCC[NumIm]>0)      
    {
     ThisImg.src=Img0;
     if (WIm.indexOf(Img2)>0)
         {
//?
         }
    }
  }
ClickOnBliz(NumIm, "");
}

function ClickOnImage(NumIm,NumPL,RealCl)
{
var NeedTest=",";

if (document.all || document.getElementById)
 {var ThisImg=document.images["imgt"+NumIm];}
else
if (document.layers)
 {var ThisImg=document.GlDiv.document.images["imgt"+NumIm];}
 var ImgName=ThisImg.src; 
 var NewImgName=ImgName;
 var I0=ImgName.indexOf(Img0);
 var I1=ImgName.indexOf(Img1);
 var I2=ImgName.indexOf(Img2);
 var I3=ImgName.indexOf(Img3);
 var I4=ImgName.indexOf(Img4);
 var I5=ImgName.indexOf(Img5);
 if (I3<0)
   {
     if (RealCl)
       {
         if (I0>=0 || I4>=0 || I5>=0)
          {
  	    NewImgName=Img2;
          } 
         if (I2>=0)
          {
  	    NewImgName=Img0;
          } 
         ThisImg.src=NewImgName;
       }

     NeedTest+=ArrPA[NumIm];
     NeedTest+=ClickOnBliz(NumIm, NeedTest);
     
     if (document.all || document.getElementById)
       {var ThisVal=document.forms[1].elements[NumIm-1].value;}
     else
     if (document.layers)
       {var ThisVal=document.GlDiv.document.forms[0].elements[NumIm-1].value;}

        if (document.all || document.getElementById)
          {var CBC=document.forms[1].CBC.value;}
	else
	if (document.layers)  
          {var CBC=document.GlDiv.document.forms[0].CBC.value;}

        var ChildStr=ArrIN[NumIm];
        var NumI="";
        var aArrNI=new Array();
	var aNIC=0;
        for (ml=0;ml<ChildStr.length;ml++)
          {
            var TC=ChildStr.substring(ml,ml+1);
            if (TC==",")
              {
		if (NumI!="")
 		 {
                   aNIC++;aArrNI[aNIC]=NumI;NumI="";
		 }
	      }
            else NumI+=TC;  
          } 

        for (ml=1;ml<=aNIC;ml++)
 	  {
            g=aArrNI[ml];  
            if (document.all || document.getElementById)
            {
	      var CBImg=document.images["imgt"+g];
	      var CBName=document.forms[1].elements[g-1].name;
	      var CBVal=document.forms[1].elements[g-1].value;	
  	    }
 	    else
	    if (document.layers)
            {
	      var CBImg=document.GlDiv.document.images["imgt"+g];
	      var CBName=document.GlDiv.document.forms[0].elements[g-1].name;
	      var CBVal=document.GlDiv.document.forms[0].elements[g-1].value;	
  	    }
            var HisNV=ArrCN[g];

            var IndCN=-1;
	    if (HisNV!="")
              IndCN=ThisVal.indexOf(HisNV); 

            if (IndCN>=0 && CBName!="cbbb"+g)
	      {
                if (RealCl) 
		  {
 		   CBImg.src=ThisImg.src;    
                   if (NeedTest.indexOf(ArrPA[g])<0)               
     		     NeedTest+=ArrPA[g];
     		   NeedTest+=ClickOnBliz(g, NeedTest);
		  }
	      }
	  }
//window.alert(NeedTest); 
var AR=new Array();
var ARc=0;
var El="";
for (mu=0;mu<NeedTest.length;mu++)
  {
   var Tel=NeedTest.substring(mu,mu+1);
   if (Tel==",")
     {
       if (El!="")
         {
           var Rep=false;
           for (ku=1;ku<=ARc;ku++) if (AR[ku]==El) Rep=true;
           if (!Rep)
             {  
              ARc++;
              AR[ARc]=El;
             }
         }
       El="";
     }
   else
     El+=Tel;
  } 

	if (RealCl)
	 {
    		ClickOnCb++;
    		document.forms[0].TestI.value+=NumPL+"t";
//    		for (u=1;u<=CBC;u++)
    		for (uu=1;uu<=ARc;uu++)
     		{
                  u=AR[uu];
                  CheckN4(u);
     		}
//    		MemStImages(CBC);
 	}
   } //I3<0
}

function ChoiceMPL(Inda)
{
var aWho=document.forms[0].Who.value;
var a_frm=null;
if (document.all || document.getElementById)
 {
   GlDiv.style.visibility="hidden";   
//   ChoiceThis(3);                                                //f
   ChoiceThis3();                                                //f
   a_frm=document.forms[1];
 }
 else if (document.layers) 
 {
   document.GlDiv.visibility="hide";
//   ChoiceThis(3);          
   ChoiceThis3();          
   a_frm=document.GlDiv.document.forms[0];
 }
   if (Inda==0)
      a_frm.My.value="";
   else
      a_frm.My.value="T";

if (a_frm!=null)
  {
   a_frm.HisPLMPS.value=document.forms[0].HisPLMPS.value;
   a_frm.HisPLMP.value=document.forms[0].HisPLMP.value;
   a_frm.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
   a_frm.HisPLMPF.value=document.forms[0].HisPLMPF.value;
   a_frm.ChoCats.value=document.forms[0].ChoCats.value;

   a_frm.Who.value=aWho;
   a_frm.TestI.value=document.forms[0].TestI.value;
   a_frm.rb.value=1;
   a_frm.FindThisWords.click();
  }
}

function ChoiceCats()
{
var a_frm=null;
if (ClickOnCb==0)
  {
//   ChoiceThis(4);
   ChoiceThis4();
  }
else
{
var aWho=4;
if (document.all || document.getElementById)
 {
   GlDiv.style.visibility="hidden";   
//   ChoiceThis(3);                                                      //f
   ChoiceThis3();                                                      //f
   a_frm=document.forms[1];
 }
 else if (document.layers) 
 {
   document.GlDiv.visibility="hide";
//   ChoiceThis(3);                                                         //f
   ChoiceThis3();                                                         //f
   a_frm=document.GlDiv.document.forms[0];
 }
if (a_frm!=null)
  {
   a_frm.HisPLMPS.value=document.forms[0].HisPLMPS.value;
   a_frm.HisPLMP.value=document.forms[0].HisPLMP.value;
   a_frm.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
   a_frm.HisPLMPF.value=document.forms[0].HisPLMPF.value;
   a_frm.ChoCats.value=document.forms[0].ChoCats.value;

   a_frm.Who.value=aWho;
   a_frm.TestI.value=document.forms[0].TestI.value;
   a_frm.rb.value=1;
   a_frm.FindThisWords.click();
  }
}
}

function NCatPL(P1,P2,Lev,ND)
{
if (ND==null) ND=0;
if (P1==null) P1="";
if (P2==null) P2="";
if (Lev==null) Lev=0;

var a_frm=null;

if (ND==0)
  {ND=document.forms[0].Who.value;}
 if (document.all || document.getElementById) 
  {
   GlDiv.style.visibility="hidden";
//   ChoiceThis(3);                                                            //f
   ChoiceThis3();                                                            //f
   a_frm=document.forms[1];
 }
 else if (document.layers) 
  {
   document.GlDiv.visibility="hide";
//   ChoiceThis(3);
   ChoiceThis3();
   a_frm=document.GlDiv.document.forms[0];
  }
if (a_frm!=null)
  {
   a_frm.HisPLMPS.value=document.forms[0].HisPLMPS.value;
   a_frm.HisPLMP.value=document.forms[0].HisPLMP.value;
   a_frm.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
   a_frm.HisPLMPF.value=document.forms[0].HisPLMPF.value;
   a_frm.ChoCats.value=document.forms[0].ChoCats.value;

   a_frm.Who.value=ND;
   a_frm.Lev.value=Lev;
   a_frm.Path.value=P2;
   a_frm.Path33.value=P1;
   a_frm.TestI.value=document.forms[0].TestI.value;
   a_frm.pg.value=1;
   a_frm.FindThisWords.click();
  }
}

function NPa(npg)
{ 
if (npg==null) npg=1;
               //form1
var Ind=document.forms[0].Who.value;
if (parseInt(Ind)==1)
{
  var a_frm1=null;
  if (document.all || document.getElementById)
   {
    a_frm1=document.forms[1];
   }
  else if (document.layers) 
   {
    a_frm1=document.GlDiv.document.forms[0];
   }
  if (a_frm1!=null)
    {
     a_frm1.TestI.value=document.forms[0].TestI.value;
     a_frm1.HisPLMPS.value=document.forms[0].HisPLMPS.value;
     a_frm1.HisPLMP.value=document.forms[0].HisPLMP.value;
     a_frm1.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
     a_frm1.HisPLMPF.value=document.forms[0].HisPLMPF.value;
     a_frm1.ChoCats.value=document.forms[0].ChoCats.value;
     a_frm1.pg.value=npg;
     a_frm1.submit.click();
    }
}
else
if (parseInt(Ind)==3)
{
  var a_frm2=null;
  if (document.all || document.getElementById)
   {
    a_frm2=document.forms[2];
   }
  else if (document.layers) 
   {
    a_frm2=document.GlDiv.document.forms[1];
   }
  if (a_frm2!=null)
   {
    a_frm2.HisPLMPS.value=document.forms[0].HisPLMPS.value;
    a_frm2.HisPLMP.value=document.forms[0].HisPLMP.value;
    a_frm2.HisPLMPSF.value=document.forms[0].HisPLMPSF.value;
    a_frm2.HisPLMPF.value=document.forms[0].HisPLMPF.value;
    a_frm2.ChoCats.value=document.forms[0].ChoCats.value;

    a_frm2.Who.value=3;
    a_frm2.TestI.value=document.forms[0].TestI.value;
    a_frm2.pg.value=npg;
    a_frm2.submit.click();
   }
}
}

