

N   = (document.layers) ? true:false;                 // netscape 4
I   = (document.all) ? true:false;                    // ie4+
DOM = ((document.getElementById)&&(!I))?true:false;   // ns6 etc.
MAC = (navigator.platform=="MacPPC")?true:false;   // Mac
SAFARI = (navigator.userAgent.indexOf('Safari')>-1)?true:false;   // Mac
Ixp   = (document.all)&&(navigator.userAgent.indexOf('Windows NT 5.1')>-1) ? true:false;                    // windows xp 


function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//ALL NEW
// JavaScript Document
var obj;
var objChild;

function init() 
{
	cssjsmenu('globalNav');
}


function setMouseOverStyles(obj){
	
		 // obj.style.borderTop = '#94BFE1 solid 2px';   ///   ******************   TOP DES ?L?MENTS DE MENU !!!!!!!!
		 obj.style.borderTop = '#619936 solid 0px';  			  ///******************   TOP DES ?L?MENTS DE MENU !!!!!!!! ************/
			  
}
function setMouseOutStyles(){

				objChild.style.visibility = 'hidden';
				obj.style.border = '#619936 solid 0px';						// bordure autour elements de menu principaux
				if(!SAFARI){obj.style.borderBottom = '#619936 solid 0px'}
				
}

function elementContains(elmOuter, elmInner){
  while (elmInner && elmInner != elmOuter)
  {elmInner = elmInner.parentNode;}
  if (elmInner == elmOuter){
    return true;}
  return false;
}
function getPageXY(elm)
{
  var point = { x: 0, y: 0 };
  while (elm)
  {
		point.x += elm.offsetLeft;
    	point.y += elm.offsetTop;
    	elm = elm.offsetParent;
	 }
return point;
}
function setPageXY(elm, x, y){
  var parentXY = {x: 0, y: 0 };
  if (elm.offsetParent){
    parentXY = getPageXY(elm.offsetParent);}
	if(DOM){y+=2}//Mine to give some distance from the parent li
	elm.style.left = (x) + 'px';elm.style.top = (y) + 'px';
}
function cssjsmenu(menuid){
  var i;
  var j;
  var node;
  var child;
  var parent;
  if (!document.getElementById)
  {
    return true;
  }
  var version;
  var offset;
  offset = navigator.userAgent.indexOf('Opera');
  if (offset != -1){
    version = parseInt('0' + navigator.userAgent.substr(offset + 6), 10);
		if (version < 7){
      return true;}
  }
var menudiv = document.getElementById(menuid);
  // ul
  var ul = new Array();
  for (i = 0; i < menudiv.childNodes.length; i++){
	node = menudiv.childNodes[i];
    if (node.nodeName.toUpperCase() == 'UL'){
      ul[ul.length] = node;}
  }
  // ul > li
  var ul_gt_li = new Array();
  for (i = 0; i < ul.length; i++){
    node = ul[i];for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName.toUpperCase() == 'LI'){
        ul_gt_li[ul_gt_li.length] = child;
        child.style.display = 'inline';
        child.style.listStyle = 'none';
        child.style.position = 'static';
		
		
		 ///     if(!SAFARI){child.style.borderBottom = '#ffffff solid 1px'} }   /// 
		 
		  if(!SAFARI){child.style.borderBottom = '#619936 solid 0px'} }   ///   Bordure sous éléments de menu principaux 
		 
		 
		 
		        
    }
  }
  // ul > li > ul
  var ul_gt_li_gt_ul = new Array();
  for (i = 0; i < ul_gt_li.length; i++)
  {
    node = ul_gt_li[i];
    for (j = 0; j < node.childNodes.length; j++)
    {
      child = node.childNodes[j];
      if (child.nodeName.toUpperCase() == 'UL')
      {
        ul_gt_li_gt_ul[ul_gt_li_gt_ul.length] = child;
 
 		parent = child.parentNode; 
        parent.onmouseover = function (e)
        {
          var i;
          var child;
          var point;
          // stop the pure css hover effect
          this.style.paddingBottom = '0';
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName.toUpperCase() == 'UL')
            {
              point = getPageXY(this);
              setPageXY(child, point.x, point.y + this.offsetHeight);
              child.style.visibility = 'visible';
			 setMouseOverStyles(this);}
			}
          return false;
        };
        parent.onmouseout = function (e)
        {
          var relatedTarget = null;
          if (e){//Nescape&Mozilla&Safari 
		  
            relatedTarget = e.relatedTarget;
	    	if (navigator.product == 'Gecko' && navigator.platform.indexOf('Linux') != -1 && !relatedTarget){
	      		relatedTarget = e.originalTarget;}
          }
          else if (window.event){//IE
          	relatedTarget = window.event.toElement;}
          	if (elementContains(this, relatedTarget)){
            return false;}
          var i;
          var child;
          for (i = 0; i < this.childNodes.length; i++)
          {
            child = this.childNodes[i];
            if (child.nodeName.toUpperCase() == 'UL')
            {
					obj=this;
					objChild=child;
					setMouseOutStyles();
            }
          }
          return false;
        };
      }
    }
  }
  return true;
}






function writeMenu(){  // écrire le code du menu horizontal
	
	
	var sMenu = '';
	
	sMenu += '	 <div id="globalNav">  ';
	sMenu += '         <ul id="globalMain"> ';
	
	
	sMenu += '           <li class="submenu"> </li> ';
			  
			  				  			  		  
	sMenu += '           <li class="submenu"><a href="#">About Us</a> ';
	sMenu += '             <ul> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/info_generale_en.htm">  Our Profile</a></li> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/cons_admin_en.htm">  Board of Directors</a></li> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/equipe_en.htm">  Executive Team</a></li> ';
	sMenu += '             </ul> ';
	sMenu += '           </li> ';
			  
			  		  
	sMenu += '           <li class="submenu"><a href="#">Events</a> ';
	sMenu += '             <ul> ';
	// sMenu += '               <li><a href="http://www.corim.qc.ca/index.php?idsession=0&cate=1&recherche=&idmodule=4&idmodule_temp=&idprod=&page_html=&idstatic=&idlang=2">  Coming Events</a></li> ';
	
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/a_venir_en.htm">  Coming Events</a></li> ';	
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/evenement_passe_en.htm">  Past Events</a></li> ';
	sMenu += '             </ul> ';
	sMenu += '           </li> ';
	
	
	sMenu += '           <li class="submenu"><a href="#">Membership</a> ';
	sMenu += '             <ul> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/devenir_membre_en.htm">  Become a Member</a></li> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/membres_en.htm">  Our Members</a></li> ';
	sMenu += '             </ul> ';
	sMenu += '           </li> ';
	

	sMenu += '           <li class="submenu"><a href="#">  Publications</a>  ';
	sMenu += '             <ul> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/publications_en.html">  Recent Publications</a></li> ';
	sMenu += '               <li><a href="http://www.corim.qc.ca/home/publications_12mois_en.html">  12 Last Months</a></li> ';
	sMenu += '             </ul> ';
	sMenu += '           </li> ';


/*	
	sMenu += '           <li class="submenu"><a href="http://www.corim.qc.ca/home/publications_en.html">  Publications</a></li> ';
*/	
	sMenu += '           <li class="submenu"><a href="http://www.corim.qc.ca/home/calendrier/calendrier_redirect_en.html">  International Calendar</a> </li> ';
			  
			 			  
	sMenu += '           <li class="submenu"><a href="http://www.corim.qc.ca/home/presse_internationale_en.html">  International Press</a> </li> ';
	
				  		  
	sMenu += '           <li class="submenuLast"><a href="http://www.corim.qc.ca/home/medias_en.html">  Media Centre</a></li> ';
	
	
	sMenu += '         </ul> ';
	sMenu += '    </div> ';

	
	document.write(sMenu);

}
								
writeMenu();



// if (MAC&&I){document.write('<style>ul#globalMain li ul{top: 4.7em !important;}</style>')}
// if (SAFARI){document.write('<style>ul#globalMain li.submenuLast ul li a,ul#globalMain li.submenu ul li a{display: block; margin: 0;padding: 0px 2.5%;border-width: 0;width: 97%;}</style>')}



window.onload=init;




