<!--
/*
TiboLab Left Menu
Aurhor: TiboLab
*/



function cloneObject(what) {
    for (i in what) {
       // if (typeof what[i] == 'object') {
      //      this[i] = new cloneObject(what[i]);
      //  }
       // else
            this[i] = what[i];
    }
}



// This is the prototype of the general TiboLab product descriptor
// All urls are relative to main dir

// Global variables
 rootpath=''       // path from current location to the root
 CurrentID = ''    // ID of currently selected item

 TLProd = new Array() // Array of all items - referenced by consequence of construction
 TLActive = null 
 ShowTop=true;
 ShowLeft=true;  
 currency = 'лв'

divlineimg="shared/pictures/divline.gif"
topseparator="shared/pictures/sep1.gif"

function TLProductDescr(ID,Name,rpath,url,smallimg)
{this.ID=ID
 TLProd[TLProd.length]=this
 this.Name=Name
 this.rootpath=rpath
 this.url=url
 this.smallimg=smallimg // Small Image location
 this.largeimg='' 
 this.Active=false
 this.parent=null
 this.child=new Array()
 this.price=''

 this.AddChild = function(theChild) {theChild.parent=this; this.child[this.child.length]=theChild}

 this.AddinLeftMenuAnItem = function () {
 if (TLActive!=null)
           {if (this==TLActive.parent||this==TLActive)
               {AddFMTItem(rootpath+this.smallimg,'<font color="#0B049A">'+this.Name+'</font>&nbsp&nbsp&nbsp'+this.GetHchildren()+' ', rootpath+this.url,true)} 
          else {AddFMTItem(rootpath+this.smallimg,this.Name+'&nbsp&nbsp&nbsp'+this.GetHchildren()+' ', rootpath+this.url,false)}} else

 {AddFMTItem(rootpath+this.smallimg,this.Name+'&nbsp&nbsp&nbsp'+this.GetHchildren()+' ', rootpath+this.url,false)}


                   // this.AddHMenu()
} // AddinLeftMenuAnItem

//===============================

 this.AddinLeftMenu = function (ShowChildren) {

 if (TLActive!=null)
{if (this==TLActive)  {imgstyle = ' class=mitem_selected '} else {imgstyle = ' class=mitem_unselected '}}
 addItem("<img src='"+rootpath+this.smallimg+"'"+imgstyle+" border=0 > <b style='font-size : 12px;'><font color='#0B049A' >  "+this.Name+"</font></b>", rootpath+this.url, "");//Add the boss
if (ShowChildren)
{
    for (var i = 0; i < this.child.length; i++)
         {this.child[i].AddinLeftMenuAnItem()}

addLine("<img src='"+rootpath+divlineimg+"' border=0 style='vertical-align : middle;'>","center")
}
} // AddinLeftMenu ==================

 this.GetHMstring = function () // Returns formated string - smallimg+Name+HelpText
                            { 
	if (this.Active) {imgstyle = ' class=item_selected '} else {imgstyle = ' class=item_unselected '}
  picsize=16; brd=0; 
  pic='<img src='+rootpath+this.smallimg+' border='+brd+ ' height='+picsize+'px width='+picsize+'px'+imgstyle+'>'

   pic2='<img src='+rootpath+this.smallimg+' border=0  height='+picsize+'px width='+picsize+'px'+imgstyle+'>'
  if (this.parent!=null)
    {pic2='<img src='+rootpath+this.parent.smallimg+' border=0  height='+picsize+'px width='+picsize+'px>'+pic2}

   pic = '<a href=\''+rootpath+this.url+'\' onmouseover="writetxt(\''+pic2+' '+this.Name+'\')" onmouseout="writetxt(0)">'+pic+'</a>'
  return (pic)               } // GetHMstring


 this.GetHchildren = function() // Returns Horisontal children in a formated string
                        { var s='';
    for (var i = 0; i < this.child.length; i++)
     { if (this.child[i].child.length==0)
                                  {s+=this.child[i].GetHMstring() } }//for
      return(s) 
                          } //GetHchildren

 this.AddHMenu = function() { 
      addLine(this.GetHchildren(),"right") 
                             } //AddHMenu

 this.Activate = function() {
          CurrentID=this.ID;
           this.Active=true;
           TLActive=this;
           rootpath=this.rootpath;
    if (ShowLeft) {ShowLeftMenu()}
   if (ShowTop) {this.ShowPageHeader()}

                            } //Activate

this.GetFamilyTree=function(s){
s[s.length]=this
if (this.parent!=null) {s=this.parent.GetFamilyTree(s)}
return(s)
                            }//GetFamilyTree

this.ShowPageHeader=function() {
s='<table class="toptable"><tr><td  rowspan=2><br>'
topimg=this.largeimg
if (topimg=='' & this.parent!=null) {topimg=this.parent.largeimg}
if (topimg!='')
{s+='<img src="'+rootpath+topimg+'" align=left  alt="" style="vertical-align : top;">&nbsp&nbsp&nbsp</td>'}
else {s+='</td>'}

s+='<td class="pagetitletop">'    
Family = new Array()
Family=this.GetFamilyTree(Family); 
for (var i = Family.length-1;i>0; i--) {

s+=' <img style="vertical-align : middle;" src="'+rootpath+topseparator+
'" > &nbsp <a class="as" href="'+rootpath+Family[i].url+'"> '+Family[i].Name +'</a>'


}


if (this.parent!=null) {
if (this.parent.parent!=null){s+=tab(3)+this.parent.parent.GetSmallimg()}
s+=tab(1)+this.parent.GetSmallimg()+'<br>'
s+=this.parent.GetHchildren()

}


s+='</td></tr>'

s+='<tr><td class="pagetitle" style="vertical-align : top;">'
s+='<h1><img src="'+rootpath+'shared/pictures/TL24x24w.gif" border=0 alt="TiboLab" style="vertical-align : middle;">'
s+=' '+this.Name +'</h1>'

s+='</td></tr><tr><td colspan=2><hr></td></tr></table>' 
document.write(s)
          }//ShowPageHeader


this.GetSmallimg=function() {if (this.smallimg!=''){s='<img src="'+rootpath+this.smallimg + '" border=0>'; return (s)}
else {return('')} }//GetSmallimg

this.GetLargeimg=function() {if (this.largeimg!=''){s='<img src="'+rootpath+this.largeimg + '" border=0>'; return (s)}
else {return('')} }//GetSmallimg


this.GetNameurl=function(classname) {s='<a class="'+classname+'" href="'+rootpath+this.url+'">'+this.Name+'</a>'; return (s) }//GetNameurl

this.GetImgNmurl=function(classname) {s='<a class="'+classname+'" href="'+rootpath+this.url+'">';
                                      s+=this.GetSmallimg()+' '+this.Name+'</a>'; return(s)}//GetImgNmurl

}  //TLProductDescr


// Mechanics ID=M0  ====================================================================================

var Mechanics = new TLProductDescr('M0',
                                   'Механика',
                                   '../',
                                   'Mechanics/index.htm',
                                   'shared/pictures/Pendulum.gif')
Mechanics.largeimg="Mechanics/photos/mechanics.gif"

var Mechanics1 = new TLProductDescr('M1',
                                    '<small><i>SPM-001</i></small> Комплект Механика - общ',
                                   '../',
                                    'Mechanics/Mechanics1.htm',
                                     'shared/pictures/n1.gif')

var Mechanics2 = new TLProductDescr('M2',
                                    '<small><i>SPM-002</i></small> Комплект Демонстрация на крайната скорост на звука',
                                   '../',
                                    'Mechanics/Mechanics2.htm',
                                    'shared/pictures/n2.gif')

var Mechanics3 = new TLProductDescr('M3',
                                    '<small><i>SPM-003</i></small> Комплект Скорост на звука',
                                   '../',
                                    'Mechanics/Mechanics3.htm',
                                     'shared/pictures/n3.gif')

var Mechanics4 = new TLProductDescr('M4',
                                    '<small><i>SPM-004</i></small> Комплект Трептения',
                                   '../',
                                    'Mechanics/Mechanics4.htm',
                                    'shared/pictures/n4.gif')

var Mechanics5 = new TLProductDescr('M5',
                                    '<small><i>SPM-005</i></small> Комплект Сили на триене',
                                   '../',
                                    'Mechanics/Mechanics5.htm',
                                    'shared/pictures/n5.gif')


var UT01 = new TLProductDescr('M6',
                                    '<small><i>UT-01</i></small> Универсален таймер/хронометър UT-01',
                                   '../',
                                    'Mechanics/UT01.htm',
                                    'shared/pictures/n6.gif')

var UT01soft = new TLProductDescr('M7',
                                    '<small><i>UT-01soft</i></small> Интерфейс и софтуер за връзка на UT-01 с компютър',
                                   '../',
                                    'Mechanics/UT01.htm#UT01soft',
                                    'shared/pictures/n7.gif')

var Mechanics8 = new TLProductDescr('M8',
                                    '<small><i>SPM-008</i></small> Комплект Равноускорително движение',
                                   '../',
                                    'Mechanics/Mechanics8.htm',
                                    'shared/pictures/n8.gif')

var Mechanics9 = new TLProductDescr('M9',
                                    '<small><i>SPM-009</i></small> Комплект Равновесие 1 (демонстрационен)',
                                   '../',
                                    'Mechanics/Mechanics9.htm',
                                    'shared/pictures/n9.gif')

var Mechanics10 = new TLProductDescr('M10',
                                    '<small><i>SPM-010</i></small> Комплект Равновесие 2 (лабораторен)',
                                   '../',
                                    'Mechanics/Mechanics10.htm',
                                    'shared/pictures/n10.gif')

   Mechanics.AddChild(Mechanics1)
   Mechanics.AddChild(Mechanics2)
   Mechanics.AddChild(Mechanics3)
   Mechanics.AddChild(Mechanics4)
   Mechanics.AddChild(Mechanics5)
   Mechanics.AddChild(UT01)
   Mechanics.AddChild(UT01soft)
   Mechanics.AddChild(Mechanics8)
   Mechanics.AddChild(Mechanics9)
   Mechanics.AddChild(Mechanics10)

// Electricity ID=E0 ====================================================
var Electricity = new TLProductDescr('E0',
                                   'Електричество и магнетизъм',
                                   '../',
                                   'Electricity/index.htm',
                                   'shared/pictures/lightning.gif')
Electricity.largeimg="Electricity/photos/Electricity.jpg"

var Electricity1 = new TLProductDescr('E1',
                                    '<small><i>SPE-001</i></small> Комплект Електрически вериги',
                                   '../',
                                    'Electricity/Electricity1.htm',
                                     'shared/pictures/n1.gif')

var Electricity2 = new TLProductDescr('E2',
                                    '<small><i>SPE-002</i></small> Комплект Електрически вериги 2',
                                   '../',
                                    'Electricity/Electricity2.htm',
                                    'shared/pictures/n2.gif')

var Electricity3 = new TLProductDescr('E3',
                                    '<small><i>SPE-003</i></small> Комплект Електромагнетизъм',
                                   '../',
                                    'Electricity/Electricity3.htm',
                                     'shared/pictures/n3.gif')

var Electricity4 = new TLProductDescr('E4',
                                    '<small><i>SPE-004</i></small> Комплект Трансформатор',
                                   '../',
                                    'Electricity/Electricity4.htm',
                                    'shared/pictures/n4.gif')

var Electricity5 = new TLProductDescr('E5',
                                    '<small><i>SPE-005</i></small> Комплект Полупроводникови прибори',
                                   '../',
                                    'Electricity/Electricity5.htm',
                                    'shared/pictures/n5.gif')

var Electricity6 = new TLProductDescr('E6',
                                    '<small><i>SPE-006</i></small> Комплект Черна кутия',
                                   '../',
                                    'Electricity/Electricity6.htm',
                                    'shared/pictures/n6.gif')

var Electricity7 = new TLProductDescr('E7',
                                    '<small><i>SPE-007</i></small> Комплект Закон на Джаул-Ленц',
                                   '../',
                                    'Electricity/Electricity7.htm',
                                    'shared/pictures/n7.gif')

var Electricity8 = new TLProductDescr('E8',
                                    '<small><i>SPE-008</i></small> Комплект Електростатика',
                                   '../',
                                    'Electricity/Electricity8.htm',
                                    'shared/pictures/n8.gif')

   Electricity.AddChild(Electricity1)
   Electricity.AddChild(Electricity2)
   Electricity.AddChild(Electricity3)
   Electricity.AddChild(Electricity4)
   Electricity.AddChild(Electricity5)
   Electricity.AddChild(Electricity6)
   Electricity.AddChild(Electricity7)
   Electricity.AddChild(Electricity8)

// Optics ID=O0 ====================================================
var Optics = new TLProductDescr('O0',
                                   'Оптика',
                                   '../',
                                   'Optics/index.htm',
                                   'shared/pictures/lens.gif')
Optics.largeimg="Optics/photos/Optics.jpg"

var Optics1 = new TLProductDescr('O1',
                                    '<small><i>SPO-001</i></small> Комплект Интерференция и дифракция на светлина',
                                   '../',
                                    'Optics/Optics1.htm',
                                     'shared/pictures/n1.gif')

var Optics2 = new TLProductDescr('O2',
                                    '<small><i>SPO-002</i></small> Комплект Плоско огледало',
                                   '../',
                                    'Optics/Optics2.htm',
                                    'shared/pictures/n2.gif')

var Optics3 = new TLProductDescr('O3',
                                    '<small><i>SPO-003</i></small> Комплект Събирателна леща',
                                   '../',
                                    'Optics/Optics3.htm',
                                     'shared/pictures/n3.gif')

var Optics4 = new TLProductDescr('O4',
                                    '<small><i>SPO-004</i></small> Комплект Оптични уреди',
                                   '../',
                                    'Optics/Optics4.htm',
                                    'shared/pictures/n4.gif')

var Optics5 = new TLProductDescr('O5',
                                    '<small><i>SPO-005</i></small> Комплект Оптичен кръг',
                                   '../',
                                    'Optics/Optics5.htm',
                                    'shared/pictures/n5.gif')

var Optics6 = new TLProductDescr('O6',
                                    '<small><i>SPO-006</i></small> Комплект Изследване на спектри',
                                   '../',
                                    'Optics/Optics6.htm',
                                    'shared/pictures/n6.gif')
var Optics7 = new TLProductDescr('O7',
                                    '<small><i>SPO-007</i></small> Комплект Източници на светлина',
                                   '../',
                                    'Optics/Optics7.htm',
                                    'shared/pictures/n7.gif')


   Optics.AddChild(Optics1)
   Optics.AddChild(Optics2)
   Optics.AddChild(Optics3)
   Optics.AddChild(Optics4)
   Optics.AddChild(Optics5)
   Optics.AddChild(Optics6)
   Optics.AddChild(Optics7)

// Thermodynamics ID=T0 ====================================================

var Thermodynamics = new TLProductDescr('T0',
                                   'Топлинни явления',
                                   '../',
                                   'Thermodynamics/index.htm',
                                   'shared/pictures/flame.gif')
Thermodynamics.largeimg="Thermodynamics/photos/tmain.jpg"

var Thermodynamics1 = new TLProductDescr('T1',
                                   '<small><i>SPT-001</i></small> Комплект Топлинни явления',
                                   '../',
                                   'Thermodynamics/Thermo1.htm',
                                   'shared/pictures/n1.gif')

   Thermodynamics.AddChild(Thermodynamics1)




//Physics ==================================================
var Physics = new TLProductDescr('P0',
                                   'Физика',
                                   '',
                                   'sets.htm',
                                   'shared/pictures/physics.gif')

   Physics.AddChild(Mechanics)
   Physics.AddChild(Electricity)
   Physics.AddChild(Optics)
   Physics.AddChild(Thermodynamics)

//Science=============================
var Science = new TLProductDescr('S0',
                                   'Човекът и природата',
                                   '',                //'../',
                                   'sets.htm',        //'Science/index.htm',
                                   'shared/pictures/science.gif')
Science.largeimg="Science/photos/science.jpg"

var Science1 = new TLProductDescr('S1',
                                    '<small><i>SPS-001</i></small> Комплект 5<sup>-и</sup> клас',
                                   '../',
                                    'Science/Science1.htm',
                                    'shared/pictures/n1s.gif')

var Science2 = new TLProductDescr('S2',
                                    '<small><i>SPS-002</i></small> Комплект Наблюдения с микроскоп',
                                   '../',
                                    'Science/Science2.htm',
                                    'shared/pictures/n2s.gif')

//var Science3 = new TLProductDescr('S3',
  //                                '<small><i>SPS-003</i></small> Комплект Сили на триене',
    //                               '../',
      //                              'Science/Science3.htm',
        //                           'shared/pictures/n3s.gif')


var Science3 = new cloneObject(Mechanics5)
Science3.smallimg = 'shared/pictures/n3s.gif' //!!!!!!!!!!!!!!!
Science3.url = 'Science/Science3.htm'

var Science4 = new TLProductDescr('S4',
                                    '<small><i>SPS-004</i></small> Комплект Плътност. Плаване',
                                   '../',
                                    'Science/Science4.htm',
                                    'shared/pictures/n4s.gif')

//var Science3 = new cloneObject(Mechanics5)

   Science.AddChild(Science1)
   Science.AddChild(Science2)
   Science.AddChild(Science3)
   Science.AddChild(Science4)


// !!!!!!!!!!!!!!!!!!!!! ================================================
var Mechanics11 = new cloneObject(Science4)
Mechanics11.smallimg = 'shared/pictures/n11.gif' //!!!!!!!!!!!!!!!
Mechanics11.url = 'Mechanics/Mechanics11.htm'
Mechanics.AddChild(Mechanics11)

// 7-mi klas ===================================================


var Seventh = new TLProductDescr('class07',
                                   'Комплекти за 7 клас',
                                   '../',
                                   'seventh/index.htm',
                                   'shared/pictures/seventh.gif')
Seventh.largeimg="seventh/photos/Kor_small.jpg"

var Seventh1 = new cloneObject(Electricity1)
var Seventh2 = new cloneObject(Optics5)
var Seventh3 = new cloneObject(Optics2)
var Seventh4 = new cloneObject(Optics3)
var Seventh5 = new cloneObject(Mechanics4)

Seventh1.smallimg='shared/pictures/n1.gif'
Seventh2.smallimg='shared/pictures/n2.gif'
Seventh3.smallimg='shared/pictures/n3.gif'
Seventh4.smallimg='shared/pictures/n4.gif'
Seventh5.smallimg='shared/pictures/n5.gif'

Seventh1.largeimg="seventh/photos/small7_01.jpg"
Seventh2.largeimg="seventh/photos/small7_02.jpg"
Seventh3.largeimg="seventh/photos/small7_03.jpg"
Seventh4.largeimg="seventh/photos/small7_04.jpg"
Seventh5.largeimg="seventh/photos/small7_05.jpg"


Seventh.AddChild(Seventh1)
Seventh.AddChild(Seventh2)
Seventh.AddChild(Seventh3)
Seventh.AddChild(Seventh4)
Seventh.AddChild(Seventh5)


// 8-mi klas ===================================================


var Eighth = new TLProductDescr('class08',
                                   'Комплекти за 8 клас',
                                   '../',
                                   'eighth/index.htm',
                                   'shared/pictures/eighth.gif')
//Eighth.largeimg="eighth/photos/Kor_small.jpg"

var Eighth1 = new cloneObject(Mechanics8)
var Eighth2 = new cloneObject(Mechanics5)
var Eighth3 = new cloneObject(Mechanics9)
var Eighth4 = new cloneObject(Mechanics10)
var Eighth5 = new cloneObject(Mechanics11)
var Eighth6 = new cloneObject(Thermodynamics1)


Eighth1.smallimg='shared/pictures/n1.gif'
Eighth2.smallimg='shared/pictures/n2.gif'
Eighth3.smallimg='shared/pictures/n3.gif'
Eighth4.smallimg='shared/pictures/n4.gif'
Eighth5.smallimg='shared/pictures/n5.gif'
Eighth6.smallimg='shared/pictures/n6.gif'

Eighth1.largeimg="eighth/photos/spm008-00.jpg"
Eighth2.largeimg="eighth/photos/sci300.jpg"
Eighth3.largeimg="eighth/photos/spm009-00.jpg"
Eighth4.largeimg="eighth/photos/spm010-00.jpg"
Eighth5.largeimg="eighth/photos/sci400.jpg"
Eighth6.largeimg="eighth/photos/t1i0.jpg"


Eighth.AddChild(Eighth1)
Eighth.AddChild(Eighth2)
Eighth.AddChild(Eighth3)
Eighth.AddChild(Eighth4)
Eighth.AddChild(Eighth5)
Eighth.AddChild(Eighth6)

// Sets ========================================
var Sets = new TLProductDescr('S0',
                                   'Комплекти',
                                   '',
                                   'sets.htm',
                                   '')

Sets.AddChild(Physics); Sets.AddChild(Science); Sets.AddChild(Seventh);
Sets.AddChild(Eighth)
//=============

// Sets ========================================
var PriceList = new TLProductDescr('PL0',
                                   'Цени',
                                   '',
                                   'eshop', //was priceinfo.htm
                                   'shared/pictures/basket.gif')
PriceList.largeimg="shared/pictures/prices.gif";

//=============

// RootPage ========================================
var RootPage = new TLProductDescr('R0',
                                   'Начало',
                                   '',
                                   'index.htm',
                                   'shared/pictures/sitemap.gif')

RootPage.AddChild(Sets); RootPage.AddChild(PriceList); 

//=============




function AddFMTItem(theImage,theText, theURL, isActive)
{
if (theImage!="")
{
if (isActive) {imgstyle = ' class=mitem_selected '} else {imgstyle = ' class=mitem_unselected '}
{addItem("<img src='"+ theImage +"'  border=0 style='vertical-align : middle;'"+imgstyle+"> "+
"<font style='vertical-align : middle;'>"+ theText+"</font>" ,
 theURL, "")} 
}
else
{
addItem("<b> "+ theText + "</b>",
 theURL, "")
}
}


function AddFMTSubItem(theImage,theText, theURL)
{
if (theImage!="")
{
addItem("&nbsp;<img src='"+ theImage +"' height=8px width=8px border=0  alt='"+theText+"'>"+
" <i>"+ theText + "</i>",
 theURL, "")
}
else
{
addItem("<i>"+ theText + "</i>",
 theURL, "")
}
}


function tab(x) {s=''; for (var i=0; i<x; i++){s+='&nbsp'}; return(s)}


function ShowLeftMenu()
 {
startMenu("Комплекти", "<IMG src='"+rootpath+"shared/pictures/navigate4xr3.gif' border=0>");


Physics.AddinLeftMenu(true)
Science.AddinLeftMenu(false)
AddFMTItem('',Science.GetHchildren(), '',true)


addLine("<img src='"+rootpath+divlineimg+"' border=0 style='vertical-align : middle;'>","center")

Seventh.AddinLeftMenu(false)
Eighth.AddinLeftMenu(false)

//addLine('<hr>',"center");

addLine("<img src='"+rootpath+divlineimg+"' border=0 style='vertical-align : middle;'>","center")

addItem("<img src='"+rootpath+RootPage.smallimg+"' height=12px width=12px border=0> Начало", rootpath+"index.htm", "");


addItem("<img src='"+rootpath+"shared/pictures/basket.gif' height=12px width=12px border=0> Цени", "http://www.tibolab.com/eshop", "");
addItem("<img src='"+rootpath+"shared/pictures/emails.gif' height=12px width=12px border=0> e-mail: info@tibolab.com", "mailto:info@tibolab.com", "");

endMenu();
                          } //ShowLeftMenu;

function FindActive()
{
lmatch=-1;  //how long is the match?
imatch=-1;
    for (var i = 0; i < TLProd.length; i++)
{  ind=location.href.indexOf(TLProd[i].url);
          if (ind!=-1) {if (location.href.length-ind>lmatch)
                           {imatch=i; lmatch=location.href.length-ind} 
                       }

}//for

rootpath=location.href.substring(0,location.href.length-lmatch); 
TLActive=TLProd[imatch];
 }//FindActive



//FindActive(); 
//TLActive.Activate(); 

//ShowLeftMenu()  
                     
//-->

