function MenuData() {



  this.Stack = function() {

    var stackArray = [ ];



    function StackUnit(node, action) {

      this.node = node;

      this.action = action;

    }



    this.stackArray = stackArray;



    this.put = function (node, action) {

      stackArray[stackArray.length] = new StackUnit(node, action);

    }

    this.clear = function (stopNode) {

      for (var i = stackArray.length - 1; i > -1 && stackArray[i].node != stopNode; stackArray[i--].action());

      stackArray.length = ++i;

    }

    this.isPresent = function (node) {

      for (var i = stackArray.length - 1; i > -1 && stackArray[i].node != node; --i);

      return ++i;

    }

  }



  this.Node = function(nodeData, parentNode) {

    var context = this,

        childNodes = [ ],

        i = parentNode ? parentNode.childNodes.length - 1 : -1,

        Node = this.constructor;



    if (i > -1) {

      (this.previousSibling = parentNode.childNodes[i]).nextSibling = this;

    }

    else {

      this.previousSibling = null;

    }



    this.nextSibling = null;



    this.parentNode = parentNode;

    this.childNodes = childNodes;

    this.data = nodeData;

    this.runtimeData = { };



    this.addChildNode = function (nodeData) {

      return childNodes[childNodes.length] = new Node(nodeData, context);

    }

    this.implement = function (Implementation) {

      return context.implementation = new Implementation(context);

    }

  }



}



var menuData = new MenuData();



/* -- User data types -- */



function MenuDataTypes() {



  this.HostMenu = function (baseZIndex) {

    this.baseZIndex = baseZIndex; // Next free zIndex is baseZIndex + 4

    this.hideDelay = 1000;

  }



  this.HostItem = function (id) {

    this.id = id;

    this.childMenuPosition = {

      h: "near", // near | middle | far

      v: "near",

      hParent: "near",

      vParent: "far",

      hOffset: 0, // in px

      vOffset: 0,

      hOptimize: "offset", // none | offset | mirror

      vOptimize: "none"

    }

  }



  this.Menu = function () {

    this.dir = "v"; // menu direction (one under another items), affects kb navigation

  }



  this.Item = function (itemHtml, href, target) {

    this.itemHtml = itemHtml;

    this.href = href == undefined ? "#" : href;

    this.target = target == undefined ? "" : " target='" + target + "'";

    this.childMenuPosition = {

      h: "near", // near | middle | far

      v: "near",

      hParent: "far",

      vParent: "near",

      hOffset: 0, // in px

      vOffset: 0,

      hOptimize: "mirror", // none | offset | mirror

      vOptimize: "offset"

    }

  }



}



var menuDataTypes = new MenuDataTypes();



/* -- End of user data types -- */



var navMenu = new menuData.Node(new menuDataTypes.HostMenu());



with (navMenu) {

  with (addChildNode(new menuDataTypes.HostItem('m2Company'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('Corporate', '/company/corporate.htm'));

      addChildNode(new menuDataTypes.Item('Technology', '/company/technology.htm'));

      addChildNode(new menuDataTypes.Item('Partners', '/company/partners.htm'));

      addChildNode(new menuDataTypes.Item('Careers', '/company/careers.htm'));

      addChildNode(new menuDataTypes.Item('News', '/company/news2011.htm'));

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Customers'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('By Industry', '/customers/by_industry.htm'));

      addChildNode(new menuDataTypes.Item('Testimonials', '/customers/testimonials.htm'));

      addChildNode(new menuDataTypes.Item('Customers\' FAQ', '/customers/faq.htm'));

      addChildNode(new menuDataTypes.Item('Customer Support', '/customers/support.htm'));

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Solutions'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('Content Management', '/solutions/content_management.htm'));

      addChildNode(new menuDataTypes.Item('E-Commerce', '/solutions/e-commerce.htm'));

	  addChildNode(new menuDataTypes.Item('Site Traffic Stats Engine', '/solutions/sts_engine.htm'));	  

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Services'))) {

    with (addChildNode(new menuDataTypes.Menu())) {
		
      addChildNode(new menuDataTypes.Item('Magento Development', '/services/modulesmagento.html'));

      addChildNode(new menuDataTypes.Item('Web Design', '/services/web_design.htm'));

      addChildNode(new menuDataTypes.Item('Web Programming', '/services/web_programming.htm'));

      addChildNode(new menuDataTypes.Item('Logo and Corporate Identity', '/services/corporate_identity.htm'));

      addChildNode(new menuDataTypes.Item('Internet Marketing', '/services/internet_marketing.htm'));

      addChildNode(new menuDataTypes.Item('Flash Presentations', '/services/flash_presentations.htm'));

      addChildNode(new menuDataTypes.Item('Offshore Outsourcing', '/services/offshore_outsourcing.htm'));

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Portfolio'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('Website Development', '/portfolio/website_design_development.htm'));

      addChildNode(new menuDataTypes.Item('Logo and Corporate Identity', '/portfolio/logo_design_development.htm'));

      addChildNode(new menuDataTypes.Item('Flash Intros', '/portfolio/flash_design_development.htm'));

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Products'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('Flash Calendar', '/products/flash_calendar.php'));

      addChildNode(new menuDataTypes.Item('Wallpapers, Screen Savers, Greeting Cards', '/products/wallpapers.htm'));

      addChildNode(new menuDataTypes.Item('Website Event Calendar Pro', '/products/website_event_calendar.php'));

	  addChildNode(new menuDataTypes.Item('Site Traffic Stats Engine MySQL Edition', '/products/sts_engine.php'));

      addChildNode(new menuDataTypes.Item('USA Map in Flash', '/products/usa_flash_map.php'));

      addChildNode(new menuDataTypes.Item('Free JavaScript Widgets', '/products/js_widgets.htm'));

    }

  }

  with (addChildNode(new menuDataTypes.HostItem('m2Contact'))) {

    with (addChildNode(new menuDataTypes.Menu())) {

      addChildNode(new menuDataTypes.Item('Contact Information', '/contact/contact_information.htm'));

      addChildNode(new menuDataTypes.Item('Support on Custom Projects', '/contact/client_area.htm'));

      addChildNode(new menuDataTypes.Item('Get a Free Price Quote', '/contact/price_quote/?action=rfp'));

    }

  }

}
