<?xml version="1.0" encoding="UTF-8"?>
<rmml>
<!--
$RCSfile: rnmc_stdMediaObject.xml,v $
$Revision: 1030 $

last change: $Date: 2009-03-24 16:33:22 +0300 (Вт, 24 мар 2009) $
             $Author: faja $

  Lacerta Project
  version 1.0.0.1
  Copyright (C) 2007-2009 RNMC
-->

<composition name="rnmc_stdMediaObject" class="rnmc_stdObject">
<script><![CDATA[
  this.id = "";
  this.visibility = OBJECT_VISIBILITY_UNDEFINED;

//  недоступность для использования в действиях
  this.disabled = false;

//  признак того что объект в данный момент считается увеличенным
  this.zoomed = false;

// Стек для запоминания изменения позиций объекта
  this.positionsArray = new Array();

//  параметры объекта
  this.objectX    = 0;
  this.objectY    = 0;
  this.objectWidth  = 0;
  this.objectHeight  = 0;
  this.objectDepth  = 0;
  this.objectRatio    = false;
  
  this.objectSetFocus = false;

  this.originalX    = 0;
  this.originalY    = 0;
  this.originalWidth  = 0;
  this.originalHeight  = 0;
  this.originalDepth  = 0;

// Автоматическое позиционирование контрола к объекту
  this.controlAttachPoint = null;  
  this.controlAttachStyle = AUTOATTACH_NO;

// Автоматическое позицианирование подписи к объекту
  this.titleAttachStyle = AUTOATTACH_NO;

  this.autoAttachTarget = null;
  this.autoAttachStyle = AUTOATTACH_NO;
  this.autoAttachOffsetX = 0;
  this.autoAttachOffsetY = 0;

  this.sizeMode = SIZE_MODE_NORMAL;
  this.horizontalAlign = H_ALIGN_LEFT; 
  this.verticalAlign = V_ALIGN_TOP;

  this.objectOpacity  = 1.0;
  this.objectSrc    = null;
  this.objectFolder  = null;    //  flash only
  this.objectValue  = null;    //  text only
  this.objectStyle  = null;    //  text only
  this.objectScroll  = false;  //  text only
  this.objectLoop    = false;  //  audio/video only
  this.objectRewind   = true;    // 
  
  // Не объявляются, а вдруг все прозрачно
  // Цвет фона объекта в нормальном состоянии
  //this.objectBgColor        = "#FFFFFF";
  // в активном
  //this.objectBgColorActive  = "#FFFFFF";
  // в отключенном (disable, read only)
  //this.objectBgColorDisable = "#FFFFFF";

  this.playing = OBJECT_PLAYING_FALSE;
// Область реакции
// "bound" - габариты
// "opaque" - учитывать прозрачность
// [x,y,w,h] - прямоугольник
// {(x1,y1), (x2,y3), (x3,y3)} - полигон
  this.objectHitArea  = null;

  //this.componentsApperance = APPEAR_AFTER_SHOW;

  //   параметры подписи
// для подписи
  this.titleObject = null;
  this.titleX = 0;
  this.titleY = 0;
  this.titleWidth = 0;
  this.titleHeight = 0;
  this.titleDepth = 0;
  this.titleBgColor = null;
  this.titleValue = null;
  this.titleStyle = null;
  this.titleSrc = null;
  this.titleVisible = false;
  this.titleRelative = false;

//   параметры хинта
  this.hintDefined = false;
  this.hintType = HINT_TYPE_TEXT;
  //  событие для показа хинта:  HINT_EVENT_ONPRESS - на нажатие
  //                HINT_EVENT_ONROLLOVER - на наезд 
  this.hintEvent = HINT_EVENT_ONROLLOVER;
  this.hintValue = null;
  this.hintSrc = null;
  this.hintWidth = 0;
  this.hintHeight = 0;
  this.hintScale = 0;
  this.hintBgColor = null;
  this.hintBorderColor = null;

//  параметры всплывающего меню rnmc_RollOverMenu
// точка привязки
  this.rolloverMenuPoint = ROLLOVERMENU_POINT_RIGHTBOTTOM;
// отступы от точки привязки
  this.rolloverMenuX = 0;
  this.rolloverMenuY = 0;
// наличие соответствующих опций в меню
  this.rolloverMenuSaveOption = false;
  this.rolloverMenuCopyOption = false;
  this.rolloverMenuZoomOption = false;

  this.rolloverMenuAreaX = 0;
  this.rolloverMenuAreaY = 0;
  this.rolloverMenuAreaWidth = 0;
  this.rolloverMenuAreaHeight = 0;
  this.rolloverMenuStyle = null;

//  атрибуты таскания объекта
  this.draggingEnabled = false;
  this.draggingMinXBound = 0;
  this.draggingMaxXBound = Player.module.width;
  this.draggingMinYBound = 0;
  this.draggingMaxYBound = Player.module.height;
  this.objectCaptured = false;
  this.draggingXOffset = 0;
  this.draggingYOffset = 0;

//  атрибуты scrollmenu
  this.scrollMenuDefined = false;
  this.scrollMenuX = 0;
  this.scrollMenuY = 0;
   
//  для шаблона Integration
  this.quantity = 1;

//  "разрешения" на инициализацию соответствующих компонентов
//  подпись
  this.initializeTitle = true;
//  панель управления
  this.initializeControl = true;
//  хинт
  this.initializeHint = true;  
//  всплывающее меню
  this.initializeRolloverMenu = true;
//  объект зум
  this.initializeZoom = true;
//  список действий
  this.initializeActions = true;
//  эффекты
  this.initializeEffects = true;

//  наличие панели управления
  this.titleDefined = false;
//  наличие панели управления
  this.controlDefined = false;
//  наличие хинта
  this.hintDefined = false;
//  наличие всплывающего меню 
  this.rolloverMenuDefined = false;
//  наличие объекта zoom
  this.zoomDefined = false;

//  компоненты 
  this.objectContent = null;
  
// Attach control panel
  this.attachedControl = null;
  this.controlX = 0;
  this.controlY = 0;
  this.controlDepth = 0;

  this.titleObject = null;
 
  this.rolloverMenuObject = null;

//  массив со списками действий на события
  this.actionsList = null;
//  объект-обработчик действий
  this.actionDispatcherObject = null;

// Постоянные свойства объекта,
// должны сохраняться между вугрузкой и загрузкой объекта,
// могут изменяться во время существования объекта
// !!!! Пока будет реализовано, только для шага/сцены
  this.propertysList = null;

  this.attachPressHandler = false;
  this.attachReleaseHandler = false;
  this.attachRollOverHandler = false;
  this.attachRollOutHandler = false;

// Объект который необходимо уведомлять,
// когда объект показывается
  this.showCallBackObject = null;
  this.showCallBackFunction = null;

// Объект который необходимо уведомлять,
// когда объект полностью спрятан (уже после всех эффектов)
  this.hideCallBackObject = null;
  this.hideCallBackFunction = null;

//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//  ЕСЛИ У ОБЪЕКТА НЕТ НИ ОДНОГО ХЭНДЛЕРА - ЕГО МОЖНО (И НУЖНО ДЕЛАТЬ enabled = false;)
  this.objectMayBeDisabled = true;
  
// Статистические данные по работе с объектом, результат, количество ошибок, количество подсказок
  this.objectResult = -1;
  this.objectErrors = 0;
  this.objectHelps  = 0;
  this.objectAttempts  = 0;

// Флаг показывает нужноли грузить для объекта свойства "по-умолчанию"
  this.defaultSettings = true;
  
  // Флаг говорит, блочить ли поле ввода после проверки или нет
  this.checkModeAfter = CHECK_MODE_AFTER_WRITE;

  // Варианты подсчета результатов для ВСЕХ (!) объектов
  // см. rnmc_stdCountResultAlgorithms.xml
  this.crAlgorithm = "not_init";
  
  // Сработал таймер
  this.isOnTimeout = false;
  
  this.layoutMode = LAYOUT_NO;

//  ======================================== Функции разбора узлов  ====================================

//  разбор узла "properties"
  function parsePropertiesNode(srcNode){
//trace("rnmc_stdMediaObject::parsePropertiesNode()");

    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "properties"){
      var xmlNode = srcNode.firstChild;
      while (xmlNode){
        if (xmlNode.nodeName == "property"){
          xmlAttributeMap = xmlNode.attributes;
          if (xmlAttributeMap){
            xmlAttribute = xmlAttributeMap.getNamedItem("name");
            if (xmlAttribute != null && xmlAttribute.specified){
              var name = xmlAttribute.value;
              var value = xmlNode.textContent;
              xmlAttribute = xmlAttributeMap.getNamedItem("type");
              if (xmlAttribute != null && xmlAttribute.specified){
                switch (xmlAttribute.value.toLocaleLowerCase()){
                  case "boolean":
                    if (value == null
                      || value.toLocaleLowerCase() == "false"
                        || parseInt(value) == 0 || parseFloat(value) == 0.0)
                      value = false;
                    else
                      value = true;
                    break;
                  case "integer":
                    value = parseInt(value);
                    break;
                  case "float":
                    value = parseFloat(value);
                    break;
                  case "string":
                  default:
                    value = new String(value);
                    break;
                }
              }

              if (!this.propertysList)
                this.propertysList = new Array();
              this.propertysList[name] = value;
            }
          }
          
        }
        xmlNode = xmlNode.nextSibling;
      }
    }
  }
  
//  разбор узла "param"
  function parseParamNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;
    
    var srcBase = null;
    if (srcNode.ownerDocument.source)
    {
      var tmp = new String(srcNode.ownerDocument.source).replace("/\/.g", "\\").split("\\")
      tmp.pop();
      srcBase = tmp.join("\\");
    }

    if(srcNode.nodeName == "param"){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        xmlAttribute = xmlAttributeMap.getNamedItem("src");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectSrc = scene.Utils.makePathSrc(srcBase, xmlAttribute.value);
        //  START rnmc_stdFlash  SPECIFICS
        xmlAttribute = xmlAttributeMap.getNamedItem("folder");
        if (xmlAttribute != null && xmlAttribute.specified){
          if(this.type == "rnmc_stdFlash"){
            this.objectFolder = xmlAttribute.value.toString();
            xmlAttribute = xmlAttributeMap.getNamedItem("src");
            if (xmlAttribute != null && xmlAttribute.specified)
              this.objectSrc = xmlAttribute.value;
          }
        }
        //  END rnmc_stdFlash  SPECIFICS
        xmlAttribute =  xmlAttributeMap.getNamedItem("x");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("y");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectY = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("width");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectWidth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("height");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectHeight = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("depth");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectDepth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("opacity");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectOpacity = parseFloat(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("hitArea");
        if (xmlAttribute != null && xmlAttribute.specified && 
            xmlAttribute.value != "")
          this.objectHitArea = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("ratio");
        if (xmlAttribute != null && xmlAttribute.specified && xmlAttribute.value == "true")
          this.objectRatio = true;

      //  параметры вывода объекта на экран
        xmlAttribute =  xmlAttributeMap.getNamedItem("sizeMode");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "normal":  
            this.sizeMode = SIZE_MODE_NORMAL;
            break;
          case "fit":  
            this.sizeMode = SIZE_MODE_FIT;
            break;
          case "fit_only_big":  
            this.sizeMode = SIZE_MODE_FIT_ONLY_BIG;
            break;
          case "crop":  
            this.sizeMode = SIZE_MODE_CROP;
            break;
          }
        }

        xmlAttribute =  xmlAttributeMap.getNamedItem("hAlign");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "left":  
            this.horizontalAlign = H_ALIGN_LEFT;
            break;
          case "center":  
            this.horizontalAlign = H_ALIGN_CENTER;
            break;
          case "right":  
            this.horizontalAlign = H_ALIGN_RIGHT;
            break;
          }
        }

        xmlAttribute =  xmlAttributeMap.getNamedItem("vAlign");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "top":  
            this.verticalAlign = V_ALIGN_TOP;
            break;
          case "center":  
            this.verticalAlign = V_ALIGN_CENTER;
            break;
          case "bottom":  
            this.verticalAlign = V_ALIGN_BOTTOM;
            break;
          }
        }  

        xmlAttribute =  xmlAttributeMap.getNamedItem("layoutMode");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "none":  
            this.layoutMode = LAYOUT_NO;
            break;
          case "vertical":  
            this.layoutMode = LAYOUT_VERTICAL;
            break;
          case "horizontal":  
            this.layoutMode = LAYOUT_HORIZONTAL;
            break;
          }
        }  
        
/*
      //  выводимая часть объекта область
        xmlAttribute =  xmlAttributeMap.getNamedItem("displayArea");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectDisplayArea = xmlAttribute.value;
      //  выводимая часть объекта область
        xmlAttribute =  xmlAttributeMap.getNamedItem("displayStyle");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectDisplayArea = xmlAttribute.value;
      //  выводимая часть объекта область
        xmlAttribute =  xmlAttributeMap.getNamedItem("visibleArea");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectVisibleArea = xmlAttribute.value;
*/

      //  специфичные для текста параметры
        xmlAttribute = xmlAttributeMap.getNamedItem("style");
        if (xmlAttribute != null && xmlAttribute.specified)
          if(scene.StyleManager.styleExists(xmlAttribute.value))
            this.objectStyle = xmlAttribute.value;
        xmlAttribute = xmlAttributeMap.getNamedItem("scroll");
        if (xmlAttribute != null && xmlAttribute.specified){
          if (xmlAttribute.value.toLowerCase() == "true")
            this.objectScroll = true;
          else if (xmlAttribute.value.toLowerCase() == "false")
            this.objectScroll = false;
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectBgColor = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor_active");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectBgColorActive = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor_disable");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.objectBgColorDisable = xmlAttribute.value;
        xmlAttribute = xmlAttributeMap.getNamedItem("loop");
        if (xmlAttribute != null && xmlAttribute.specified
          && xmlAttribute.value.toLowerCase() == "true")
          this.objectLoop = true;

        xmlAttribute = xmlAttributeMap.getNamedItem("rewind");
        if (xmlAttribute != null && xmlAttribute.specified){
          if(xmlAttribute.value.toLowerCase() == "true"){
            this.objectRewind = true;
          } else if(xmlAttribute.value.toLowerCase() == "false"){
            this.objectRewind = false;
          }
        }

        xmlAttribute = xmlAttributeMap.getNamedItem("setFocus");
        if (xmlAttribute != null && xmlAttribute.specified){
          if(xmlAttribute.value.toLowerCase() == "true")
            this.objectSetFocus = true;
          else if(xmlAttribute.value.toLowerCase() == "false")
            this.objectSetFocus = false;
        }        
        
        // Для проверки полей ввода в группе
        xmlAttribute = xmlAttributeMap.getNamedItem("checkMode");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "after_write":  
            this.checkModeAfter = CHECK_MODE_AFTER_WRITE;
            break;
          case "after_read_only":  
            this.checkModeAfter = CHECK_MODE_AFTER_READ_ONLY;
            break;
          }
        }        
      }
    //  для шаблона Integration
      xmlAttribute = xmlAttributeMap.getNamedItem("quantity");
      if (xmlAttribute != null && xmlAttribute.specified){
        this.quantity = parseInt(xmlAttribute.value);
      }
      
      var xmlNode;
      xmlNode = srcNode.firstChild;
      while(xmlNode){
        if(xmlNode.nodeName.toLowerCase() == "resultof"){
          this.parseCountingResults(xmlNode);
        }
        xmlNode = xmlNode.nextSibling;
      }
      
      if (this.crAlgorithm != "not_init" && this.childObjects){
        for(var i = 0; i < this.childObjects.length; i++){
          if ("crAlgorithm" in this.childObjects[i] &&
              this.childObjects[i].crAlgorithm){
            if (this.childObjects[i].crAlgorithm == "not_init"){
              this.childObjects[i].crAlgorithm = this.crAlgorithm;
            }
          }
        }
      }
    }
  }

//  разбор узла "control"
  function parseControlNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "control" && this.initializeControl){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.controlDefined = true;
        xmlAttribute = xmlAttributeMap.getNamedItem("style");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.controlStyle = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("x");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.controlX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("y");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.controlY = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("depth");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.controlDepth = parseInt(xmlAttribute.value);
        else
          this.controlDepth = this.objectDepth;

        xmlAttribute =  xmlAttributeMap.getNamedItem("attachPoint");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.controlAttachPoint = true;
          switch((xmlAttribute.value).toUpperCase()){
            case "ABOVE_FROMLEFT":
            case "FROMLEFT_ABOVE":
              this.controlAttachStyle = ATTACH_ABOVE_FROMLEFT;
              break;

            case "ABOVE_LEFT":
            case "LEFT_ABOVE":
              this.controlAttachStyle = ATTACH_ABOVE_LEFT;
              break;

            case "ABOVE_CENTER":
            case "CENTER_ABOVE":
              this.controlAttachStyle = ATTACH_ABOVE_CENTER;
              break;

            case "ABOVE_RIGHT":
            case "RIGHT_ABOVE":
              this.controlAttachStyle = ATTACH_ABOVE_RIGHT;
              break;
              
            case "ABOVE_FROMRIGHT":
            case "FROMRIGHT_ABOVE":
              this.controlAttachStyle = ATTACH_ABOVE_FROMRIGHT;
              break;

            case "TOP_FROMLEFT":
            case "FROMLEFT_TOP":
              this.controlAttachStyle = ATTACH_TOP_FROMLEFT;
              break;

            case "TOP_LEFT":
            case "LEFT_TOP":
              this.controlAttachStyle = ATTACH_TOP_LEFT;
              break;

            case "TOP_CENTER":
            case "CENTER_TOP":
              this.controlAttachStyle = ATTACH_TOP_CENTER;
              break;

            case "TOP_RIGHT":
            case "RIGHT_TOP":
              this.controlAttachStyle = ATTACH_TOP_RIGHT;
              break;

            case "TOP_FROMRIGHT":
            case "FROMRIGHT_TOP":
              this.controlAttachStyle = ATTACH_TOP_FROMRIGHT;
              break;

            case "CENTER_FROMLEFT":
            case "FROMLEFT_CENTER":
              this.controlAttachStyle = ATTACH_CENTER_FROMLEFT;
              break;

            case "CENTER_LEFT":
            case "LEFT_CENTER":
              this.controlAttachStyle = ATTACH_CENTER_LEFT;
              break;

            case "CENTER_CENTER":
              this.controlAttachStyle = ATTACH_CENTER_CENTER;
              break;

            case "CENTER_RIGHT":
            case "RIGHT_CENTER":
              this.controlAttachStyle = ATTACH_CENTER_RIGHT;
              break;

            case "CENTER_FROMRIGHT":
            case "FROMRIGHT_CENTER":
              this.controlAttachStyle = ATTACH_CENTER_FROMRIGHT;
              break;

            case "BOTTOM_FROMLEFT":
            case "FROMLEFT_BOTTOM":
              this.controlAttachStyle = ATTACH_BOTTOM_FROMLEFT;
              break;

            case "BOTTOM_LEFT":
            case "LEFT_BOTTOM":
              this.controlAttachStyle = ATTACH_BOTTOM_LEFT;
              break;

            case "BOTTOM_CENTER":
            case "CENTER_BOTTOM":
              this.controlAttachStyle = ATTACH_BOTTOM_CENTER;
              break;

            case "BOTTOM_RIGHT":
            case "RIGHT_BOTTOM":
              this.controlAttachStyle = ATTACH_BOTTOM_RIGHT;
              break;

            case "BOTTOM_FROMRIGHT":
            case "FROMRIGHT_BOTTOM":
              this.controlAttachStyle = ATTACH_BOTTOM_FROMRIGHT;
              break;

            case "BELOW_FROMLEFT":
            case "FROMLEFT_BELOW":
              this.controlAttachStyle = ATTACH_BELOW_FROMLEFT;
              break;

            case "BELOW_LEFT":
            case "LEFT_BELOW":
              this.controlAttachStyle = ATTACH_BELOW_LEFT;
              break;

            case "BELOW_CENTER":
            case "CENTER_BELOW":
              this.controlAttachStyle = ATTACH_BELOW_CENTER;
              break;

            case "BELOW_RIGHT":
            case "RIGHT_BELOW":
              this.controlAttachStyle = ATTACH_BELOW_RIGHT;
              break;

            case "BELOW_FROMRIGHT":
            case "FROMRIGHT_BELOW":
              this.controlAttachStyle = ATTACH_BELOW_FROMRIGHT;
              break;

            default:
              this.controlAttachPoint = false;
              break;              
          }
        }
      }
    }
  }

//  разбор узла "title"
  function parseTitleNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "title" && this.initializeTitle){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.titleDefined = true;
        if(srcNode.textContent)
          this.titleValue = srcNode.textContent;
        xmlAttribute =  xmlAttributeMap.getNamedItem("visible");
        if (xmlAttribute != null && xmlAttribute.specified
          && xmlAttribute.value == "true")
          this.titleVisible = true;
        xmlAttribute = xmlAttributeMap.getNamedItem("style");
        if (xmlAttribute != null && xmlAttribute.specified){
          if(scene.StyleManager.styleExists(xmlAttribute.value))
            this.titleStyle = xmlAttribute.value;
        }
        xmlAttribute = xmlAttributeMap.getNamedItem("src");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.titleSrc = xmlAttribute.value;
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("x");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("y");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleY = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("width");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleWidth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("height");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleHeight = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("depth");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleDepth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleBgColor = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("relative");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.titleRelative = new Boolean(xmlAttribute.value);

        xmlAttribute =  xmlAttributeMap.getNamedItem("attachPoint");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toUpperCase()){
            case "ABOVE_FROMLEFT":
            case "FROMLEFT_ABOVE":
              this.titleAttachStyle = ATTACH_ABOVE_FROMLEFT;
              break;

            case "ABOVE_LEFT":
            case "LEFT_ABOVE":
              this.titleAttachStyle = ATTACH_ABOVE_LEFT;
              break;

            case "ABOVE_CENTER":
            case "CENTER_ABOVE":
              this.titleAttachStyle = ATTACH_ABOVE_CENTER;
              break;

            case "ABOVE_RIGHT":
            case "RIGHT_ABOVE":
              this.titleAttachStyle = ATTACH_ABOVE_RIGHT;
              break;
              
            case "ABOVE_FROMRIGHT":
            case "FROMRIGHT_ABOVE":
              this.titleAttachStyle = ATTACH_ABOVE_FROMRIGHT;
              break;

            case "TOP_FROMLEFT":
            case "FROMLEFT_TOP":
              this.titleAttachStyle = ATTACH_TOP_FROMLEFT;
              break;

            case "TOP_LEFT":
            case "LEFT_TOP":
              this.titleAttachStyle = ATTACH_TOP_LEFT;
              break;

            case "TOP_CENTER":
            case "CENTER_TOP":
              this.titleAttachStyle = ATTACH_TOP_CENTER;
              break;

            case "TOP_RIGHT":
            case "RIGHT_TOP":
              this.titleAttachStyle = ATTACH_TOP_RIGHT;
              break;

            case "TOP_FROMRIGHT":
            case "FROMRIGHT_TOP":
              this.titleAttachStyle = ATTACH_TOP_FROMRIGHT;
              break;

            case "CENTER_FROMLEFT":
            case "FROMLEFT_CENTER":
              this.titleAttachStyle = ATTACH_CENTER_FROMLEFT;
              break;

            case "CENTER_LEFT":
            case "LEFT_CENTER":
              this.titleAttachStyle = ATTACH_CENTER_LEFT;
              break;

            case "CENTER_CENTER":
              this.titleAttachStyle = ATTACH_CENTER_CENTER;
              break;

            case "CENTER_RIGHT":
            case "RIGHT_CENTER":
              this.titleAttachStyle = ATTACH_CENTER_RIGHT;
              break;

            case "CENTER_FROMRIGHT":
            case "FROMRIGHT_CENTER":
              this.titleAttachStyle = ATTACH_CENTER_FROMRIGHT;
              break;

            case "BOTTOM_FROMLEFT":
            case "FROMLEFT_BOTTOM":
              this.titleAttachStyle = ATTACH_BOTTOM_FROMLEFT;
              break;

            case "BOTTOM_LEFT":
            case "LEFT_BOTTOM":
              this.titleAttachStyle = ATTACH_BOTTOM_LEFT;
              break;

            case "BOTTOM_CENTER":
            case "CENTER_BOTTOM":
              this.titleAttachStyle = ATTACH_BOTTOM_CENTER;
              break;

            case "BOTTOM_RIGHT":
            case "RIGHT_BOTTOM":
              this.titleAttachStyle = ATTACH_BOTTOM_RIGHT;
              break;

            case "BOTTOM_FROMRIGHT":
            case "FROMRIGHT_BOTTOM":
              this.titleAttachStyle = ATTACH_BOTTOM_FROMRIGHT;
              break;

            case "BELOW_FROMLEFT":
            case "FROMLEFT_BELOW":
              this.titleAttachStyle = ATTACH_BELOW_FROMLEFT;
              break;

            case "BELOW_LEFT":
            case "LEFT_BELOW":
              this.titleAttachStyle = ATTACH_BELOW_LEFT;
              break;

            case "BELOW_CENTER":
            case "CENTER_BELOW":
              this.titleAttachStyle = ATTACH_BELOW_CENTER;
              break;

            case "BELOW_RIGHT":
            case "RIGHT_BELOW":
              this.titleAttachStyle = ATTACH_BELOW_RIGHT;
              break;

            case "BELOW_FROMRIGHT":
            case "FROMRIGHT_BELOW":
              this.titleAttachStyle = ATTACH_BELOW_FROMRIGHT;
              break;

            default:
              this.titleAttachStyle = ATTACH_NOATTACH;
              break;              
          }
        }
      }
    }
  }
  
//  разбор узла "rollovermenu"
  function parseRolloverMenuNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;
    
    if(srcNode.nodeName == "rollovermenu" && this.initializeRolloverMenu){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.rolloverMenuDefined = true;
        xmlAttribute =  xmlAttributeMap.getNamedItem("attachPoint");
        if (!xmlAttribute)
          xmlAttribute =  xmlAttributeMap.getNamedItem("point");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch(xmlAttribute.value){
          case "TOP_LEFT":
            this.rolloverMenuPoint = ROLLOVERMENU_POINT_LEFTTOP;
            break;
          case "BOTTOM_LEFT":
            this.rolloverMenuPoint = ROLLOVERMENU_POINT_LEFTBOTTOM;
            break;
          case "TOP_RIGHT":
            this.rolloverMenuPoint = ROLLOVERMENU_POINT_RIGHTTOP;
            break;
          case "BOTTOM_RIGHT":
            this.rolloverMenuPoint = ROLLOVERMENU_POINT_RIGHTBOTTOM;
            break;
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("x");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.rolloverMenuX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("y");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.rolloverMenuY = parseInt(xmlAttribute.value);
        //  НОВЫЙ ВАРИАНТ: опции указываются через запятую в нужном порядке вывода на экран
        xmlAttribute =  xmlAttributeMap.getNamedItem("options");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.rolloverMenuOptions = (xmlAttribute.value).split(",");
        if(!this.rolloverMenuOptions){
          xmlAttribute =  xmlAttributeMap.getNamedItem("save");
          if (xmlAttribute != null && xmlAttribute.specified
            && xmlAttribute.value == "true")
            this.rolloverMenuSaveOption = true;
          xmlAttribute =  xmlAttributeMap.getNamedItem("copy");
          if (xmlAttribute != null && xmlAttribute.specified
            && xmlAttribute.value == "true")
            this.rolloverMenuCopyOption = true;
          xmlAttribute =  xmlAttributeMap.getNamedItem("zoom");
          if (xmlAttribute != null && xmlAttribute.specified
            && xmlAttribute.value == "true")
            this.rolloverMenuZoomOption = true;
          if(this.rolloverMenuSaveOption == false &&
            this.rolloverMenuCopyOption == false &&
            this.rolloverMenuZoomOption == false){
            this.rolloverMenuDefined = false;
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("area");
        if (xmlAttribute != null && xmlAttribute.specified){
          var rectArea  = scene.Utils.parseRectToArray(xmlAttribute.value);
          if (rectArea){
            this.rolloverMenuAreaX = rectArea[0];
            this.rolloverMenuAreaY = rectArea[1];
            this.rolloverMenuAreaWidth = rectArea[2];
            this.rolloverMenuAreaHeight = rectArea[3];
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("style");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.rolloverMenuStyle = xmlAttribute.value;
          this.rolloverMenuDefined = true;
        }
      }
    }
  }

  function parseAttachNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "attach"){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.rolloverMenuDefined = true;
        xmlAttribute =  xmlAttributeMap.getNamedItem("target");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.autoAttachTarget = xmlAttribute.value;
        xmlAttribute =  xmlAttributeMap.getNamedItem("direction");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toUpperCase()){
          case "LEFT_ABOVE":
            this.autoAttachStyle = AUTOATTACH_LEFT_ABOVE;
            break;
          case "LEFT_TOP":
            this.autoAttachStyle = AUTOATTACH_LEFT_TOP;
            break;
          case "LEFT_CENTER":
            this.autoAttachStyle = AUTOATTACH_LEFT_CENTER;
            break;
          case "LEFT_BOTTOM":
            this.autoAttachStyle = AUTOATTACH_LEFT_BOTTOM;
            break;
          case "LEFT_BELOW":
            this.autoAttachStyle = AUTOATTACH_LEFT_BELOW;
            break;
          case "TOP_LEFT":
            this.autoAttachStyle = AUTOATTACH_TOP_LEFT;
            break;
          case "TOP_CENTER":
            this.autoAttachStyle = AUTOATTACH_TOP_CENTER;
            break;
          case "TOP_RIGHT":
            this.autoAttachStyle = AUTOATTACH_TOP_RIGHT;
            break;
          case "RIGHT_ABOVE":
            this.autoAttachStyle = AUTOATTACH_RIGHT_ABOVE;
            break;
          case "RIGHT_TOP":
            this.autoAttachStyle = AUTOATTACH_RIGHT_TOP;
            break;
          case "RIGHT_CENTER":
            this.autoAttachStyle = AUTOATTACH_RIGHT_CENTER;
            break;
          case "RIGHT_BOTTOM":
            this.autoAttachStyle = AUTOATTACH_RIGHT_BOTTOM;
            break;
          case "RIGHT_BELOW":
            this.autoAttachStyle = AUTOATTACH_RIGHT_BELOW;
            break;
          case "BOTTOM_LEFT":
            this.autoAttachStyle = AUTOATTACH_BOTTOM_LEFT;
            break;
          case "BOTTOM_CENTER":
            this.autoAttachStyle = AUTOATTACH_BOTTOM_CENTER;
            break;
          case "BOTTOM_RIGHT":
            this.autoAttachStyle = AUTOATTACH_BOTTOM_RIGHT;
            break;
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("offsetX");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.autoAttachOffsetX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("offsetY");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.autoAttachOffsetY = parseInt(xmlAttribute.value);
      }
    }
  }

//  разбор узла "hint"
  function parseHintNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "hint" && this.initializeHint){

      var srcBase = null;
      if (srcNode.ownerDocument.source){
        var tmp = new String(srcNode.ownerDocument.source).replace("/\/.g", "\\").split("\\")
        tmp.pop();
        srcBase = tmp.join("\\");
      }

      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.hintDefined = true;
        xmlAttribute =  xmlAttributeMap.getNamedItem("event");
        if (xmlAttribute != null && xmlAttribute.specified){
          if(xmlAttribute.value == "onPress")
            this.hintEvent = HINT_EVENT_ONPRESS;
          else if(xmlAttribute.value == "onRollOver")
            this.hintEvent = HINT_EVENT_ONROLLOVER;
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("type");
        if (xmlAttribute != null && xmlAttribute.specified){
          switch((xmlAttribute.value).toLowerCase()){
          case "text":
            this.hintType = HINT_TYPE_TEXT;
            if(srcNode.textContent){
              this.hintValue = srcNode.textContent;
            }
            break;
          case "external_text":
            this.hintType = HINT_TYPE_EXTERNALTEXT;
            break;
          case "image":
            this.hintType = HINT_TYPE_IMAGE;
            break;
          case "audio":
            this.hintType = HINT_TYPE_AUDIO;
            break;
          case "video":
            this.hintType = HINT_TYPE_VIDEO;
            break;
          default:
            break;
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("src");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.hintValue = scene.Utils.makePathSrc(srcBase, xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("width");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.hintWidth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("height");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.hintHeight = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("depth");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.hintDepth = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("bgcolor");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.hintBgColor = xmlAttribute.value;

		switch (this.hintEvent) {
          case HINT_EVENT_ONPRESS:
            this.attachPressHandler = true;
            this.attachRollOutHandler = true;
            break;
          case HINT_EVENT_ONROLLOVER:
            this.attachRollOverHandler = true;
            this.attachRollOutHandler = true;
            break;
        }
      }
    }
  }

  function parseDraggingNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;
    if(srcNode.nodeName == "drag"){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        xmlAttribute =  xmlAttributeMap.getNamedItem("enabled");
        if (xmlAttribute != null && xmlAttribute.specified){
          if((xmlAttribute.value).toLowerCase() == "true"){
            this.draggingEnabled = true;
          } else if((xmlAttribute.value).toLowerCase() == "false"){
            this.draggingEnabled = false;
          }
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("xMinBound");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.draggingMinXBound = parseInt(xmlAttribute.value);
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("xMaxBound");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.draggingMaxXBound = parseInt(xmlAttribute.value);
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("yMinBound");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.draggingMinYBound = parseInt(xmlAttribute.value);
        }
        xmlAttribute =  xmlAttributeMap.getNamedItem("yMaxBound");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.draggingMaxYBound = parseInt(xmlAttribute.value);
        }
      }
    }
    return true;
  }

  function parseScrollMenuNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

    if(srcNode.nodeName == "scrollmenu"){
      xmlAttributeMap = srcNode.attributes;
      if (xmlAttributeMap){
        this.scrollMenuDefined = true;
        xmlAttribute =  xmlAttributeMap.getNamedItem("x");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.scrollMenuX = parseInt(xmlAttribute.value);
        xmlAttribute =  xmlAttributeMap.getNamedItem("y");
        if (xmlAttribute != null && xmlAttribute.specified)
          this.scrollMenuY = parseInt(xmlAttribute.value);
      }
    }
  }

  function parseActionsNode(srcNode){
    var xmlAttributeMap = null;
    var xmlAttribute = null;

/*  ПАМЯТКА - КАКИЕ СПИСКИ ДЕЙСТВИЙ МОГУТ БЫТЬ
  EVENT_ON_PRESS            //  нажатие кнопки мыши
  EVENT_ON_RELEASE          //  отпускание кнопки мыши
  EVENT_ON_ROLLOVER          //  наезд на объект
  EVENT_ON_ROLLOUT          //  съезд с объекта
  EVENT_ON_SHOW            //  объект показан
  EVENT_ON_HIDE            //  объект спрятан
  EVENT_ON_START_EFFECT        //  стартовал эффект (подразумевается эффект с некоторым id)
  EVENT_ON_COMPLETE_EFFECT      //  завершился эффект (подразумевается эффект с некоторым id)
  // специфичные для quicktime
  EVENT_QUICKTIME_ON_ENTER_NODE    //  вход в узел
  EVENT_QUICKTIME_ON_LEAVE_NODE    //  выход из узла
  EVENT_QUICKTIME_ON_ENTER_HOTSPOT  //  наезд на зону
  EVENT_QUICKTIME_ON_LEAVE_HOTSPOT  //  съезд с зоны
  EVENT_QUICKTIME_ON_TRIGGER_HOTSPOT  //  нажатие на зону
  // специфичные для InputBoxEx
  EVENT_INPUTBOX_ON_ALL_COMPLETE // вызывается, когда в группе все поля 
                                 // запелнены верно
  EVENT_INPUTBOX_ON_ALL_WRONG // вызывается, когда в группе есть хотя бы одно
                              // поле неверно заполненное
  
  EVENT_ON_PLAYED
  EVENT_ON_PAUSED
  EVENT_ON_STOPPED

//  события для таскаемых объектов в Integration
  EVENT_ON_PLACEDRIGHT
  EVENT_ON_PLACEDWRONG
  EVENT_ON_ENTERTARGET
  EVENT_ON_LEAVETARGET
  
 // срабатывание обязательных объектов
  EVENT_ON_ALL_OBJECTIVES
  EVENT_ON_ALL_MANDATORY_OBJECTIVES
*/

    if(srcNode.nodeName == "actions"){
      if(!this.actionsList)
        this.actionsList = new Array();
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPress");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_PRESS] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_PRESS].push(newActionsArray[i]);
        this.attachPressHandler = true;
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onRelease");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_RELEASE] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_RELEASE].push(newActionsArray[i]);
        this.attachReleaseHandler = true;
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onRollOver");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ROLLOVER] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_ROLLOVER].push(newActionsArray[i]);
        this.attachRollOverHandler = true;
	
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onRollOut");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ROLLOUT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_ROLLOUT].push(newActionsArray[i]);
        this.attachRollOutHandler = true;
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onShow");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_SHOW] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_SHOW].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onHide");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_HIDE] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_HIDE].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onStartEffect");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_START_EFFECT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_START_EFFECT].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onCompleteEffect");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_COMPLETE_EFFECT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_COMPLETE_EFFECT].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onZoomIn");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ZOOM_IN] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_ZOOM_IN].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onZoomOut");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ZOOM_OUT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_ZOOM_OUT].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPlayed");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_PLAYED] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++){
          this.actionsList[EVENT_ON_PLAYED].push(newActionsArray[i]);
        }
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPlay");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_PLAY] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++){
          this.actionsList[EVENT_ON_PLAY].push(newActionsArray[i]);
        }
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPause");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_PAUSE] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++){
          this.actionsList[EVENT_ON_PAUSE].push(newActionsArray[i]);
        }
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onStop");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_STOP] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_STOP].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onAllInputBoxComplete");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_INPUTBOX_ON_ALL_COMPLETE] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_INPUTBOX_ON_ALL_COMPLETE].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onAllInputBoxWrong");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_INPUTBOX_ON_ALL_WRONG] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_INPUTBOX_ON_ALL_WRONG].push(newActionsArray[i]);
      }

      //  события для таскаемых объектов в Integration
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPlacedRight");
      if(newActionsArray && newActionsArray.length > 0){
        this.onPlacedRightActions = true;
          this.actionsList[EVENT_ON_PLACEDRIGHT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_PLACEDRIGHT].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onPlacedWrong");
      if(newActionsArray && newActionsArray.length > 0){
        this.onPlacedWrongActions = true;
        this.actionsList[EVENT_ON_PLACEDWRONG] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_PLACEDWRONG].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onEnterTarget");
      if(newActionsArray && newActionsArray.length > 0){
        this.onEnterTargetActions = true;
        this.actionsList[EVENT_ON_ENTERTARGET] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_ENTERTARGET].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onLeaveTarget");
      if(newActionsArray && newActionsArray.length > 0){
        this.onLeaveTargetActions = true;
        this.actionsList[EVENT_ON_LEAVETARGET] = new Array();
        for(var i = 0 ; i < newActionsArray.length; i++)
          this.actionsList[EVENT_ON_LEAVETARGET].push(newActionsArray[i]);
      }

      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onAllObjectives");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ALL_OBJECTIVES] = new Array();
        for(var i = 0 ; i < newActionsArray.length; ++i)
          this.actionsList[EVENT_ON_ALL_OBJECTIVES].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onAllMandatoryObjectives");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_ALL_MANDATORY_OBJECTIVES] = new Array();
        for(var i = 0 ; i < newActionsArray.length; ++i)
          this.actionsList[EVENT_ON_ALL_MANDATORY_OBJECTIVES].push(newActionsArray[i]);
      }
      newActionsArray = scene.Utils.parseActionsNode(srcNode, "onTimeOut");
      if(newActionsArray && newActionsArray.length > 0){
        this.actionsList[EVENT_ON_TIME_OUT] = new Array();
        for(var i = 0 ; i < newActionsArray.length; ++i)
          this.actionsList[EVENT_ON_TIME_OUT].push(newActionsArray[i]);
      }
 
      newActionsArray = null;
    }

    return true;
  }

//  добавляет 
  function addAction(forEvent, newAction){
  }

//  удалить действие с неокторым id из заданной группы
  function removeAction(){
  }

  function applyActions(onEvent){
    var strAction = null;
    switch (onEvent)
    {
      case EVENT_ON_PLAY:     strAction = "onPlay";    break;
      case EVENT_ON_PAUSE:    strAction = "onPause";   break;
      case EVENT_ON_STOP:     strAction = "onStop";    break;
      case EVENT_ON_ZOOM_IN:  strAction = "onZoomIn";  break;
      case EVENT_ON_ZOOM_OUT: strAction = "onZoomOut"; break;
    }

    if(strAction && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == strAction){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }

    if (checkActions(onEvent)){
      if(!this.actionDispatcherObject){
        var object = this;
        while (object){
          if ("dispatchAction" in object){
            this.actionDispatcherObject = object;
            break;
          }
          object = object.parent;
        }
      }
      if(this.actionDispatcherObject){
        for(var i = 0; i < this.actionsList[onEvent].length; i++)
            this.actionDispatcherObject.dispatchAction(this.actionsList[onEvent][i]);
      }

      switch (onEvent)
      {
        case EVENT_ON_ALL_MANDATORY_OBJECTIVES:
        case EVENT_ON_ALL_OBJECTIVES:
          this.actionsList[onEvent].already = true;
          break;

        default:
          break;
      }
    }
  }
 
  // Прверяет, установленн ли обработчик onEvent
  function checkActions(onEvent){
    if (this.actionsList && this.actionsList[onEvent]){
      switch (onEvent){
        case EVENT_ON_ALL_OBJECTIVES:
        case EVENT_ON_ALL_MANDATORY_OBJECTIVES:
          return !this.actionsList[onEvent].already;

        default:
          return true;
      }
    }
    
    return false;
  }

//  =============================  ПОДПИСЬ  ===================================
//  создание подписи
  function createTitleObject(){
    // если определена подпись
    if((this.titleValue || this.titleSrc) && !this.titleObject){
      this.titleObject = new Text();
      this.titleObject.adjustHeight = false;
      this.titleObject.visible = false;
      if (this.titleRelative){
        this.titleObject.x = this.objectX + this.titleX;
        this.titleObject.y = this.objectY + this.titleY;
      }
      else{
        this.titleObject.x = this.titleX;
        this.titleObject.y = this.titleY;
      }
      if(this.titleWidth > 0)
        this.titleObject.width = this.titleWidth;
      if(this.titleHeight > 0)
        this.titleObject.height = this.titleHeight;
      this.titleObject.depth = this.titleDepth;
      if(this.titleBgColor)
        this.titleObject.bkgColor = this.titleBgColor;
      if(this.titleSrc)
        this.titleObject.src = this.titleSrc;
      if(this.titleValue)
        this.titleObject.value = this.titleValue;
      this.titleObject.parent = this;
      if(this.titleStyle)
        this.titleObject.style = this.titleStyle;

      if (this.titleObject.getMediaSize().height > this.titleObject.height
        && this.titleObject.pageSize > 0 && this.titleObject.textSize > 0){
      // необходимо поставить скроллинг
        this.titleObject.scrollTo = function(scrollPos, is_horizontal){
          if (!is_horizontal)
            this.scrollToLine(scrollPos);
        }
      }

  //  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      this.titleObject.onMouseWheel = function(){
        if (Mouse.target == this
          && this.scrollTo != undefined
          && this.scrollTo != null){
           var scroll_pos = this.scrollTop - parseInt(Mouse.delta/120);
           if (this.scroller)
             this.scroller.setClientPos(scroll_pos);
           else
             this.scrollTo(scroll_pos, false);
 
           if (this.scroller)
             this.scroller.setSliderPos(this.scrollTop/scroller.scrollMax);
        }
      }
      
      this.titleObject.onPressLink = function(){
        scene.Utils.fireLink(this.getLinkInfo().href, this);
      };
      this.titleObject.onRollOutLink = function(){
        if (scene.Hint)
          scene.Hint.hideHint();
      };

      if(this.titleVisible)
        this.titleObject.visible = true;
    }
  }

  function destroyTitleObject(){
    if(this.titleObject){
      if(this.titleObject.scroller){
        this.titleObject.scroller.parent = null;
        this.titleObject.scroller = null;
      }
      this.titleObject.parent = null;
      this.titleObject = null;
    }
  }

//  ==========================  CONTROL  ============================
//  функции работы с control
  function repositionControlPos(){
    if(!this.controlDefined || !this.attachedControl
      || !this.controlAttachPoint)
      return;

    var mediaSize;
    if (this.objectContent && ("getMediaSize" in this.objectContent)){
      mediaSize = this.objectContent.getMediaSize();
    }
    else{
      mediaSize = new Object();
      mediaSize.width = 0;
      mediaSize.height = 0;
    }

    if (this.objectWidth > 0)
      mediaSize.width = this.objectWidth;
    if (this.objectHeight > 0)
      mediaSize.height = this.objectHeight;

    switch(this.controlAttachStyle){
      case ATTACH_ABOVE_FROMLEFT:
      case ATTACH_ABOVE_LEFT:
      case ATTACH_ABOVE_CENTER:
      case ATTACH_ABOVE_RIGHT:
      case ATTACH_ABOVE_FROMRIGHT:
        this.attachedControl.y = this.objectY + this.controlY
          - this.attachedControl.height;
        break;

      case ATTACH_TOP_FROMLEFT:
      case ATTACH_TOP_LEFT:
      case ATTACH_TOP_CENTER:
      case ATTACH_TOP_RIGHT:
      case ATTACH_TOP_FROMRIGHT:
        this.attachedControl.y = this.objectY + this.controlY;
        break;

      case ATTACH_CENTER_FROMLEFT:
      case ATTACH_CENTER_LEFT:
      case ATTACH_CENTER_CENTER:
      case ATTACH_CENTER_RIGHT:
      case ATTACH_CENTER_FROMRIGHT:
        this.attachedControl.y = this.objectY + this.controlY
          + (mediaSize.height - this.attachedControl.height)/2;
        break;

      case ATTACH_BOTTOM_FROMLEFT:
      case ATTACH_BOTTOM_LEFT:
      case ATTACH_BOTTOM_CENTER:
      case ATTACH_BOTTOM_RIGHT:
      case ATTACH_BOTTOM_FROMRIGHT:
        this.attachedControl.y = this.objectY + this.controlY
          + mediaSize.height - this.attachedControl.height;
        break;

      case ATTACH_BELOW_FROMLEFT:
      case ATTACH_BELOW_LEFT:
      case ATTACH_BELOW_CENTER:
      case ATTACH_BELOW_RIGHT:
      case ATTACH_BELOW_FROMRIGHT:
        this.attachedControl.y = this.objectY + this.controlY
          + mediaSize.height;
        break;
    }

    switch(this.controlAttachStyle){
      case ATTACH_ABOVE_FROMLEFT:
      case ATTACH_TOP_FROMLEFT:
      case ATTACH_CENTER_FROMLEFT:
      case ATTACH_BOTTOM_FROMLEFT:
      case ATTACH_BELOW_FROMLEFT:
        this.attachedControl.x = this.objectX + this.controlX
          - this.attachedControl.width;
        break;

      case ATTACH_ABOVE_LEFT:
      case ATTACH_TOP_LEFT:
      case ATTACH_CENTER_LEFT:
      case ATTACH_BOTTOM_LEFT:
      case ATTACH_BELOW_LEFT:
        this.attachedControl.x = this.objectX + this.controlX;
        break;
      
      case ATTACH_ABOVE_CENTER:
      case ATTACH_TOP_CENTER:
      case ATTACH_CENTER_CENTER:
      case ATTACH_BOTTOM_CENTER:
      case ATTACH_BELOW_CENTER:
        this.attachedControl.x = this.objectX + this.controlX
          + (mediaSize.width - this.attachedControl.width)/2;
        break;

      case ATTACH_ABOVE_RIGHT:
      case ATTACH_TOP_RIGHT:
      case ATTACH_CENTER_RIGHT:
      case ATTACH_BOTTOM_RIGHT:
      case ATTACH_BELOW_RIGHT:
        this.attachedControl.x = this.objectX + this.controlX
          + mediaSize.width - this.attachedControl.width;
        break;

      case ATTACH_ABOVE_FROMRIGHT:
      case ATTACH_TOP_FROMRIGHT:
      case ATTACH_CENTER_FROMRIGHT:
      case ATTACH_BOTTOM_FROMRIGHT:
      case ATTACH_BELOW_FROMRIGHT:
        this.attachedControl.x = this.objectX + this.controlX
          + mediaSize.width;
        break;
    }
  this.attachedControl.depth = this.objectContent.depth;
  }

//  =======================  ПОДПИСЬ  ======================================
//  Функция автоматического позиционирования подписи
  function repositionTitlePos(){
    if(!this.titleDefined || !this.titleObject)
      return;

    var mediaSize;
    if (this.objectContent && ("getMediaSize" in this.objectContent)){
      mediaSize = this.objectContent.getMediaSize();
    }
    else{
      mediaSize = new Object();
      mediaSize.width = 0;
      mediaSize.height = 0;
    }

    if (this.objectWidth > 0)
      mediaSize.width = this.objectWidth;
    if (this.objectHeight > 0)
      mediaSize.height = this.objectHeight;

    switch(this.titleAttachStyle){
      case ATTACH_ABOVE_FROMLEFT:
      case ATTACH_ABOVE_LEFT:
      case ATTACH_ABOVE_CENTER:
      case ATTACH_ABOVE_RIGHT:
      case ATTACH_ABOVE_FROMRIGHT:
        this.titleObject.y = this.objectY + this.titleY
          - this.titleObject.height;
        break;

      case ATTACH_TOP_FROMLEFT:
      case ATTACH_TOP_LEFT:
      case ATTACH_TOP_CENTER:
      case ATTACH_TOP_RIGHT:
      case ATTACH_TOP_FROMRIGHT:
        this.titleObject.y = this.objectY + this.titleY;
        break;

      case ATTACH_CENTER_FROMLEFT:
      case ATTACH_CENTER_LEFT:
      case ATTACH_CENTER_CENTER:
      case ATTACH_CENTER_RIGHT:
      case ATTACH_CENTER_FROMRIGHT:
        this.titleObject.y = this.objectY + this.titleY
          + (mediaSize.height - this.titleObject.height)/2;
        break;

      case ATTACH_BOTTOM_FROMLEFT:
      case ATTACH_BOTTOM_LEFT:
      case ATTACH_BOTTOM_CENTER:
      case ATTACH_BOTTOM_RIGHT:
      case ATTACH_BOTTOM_FROMRIGHT:
        this.titleObject.y = this.objectY + this.titleY
          + mediaSize.height - this.titleObject.height;
        break;

      case ATTACH_BELOW_FROMLEFT:
      case ATTACH_BELOW_LEFT:
      case ATTACH_BELOW_CENTER:
      case ATTACH_BELOW_RIGHT:
      case ATTACH_BELOW_FROMRIGHT:
        this.titleObject.y = this.objectY + this.titleY
          + mediaSize.height;
        break;
    }

    switch(this.titleAttachStyle){
      case ATTACH_ABOVE_FROMLEFT:
      case ATTACH_TOP_FROMLEFT:
      case ATTACH_CENTER_FROMLEFT:
      case ATTACH_BOTTOM_FROMLEFT:
      case ATTACH_BELOW_FROMLEFT:
        this.titleObject.x = this.objectX + this.titleX
          - this.titleObject.width;
        break;

      case ATTACH_ABOVE_LEFT:
      case ATTACH_TOP_LEFT:
      case ATTACH_CENTER_LEFT:
      case ATTACH_BOTTOM_LEFT:
      case ATTACH_BELOW_LEFT:
        this.titleObject.x = this.objectX + this.titleX;
        break;
      
      case ATTACH_ABOVE_CENTER:
      case ATTACH_TOP_CENTER:
      case ATTACH_CENTER_CENTER:
      case ATTACH_BOTTOM_CENTER:
      case ATTACH_BELOW_CENTER:
        this.titleObject.x = this.objectX + this.titleX
          + (mediaSize.width - this.titleObject.width)/2;
        break;

      case ATTACH_ABOVE_RIGHT:
      case ATTACH_TOP_RIGHT:
      case ATTACH_CENTER_RIGHT:
      case ATTACH_BOTTOM_RIGHT:
      case ATTACH_BELOW_RIGHT:
        this.titleObject.x = this.objectX + this.titleX
          + mediaSize.width - this.titleObject.width;
        break;

      case ATTACH_ABOVE_FROMRIGHT:
      case ATTACH_TOP_FROMRIGHT:
      case ATTACH_CENTER_FROMRIGHT:
      case ATTACH_BOTTOM_FROMRIGHT:
      case ATTACH_BELOW_FROMRIGHT:
        this.titleObject.x = this.objectX + this.titleX
          + mediaSize.width;
        break;
    }
  }  

//  =======================  ВСПЛЫАЮЩЕЕ МЕНЮ  ======================================
//  функции работы со всплывающим меню
//  создание объекта всплывающее меню
  function createRolloverMenuObject(){
    if(this.rolloverMenuOptions || this.rolloverMenuSaveOption
      || this.rolloverMenuCopyOption || this.rolloverMenuZoomOption || this.rolloverMenuStyle){
      this.rolloverMenuObject = new Composition();
      this.rolloverMenuObject._class = "rnmc_RollOverMenu";
      this.rolloverMenuObject.parent = scene;//this;
      this.rolloverMenuObject.visible = false;
      this.rolloverMenuObject.depth = -100;
      this.rolloverMenuObject.initObject();
      this.rolloverMenuObject.setCallBack(this, buttonDispatcher);
      this.useHandCursor = false;
    };
  }
//  удаление объекта всплывающее меню
  function destroyRolloverMenuObject(){
    if(this.rolloverMenuObject){
      this.rolloverMenuObject.parent = null;
      this.rolloverMenuObject = null;
    }
  }

  function reattachRolloverMenuObject(attachPoint, offsetX, offsetY){
    var curAttachPoint = this.rolloverMenuPoint;
    var curAttachPointX = this.rolloverMenuX;
    var curAttachPointY = this.rolloverMenuY;

    if(attachPoint)
      curAttachPoint = attachPoint;
    if(offsetX)
      curAttachPointX = offsetX;
    if(offsetY)
      curAttachPointY = offsetY;
    if(this.rolloverMenuObject && this.objectContent){
      var oldVisible = this.rolloverMenuObject.visible;
      this.rolloverMenuObject.visible = false;
      this.rolloverMenuObject.attachToObject(this.objectContent, curAttachPoint,
        curAttachPointX, curAttachPointY);
      this.rolloverMenuObject.visible = oldVisible;
    }
  }  

//  scrollmenu =============================================================================
  function createScrollMenu(){
    if(!this.scrollMenuObject && this.scrollMenuDefined){
      this.scrollMenuObject = new Composition();
      this.scrollMenuObject._class = "rnmc_ScrollMenu";
      this.scrollMenuObject.parent = this;
      this.scrollMenuObject.visible = false;
      this.scrollMenuObject.x = this.scrollMenuX;
      this.scrollMenuObject.y = this.scrollMenuY;
      this.scrollMenuObject.depth = -100;
      this.scrollMenuObject.initObject();
      this.scrollMenuObject.setCallBack(this, this.onScrollObject);
      this.scrollMenuObject.showObject();
    }
  }

//  удаление объекта всплывающее меню
  function destroyScrollMenu(){
    if(this.scrollMenuObject){
      this.scrollMenuObject.parent = null;
      this.scrollMenuObject = null;
    }
  }

  function enableOption(optionId){
    switch(optionId){
    case OPTION_CONTROL:
      break;
    case OPTION_TITLE:
      break;
    case OPTION_HINT:
      break;
    case OPTION_ROLLOVERMENU:
      break;
    case OPTION_ZOOM:
      break;
    case OPTION_ALL:
      break;
    }
  }

  function disableOption(optionId){
    switch(optionId){
    case OPTION_CONTROL:
      break;
    case OPTION_TITLE:
      break;
    case OPTION_HINT:
      break;
    case OPTION_ROLLOVERMENU:
      break;
    case OPTION_ZOOM:
      break;
    case OPTION_ALL:
      break;
    }
  }

  function clearEventHandlers(){
    this.onMouseMove = null;
  /*
  this.objectContent.onRollOver = null;
  this.objectContent.onRollOut = null;
  this.objectContent.onPress = null;
  this.objectContent.onRelease = null;
  */
  }

  function saveAs(){
    if(this.objectContent)
      this.objectContent.saveAs();
  }

  function saveToClipboard(){
    if(this.objectContent instanceof Audio){
      return;
    } else {
      this.objectContent.copyToClipboard();
    }
  }

//  ======================    ЭФФЕКТЫ    ===================
//  ПЕРЕОПРЕДЕЛЕНИЕ  
//  сообщение от эффекта
  function notifyEffectComplete(effectObject){
    if(this.actionsList && this.actionsList[EVENT_ON_COMPLETE_EFFECT]){
      for(var i = 0; i < this.actionsList[EVENT_ON_COMPLETE_EFFECT].length; i++){
        if(this.actionsList[EVENT_ON_COMPLETE_EFFECT][i].eventParam
          && this.actionsList[EVENT_ON_COMPLETE_EFFECT][i].eventParam == effectObject.id){
          parent.dispatchAction(this.actionsList[EVENT_ON_COMPLETE_EFFECT][i]);
        }
      }
    }
    effectObject.clearCallBack();
    this.effectsRunning--;
    if(effectObject.effectEvent == EVENT_ON_HIDE){
      if(this.effectsRunning == 0 && this.objectContent){
        this.unloadObject();
        //  если назначена функция обратного вызова
        if(this.hideCallBackFunction != null && this.hideCallBackObject != null)
          this.hideCallBackFunction.call(this.hideCallBackObject, this.id);
      }
    }
  }

//  ========================  END  ЭФФЕКТЫ    ====================
  function showObject(){
    //  OBJECTIVES for onShow
    if(this.onShowObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onShow"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
    //  END OBJECTIVES for onShow
    
    if(this.rolloverMenuDefined){
      // еcли задано  
      this.createRolloverMenuObject();
      this.onMouseMove = this.mouseMoveHandler;
    } else if(this.draggingEnabled){
      //  если данный медиа объект таскаемый
      this.onMouseMove = this.mouseMoveHandler;
    }
    //  создание объекта подпись
    this.createTitleObject();
    
    this.createScrollMenu();
    
  //	если определена панель управления
    if(this.controlDefined && !this.attachedControl){
      this.attachedControl = scene.ControlManager.getControl(this.controlStyle, this);
    if(this.attachedControl){
        this.attachedControl.visible = false;
        this.attachedControl.x = this.controlX;
        this.attachedControl.y = this.controlY;

        this.attachedControl.depth = this.controlDepth;
        this.attachedControl.setDispatcher(this, this.buttonDispatcher);

        if (this.attachedControl.id == "playcontrol")
          this.playControl = this.attachedControl;
        else
          this.playControl = this.attachedControl.getChildControl("playcontrol");

        if(this.playControl){
          this.playControl.attachToObject(this.objectContent);
          this.playControl.setDispatcher(this, this.buttonDispatcher);
          this.playControl.showObject();
        }
        if(this.zoomObject){
          this.attachedControl.hideChildControl("zoomout");
          this.attachedControl.showChildControl("zoomin");
        }
    //  кнопки, относящиеся к подписи
      if(this.titleObject){
        if(this.titleVisible){
          this.attachedControl.hideChildControl("showtitle");
          this.attachedControl.showChildControl("hidetitle");
        } else {
          this.attachedControl.hideChildControl("hidetitle");
          this.attachedControl.showChildControl("showtitle");
        }
      } else {
        this.attachedControl.hideChildControl("hidetitle");
        this.attachedControl.hideChildControl("showtitle");
      }
        this.attachedControl.showChildControl("save");
        this.attachedControl.showChildControl("copy");
        this.attachedControl.showObject();
      }
    }
    
	//	перебор присоединённых эффектов для показа
    if (this.objectContent){
      this.effectsTarget = this.objectContent;
      var showEffectsCount = this.startEffects(EVENT_ON_SHOW);
      if(showEffectsCount == 0){
        this.objectContent.visible = true;
      }
    }
    
    // если определён хинт
		if(this.hintDefined && this.hintEvent == HINT_EVENT_ONROLLOVER)
			this.objectContent.onRollOver = this.onRollOverHandlerAlias;
		if(this.hintDefined && this.hintEvent == HINT_EVENT_ONPRESS)
			this.objectContent.onRollOver = this.onPressHandlerAlias;
    
  // Позиционирование контрола
    repositionControlPos();
  // Позиционирование подписи
    repositionTitlePos();

    this.visible = true;

    if(this.showCallBackFunction != null && this.showCallBackObject != null)
      this.showCallBackFunction.call(this.showCallBackObject, this.id);

    // если нужны на соответствующие события
    if(this.attachRollOverHandler){
      this.objectContent.onRollOver = this.onRollOverHandlerAlias;
      this.objectMayBeDisabled = false;
    }
    if(this.attachRollOutHandler){
      this.objectContent.onRollOut = this.onRollOutHandlerAlias;
      this.objectMayBeDisabled = false;
    }
    if(this.attachPressHandler || this.draggingEnabled){
      this.objectContent.onPress = this.onPressHandlerAlias;
      this.objectMayBeDisabled = false;
    }
    if(this.attachReleaseHandler || this.draggingEnabled){
      this.objectContent.onRelease = this.onReleaseHandlerAlias;
      this.objectMayBeDisabled = false;
    }
    if(this.draggingEnabled){
      this.objectContent.onReleaseOutside = this.onReleaseOutsideHandlerAlias;
      this.objectMayBeDisabled = false;
    }
    //  проверка допустимых значений границ для таскания
    if(this.draggingEnabled){
      if(this.draggingMaxXBound - this.draggingMinXBound < this.objectContent.width){
 trace("#FF0000Ошибка - границы таскания для объекта " + this.id + " заданы неверно.");
        if(this.objectContent.width >= Player.module.width){
          this.draggingMinXBound = Player.module.width - this.objectContent.width;
          this.draggingMaxXBound = 0;
        } else {
          this.draggingMinXBound = 0;
          this.draggingMaxXBound =  Player.module.width - this.objectContent.width;
        }
      }
      if(this.draggingMaxYBound - this.draggingMinYBound < this.objectContent.height){
 trace("#FF0000Ошибка - границы таскания для объекта " + this.id + " заданы неверно.");
        if(this.objectContent.height >= Player.module.height){
          this.draggingMinYBound = Player.module.height - this.objectContent.height;
          this.draggingMaxYBound = 0;
        } else {
          this.draggingMinYBound = 0;
          this.draggingMaxYBound = this.objectContent.height - 600;
        }
      }
      if(this.objectContent.x < this.draggingMinXBound){
        this.objectContent.x = this.draggingMinXBound;
      } else if(this.objectContent.x + this.objectContent.width> this.draggingMaxXBound){
        this.objectContent.x = this.draggingMaxXBound - this.objectContent.width;
      }
      if(this.objectContent.y < this.draggingMinYBound){
        this.objectContent.y = this.draggingMinYBound;
      } else if(this.objectContent.y + this.objectContent.height> this.draggingMaxYBound){
        this.objectContent.y = this.draggingMaxYBound - this.objectContent.height;
      }
    }  
    this.applyActions(EVENT_ON_SHOW);
    //  уведомляем родительский объект о показе
    //parent.notifyChildObjectShown(this.id);
    try {
      parent.notifyPositionChanged(this.id);
    } catch(ex) {
    }
  }

  function hideObject(){
    //  OBJECTIVES for onHide
    if(this.onHideObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onHide"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
    //  END OBJECTIVES for onHide
    
    if(this.attachedControl){
      if(this.playControl)
        this.playControl = null;
      this.attachedControl.parent = null;
      this.attachedControl = null;
    };
  // удаляем подпись
    this.destroyTitleObject();
    //this.clearEventHandlers()
  //  удаляем всплывающее меню
    this.destroyRolloverMenuObject();

    this.applyActions(EVENT_ON_HIDE);

    if(this.objectContent){
    //  перебор присоединённых эффектов для hide
      var effectsCount = this.startEffects(EVENT_ON_HIDE);
      if(effectsCount == 0){
        this.visible = false;	  
        this.unloadObject();
        //  если назначена функция обратного вызова
        if(this.hideCallBackFunction != null && this.hideCallBackObject != null)
          this.hideCallBackFunction.call(this.hideCallBackObject, this.id);
      }
    } else {
      this.visible = false;
    }

    try {
      parent.notifyPositionChanged(this.id);
    } catch(ex) {
    }
  }

  function getAttachPosition(){
//trace("getAttachPosition");
    var positionArray = new Array();
    var realX = 0;
    var realY = 0;
    var realWidth = 0;
    var realHeight = 0;
    if(this.objectWidth){
      realWidth = this.objectWidth;
    } else if(this.objectContent){
      realWidth = this.objectContent.width;
    } else {
      realWidth = 0;
    }
    if(this.objectHeight){
      realHeight = this.objectHeight;
    } else if(this.objectContent){
      realHeight = this.objectContent.height;
    } else {
      realHeight = 0;
    }
    var targetObjPosition = parent.getChildPosition(this.autoAttachTarget);
    if(!targetObjPosition)
      return null;
//trace(this.id + ": targetObjPosition == " + targetObjPosition);
    switch(this.autoAttachStyle){
    case AUTOATTACH_TOP_FROMLEFT:
      realX = targetObjPosition[0] - targetObjPosition[2] + this.autoAttacheffsetX;
      realY = targetObjPosition[1] - realHeight + this.autoAttacheffsetY;
      break;
    case AUTOATTACH_TOP_LEFT:
      realX = targetObjPosition[0] + this.autoAttacheffsetX;
      realY = targetObjPosition[1] - realHeight + this.autoAttacheffsetY;
      break;
    case AUTOATTACH_TOP_CENTER:
      realX = parseInt(targetObjPosition[0] + (targetObjPosition[2] - realWidth)/2);
      realY = targetObjPosition[1] - realHeight - this.autoAttachOffsetY;
      break;
    case AUTOATTACH_TOP_RIGHT:
      realX = targetObjPosition[0] + targetObjPosition[2] - realWidth;
      realY = targetObjPosition[1] - realHeight - this.autoAttachOffsetY;
      break;
    case AUTOATTACH_TOP_FROMRIGHT:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttacheffsetX;
      realY = targetObjPosition[1] - realHeight + this.autoAttacheffsetY;
      break;
    case AUTOATTACH_LEFT_TOP:
      realX = targetObjPosition[0] - realWidth - this.autoAttachOffsetX;
      realY = targetObjPosition[1];
      break;
    case AUTOATTACH_LEFT_CENTER:
      realX = targetObjPosition[0] - realWidth - this.autoAttachOffsetX;
      realY = parseInt(targetObjPosition[1] + (targetObjPosition[3] - realHeight)/2);
      break;
    case AUTOATTACH_LEFT_BOTTOM:
      realX = targetObjPosition[0] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_LEFT_ABOVE:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] - realHeight + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_LEFT_BELOW:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] - realHeight + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_BOTTOM_FROMLEFT:
      realX = targetObjPosition[0] - targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_BOTTOM_LEFT:
      realX = targetObjPosition[0] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_BOTTOM_CENTER:
      realX = parseInt(targetObjPosition[0] + (targetObjPosition[2] - realWidth)/2) + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_BOTTOM_RIGHT:
      realX = targetObjPosition[0] + targetObjPosition[2] - realWidth + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_BOTTOM_FROMRIGHT:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_RIGHT_TOP:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_RIGHT_CENTER:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = parseInt(targetObjPosition[1] + (targetObjPosition[3] - realHeight)/2) + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_RIGHT_BOTTOM:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] - realHeight + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_RIGHT_ABOVE:
      realX= targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] - realHeight + this.autoAttachOffsetY;
      break;
    case AUTOATTACH_RIGHT_BELOW:
      realX = targetObjPosition[0] + targetObjPosition[2] + this.autoAttachOffsetX;
      realY = targetObjPosition[1] + targetObjPosition[3] + this.autoAttachOffsetY;
      break;
    }
    positionArray.push(realX, realY, realWidth, realHeight);
    return positionArray;
  }

  function getPosition(){
//trace("getPosition: " + this.id);
    var positionArray = new Array();
    if(this.objectContent){  //  объект создан
      var mediaSize = new Object();
      if ("getMediaSize" in this.objectContent)
        mediaSize = this.objectContent.getMediaSize();
      else{
        mediaSize.width = 0;
        mediaSize.height = 0
      }
      var containerX = 0;
      var containerY = 0;
      var offsetX = 0;
      var offsetY = 0;
      var newWidth = 0;
      var newHeight = 0;

      if(this.autoAttachTarget){  //  объект к чему то присоединён
        var attachCoords = this.getAttachPosition();
        containerX = attachCoords[0];
        containerY = attachCoords[1];
      } else {
        containerX = this.objectX;
        containerY = this.objectY;
      }
      switch(this.sizeMode){
      case SIZE_MODE_NORMAL:
//trace("SIZE MODE: NORMAL");
        if (this.objectRatio
          && ((this.objectWidth == 0 && this.objectHeight != 0)
            || (this.objectHeight == 0 && this.objectWidth != 0))){
          var mediaSize = this.objectContent.getMediaSize();
          if (this.objectWidth == 0) {
            newWidth  = mediaSize.width * this.objectHeight / mediaSize.height;
            this.objectContent.height = this.objectHeight;
          }
          else {
            newWidth  = this.objectWidth;
            newHeight = mediaSize.height * this.objectWidth / mediaSize.width;
          }
        } else {
          if(this.objectWidth > 0)
            newWidth = this.objectWidth;
          else
            newWidth = this.objectContent.width;
            
          if(this.objectHeight > 0)
            newHeight = this.objectHeight;
          else
            newHeight = this.objectContent.height;
        }
        break;
      case  SIZE_MODE_FIT:
//trace("SIZE MODE: FIT");
        var originalRatio = mediaSize.width/mediaSize.height;
        var destinationRatio = this.objectWidth/this.objectHeight;
        if(originalRatio >= 1){  // horizontal or square
          if(originalRatio < destinationRatio){
            newHeight = parseInt(this.objectHeight);
            newWidth = parseInt((mediaSize.width/mediaSize.height) * this.objectHeight);
          } else if(originalRatio > destinationRatio){
            newWidth = parseInt(this.objectWidth);
            newHeight = parseInt((mediaSize.height/mediaSize.width) * this.objectWidth);
          } else{
            newWidth = this.objectWidth;
            newHeight = this.objectHeight;
          }
        } else {         // vertical
          if(originalRatio < destinationRatio){
            var newHeight = this.objectHeight;
            var newWidth = parseInt((mediaSize.width/mediaSize.height) * this.objectHeight);
          } else if(originalRatio > destinationRatio){
            var newWidth = this.objectWidth;
            var newHeight = parseInt((mediaSize.height/mediaSize.width) * this.objectWidth);
          } else{
            newWidth = this.objectWidth;
            newHeight = this.objectHeight;
          }
        }
        break;
      case SIZE_MODE_FIT_ONLY_BIG:
//trace("SIZE MODE: FIT ONLY BIG");
        if(mediaSize.width > this.objectWidth || mediaSize.height > this.objectHeight){
          var originalRatio = mediaSize.width/mediaSize.height;
          var destinationRatio = this.objectWidth/this.objectHeight;
          if(originalRatio >= 1){  // horizontal or square
            if(originalRatio < destinationRatio){
              newHeight = parseInt(this.objectHeight);
              newWidth = parseInt((mediaSize.width/mediaSize.height) * this.objectHeight);
            } else if(originalRatio > destinationRatio){
              newWidth = parseInt(this.objectWidth);
              newHeight = parseInt((mediaSize.height/mediaSize.width) * this.objectWidth);
            } else{
              newWidth = this.objectWidth;
              newHeight = this.objectHeight;
            }
          } else {         // vertical
            if(originalRatio < destinationRatio){
              var newHeight = this.objectHeight;
              var newWidth = parseInt((mediaSize.width/mediaSize.height) * this.objectHeight);
            } else if(originalRatio > destinationRatio){
              var newWidth = this.objectWidth;
              var newHeight = parseInt((mediaSize.height/mediaSize.width) * this.objectWidth);
            } else{
              newWidth = this.objectWidth;
              newHeight = this.objectHeight;
            }
          }
        } else {
          newWidth = mediaSize.width;
          newHeight = mediaSize.height;
        }
        break;
      case SIZE_MODE_CROP = 3:
//trace("SIZE MODE: CROP");
      /*
        if(this.objectWidth == 0)
          this.objectWidth = mediaSize.width;
        if(this.objectHeight == 0)
          this.objectHeight = mediaSize.height;
          
        if (mediaSize.width > this.objectWidth){
          newWidth = this.objectWidth;
        } else {
          newWidth = mediaSize.width;
        }
        if (mediaSize.height > this.objectHeight){
          newHeight = this.objectHeight;
        } else {
          newHeight = height;
        }
          this.objectContent.x = this.objectX;
          this.objectContent.y = this.objectY;
        
        this.objectContent.width  = mediaSize.width * this.objectHeight / mediaSize.height;
            this.objectContent.height = this.objectHeight;
          }
          else {
            this.objectContent.width  = this.objectWidth;
            this.objectContent.height = mediaSize.height * this.objectWidth / mediaSize.width;
          }
        }
      */
        break;
      }
      if(this.sizeMode == SIZE_MODE_FIT || this.sizeMode == SIZE_MODE_FIT_ONLY_BIG){
        switch(this.horizontalAlign){
        case H_ALIGN_LEFT:
          offsetX = 0;
          break;
        case H_ALIGN_CENTER:
          offsetX = parseInt((this.objectWidth - newWidth)/2);
          break;
        case H_ALIGN_RIGHT:
          offsetX = this.objectWidth - newWidth;
          break;
        }
        switch(this.verticalAlign){
        case V_ALIGN_TOP:
          offsetY = 0;
          break;
        case V_ALIGN_CENTER:
          offsetY = parseInt((this.objectHeight - newHeight)/2);
          break;
        case V_ALIGN_BOTTOM:
          offsetY = this.objectHeight - newHeight;
          break;
        }
      }
      positionArray.push(containerX + offsetX);
      positionArray.push(containerY + offsetY);
      positionArray.push(newWidth);
      positionArray.push(newHeight);
    } else {  //  значит объект еще не создан
      var realX = this.objectX;
      var realY = this.objectY;
      var realWidth = 0;
      var realHeight = 0;
      if(this.autoAttachTarget){
        var attachCoords = this.getAttachPosition();
        realX = attachCoords[0];
        realY = attachCoords[1];
        realWidth = 0;
        realHeight = 0;
      }
      positionArray.push(realX, realY, realWidth, realHeight);
    }
    return positionArray;
  }
  
  function absoluteObjectDepth(object){
		var tmp = 0;
		while (object){
			if(object.objectContent)
				tmp += object.objectContent.depth
			else
				tmp += object.depth;
			object = object.parent;
		}
		return tmp;
	}
  
  function getCoords(object){
  	if (!this.objectContent)
		return;
		
    var positionObject = new Object();		

	if(!object){
		positionObject.x = this.objectContent.x;
  		positionObject.y = this.objectContent.y;
		positionObject.depth = this.objectContent.depth;
	} else{
		var objectX = 0;
		var objectY = 0;
		if(!object.objectContent){
			objectX = object.objectX;
			objectY = object.objectY;			
		} else{
			objectX = object.objectContent.x;
			objectY = object.objectContent.y;
		}
		var globCoordThis = this.localToGlobal(this.objectContent.x, this.objectContent.y);
		var globCoordObject = this.localToGlobal(objectX, objectY);
		thisDepth = absoluteObjectDepth(this);
		objectDepth = absoluteObjectDepth(object);
		positionObject.x = globCoordThis.x - globCoordObject.x;
		positionObject.y = globCoordThis.y - globCoordObject.y;
		positionObject.depth = thisDepth - objectDepth;
	}
	    
    positionObject.width = this.objectContent.width;
    positionObject.height = this.objectContent.height;    
    positionObject.ratio = this.objectRatio;
	
	return positionObject;
  }

//  функция устанавливает актуальные размеры и положения для эффектов (мож и ещё где понадобится)
  function setActualPosition(actualX, actualY, actualWidth, actualHeight, actualDepth){
  /*
    for(var i = 0; i < this.attachedEffects.length; i++){
      //  перебираем эфефкты для всех событий
      if(this.attachedEffects[i] && this.attachedEffects[i].length > 0){
        for(var j = 0; j < this.attachedEffects[i].length; j++){
          this.attachedEffects[i][j].setActualPosition(actualX, actualY, actualWidth, actualHeight, actualDepth);
        }
      }
    }
  */
  }

  function updatePosition(){
    if(this.objectContent){
      if(this.autoAttachTarget){  //  объект к чему то присоединён
        var actualCoords = this.getPosition();
        this.objectContent.x = actualCoords[0];
        this.objectContent.y = actualCoords[1];
        this.objectContent.width = actualCoords[2];
        this.objectContent.height = actualCoords[3];
      }
    }
    try {
      parent.notifyPositionChanged(this.id);
    } catch(ex){
    }
  }
  
  function getFullPath(){
    return parent.getFullPath();
  }

//  =========================== обработчики событий =======================
  function onRollOverHandlerAlias(){
    onRollOverHandler();
  }

  function onRollOverHandler(){
//trace("rnmc_stdMediaObject.onRollOverHandler  "+this.id);//+this.actionsList[EVENT_ON_ROLLOVER]

  //  OBJECTIVES for "onRollOver"
    if(this.onRollOverObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onRollOver"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
  //  END OBJECTIVES for "onRollOver"

    if(this.hintDefined && this.hintEvent == HINT_EVENT_ONROLLOVER){
      if (scene.Hint)
        scene.Hint.startHint(this.hintType, this.hintValue,
          this.hintScale, this.hintBgColor, this.hintBorderColor);
    }

    var dispatcher = parent;
    while (dispatcher) {
      if ("dispatchAction" in dispatcher)
        break;
      dispatcher = dispatcher.parent;
    }
    
    if (!dispatcher)
      return;

    if(this.actionsList && this.actionsList[EVENT_ON_ROLLOVER]){
      for(var i = 0; i < this.actionsList[EVENT_ON_ROLLOVER].length; i++){
        dispatcher.dispatchAction(this.actionsList[EVENT_ON_ROLLOVER][i]);
      }
    }
  }

  function onRollOutHandlerAlias(){
    onRollOutHandler();
  }

  function onRollOutHandler(){
//trace("rnmc_stdMediaObject.onRollOutHandler");

  //  OBJECTIVES for "onRollOut"
    if(this.onRollOutObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onRollOut"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
  //  END OBJECTIVES for "onRollOut"
  
    if (scene.Hint)
      scene.Hint.stopHint();

    if(this.draggingEnabled){
      this.objectCaptured = false;
    }

    var dispatcher = parent;
    while (dispatcher) {
      if ("dispatchAction" in dispatcher)
        break;
      dispatcher = dispatcher.parent;
    }
    
    if (!dispatcher)
      return;
      
    if(this.actionsList && this.actionsList[EVENT_ON_ROLLOUT]){
      for(var i = 0; i < this.actionsList[EVENT_ON_ROLLOUT].length; i++){
        dispatcher.dispatchAction(this.actionsList[EVENT_ON_ROLLOUT][i]);
      }
    }
  }
  
  function onPressHandlerAlias(){
    onPressHandler();
  }

  function onPressHandler(){
//trace("rnmc_stdMediaObject" + this.id + ".onPressHandler");

  //  OBJECTIVES for "onPress"
    if(this.onPressObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onPress"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
  //  END OBJECTIVES for "onPress"
  
    if(this.hintDefined){
      if (this.hintEvent == HINT_EVENT_ONPRESS){
        if (scene.Hint)
          scene.Hint.startHint(this.hintType, this.hintValue,
            this.hintScale, this.hintBgColor, this.hintBorderColor);
      }else{
        if (scene.Hint)
          scene.Hint.stopHint();
      }
    }else{
      if (scene.Hint)
        scene.Hint.stopHint();
    }
    
    //  включение таскания
    if(this.draggingEnabled){
      this.draggingXOffset = this.objectContent.xMouse;
      this.draggingYOffset = this.objectContent.yMouse;
      this.objectCaptured = true;
    }

    var dispatcher = parent;
    while (dispatcher) {
      if ("dispatchAction" in dispatcher)
        break;
      dispatcher = dispatcher.parent;
    }

    if (!dispatcher)
      return;

    if(this.actionsList && this.actionsList[EVENT_ON_PRESS]){
      for(var i = 0; i < this.actionsList[EVENT_ON_PRESS].length; i++){
        dispatcher.dispatchAction(this.actionsList[EVENT_ON_PRESS][i]);
      }
    }
  }

  function onReleaseHandlerAlias(){
    onReleaseHandler();
  }

  function onReleaseHandler(){
//trace("rnmc_stdMediaObject.onReleaseHandler");

  //  OBJECTIVES for "onRelease"
    if(this.onReleaseObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onRelease"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
  //  END OBJECTIVES for "onRelease"
  
  //  выключение таскания
    if(this.draggingEnabled){
      this.objectCaptured = false;
    }
    var dispatcher = parent;
    while (dispatcher) {
      if ("dispatchAction" in dispatcher)
        break;
      dispatcher = dispatcher.parent;
    }
    
    if (!dispatcher)
      return;
      
    if(this.actionsList && this.actionsList[EVENT_ON_RELEASE]){
      for(var i = 0; i < this.actionsList[EVENT_ON_RELEASE].length; i++){
        dispatcher.dispatchAction(this.actionsList[EVENT_ON_RELEASE][i]);
      }
    }
  }

  function onReleaseOutsideHandlerAlias(){
    onReleaseOutsideHandler();
  }

  function onReleaseOutsideHandler(){
//trace("rnmc_stdMediaObject.onReleaseOutsideHandler");
  
  //  выключение таскания
    if(this.draggingEnabled){
      this.objectCaptured = false;
    }
  }

  function onPlayedHandlerAlias(){
    onPlayedHandler();
  }

  function onPlayedHandler(){
//trace("rnmc_stdMediaObject.onPlayed == "+actionsList);

  //  OBJECTIVES for "onPlayed"
    if(this.onPlayedObjectives && this.objectivesList){
      for(var i = 0; i < this.objectivesList.length; i++){
        if(this.objectivesList[i] == "onPlayed"){
          this.objectivesList[i].complete = true;
          this.checkObjectives();
        }
      }
    }
  //  END OBJECTIVES for "onPlayed"
  
    var dispatcher = parent;
    while (dispatcher) {
      if ("dispatchAction" in dispatcher)
        break;
      dispatcher = dispatcher.parent;
    }

    if (!dispatcher)
      return;
      
    if(this.actionsList && this.actionsList[EVENT_ON_PLAYED]){
      for(var i = 0; i < this.actionsList[EVENT_ON_PLAYED].length; i++){
        dispatcher.dispatchAction(this.actionsList[EVENT_ON_PLAYED][i]);
      }
    }
  }  

//  обработчик назначается в createRollOverMenu(),
//    т.к. пока, кроме как для RollOverMenu, он не нужен
  function mouseMoveHandler(){
    if(this.draggingEnabled && this.objectCaptured){
//trace("this.objectContent.onRelease == "+this.objectContent.onRelease);
    if(scene.Hint)
      scene.Hint.stopHint();
    if(this.rolloverMenuObject)
    this.rolloverMenuObject.hideObject();
    
    var newX = this.objectContent.x +
    (this.objectContent.xMouse - this.draggingXOffset);
    var newY = this.objectContent.y +
    (this.objectContent.yMouse - this.draggingYOffset);
    
    if(newX <= this.draggingMinXBound)
    newX = this.draggingMinXBound
    else if(newX + this.objectContent.width  >= this.draggingMaxXBound)
    newX = this.draggingMaxXBound - this.objectContent.width;

    if(newY < this.draggingMinYBound)  
    newY = this.draggingMinYBound
    else if(newY + this.objectContent.height > this.draggingMaxYBound)
    newY = this.draggingMaxYBound - this.objectContent.height;  

    var deltaX = this.objectContent.x - newX;
    var deltaY = this.objectContent.y - newY;

    this.objectContent.x = newX;
    this.objectContent.y = newY;      
      
  // выполнение actions onEnterTarget и onLeaveTarget для шаблона Integration
    if(this.integration)        
    parent.notifyMouseCoords(this);

    // переместить присоединенный контрол
      if(this.controlAttachPoint && this.attachedControl){
        this.attachedControl.x -= deltaX;
        this.attachedControl.y -= deltaY;
      }
      
    // переместить присоединенную подпись
      if(this.titleAttachStyle != AUTOATTACH_NO){
        this.titleObject.x -= deltaX;
        this.titleObject.y -= deltaY;
      }

    // переместить скролинг
      if(this.objectContent && this.objectContent.scroller){
        this.objectContent.scroller.x -= deltaX;
        this.objectContent.scroller.y -= deltaY;
      }
    } else if(this.rolloverMenuAreaWidth || this.rolloverMenuAreaHeight){
      if(xMouse > this.rolloverMenuAreaX
        && xMouse < this.rolloverMenuAreaX + this.rolloverMenuAreaWidth
        && yMouse > this.rolloverMenuAreaY
        && yMouse < this.rolloverMenuAreaY + this.rolloverMenuAreaHeight){
          var rolloverMenuParams = new Array();
          if(this.rolloverMenuOptions){
            rolloverMenuParams = this.rolloverMenuOptions.slice(0);
            for(var i = 0; i < rolloverMenuParams.length; i++){
              if(rolloverMenuParams[i] == "zoomin"
                || rolloverMenuParams[i] == "zoomout"
                || rolloverMenuParams[i] == "zoom"){
                rolloverMenuParams[i] = this.zoomed ? "zoomout" : "zoomin";
                break;
              }
            }
          } else {
            if(this.rolloverMenuSaveOption)
              rolloverMenuParams.push("save");
            if(this.rolloverMenuCopyOption)
              rolloverMenuParams.push("copy");
            if(this.rolloverMenuZoomOption)
              rolloverMenuParams.push(this.zoomed ? "zoomout" : "zoomin");
          }
          if(this.rolloverMenuObject && !this.rolloverMenuObject.visible){
            this.rolloverMenuObject.enableMenuOptions(
              rolloverMenuParams, this.rolloverMenuStyle);
            this.rolloverMenuObject.attachToObject(this.objectContent,
              this.rolloverMenuPoint, this.rolloverMenuX, this.rolloverMenuY);
            this.rolloverMenuObject.showObject();
            this.updateRolloverMenu();
          }
      } if(this.rolloverMenuObject && this.rolloverMenuObject.visible){
        this.rolloverMenuObject.hideObject();
      }
    } else if(this.objectContent && xMouse > this.objectContent.x
      && xMouse < this.objectContent.x + this.objectContent.width
      && yMouse > this.objectContent.y
      && yMouse < this.objectContent.y + this.objectContent.height){
      var rolloverMenuParams = new Array();
      if(this.rolloverMenuOptions){
        rolloverMenuParams = this.rolloverMenuOptions.slice(0);
        for(var i = 0; i < rolloverMenuParams.length; i++){
          if(rolloverMenuParams[i] == "zoomin"
            || rolloverMenuParams[i] == "zoomout"
            || rolloverMenuParams[i] == "zoom"){
            rolloverMenuParams[i] = this.zoomed ? "zoomout" : "zoomin";
            break;
          }
        }
      } else {
        if(this.rolloverMenuSaveOption)
          rolloverMenuParams.push("save");
        if(this.rolloverMenuCopyOption)
          rolloverMenuParams.push("copy");
        if(this.rolloverMenuZoomOption)
          rolloverMenuParams.push(this.zoomed ? "zoomout" : "zoomin");
      }
      if(this.rolloverMenuObject && !this.rolloverMenuObject.visible){
        this.rolloverMenuObject.enableMenuOptions(
          rolloverMenuParams, this.rolloverMenuStyle);
        this.rolloverMenuObject.attachToObject(this.objectContent,
          this.rolloverMenuPoint, this.rolloverMenuX, this.rolloverMenuY);
        this.rolloverMenuObject.showObject();
        this.updateRolloverMenu();
      }
    } else if(this.rolloverMenuObject && this.rolloverMenuObject.visible){
      this.rolloverMenuObject.hideObject();
    }
  }

  function zoomIn(){
    this.zoomed = true;
    if(this.attachedControl){
      this.attachedControl.showChildControl("zoomout");
      this.attachedControl.hideChildControl("zoomin");
    }

    this.applyActions(EVENT_ON_ZOOM_IN);
    //  Важно: reattachObject должен стоять после applyActions
    //  для корректного изменения положения RolloverMenu
    this.updateRolloverMenu();
  }

  function zoomOut(){
    this.zoomed = false;
    if(this.attachedControl){
      this.attachedControl.hideChildControl("zoomout");
      this.attachedControl.showChildControl("zoomin");
    }

    this.applyActions(EVENT_ON_ZOOM_OUT);
  //  Важно: reattachRolloverMenuObject должен стоять после applyActions
  //  для корректного изменения положения RolloverMenu
    this.updateRolloverMenu();
  }
  
  function updateRolloverMenu(){
    if(!this.rolloverMenuObject)
      return;

    if(this.zoomed){
      this.rolloverMenuObject.showChildControl("zoomout");
      this.rolloverMenuObject.hideChildControl("zoomin");
    } else {
      this.rolloverMenuObject.hideChildControl("zoomout");
      this.rolloverMenuObject.showChildControl("zoomin");
    }

    var rolloverMenuParams = new Array();
    if(this.rolloverMenuOptions){
      rolloverMenuParams = this.rolloverMenuOptions.slice(0);
      var zoomOption = scene.Utils.getOne("zoom", rolloverMenuParams);
      if(zoomOption >= 0){
        if(this.zoomed){
          rolloverMenuParams[zoomOption] = "zoomout";
        } else {
          rolloverMenuParams[zoomOption] = "zoomin";
        }
      }
    } else {
      if(this.rolloverMenuSaveOption)
        rolloverMenuParams.push("save");
      if(this.rolloverMenuCopyOption)
        rolloverMenuParams.push("copy");
      if(this.rolloverMenuZoomOption)
        rolloverMenuParams.push(this.zoomed ? "zoomout" : "zoomin");
    }

    this.rolloverMenuObject.enableMenuOptions(rolloverMenuParams, this.rolloverMenuStyle);
    this.rolloverMenuObject.reattachToObject(this.objectContent);
  }
  
//	устанавливает 
	function addObjectiveDispatcher(objectiveEvent){
		switch(objectiveEvent){
		case "onShow":
			this.onShowObjectives = true;
			break;
		case "onHide":
			this.onHideObjectives = true;
			break;
		case "onPress":
			this.onPressObjectives = true;
			break;
		case "onRelease":
			this.onReleaseObjectives = true;
			break;
		case "onRollOver":
			this.onRollOverObjectives = true;
			break;
		case "onRollOut":
			this.onRollOutObjectives = true;
		}
	}  

//  функция установки координат и рамеров объекта
  function setPosition(newX, newY, newWidth, newHeight, newDepth, newRatio){
   if (!this.objectContent)
		return;
  
    var positionObject = new Object();

    positionObject.originalX    = this.objectContent.x;
    positionObject.originalY    = this.objectContent.y;
    positionObject.originalWidth  = this.objectContent.width;
    positionObject.originalHeight  = this.objectContent.height;
    positionObject.originalDepth  = this.objectContent.depth;
    positionObject.originalRatio  = this.objectRatio;    
/*
    this.originalX    = this.objectContent.x;
    this.originalY    = this.objectContent.y;
    this.originalWidth  = this.objectContent.width;
    this.originalHeight  = this.objectContent.height;
    this.originalDepth  = this.objectContent.depth;
    this.originalRatio  = this.objectRatio;
*/
    this.positionsArray.push(positionObject);

    if (newX)
      this.objectX = parseInt(newX);
    if (newY)
      this.objectY = parseInt(newY);
    if (newWidth)
      this.objectWidth = parseInt(newWidth);
    if (newHeight)
      this.objectHeight = parseInt(newHeight);
    if (newDepth)
      this.objectDepth = parseInt(newDepth);
    if (newRatio)
      this.objectRatio = (newRatio == "false" ? false : true);

    this.applyPositionChanges();
    //
    //    this.applyActions("onPosition");
  }

  function resetPosition(){
    if (this.positionsArray.length > 0)
    {
      var positionObject = this.positionsArray.pop();
      this.objectX    = positionObject.originalX;
      this.objectY    = positionObject.originalY;
      this.objectWidth  = positionObject.originalWidth;
      this.objectHeight  = positionObject.originalHeight;
      this.objectDepth  = positionObject.originalDepth;
      this.objectRatio    = positionObject.originalRatio;  
/*
      this.objectX    = this.originalX;
      this.objectY    = this.originalY;
      this.objectWidth  = this.originalWidth;
      this.objectHeight  = this.originalHeight;
      this.objectDepth  = this.originalDepth;
      this.objectRatio    = this.originalRatio;
*/
      this.applyPositionChanges();
    }
  }
  
//  применяет текущие значения положения объектов
  //  private 
  function applyPositionChanges(){
    if(this.objectContent){
      var oldVisible = this.objectContent.visible;
      this.objectContent.visible = false;
      this.objectContent.x = this.objectX;
      this.objectContent.y = this.objectY;
      
      if (this.objectRatio
        && ((this.objectWidth == 0 && this.objectHeight != 0)
          || (this.objectHeight == 0 && this.objectWidth != 0))){
          
        var mediaSize = this.objectContent.getMediaSize();
        if (this.objectWidth == 0)
        {
          this.objectContent.width  = mediaSize.width * this.objectHeight / mediaSize.height;
          this.objectContent.height = this.objectHeight;
        }
        else {
          this.objectContent.width  = this.objectWidth;
          this.objectContent.height = mediaSize.height * this.objectWidth / mediaSize.width;
        }
      } else {
        if(this.objectWidth)
          this.objectContent.width = this.objectWidth;
        if(this.objectHeight)
          this.objectContent.height = this.objectHeight;
      }
/*
      if(this.objectWidth)
        this.objectContent.width = this.objectWidth;
      if(this.objectHeight)
        this.objectContent.height = this.objectHeight;
*/
      this.objectContent.depth = this.objectDepth;
      this.objectContent.visible = oldVisible;
      
    }
  // Позиционирование конрола
    repositionControlPos();
  // Позиционирование подписи
    repositionTitlePos();
  }

//  обработчик нажатий кнопок
  function buttonDispatcher(btnId){
    switch(btnId.toLowerCase()){
    case "save":
      this.saveAs();
      break;
    case "copy":
      this.saveToClipboard();
      break;
    case "showtitle":
      if(this.titleObject){
        this.titleObject.visible = true;
        if(this.attachedControl){
          this.attachedControl.hideChildControl("showtitle");
          this.attachedControl.showChildControl("hidetitle");
        }
      }
      break;
    case "hidetitle":
      if(this.titleObject){
        this.titleObject.visible = false;
        if(this.attachedControl){
          this.attachedControl.hideChildControl("hidetitle");
          this.attachedControl.showChildControl("showtitle");
        }
      }
      break;
    case "zoomin":
      this.zoomIn();
      break;
    case "zoomout":
      this.zoomOut();
      break;
    default:
      trace("UNKNOWN BUTTON ID: " + btnId);
    }
  }
  
  function resetObject(){
    this.isOnTimeout = false;
    
    if (this.actionsList){
      if(this.actionsList[EVENT_ON_ALL_OBJECTIVES])
        this.actionsList[EVENT_ON_ALL_OBJECTIVES].already = false;
      if(this.actionsList[EVENT_ON_ALL_MANDATORY_OBJECTIVES])
        this.actionsList[EVENT_ON_ALL_MANDATORY_OBJECTIVES].already = false;
    }

    if (this.objectivesList){
      for (var i = 0; i < this.objectivesList.length; ++i){
        this.objectivesList[i].complete = false;
      }
    }
  }
  
	function frozenObject(){
		
		this._useHandCursor = this.useHandCursor;
		this._onPress = this.onPress;
		this._onKeyDown = this.onKeyDown;

		this.useHandCursor = 1;
		this.onPress = function () {

		}
		this.onKeyDown = function () {
		
		}
	}

	function unfrozenObject(){
		this.useHandCursor = this._useHandCursor;
		if (this._onPress == undefined) 
			this.onPress = null;
		if (this._onKeyDown == undefined) 
			this.onKeyDown = null;
	}

// Установка функции обратного вызова на события
//  показ объекта
  function setShowCallBack(pointerToObject, callbackFunction){
    this.showCallBackObject = pointerToObject;
    this.showCallBackFunction = callbackFunction;
  };

//  Установка функции обратного вызова на события
//  убирания объекта (будет вызвана тогда когда все эффекты завершатся)
  function setHideCallBack(pointerToObject, callbackFunction){
    this.hideCallBackObject = pointerToObject;
    this.hideCallBackFunction = callbackFunction;
  };

  function onScrollObject(buttonId, scrollSpeed){
    if(this.draggingEnabled && this.objectContent){
      var newX = 0;
      var newY = 0;
      //var lastX = this.objectContent.x;
      //var lastY = this.objectContent.x;

      switch(buttonId){
      case "left":
        newX = this.objectContent.x + scrollSpeed;
        newY = this.objectContent.y;
        break;
      case "up":
        newX = this.objectContent.x;
        newY = this.objectContent.y + scrollSpeed;
        break;
      case "down":
        newX = this.objectContent.x;
        newY = this.objectContent.y - scrollSpeed;
        break;
      case "right":
        newX = this.objectContent.x - scrollSpeed;
        newY = this.objectContent.y;
        break;
      }
      if(newX <= this.draggingMinXBound)
        newX = this.draggingMinXBound;
      else if(newX  >= this.draggingMaxXBound)
        newX = this.draggingMaxXBound;

      if(newY < this.draggingMinYBound)
        newY = this.draggingMinYBound;
      else if(newY  > this.draggingMaxYBound)
        newY = this.draggingMaxYBound;

      this.objectContent.x = newX;
      this.objectContent.y = newY;
    }
  }
  
// Объекты
// Проверка сработавших объектов и выбрoс соответсвующего события
  function checkObjectives(){
//  var object = this;
//  while ("checkObjectives" in object.parent)
//    object = object.parent;
//
//  if (object)
//    object.doCheckObjectives();

    var object = this;
	
    while (object.doCheckObjectives()){
      if ("checkObjectives" in object.parent)
        object = object.parent;		
      else
        break;		
    }
  }
 
  function doCheckObjectives(){

    if (this.isObjectives("all")){
      this.applyActions(EVENT_ON_ALL_MANDATORY_OBJECTIVES);
      this.applyActions(EVENT_ON_ALL_OBJECTIVES);
      return true;
    } else if (this.isObjectives("mandatory")) {
      this.applyActions(EVENT_ON_ALL_MANDATORY_OBJECTIVES);
      return true;
    }

    return false;
  }
 
// Проверка объектов
// "all" - всех.
// "mandatory" - обязательных.
  function isObjectives(type){

    if (this.childObjects){

      for(var i = 0; i < this.childObjects.length; i++){

        if(!this.childObjects[i].isObjectives(type))
		{
          return false;
		}
      }
    }
    
    if (!this.objectivesList)
      return true;
	 
	
    switch (type)
    {
      case "all":
        for (var i = 0; i < this.objectivesList.length; ++i){
		  if (this.objectivesList[i].wrongtarget)
		    continue;

          if (!this.objectivesList[i].complete)
            return false;
        }
        break;

      case "mandatory":
        for (var i = 0; i < this.objectivesList.length; ++i){
          if (this.objectivesList[i].optional)
			continue;

		  if (this.objectivesList[i].wrongtarget)
		    continue;

          if (!this.objectivesList[i].complete)
		    return false;
        }		
        break;

       default:
        return false;
    }	

    return true;
  }

// Свойства объектов  
  function getObjectProperty(objName, objProperty){
//trace(this.id + ".mediaObject::get property: " + objProperty);
    switch(objProperty){
    case "visible":
      return this.visible;
      break;

    default:
      if (this.propertysList) {
        if (this.propertysList[objProperty])
          return this.propertysList[objProperty];
      }  
    }  
  }
  
  function setObjectProperty(objName, objProperty, propertyValue){
//trace(this.id + ".mediaObject::set property: " + objProperty + " == "+propertyValue);
    if (!this.propertysList)
      this.propertysList = new Array();
    this.propertysList[objProperty] = propertyValue;
  }

//////////////////////////////////////////////////////////
// Функции, относящиеся к статистике по работе с объектом
//
  function getErrors(){
    return this.objectErrors;
  }

  function getHelps(){
    return this.objectHelps;
  }
  
  function getAttempts(){
    return this.objectAttempts;
  }
  
  function resetResult(){
    this.objectResult = -1;
    this.objectErrors = 0;
    this.objectHelps  = 0;  
    this.objectAttempts  = 0;  
  }
  
  function checkObject(){
    if (this.childObjects){
      for(var i = 0; i < this.childObjects.length; i++){
        if(!this.childObjects[i].disabled)
          this.childObjects[i].checkObject();
      }
    }
  }
  
  function parseCountingResults(resultNode){
    if(resultNode.nodeName.toLowerCase() == "resultof"){
      var xmlAttributeMap = null;
      var xmlAttribute = null;
      
      xmlAttributeMap = resultNode.attributes;
      if (xmlAttributeMap){
        xmlAttribute =  xmlAttributeMap.getNamedItem("type");
        if (xmlAttribute != null && xmlAttribute.specified){
          this.crAlgorithm = xmlAttribute.value;
        }
      }
    }
  }
  
  function onTimeout(timer_id){
    this.isOnTimeout = true;
    
    if (this.actionsList && this.actionsList[EVENT_ON_TIME_OUT]){
      if(!this.actionDispatcherObject){
        var object = this;
        while (object){
          if ("dispatchAction" in object){
            this.actionDispatcherObject = object;
            break;
          }
          object = object.parent;
        }
      }
      
      if(this.actionDispatcherObject){
        for(var i = 0; i < this.actionsList[EVENT_ON_TIME_OUT].length; i++){
          if (this.actionsList[EVENT_ON_TIME_OUT][i].eventParam == "" || 
              timer_id == "LABWORK" ||
              this.actionsList[EVENT_ON_TIME_OUT][i].eventParam == timer_id){
            this.actionDispatcherObject.dispatchAction(this.actionsList[EVENT_ON_TIME_OUT][i]);
          }
        }
      }
    }
  }
]]></script>
</composition>
</rmml>
