
/*******************************************************************************

 
*******************************************************************************/
var load = 0;
function Browser(){
    this.ie=(document.all)?1:0;
    this.ns=(document.layers)?1:0;
    return this
}
var bw = new Browser();
/************************************
  Start
************************************/

var MenuArray = new Array();
var timeOut = 10;
var visible_div =1;

/*******************************************************************************
Класс BestPopupMenu 
*******************************************************************************/

function BestPopupMenu(){
  //Свойства
  this.index = MenuArray.length;
  MenuArray[MenuArray.length] = this;//Регистрация в глобальном массиве
  this.top;
  this.left;
  this.subs = new Array();//Список всех подменю
  this.SubMenuProperty = new SubMenuProperty() ; // Свойства подменю
  this.ItemProperty = new ItemProperty() ; // Свойства элементов
  this.lastActivMenu; //Последнее активное меню(Объект SubMenu)
  this.hideAllMenuTim;//Таймер 
  this.style_str = '';
  this.div_str = '';

  //Методы
  this.setSubMenuProperty = BPM_setSubMenuProperty;
  this.setItemProperty = BPM_setItemProperty;
  this.addSubMenu = BPM_addSubMenu;
  this.draw = BPM_draw;
  this.hide = BPM_hide;

}

function BPM_setSubMenuProperty(SMP){
  if (!SMP) return;
  this.SubMenuProperty = SMP;
}

function BPM_setItemProperty(ITP){
  if (!ITP) return; 
  this.ItemProperty = ITP;
}

function BPM_addSubMenu(parent){
  var index = this.subs.length;
  this.subs[index] = new SubMenu(parent);
  this.subs[index].index = index;
  this.subs[index].name = "menu" + this.index + index;
  this.subs[index].Menu = this;
  this.subs[index].setSubMenuProperty(this.SubMenuProperty);
  this.subs[index].setItemProperty(this.ItemProperty.clone());
  this.subs[index].var_str =  "MenuArray[" + this.index +
    "].subs[" + index + "]";
  return this.subs[index];
}

function BPM_draw(){
  for (var i = 0; i < this.subs.length ; i++){
    this.subs[i].draw();
  }
  this.style_str = "<style >\n" + this.style_str + "</style>\n";
  document.write(this.style_str);
  document.write(this.div_str);
  for (var i = 0; i < this.subs.length ; i++){
    this.subs[i].initEvent();
  }
}

function BPM_hide(){
  /**
  if (!visible_div){
    for(var i=0; i < document.form_1.elements.length; i++)
    {
      var css = getCss(document.form_1.elements[i]);
      css.visibility = "visible";
    }
    visible_div = 1;
  } 
  */
  for (var i = 0; i < this.subs[0].items.length ; i++){
    this.subs[0].items[i].mouseOutTim();
  }

}

/*******************************************************************************
Класс SubMenu 
*******************************************************************************/
function SubMenu(parent){
  //Свойства
  //Часть свойств наследуются от класса SubMenuProperty()
  this.index;//Индекс в BestPopupMenu
  this.parent = parent || 0;//Родитель - Item
  this.Menu; //Сылка на меню
  this.top = 0;
  this.left = 0;
  this.width = 120;
  this.height = 30;
  this.items = new Array();
  this.ItemProperty;//Наследуются  от родителя или переопределяются
  this.name;//Имя в тэге Div
  this.div;
  this.css;
  if (parent){
    parent.child = this;//Регистрируемся в родителе
  }
  this.style_str = '';
  this.div_str = '';
  
  //Методы
  this.setSubMenuProperty = SM_setSubMenuProperty;
  this.setItemProperty = SM_setItemProperty;
  this.addItem = SM_addItem;
  this.draw = SM_draw;
  this.setPosition = SM_setPosition;
  this.writeStyle = SM_writeStyle;
  this.writeDiv = SM_writeDiv;
  this.initEvent = SM_initEvent;
  this.show = SM_show;
  this.hide = SM_hide;
  this.mouseOver = SM_mouseOver;
  this.mouseOut = SM_mouseOut;
}
SubMenu.prototype = new SubMenuProperty();

function SM_setSubMenuProperty(SMP){ 
  if (!SMP){return};
  this.orient = SMP.orient;
  this.border = SMP.border;
  this.space = SMP.space;
  this.borderColor = SMP.borderColor;
  this.shadow = SMP.shadow;
}

function SM_setItemProperty(ITP){
  if (!ITP) return;
  this.ItemProperty = ITP;
}

function SM_addItem(text, href){
  var index = this.items.length;
  this.items[index] = new Item(text,href);
  this.items[index].index = index;
  this.items[index].text = text;
  this.items[index].href = href;
  this.items[index].owner = this;
  this.items[index].setItemProperty(this.ItemProperty);
  this.items[index].name = "item-" + this.Menu.index  + "-" + this.index + "-" +  index;
  this.items[index].var_str = "MenuArray[" + this.Menu.index + "].subs[" + 
      this.index + "].items[" + index + "]";

  return this.items[index];
}

function SM_draw(){
  this.setPosition();
  this.writeStyle();
  this.writeDiv(); 
  for (var i = 0; i < this.items.length; i++){
    this.items[i].draw();
  }
}


function SM_setPosition(){
  if(this.parent){
    if (this.parent.owner.orient == "right"){
      this.top = this.parent.top + this.parent.height +
        this.parent.owner.border - this.parent.height * 0.2 ;
      this.left =  this.parent.left + (this.parent.width * 0.1);
    } else if (this.parent.owner.orient == "down"){
      this.top = this.parent.top  + this.parent.height * 0.2 ;
      this.left =  this.parent.left + this.parent.width +
        this.parent.owner.border -  this.parent.width * 0.1;
    }
  }else{
    this.top = this.Menu.top;
    this.left = this.Menu.left;     
  }

  this.width = 0;
  this.height = 0;
  for (var i=0; i < this.items.length; i++ ){
    if (this.orient == "right"){
      this.width += this.items[i].width + this.space;
      if (this.height <  this.items[i].height){
        this.height =  this.items[i].height + 2 * this.border;
      }
    } else {
      this.height += this.items[i].height + this.space;
      if (this.width <  this.items[i].width){
        this.width =  this.items[i].width + 2 * this.border;
      }
    }
  }

  if (this.orient == "right"){
    this.width += this.border * 2;
  } else {
    this.height += this.border * 2;
  }  
}

function SM_writeStyle(){
  var menu_style = '\n';
  menu_style +=  '.' + this.name + ' { ';
  menu_style +=  ' position:absolute; ';
  menu_style += ' z-index: 2;';
  menu_style += ' visibility: ';
  if (this.parent){
    menu_style += ' hidden;';
  }else{
    menu_style += ' visible;';
  }
  menu_style += ' top: ' + (this.top - this.border) + ';';  
  menu_style += ' left: ' + (this.left - this.border) + ';';
  menu_style += ' width : ' + (this.width)+ ';';  
  menu_style += ' height : ' + (this.height) + ';';
  menu_style += ' clip: rect(0, ' + this.width +', ' + (this.height) + ', 0);';
  //menu_style += ' background-color:  ' + this.borderColor + ';'; 
  menu_style += ' layer-background-color:  ' + this.borderColor + ';'; 
  if(bw.ie && this.shadow){
    menu_style += ' border-width: ' + this.border + ';';
    menu_style += ' border-style: ' + ' outset ' + ';';
    menu_style += ' border-color: ' + this.borderColor + ';';
  }
  menu_style += '} \n';
  
  this.Menu.style_str += menu_style;
}

function SM_writeDiv(){
  var menu_str = '<div name="'+ this.name +'" '+
    ' id="' + this.name + '" class="' + this.name + '" ';
  menu_str += ' >'+ ''+'</div>';
  this.Menu.div_str += menu_str;
}

function SM_initEvent(){
  this.div = getDiv(this.name);
  this.css = getCss(this.div);
  setBgColor(this.css, this.borderColor);
  this.div.onmouseover = new Function(this.var_str + ".mouseOver()");
  this.div.onmouseout =  new Function(this.var_str + ".mouseOut()");
  for (var i = 0; i < this.items.length; i++){
    this.items[i].initEvent();
  }
}


function SM_show(){
  /**
  if (visible_div && document.form_1){
    for(var i=0; i < document.form_1.elements.length; i++)
    {
      var css = getCss(document.form_1.elements[i]);
      css.visibility = "hidden";
    }
    visible_div = 0;
  }
  */
  this.css.visibility = "visible";
  for (var i=0; i < this.items.length; i++){
      this.items[i].show();
  }
}

function SM_hide(){
  this.css.visibility = "hidden";
  for (var i=0; i < this.items.length; i++){
      this.items[i].hide();
  }
}

function SM_mouseOver(){
  clearTimeout(this.Menu.hideAllMenuTim);
  if(this.parent && this.Menu.lastActivMenu.name == this.parent.owner.name){
    // Ушел на дочернее меню
    clearTimeout(this.parent.tim);// Оставляем подсветку родителя
  }
}

function SM_mouseOut(){
  this.Menu.hideAllMenuTim = setTimeout(this.var_str + ".Menu.hide()", 500);
  this.Menu.lastActivMenu = this;
}

/*******************************************************************************
Класс SubMenuProperty
*******************************************************************************/

function SubMenuProperty(orient, border, space, borderColor, shadow){
  this.orient = orient || "down";
  this.border = border;//Ширина бордюра
  this.space = space;//Растояние между Элементами (Item)
  this.borderColor = borderColor;
  this.shadow = shadow;// 1 - Трехмерный бордюр (только в IE) 0 - нет

}



/*******************************************************************************
Класс Item
*******************************************************************************/

function Item(){
  //Свойства
  this.index;
  this.owner;//Владелец элемента (объект SubMenu)
  this.top = 0;
  this.left = 0;
  //this.width = 125;
  //this.height = 30;
  this.name;//Имя в тэге Div
  this.div;
  this.css;
  this.child;
  this.steps_count = 0;
  this.align = "left";

  //Методы
  //Установка свойств. Аргумент объект ItemProperty()
  this.setItemProperty = IT_setItemProperty;
  this.draw = IT_draw;
  this.setPosition = IT_setPosition;
  this.writeStyle = IT_writeStyle;
  this.writeDiv = IT_writeDiv;
  this.initEvent = IT_initEvent;
  this.mouseOver = IT_mouseOver;
  this.mouseOut = IT_mouseOut;
  this.mouseClick = IT_mouseClick;
  this.mouseOutTim1 = IT_mouseOutTim1;
  this.mouseOutTim = IT_mouseOutTim;
  this.show = IT_show;
  this.hide = IT_hide;
  this.fade = IT_fade;
  this.toRgbBg = IT_toRgbBg;
  this.toRgbBgOn = IT_toRgbBgOn;
}
Item.prototype = new ItemProperty();


function IT_toRgbBg() {
  var hexcode = this.bgColor;
  var RGB =  toRGB(hexcode);
  this.r = RGB[0];
  this.g = RGB[1];
  this.b = RGB[2];
}

function IT_toRgbBgOn() {
  var hexcode = this.bgColorOn;
  var RGB =  toRGB(hexcode);
  this.rOn = RGB[0];
  this.gOn = RGB[1];
  this.bOn = RGB[2];
}

function IT_setItemProperty(ITP){
  if (!ITP) return ;
  this.color = ITP.color;
  this.bgColor = ITP.bgColor;
  this.colorOn = ITP.colorOn;
  this.bgColorOn = ITP.bgColorOn;
  this.fontName = ITP.fontName;
  this.fontSize = ITP.fontSize;
  this.fontBold = ITP.fontBold;
  this.steps = ITP.steps;
  this.align = ITP.align;
  this.height = ITP.height;
  this.width = ITP.width;
  this.padding = ITP.padding;
}

function IT_draw(){
  this.setPosition();
  this.writeStyle();
  this.writeDiv();
  if(this.steps){
    this.toRgbBg();
    this.toRgbBgOn();
  }
  //this.initEvent();
}

function IT_setPosition(){
  if (this.owner.orient == "right"){
    if (this.index == 0){
      this.left = this.owner.left ;
    }else{
      this.left = this.owner.items[this.index - 1].left +         
        this.owner.items[this.index - 1].width  + this.owner.space;
    }
    this.top = this.owner.top;   
  }else if (this.owner.orient == "down"){
    this.left = this.owner.left;
    if (this.index == 0){
      this.top = this.owner.top ;
    }else{
      this.top = this.owner.items[this.index - 1].top +         
        this.owner.items[this.index - 1].height  + this.owner.space;
    }
 
  }

}

function IT_writeStyle(){
  var style = '#' + this.name + " {\n" +
    ' position:absolute;' +
    ' cursor:hand; ' 
    ' '
  ;
  if(this.owner.orient == "right" || this.align == "center"){
    style += ' text-align: center;';
  } else {
    style += ' text-align: left;';
  }
    style += ' z-index: 2;';
  if (this.img){
    style += 'background-image: url(' + this.img.src + ');' +
      'background-repeat: no-repeat;';
  }
  style += ' visibility: ';
  if (this.owner.parent){
    style += ' hidden;';
  }else{
    style += ' visible;';
  }
  style += ' clip: rect(0, ' + this.width +', ' + (this.height) + ', 0) ;';
  style += ''+
    ' padding: ' + this.padding + "px ;" +
    ' font-size:  ' + this.fontSize + 'px;' +
    ' font-family:  ' + this.fontName + ';' +
    ' font-weight:   ' + (this.fontBold ? ' 600 ' : ' 100 ') + ';' +
    ' color: ' + this.color + ';'+
    ' left:  ' + this.left + 'px;'+
    ' top: ' + this.top + 'px;'+
    ' width : ' + this.width + 'px;'+
    ' height: ' + this.height + 'px;'+
    ' layer-background-color:  ' + this.bgColor + ';'+
    '\n}\n'
  ;
  this.owner.Menu.style_str += style;
}

function IT_writeDiv(){
  var str = '<div  id="' +  this.name + '"  name="' + this.name + '" ' +
    ' class="' + this.name + '" >' ;
  var re = /^\s*$/;
  if(re.exec(this.text)){
    str +=  '&nbsp;' ; 
  }else{
    str +=  this.text ;   
  }
  str += '</div>\n';
     //document.write(str);

  this.owner.Menu.div_str += str;
}

function IT_initEvent(){
  this.div = getDiv(this.name);
  this.css = getCss(this.div);
  setBgColor(this.css, this.bgColor);
  this.div.onmouseover =  new Function(this.var_str + ".mouseOver()");
  this.div.onmouseout =  new Function(this.var_str + ".mouseOut()");
  if (bw.ns){
    this.div.captureEvents(Event.MOUSEUP);
    this.div.onmouseup = new Function(this.var_str + ".mouseClick()");
  }else{
    this.div.onclick = new Function(this.var_str + ".mouseClick()");
  }

}


function IT_mouseOver(){
  clearTimeout(this.owner.Menu.hideAllMenuTim);
  clearTimeout(this.xx);
  if (! this.owner.Menu.lastActivMenu){
    this.owner.Menu.lastActivMenu = this.owner;
  }
  //Ушел на другой элемент этого же меню 
  if (this.owner.Menu.lastActivMenu.name == this.owner.name ){
  // Ушел на дочернее меню
  }else if(this.owner.parent && 
           this.owner.Menu.lastActivMenu.name == this.owner.parent.owner.name){
    clearTimeout(this.owner.parent.tim);// Оставляем подсветку родителя
  //Ушел на родительское меню
  }else if (this.owner.Menu.lastActivMenu.parent && 
            this.owner.Menu.lastActivMenu.parent.owner.name == this.owner.name){
    //перескочил на родительское меню
    if (this.owner.Menu.lastActivMenu.parent.name != this.name){
      this.owner.Menu.lastActivMenu.parent.mouseOutTim();
    }

  //Перескочил 
  }else{
    this.owner.Menu.hide()
  }
   
  this.css.color = this.colorOn;
  setBgColor(this.css, this.bgColorOn);
  if (this.child){
     this.child.show();
  }
  this.owner.Menu.lastActivMenu = this.owner;
}

function IT_mouseOut(){
  this.owner.Menu.hideAllMenuTim = 
    setTimeout(this.var_str + ".owner.Menu.hide()",timeOut);
  this.tim = setTimeout(this.var_str + ".mouseOutTim1()",timeOut);  
}

function IT_mouseOutTim1(){
  this.css.color = this.color;
  this.steps_count = 0;
  this.xx = setTimeout(this.var_str + ".fade()",2);
  //setBgColor(this.css, this.bgColor);
  if (this.child){
    this.child.hide();
  }
}

function IT_mouseOutTim(){
  this.css.color = this.color;
  setBgColor(this.css, this.bgColor);
  if (this.child){
    this.child.hide();
  }
}

function IT_fade() {
  this.rCh = Math.floor(this.rOn * ((this.steps - this.steps_count) / this.steps) +
    this.r * (this.steps_count / this.steps));
  this.gCh = Math.floor(this.gOn * ((this.steps - this.steps_count) / this.steps) +
    this.g * (this.steps_count / this.steps));
  this.bCh = Math.floor(this.bOn * ((this.steps - this.steps_count) / this.steps) +
    this.b * (this.steps_count / this.steps));

  this.steps_count++;
  if (this.steps_count > this.steps){
    setBgColor(this.css, this.bgColor);    
    return;
  }
  setBgColor(this.css,"#" + toHex(this.rCh) + toHex(this.gCh) + toHex(this.bCh));
  this.xx = setTimeout(this.var_str + ".fade()",2);
}


function IT_mouseClick(){
  if(!this.href){return;}
  if(this.href == "undef"){
    alert("Замените undef на URL");
    return;
  }
  document.location = this.href;
}


function IT_show(){
  this.css.visibility = "visible";
}

function IT_hide(){
  this.mouseOutTim();
  this.css.visibility = "hidden";
}

/*******************************************************************************
Класс ItemProperty
*******************************************************************************/

function ItemProperty(color, bgColor, colorOn, bgColorOn, fontName,
                      fontSize, fontBold, steps, align,height,width,padding){
  this.color = color ;
  this.bgColor = bgColor ;
  this.colorOn = colorOn ;
  this.bgColorOn = bgColorOn ;
  this.fontName = fontName || "Arial";
  this.fontSize = fontSize || 12;
  this.fontBold = fontBold;
  this.steps = steps || 0;
  this.align = align;
  this.height = height||20;
  this.width = width||100;
  this.padding = padding;

  //методы
  this.clone = IP_clone;
}

function IP_clone(){
  var new_ITP = new ItemProperty(this.color, this.bgColor, this.colorOn, 
    this.bgColorOn , this.fontName, this.fontSize, this.fontBold, this.steps,
    this.align, this.height, this.width, this.padding);
  return new_ITP;
}





/*******************************************************************************
Глобальные функции
*******************************************************************************/


function getDiv(name){
  if (bw.ie){
    return document.all[name];  
  }else if (bw.ns){
    return document.layers[name];
  }
}

function getCss(div){
  if (bw.ie){
    return div.style;  
  }else if (bw.ns){
    return div;
  }
}

function setBgColor(css, color){
  if (bw.ie){
    css.backgroundColor = color; 
  }else if (bw.ns){
    css.bgColor = color;
  }
}

function toHex(dec) {
  var hexCharacters = "0123456789ABCDEF"
  if (dec< 0){ return "00" };
  if (dec>255){ return "FF"};
  var i = Math.floor(dec / 16)
  var j = dec % 16
  return hexCharacters.charAt(i) + hexCharacters.charAt(j);
}

function toRGB(hexcode) {
  var RGB = new Array();
  if (hexcode.length == 7) {
    RGB[0] = parseInt(hexcode.substring(1,3),16);
    RGB[1] = parseInt(hexcode.substring(3,5),16);
    RGB[2] = parseInt(hexcode.substring(5,7),16);
  }
  else if (hexcode.length == 6) {
    RGB[0] = parseInt(hexcode.substring(0,2),16);
    RGB[1] = parseInt(hexcode.substring(2,4),16);
    RGB[2] = parseInt(hexcode.substring(4,6),16);
  }
  else {
    RGB[0] = RGB[1] = RGB[2] = 0;
    alert("Error: ColorCode constructor failed");
  }
  if (isNaN(RGB[0])||isNaN(RGB[1])||isNaN(RGB[2]))
    alert("Error: ColorCode constructor failed");
  return RGB;
}

/******************************************************************************
                              Создаем меню
******************************************************************************/

//Создаем меню (объект BestPopupMenu)
var menuWin =  new BestPopupMenu();

//Определяем смещение сверху
menuWin.top = 145;

//Определяем смещение слева
menuWin.left = 540;

//Определяем глобальные свойства подменюшек .  
var SubMenuProperty_Main = new  SubMenuProperty(
  "down",          // orient Расположение элементов в низ - 'down', в право - 'right'  
  2,               //Ширина бордюра    
  1,               //Растояние между элементами
  "#fcfcfc",       //Цвет бордюра
  1                //Трехмерный бордюр - 1, обычный - 0
);

var SubMenuProperty_TOP = new  SubMenuProperty(
  "right",          //Расположение элементов в низ - 'down', в право - 'right'  
  0,               //Ширина бордюра    
  0,               //Растояние между элементами
  "#e5e5e5",       //Цвет бордюра
  0                //Трехмерный бордюр - 1, обычный - 0
);

//Определяем свойства подменюшек в основном объекте
//Все подменю унаследуют эти свойства, если они не будут переопределенны.
 menuWin.setSubMenuProperty(SubMenuProperty_Main);
 
//Определяем свойства  элементов подменюшек.
var ItemProperty_Main = new  ItemProperty(
  "#000000",        //Цвет текста
  "#BFA56A",        //Цвет подложки
  "#996600",        //Цвет текста при наведении
  "#ffcc00",        //Цвет подложки при наведении
  "Arial",          //Название шрифта
  11,               //Размер шрифт
  0,                //  0 - обычный, 1 - Жырный шрифт
  10,                // Затухание значение от 0 до 100, 0 - без затухания
  "",                // Центрирование "" - по левому краю, "center" - по правому
  20,                  //height
  100,                  //width
  2                  //padding
);

//Определяем свойства  элементов TOP меню.
var ItemProperty_TOP = new  ItemProperty(
  "#ffcc00",        //Цвет текста
  "#BFA56A",        //Цвет подложки
  "#996600",        //Цвет текста при наведении
  "#cc9933",        //Цвет подложки при наведении
  "Arial",          //Название шрифта
  11,               //Размер шрифт
  1,                //  0 - обычный, 1 - Жырный шрифт
  10,                // Затухание значение от 0 до 100, 0 - без затухания
  "",                // Центрирование "" - по левому краю, "center" - по правому
  15,                  //height
  100,                  //width
  0                  //padding
);

//Определяем свойства  заголовков подменюшек.
var ItemProperty_subHead = new  ItemProperty(
  "#000000",        //Цвет текста
  "#cc9933",        //Цвет подложки
  "#ff0000",        //Цвет текста при наведении
  "#C49664",        //Цвет подложки при наведении
  "Arial",          //Название шрифта
  11,               //Размер шрифт
  1,                //  0 - обычный, 1 - Жырный шрифт
  0,                // Затухание значение от 0 до 100, 0 - без затухания
  "center",          // Центрирование "" - по левому краю, "center" - по правому
  20,                  //height
  100,                  //width
  2                  //padding
);


//Определяем свойства Элементов в основном объекте
//Все Элементы унаследуют эти свойства, если они не будут переопределенны.
menuWin.setItemProperty(ItemProperty_Main);
 
//Создаем главное меню
topMenu =  menuWin.addSubMenu(0);
topMenu.setSubMenuProperty(SubMenuProperty_TOP);
topMenu.setItemProperty(ItemProperty_TOP);

//topMenu.ItemProperty.height = 25;

//Добавляем в него Элементы addItem(text, href)
search = topMenu.addItem("Разделы", "");
  searchMenu =  menuWin.addSubMenu(search);
  searchMenu.ItemProperty.width = 120;
  //searchMenu.orient = "down";
  //Добавляем в него Элементы
  apartment = searchMenu.addItem("Ритуалы","");
    apartmentMenu = menuWin.addSubMenu(apartment);
    head = apartmentMenu.addItem("Описание", "http://baltasar.fatal.ru/ritual.htm");
    head.setItemProperty(ItemProperty_subHead);
    apartmentMenu.addItem("Любовная магия", "http://www.baltasar.fatal.ru/library/zaklinaniya/privorot.htm");
    apartmentMenu.addItem("Белая магия", "http://baltasar.fatal.ru/magia0.htm");
    apartmentMenu.addItem("Черная магия", "http://baltasar.fatal.ru/magia0.htm");
    apartmentMenu.addItem("Серая магия", "http://baltasar.fatal.ru/magia0.htm");
  house  = searchMenu.addItem("Талисманы", "");
    houseMenu = menuWin.addSubMenu(house);
    head = houseMenu.addItem("Описание", "http://baltasar.fatal.ru/talisman.htm");
    head.setItemProperty(ItemProperty_subHead);
    houseMenu.addItem("Амулеты", "http://www.hermes-shop.biz/index.php?categoryID=2");
    houseMenu.addItem("Обереги", "http://www.hermes-shop.biz/index.php?categoryID=24"); 
    houseMenu.addItem("Пентакли", "http://www.hermes-shop.biz/index.php?categoryID=6");
    houseMenu.addItem("Звезда Соломона", "http://www.hermes-shop.biz/index.php?productID=123"); 
    houseMenu.addItem("Кольцо Соломона", "http://www.hermes-shop.biz/index.php?productID=5");
    houseMenu.addItem("Весь каталог", "http://www.hermes-shop.biz/");
    houseMenu.addItem("Заказать", "http://www.hermes-shop.biz/");
  office  = searchMenu.addItem("Обучение", "http://www.hermetism.info/scool/index.html");
    officeMenu = menuWin.addSubMenu(office);
    head = officeMenu.addItem("Школа Магии", "http://www.hermetism.info/scool/index.html");
    head.setItemProperty(ItemProperty_subHead);
    officeMenu.addItem("Программа", "http://www.hermetism.info/scool/index.html");
    officeMenu.addItem("Поступление", "http://www.hermetism.info/scool/anketa.html");
    officeMenu.addItem("Посвящение", "http://www.hermetism.info/scool/22arkana.html");
    officeMenu.addItem("Форум Школы", "http://www.hermetism.info/forum/");
  firms  = searchMenu.addItem("Лига Магов", "http://ligamagov.com/");
    firmsMenu = menuWin.addSubMenu(firms); 
    head = firmsMenu.addItem("Лига Магов", "http://ligamagov.com/");
    head.setItemProperty(ItemProperty_subHead);
    firmsMenu.addItem("Услуги Магов Лиги", "http://ligamagov.com/"); 
    firmsMenu.addItem("Список Магов Лиги", "http://ligamagov.com/");
    firmsMenu.addItem("Форум Магов Лиги", "http://ligamagov.com/");
    
    
//
// Библиотека
//
add = topMenu.addItem("Библиотека сайта","http://www.hermetism.info/public.html");
  add_M = menuWin.addSubMenu(add);
  add_M.ItemProperty.width = 120;
  apartment = add_M.addItem("Гримуары","");
    apartmentMenu = menuWin.addSubMenu(apartment);
    head = apartmentMenu.addItem("Гримуары","http://www.hermetism.info/public/grimuar/grimuar.html");
    head.setItemProperty(ItemProperty_subHead);
    
  house = add_M.addItem("Библиотека портала","http://www.hermetism.info/public/doc/");
   house = add_M.addItem("Читальный зал","http://www.hermetism.info/htm/");
    
  office  = add_M.addItem("Купить книги", "http://www.hermes-shop.biz/index.php?categoryID=30");
    
  firms  = add_M.addItem("Астрология", "http://hermetism.info/astrologiya.html");
    firmsMenu = menuWin.addSubMenu(firms);
    head = firmsMenu.addItem("Астрология", "http://hermetism.info/astrologiya.html");
    head.setItemProperty(ItemProperty_subHead);
    firmsMenu.addItem("Гороскоп на 2010г.", "http://hermetism.info/astrologiya.html");

forum = topMenu.addItem("Общение","http://hermetism.info/forum/");
  forum_M = menuWin.addSubMenu(forum);
  forum_M.ItemProperty.width = 130;
  discus = forum_M.addItem("Дискуссия на форуме","http://hermetism.info/forum/");
  discus = forum_M.addItem("Дискуссия в чате","http://hermetism.info/");
  discus = forum_M.addItem("Гостевая книга","http://hermetism.info/");
  discus = forum_M.addItem("Написать на емайл","mailto:admin@hermetism.info");
  

d3 = topMenu.addItem("Услуги","http://www.hermetism.info/service.html");
  d3_M = menuWin.addSubMenu(d3);
  d3_M.ItemProperty.width = 130;
  d3_real = d3_M.addItem("Провести ритуал","http://www.hermetism.info/service.html");
  //d3_real.height = 30;
  bank_d3_I = d3_M.addItem("Изготовить амулет","http://www.hermetism.info/shop/");
    bank_d3_I2 = d3_M.addItem("Составить гороскоп","http://hermetism.info/astrologiya.html");
    bank_d3_I3 = d3_M.addItem("Предсказание на Таро","http://www.baltasar.fatal.ru/library/taro/taro_on-line.htm");
      bank_d3_I3 = d3_M.addItem("Предсказание Инцзы","http://www.baltasar.fatal.ru/library/taro/inzsi_on-line.htm");
//Записываем Меню в document
menuWin.draw();
