gschlien    2005/05/25 11:52:46 CEST

  Added files:
    templates_intranet/js actions.js formvalidation.js general.js 
                          keepieapart.js menu.js navLeftPerso.js 
                          ypSlideOutMenu.js 
  Log:
  premier import
  
  Revision  Changes    Path
  1.1       +446 -0    minefi_templates/templates_intranet/js/actions.js (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/actions.js?rev=1.1&content-type=text/plain
  1.1       +55 -0     minefi_templates/templates_intranet/js/formvalidation.js 
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/formvalidation.js?rev=1.1&content-type=text/plain
  1.1       +97 -0     minefi_templates/templates_intranet/js/general.js (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/general.js?rev=1.1&content-type=text/plain
  1.1       +21 -0     minefi_templates/templates_intranet/js/keepieapart.js 
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/keepieapart.js?rev=1.1&content-type=text/plain
  1.1       +95 -0     minefi_templates/templates_intranet/js/menu.js (new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/menu.js?rev=1.1&content-type=text/plain
  1.1       +45 -0     minefi_templates/templates_intranet/js/navLeftPerso.js 
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/navLeftPerso.js?rev=1.1&content-type=text/plain
  1.1       +179 -0    minefi_templates/templates_intranet/js/ypSlideOutMenu.js 
(new)
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/minefi_templates/templates_intranet/js/ypSlideOutMenu.js?rev=1.1&content-type=text/plain
  
  
  
  Index: actions.js
  ====================================================================
  
  
//*****************************************************************************
  // Do not remove this notice.
  //
  // Copyright 2000 by Mike Hall.
  // See http://www.brainjar.com for terms of use.
  
//*****************************************************************************
  
  //----------------------------------------------------------------------------
  // Code to determine the browser and version.
  //----------------------------------------------------------------------------
  
  function Browser() {
  
    var ua, s, i;
  
    this.isIE    = false;  // Internet Explorer
    this.isNS    = false;  // Netscape
    this.version = null;
  
    ua = navigator.userAgent;
  
    s = "MSIE";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isIE = true;
      this.version = parseFloat(ua.substr(i + s.length));
      return;
    }
  
    s = "Netscape6/";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isNS = true;
      this.version = parseFloat(ua.substr(i + s.length));
      return;
    }
  
    // Treat any other "Gecko" browser as NS 6.1.
  
    s = "Gecko";
    if ((i = ua.indexOf(s)) >= 0) {
      this.isNS = true;
      this.version = 6.1;
      return;
    }
  }
  
  var browser = new Browser();
  
  //----------------------------------------------------------------------------
  // Code for handling the menu bar and active button.
  //----------------------------------------------------------------------------
  
  var activeButton = null;
  
  // Capture mouse clicks on the page so any active button can be
  // deactivated.
  
  if (browser.isIE)
    document.onmousedown = pageMousedown;
  else
    document.addEventListener("mousedown", pageMousedown, true);
  
  function pageMousedown(event) {
  
    var el;
  
    // If there is no active button, exit.
  
    if (activeButton == null)
      return;
  
    // Find the element that was clicked on.
  
    if (browser.isIE)
      el = window.event.srcElement;
    else
      el = (event.target.tagName ? event.target : event.target.parentNode);
  
    // If the active button was clicked on, exit.
  
    if (el == activeButton)
      return;
  
    // If the element is not part of a menu, reset and clear the active
    // button.
  
    if (getContainerWith(el, "DIV", "menu") == null) {
      resetButton(activeButton);
      activeButton = null;
    }
  }
  
  function buttonClick(event, menuId) {
  
    var button;
  
    // Get the target button element.
  
    if (browser.isIE)
      button = window.event.srcElement;
    else
      button = event.currentTarget;
  
    // Blur focus from the link to remove that annoying outline.
  
    button.blur();
  
    // Associate the named menu to this button if not already done.
    // Additionally, initialize menu display.
  
    if (button.menu == null) {
      button.menu = document.getElementById(menuId);
      if (button.menu.isInitialized == null)
        menuInit(button.menu);
    }
  
    // Reset the currently active button, if any.
  
    if (activeButton != null)
      resetButton(activeButton);
  
    // Activate this button, unless it was the currently active one.
  
    if (button != activeButton) {
      depressButton(button);
      activeButton = button;
    }
    else
      activeButton = null;
  
    return false;
  }
  
  function buttonMouseover(event, menuId) {
  
    var button;
  
    // Find the target button element.
  
    if (browser.isIE)
      button = window.event.srcElement;
    else
      button = event.currentTarget;
  
    // If any other button menu is active, make this one active instead.
  
    if (activeButton != null && activeButton != button)
      buttonClick(event, menuId);
  }
  
  function depressButton(button) {
  
    var x, y;
  
    // Update the button's style class to make it look like it's
    // depressed.
  
    button.className += " menuButtonActive";
  
    // Position the associated drop down menu under the button and
    // show it.
  
    x = getPageOffsetLeft(button);
    y = getPageOffsetTop(button) + button.offsetHeight;
  
    // For IE, adjust position.
  
    if (browser.isIE) {
      x += button.offsetParent.clientLeft;
      y += button.offsetParent.clientTop;
    }
  
    button.menu.style.left = x + "px";
    button.menu.style.top  = y + "px";
    button.menu.style.visibility = "visible";
  }
  
  function resetButton(button) {
  
    // Restore the button's style class.
  
    removeClassName(button, "menuButtonActive");
  
    // Hide the button's menu, first closing any sub menus.
  
    if (button.menu != null) {
      closeSubMenu(button.menu);
      button.menu.style.visibility = "hidden";
    }
  }
  
  //----------------------------------------------------------------------------
  // Code to handle the menus and sub menus.
  //----------------------------------------------------------------------------
  
  function menuMouseover(event) {
  
    var menu;
  
    // Find the target menu element.
  
    if (browser.isIE)
      menu = getContainerWith(window.event.srcElement, "DIV", "menu");
    else
      menu = event.currentTarget;
  
    // Close any active sub menu.
  
    if (menu.activeItem != null)
      closeSubMenu(menu);
  }
  
  function menuItemMouseover(event, menuId) {
  
    var item, menu, x, y;
  
    // Find the target item element and its parent menu element.
  
    if (browser.isIE)
      item = getContainerWith(window.event.srcElement, "A", "menuItem");
    else
      item = event.currentTarget;
    menu = getContainerWith(item, "DIV", "menu");
  
    // Close any active sub menu and mark this one as active.
  
    if (menu.activeItem != null)
      closeSubMenu(menu);
    menu.activeItem = item;
  
    // Highlight the item element.
  
    item.className += " menuItemHighlight";
  
    // Initialize the sub menu, if not already done.
  
    if (item.subMenu == null) {
      item.subMenu = document.getElementById(menuId);
      if (item.subMenu.isInitialized == null)
        menuInit(item.subMenu);
    }
  
    // Get position for submenu based on the menu item.
  
    x = getPageOffsetLeft(item) + item.offsetWidth;
    y = getPageOffsetTop(item);
  
    // Adjust position to fit in view.
  
    var maxX, maxY;
  
    if (browser.isNS) {
      maxX = window.scrollX + window.innerWidth;
      maxY = window.scrollY + window.innerHeight;
    }
    if (browser.isIE) {
      maxX = (document.documentElement.scrollLeft   != 0 ? 
document.documentElement.scrollLeft    : document.body.scrollLeft)
           + (document.documentElement.clientWidth  != 0 ? 
document.documentElement.clientWidth   : document.body.clientWidth);
      maxY = (document.documentElement.scrollTop    != 0 ? 
document.documentElement.scrollTop    : document.body.scrollTop)
           + (document.documentElement.clientHeight != 0 ? 
document.documentElement.clientHeight : document.body.clientHeight);
    }
    maxX -= item.subMenu.offsetWidth;
    maxY -= item.subMenu.offsetHeight;
  
    if (x > maxX)
      x = Math.max(0, x - item.offsetWidth - item.subMenu.offsetWidth
        + (menu.offsetWidth - item.offsetWidth));
    y = Math.max(0, Math.min(y, maxY));
  
    // Position and show it.
  
    item.subMenu.style.left = x + "px";
    item.subMenu.style.top  = y + "px";
    item.subMenu.style.visibility = "visible";
  
    // Stop the event from bubbling.
  
    if (browser.isIE)
      window.event.cancelBubble = true;
    else
      event.stopPropagation();
  }
  
  function closeSubMenu(menu) {
  
    if (menu == null || menu.activeItem == null)
      return;
  
    // Recursively close any sub menus.
  
    if (menu.activeItem.subMenu != null) {
      closeSubMenu(menu.activeItem.subMenu);
      menu.activeItem.subMenu.style.visibility = "hidden";
      menu.activeItem.subMenu = null;
    }
    removeClassName(menu.activeItem, "menuItemHighlight");
    menu.activeItem = null;
  }
  
  //----------------------------------------------------------------------------
  // Code to initialize menus.
  //----------------------------------------------------------------------------
  
  function menuInit(menu) {
  
    var itemList, spanList;
    var textEl, arrowEl;
    var itemWidth;
    var w, dw;
    var i, j;
  
    // For IE, replace arrow characters.
  
    if (browser.isIE) {
      menu.style.lineHeight = "2.5ex";
      spanList = menu.getElementsByTagName("SPAN");
      for (i = 0; i < spanList.length; i++)
        if (hasClassName(spanList[i], "menuItemArrow")) {
          spanList[i].style.fontFamily = "Webdings";
          spanList[i].firstChild.nodeValue = "4";
        }
    }
  
    // Find the width of a menu item.
  
    itemList = menu.getElementsByTagName("A");
    if (itemList.length > 0)
      itemWidth = itemList[0].offsetWidth;
    else
      return;
  
    // For items with arrows, add padding to item text to make the
    // arrows flush right.
  
    for (i = 0; i < itemList.length; i++) {
      spanList = itemList[i].getElementsByTagName("SPAN");
      textEl  = null;
      arrowEl = null;
      for (j = 0; j < spanList.length; j++) {
        if (hasClassName(spanList[j], "menuItemText"))
          textEl = spanList[j];
        if (hasClassName(spanList[j], "menuItemArrow"))
          arrowEl = spanList[j];
      }
      if (textEl != null && arrowEl != null)
        textEl.style.paddingRight = (itemWidth
          - (textEl.offsetWidth + arrowEl.offsetWidth)) + "px";
    }
  
    // Fix IE hover problem by setting an explicit width on first item of
    // the menu.
  
    if (browser.isIE) {
      w = itemList[0].offsetWidth;
      itemList[0].style.width = w + "px";
      dw = itemList[0].offsetWidth - w;
      w -= dw;
      itemList[0].style.width = w + "px";
    }
  
    // Mark menu as initialized.
  
    menu.isInitialized = true;
  }
  
  //----------------------------------------------------------------------------
  // General utility functions.
  //----------------------------------------------------------------------------
  
  function getContainerWith(node, tagName, className) {
  
    // Starting with the given node, find the nearest containing element
    // with the specified tag name and style class.
  
    while (node != null) {
      if (node.tagName != null && node.tagName == tagName &&
          hasClassName(node, className))
        return node;
      node = node.parentNode;
    }
  
    return node;
  }
  
  function hasClassName(el, name) {
  
    var i, list;
  
    // Return true if the given element currently has the given class
    // name.
  
    list = el.className.split(" ");
    for (i = 0; i < list.length; i++)
      if (list[i] == name)
        return true;
  
    return false;
  }
  
  function removeClassName(el, name) {
  
    var i, curList, newList;
  
    if (el.className == null)
      return;
  
    // Remove the given class name from the element's className property.
  
    newList = new Array();
    curList = el.className.split(" ");
    for (i = 0; i < curList.length; i++)
      if (curList[i] != name) {
          // Workaround to replace the push method.
          var _curList = new Array(curList[i]);
          newList.concat(_curList);
          // Comment this line because not supported by IE5.0
          //newList.push(curList[i]);
      }
    el.className = newList.join(" ");
  }
  
  function getPageOffsetLeft(el) {
  
    var x;
  
    // Return the x coordinate of an element relative to the page.
  
    x = el.offsetLeft;
    if (el.offsetParent != null)
      x += getPageOffsetLeft(el.offsetParent);
  
    return x;
  }
  
  function getPageOffsetTop(el) {
  
    var y;
  
    // Return the x coordinate of an element relative to the page.
  
    y = el.offsetTop;
    if (el.offsetParent != null)
      y += getPageOffsetTop(el.offsetParent);
  
    return y;
  }
  
  
  
  Index: formvalidation.js
  ====================================================================
  // Copyright (c) 2004 Capgemini - Tous droits r�serv�s.
  /**
   * @author $Author: gschlien $
   * @version $Revision: 1.1 $
   *
   * Classe de validation d'une date sur le client.
   */
  var dtCh= "/";
  
  function ParseDate(dateString)
  {
        if (dateString == "")
                return null;
        var tab = dateString.split(dtCh);
        if (tab.length != 3)
                throw "Date non valide";
        var jour = parseInt(tab[0]);
        var mois = parseInt(tab[1]);
        var annee = parseInt(tab[2]);
        if (isNaN(jour) || isNaN(mois) ||isNaN(annee))
                throw "Date non valide";
        mois = mois -1;
        
        var theDate = new Date(annee, mois, jour );
        
        if ((theDate.getMonth() != mois ) ||
                (theDate.getDate() != jour ) ||
                (theDate.getYear() != annee))
                throw "Date non valide";
        return theDate;
  }
  
  function ValidateForm()
  {
        try
        {
                var dateDebut = commusearch.dateDebut.value;
                ParseDate(dateDebut);
        }
        catch(e) {
                alert ("Date de debut incorrecte. \nMerci de respecter le 
format jj/mm/aaaa");
                return false;
        }
        try
        {
                var dateFin = commusearch.dateFin.value;
                ParseDate(dateFin);
        }
        catch(e) {
                alert ("Date de fin incorrecte. \nMerci de respecter le format 
jj/mm/aaaa");
                return false;
        }
      return true;
   }
  
  
  
  
  Index: general.js
  ====================================================================
  /* Roll over */
  function rollImage(ImgId, ImgNam, status) {
         document.images[ImgId].src="images_alize/"+ ImgNam +"_"+ status 
+".gif";
  }
  
  /* Date */
  
  navvers = navigator.appVersion.substring(0,1);
  if (navvers > 3)
        navok = true;
  else
        navok = false;
  
  today = new Date;
  jour = today.getDay();
  numero = today.getDate();
  if (numero<10)
        numero = "0"+numero;
  mois = today.getMonth();
  if (navok)
        annee = today.getFullYear();
  else
        annee = today.getYear();
  TabJour = new 
Array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
  TabMois = new 
Array("janvier","f&eacute;vrier","mars","avril","mai","juin","juillet","aout","septembre","octobre","novembre","d�cembre");
  messageDate = TabJour[jour] + " " + numero + " " + TabMois[mois] + " " + 
annee;
  
  function Majuscule(subText) {
    var ret=""
    var l=subText.length
    var deb = 0
    for (var i=0;i<l;i++) {
      var c = subText.substring(i,i+1)
      c = Accentue(c)
      if (c != "*"){
            if ((c>="a" && c<="z") || (c>="A" && c<="Z") || (c>="0" && c<="9")) 
{
                ret+=c
                deb = 1
            }
            else {
                    if ((c==" " || c=="-" || c=="," || c=="'") && (deb ==1)) {
                        ret+=c
                        deb = 0
                            }
            }
       }
       else{
        ret+=c
       }           
    }
    ret = ret.toUpperCase()
    return ret
  }
  
  function SearchAnais(subValue) {
    document.forms["form_anais"].pNme.value = 
Majuscule(document.forms["form_anais"].pNme.value)
    var vNom = document.forms["form_anais"].pNme.value
    if (vNom.length < 3){
      alert("La recherche doit comporter 3 caract�res minimum!")
    }
    else {
            if (vNom == "NOM"){
            var vUrl = ""
            document.forms["form_anais"].target = "_blank"
            document.forms["form_anais"].action = 
"http://alize.alize/consultation/index.jsp";
            document.forms["form_anais"].rightFrame.value = "viewAccueil.do"
            document.forms["form_anais"].submit()
                return false
        }
          else{
              var vUrl = ""
              document.forms["form_anais"].action = 
"http://alize.alize/consultation/index.jsp";
              document.forms["form_anais"].target = "_blank"
              vUrl = "searchPersonneByNom.do?nom=" + vNom
              vUrl = vUrl + "&directoryId=tous"
              document.forms["form_anais"].rightFrame.value = vUrl
              document.forms["form_anais"].submit()
              return false
          }
    }
  }
  
  
  /* ******************************* */
  /*   PopUp     */
  /* ******************************* */
  
  function doPopup(strURL,strType, navChidId) {
  var strOptions="";
        if (strType=="edit") {
        
strOptions="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=640,height=440";
                if (navChidId != "") {
                        document.getElementById(navChidId).style.display = 
"block";
                }
        }
  window.open(strURL, 'newWin', strOptions);
  }
  
  
  
  Index: keepieapart.js
  ====================================================================
  
  if (document.all)
  {
        var detect = navigator.userAgent.toLowerCase();
        var browser,thestring;
        var version = 0;
  
        if (checkIt('msie')) 
        {
                browser = "IE "
                browser += detect.substr(place + thestring.length,3);
                document.title = browser + ' - ' + document.title;
        }
  }
  
  function checkIt(string)
  {
        place = detect.indexOf(string) + 1;
        thestring = string;
        return place;
  }
  
  
  Index: menu.js
  ====================================================================
  function Browser() {

  

    var ua, s, i;

  

    this.isIE    = false;  // Internet Explorer

    this.isNS    = false;  // Netscape

    this.version = null;

  

    ua = navigator.userAgent;

  

    s = "MSIE";

    if ((i = ua.indexOf(s)) >= 0) {

      this.isIE = true;

      this.version = parseFloat(ua.substr(i + s.length));

      return;

    }

  

    s = "Netscape6/";

    if ((i = ua.indexOf(s)) >= 0) {

      this.isNS = true;

      this.version = parseFloat(ua.substr(i + s.length));

      return;

    }

  

    // Treat any other "Gecko" browser as NS 6.1.

  

    s = "Gecko";

    if ((i = ua.indexOf(s)) >= 0) {

      this.isNS = true;

      this.version = 6.1;

      return;

    }

  }

  

  var browser = new Browser();

  

  function test(e) {

      window.alert(getX(e) + ',' + getY(e));

  }

  function getPageOffsetLeft(el) {

  

    var x;

  

    // Return the x coordinate of an element relative to the page.

  

    x = el.offsetLeft;

    if (el.offsetParent != null)

      x += getPageOffsetLeft(el.offsetParent);

  

    return x;

  }

  

  function getPageOffsetTop(el) {

  

    var y;

  

    // Return the x coordinate of an element relative to the page.

  

    y = el.offsetTop;

    if (el.offsetParent != null)

      y += getPageOffsetTop(el.offsetParent);

  

    return y;

  }

  function jahiaGetObject(idf) {

      if (document.getElementById) {

          return document.getElementById(idf);

      } else if (document.all) {

          return document.all[idf];

      } else {

          return null;

      }

  }

  

  function getX(id) {

      var e = document.getElementById ? document.getElementById(id) : 
document.all ? document.all[id] : document.layers[id];

      //var e = jahiaGetObject(id);

      x = getPageOffsetLeft(e);

      // adjust position for IE

      if (browser.isIE) {

          x += e.offsetParent.clientLeft;

      }

      return x;

  }

  function getY(id) {

      var e = document.getElementById ? document.getElementById(id) : 
document.all ? document.all[id] : document.layers[id];

      //var e = jahiaGetObject(id);

      y = getPageOffsetTop(e) + e.offsetHeight;

      // adjust position for IE

      if (browser.isIE) {

          y += e.offsetParent.clientTop;

      }

      y += 4;

      return y;

  }
  
  
  Index: navLeftPerso.js
  ====================================================================
  isExpanded = false;
  var count1 = 0;
  var count2 = 0;
  var count3 = 0;
  var count4 = 0;
  var count5 = 0;
  var count6 = 0;
  var count7 = 0;
  var count8 = 0;
  var count9 = 0;
  
  function expandIt(el, Id) {
  
        //var whichEl = eval(el + "Child");
        var whichEl = document.getElementById(el + "Child");
        //var divColl = document.all.tags("div");
        
        var divColl = document.getElementsByTagName('div');
  
        if (this["count"+Id] == 0) {
                   for (i=0; i<divColl.length; i++) {
                                if ( (divColl[i].className == "navLeftContent") 
|| (divColl[i].className == "navLeftContentAlize") ) {
                                        divColl[i].style.display = (isExpanded) 
? "block" : "none";
                                        count1 = 0;
                                        count2 = 0;
                                        count3 = 0;
                                        count4 = 0;
                                        count5 = 0;
                                        count6 = 0;
                                        count7 = 0;
                                        count8 = 0;
                                        count9 = 0;
                                }
                        }
                        //document.all[(el+"Child")].style.display = "block";
                        document.getElementById(el+"Child").style.display = 
"block";
                        this["count"+Id] = 1;
                        openedItem = eval(el+"Child");
        } else  {
                //document.all[(el+"Child")].style.display = "none";
                document.getElementById(el+"Child").style.display = "none";
                this["count"+Id] = 0;
        }
        //alert(count);
  }
  
  
  Index: ypSlideOutMenu.js
  ====================================================================
  /*****************************************************

   * ypSlideOutMenu

   * 3/04/2001

   * 

   * a nice little script to create exclusive, slide-out

   * menus for ns4, ns6, mozilla, opera, ie4, ie5 on 

   * mac and win32. I've got no linux or unix to test on but 

   * it should(?) work... 

   *

   * --youngpup--

   *****************************************************/

  

  ypSlideOutMenu.Registry = []

  ypSlideOutMenu.aniLen = 250

  ypSlideOutMenu.hideDelay = 1000

  ypSlideOutMenu.minCPUResolution = 10

  

  // constructor

  function ypSlideOutMenu(id, dir, left, top, width, height)

  {

        this.ie  = document.all ? 1 : 0

        this.ns4 = document.layers ? 1 : 0

        this.dom = document.getElementById ? 1 : 0

  

        if (this.ie || this.ns4 || this.dom) {

                this.id                  = id

                this.dir                 = dir

                this.orientation = dir == "left" || dir == "right" ? "h" : "v"

                this.dirType     = dir == "right" || dir == "down" ? "-" : "+"

                this.dim                 = this.orientation == "h" ? width : 
height

                this.hideTimer   = false

                this.aniTimer    = false

                this.open                = false

                this.over                = false

                this.startTime   = 0

  

                // global reference to this object

                this.gRef = "ypSlideOutMenu_"+id

                eval(this.gRef+"=this")

  

                // add this menu object to an internal list of all menus

                ypSlideOutMenu.Registry[id] = this

  

                var d = document

  

                  var strCSS = '<style type="text/css">';

                  strCSS += '#' + this.id + 'Container { visibility:hidden; '

                strCSS += 'left:' + left + 'px; '

                strCSS += 'top:' + top + 'px; '

                strCSS += 'overflow:hidden; z-index:10000; }'

                strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { 
position:absolute; '

                strCSS += 'width:' + width + 'px; '

                strCSS += 'height:' + height + 'px; '

                strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '

                strCSS += '}'

                  strCSS += '</style>';

  

                  d.write(strCSS)

  

                this.load()

        }

  }

  

  ypSlideOutMenu.prototype.load = function() {

        var d = document

        var lyrId1 = this.id + "Container"

        var lyrId2 = this.id + "Content"

        var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? 
d.all[lyrId1] : d.layers[lyrId1]

        if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? 
d.all[lyrId2] : d.getElementById(lyrId2)

        var temp

  

        if (!obj1 || !obj2) window.setTimeout(this.gRef + ".load()", 100)

        else {

                this.container  = obj1

                this.menu               = obj2

                this.style              = this.ns4 ? this.menu : this.menu.style

                this.homePos    = eval("0" + this.dirType + this.dim)

                this.outPos             = 0

                this.accelConst = (this.outPos - this.homePos) / 
ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 

  

                // set event handlers.

                if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | 
Event.MOUSEOUT);

                this.menu.onmouseover = new 
Function("ypSlideOutMenu.showMenu('" + this.id + "')")

                this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" 
+ this.id + "')")

  

                //set initial state

                this.endSlide()

        }

  }

        

  ypSlideOutMenu.showMenu = function(id)

  {

        var reg = ypSlideOutMenu.Registry

        var obj = ypSlideOutMenu.Registry[id]

        

        if (obj.container) {

                obj.over = true

  

                // close other menus.

                for (menu in reg) if (id != menu) ypSlideOutMenu.hide(menu)

  

                // if this menu is scheduled to close, cancel it.

                if (obj.hideTimer) { reg[id].hideTimer = 
window.clearTimeout(reg[id].hideTimer) }

  

                // if this menu is closed, open it.

                if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)

        }

  }

  

  ypSlideOutMenu.hideMenu = function(id)

  {

        // schedules the menu to close after <hideDelay> ms, which

        // gives the user time to cancel the action if they accidentally moused 
out

        var obj = ypSlideOutMenu.Registry[id]

        if (obj.container) {

                if (obj.hideTimer) window.clearTimeout(obj.hideTimer)

                obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id 
+ "')", ypSlideOutMenu.hideDelay);

        }

  }

  

  ypSlideOutMenu.hide = function(id)

  {

        var obj = ypSlideOutMenu.Registry[id]

        obj.over = false

  

        if (obj.hideTimer) window.clearTimeout(obj.hideTimer)

        

        // flag that this scheduled event has occured.

        obj.hideTimer = 0

  

        // if this menu is open, close it.

        if (obj.open && !obj.aniTimer) obj.startSlide(false)

  }

  

  ypSlideOutMenu.prototype.startSlide = function(open) {

        this[open ? "onactivate" : "ondeactivate"]()

        this.open = open

        if (open) this.setVisibility(true)

        this.startTime = (new Date()).getTime() 

        this.aniTimer = window.setInterval(this.gRef + ".slide()", 
ypSlideOutMenu.minCPUResolution)

  }

  

  ypSlideOutMenu.prototype.slide = function() {

        var elapsed = (new Date()).getTime() - this.startTime

        if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()

        else {

                var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * 
this.accelConst)

                if (this.open && this.dirType == "-")           d = -d

                else if (this.open && this.dirType == "+")      d = -d

                else if (!this.open && this.dirType == "-")     d = -this.dim + 
d

                else                                                            
                d = this.dim + d

  

                this.moveTo(d)

        }

  }

  

  ypSlideOutMenu.prototype.endSlide = function() {

        this.aniTimer = window.clearTimeout(this.aniTimer)

        this.moveTo(this.open ? this.outPos : this.homePos)

        if (!this.open) this.setVisibility(false)

        if ((this.open && !this.over) || (!this.open && this.over)) {

                this.startSlide(this.over)

        }

  }

  

  ypSlideOutMenu.prototype.setVisibility = function(bShow) { 

        var s = this.ns4 ? this.container : this.container.style

        s.visibility = bShow ? "visible" : "hidden"

  }

  ypSlideOutMenu.prototype.moveTo = function(p) { 

        this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p 
+ "px"

  }

  ypSlideOutMenu.prototype.getPos = function(c) {

        return parseInt(this.style[c])

  }

  

  // events

  ypSlideOutMenu.prototype.onactivate           = function() { }

  ypSlideOutMenu.prototype.ondeactivate = function() { }

  

Reply via email to