

 _CF_checkfSwitch = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }


 _CF_checksearch_eng = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;

        //form element keyword required check
        if( !_CF_hasValue(_CF_this['keyword'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "keyword", _CF_this['keyword'].value, "Please enter a keyword!");
            _CF_error_exists = true;
        }


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }

_CF_checkmod_search_eng = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }


_CF_checkform = function(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }

function changeContent(the_file)
{

		var iframe = document.getElementById( "content" );
		iframe.src = the_file;

}


///////////////////////////////////////////////////////////////////
function contractall()
{
	
	var regexS = "[\\?&]c=([^&#]*)";
  	var regex = new RegExp( regexS );
  	var tmpURL = window.location.href;
  	var results = regex.exec( tmpURL );
	if(results == null)
		var c = -1;		
	else
		var c = results[1];
	for(i=0; i<titles.length; i++) 
	{
		arrows[i].src = document.form.path.value + 'collapsed.gif';
	}
	
	c = detectModule(c);
	
	var regexSS = "[\\?&]type=([^&#]*)";
	var regex2 = new RegExp( regexSS );
	var results2 = regex2.exec( tmpURL );

	if(results2 == null)
		var type = 0;		
	else
		var type = results2[1];	
	
	//if user values passed in url for modID and c
	if (type !=0 && c!=-1)
	{
		if (c==0)
		{
			tempVal2=1;
			if (type==1)
				tempVal='module';
			if (type==2)
				tempVal='prof';
			if (type==3)
				tempVal='immersion';
				
		}			
		if (c==2)
		{
			tempVal2=2;	
			if (type==1)
				tempVal='module';
			if (type==2)
				tempVal='eff';
				
		}				
		if (c==4)
		{
			tempVal2=3;		
			if (type==1)
				tempVal='module';	
		}	
		if (c==6)
		{
			tempVal2=4;	
			tempVal='guidesAll';
			
		}	
		if (c==7)
		{
			tempVal2=1;	
			tempVal='searchKey';

		}	
		if (c==8)
		{
			tempVal2=6;	
			tempVal='searchMod';

		}							
		
		//changeContent(tempVal,tempVal2);
	}
	
}
////////////////////////////////////////////////////////////////
function contract_title(e)
{
	if (!e)
        var e = window.event;
	
    var ce = (e.target) ? e.target : e.srcElement;
	
	ce = detectParent(ce);
	if((ce.id.substr(0,4) != "link") && (ce.id.substr(0,4) != "desc") && (ce.className != "about"))
	{
		var elem;
		var menutitle = "";
		for(var i in titles) 
		{
			if(titles[i] == ce || arrows[i] == ce)
			{
				//alert("i:"+i);
				menutitle = i;
				elem = 2 * i;
			}
		}

		//Pour fermer le 2ième niveau
		if(menutitle == '')
		{
			
		}
		else
		{   // Pour fermer le premier niveau
			var nb =  findCategorie(menutitle);
			if(nb != 0)
			{
				
			}
			else // S'il n'y a pas de 2ieme niveau au menu 
			{
				hidemenu(elem);
			}
			
			titles[Math.floor(elem/2)].onclick = openmenu;
		}

		
	}
}
//////////////////////////////////////////////////////////////////
// Utilisé pour mac
function detectParent(ce)
{
	//alert("function: detect parent");
	var access = false;
	if(ce.id == 'access')
		access = true;
	if((ce.tagName == "TD") || (isUndefined(ce.tagName)) || (access == true))
	{
		if((/MSIE/.test(n)) && (access != true))
			ce = ce.parentElement;
		else
		{
			ce = ce.parentNode;
			if (((navigator.appVersion.toLowerCase().indexOf("mac") > 0) && (ce.tagName == "TD")) || ((access == true) && (ce.tagName != "DIV")))
				ce= ce.parentNode;
		}
	}
	return ce;
}
//////////////////////////////////////////////////////////////////
function detectModule(c)
{
  //alert("detect module");
  var regexS = "[\\?&]modID=([^&#]*)";
  var regex = new RegExp( regexS );
  var tmpURL = window.location.href;
  var results = regex.exec( tmpURL );
  var elem = -1;
  if(results != null)
  {
	  var lien = "desc"+results[1];
	  var isnull = false;
	  if(c == -1)
		  isnull = true;
  }
 
  for(j=0; j<submenus.length; j++)
  {
  	
	if(submenus[j].id != c)
	{
		submenus[j].style.display="none";
		submenus[j].style.height = 0;	
	}
	else
	{
	} 		
  } 
  return c;
 
}
//////////////////////////////////////////////////////////////////
/* function that initiate the menu */
function init()
{
	//alert("function: init");
	if (document.all)
   		menu = document.all["menu"];
	else 
  		if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
		{
			menu = document["menu"]; 
		}
		else
		{
			menu = document.getElementById("menu");
		}

    titles = getElementsByClassName("", "tr", menu);
	//alert("titles.length: "+ titles.length);
    submenus = getElementsByClassName("submenu", "div", menu);
	arrows = getElementsByClassName("arrow", "img", menu);
	arrowsCat = getElementsByClassName("arrowCat", "img", menu);
	subcategories = getElementsByClassName("subCategorie", "div", menu);
    descriptions = getElementsByClassName("fadeDesc", "div", menu);	
	for(i=0; i<titles.length; i++) 
	{
		titles[i].onclick = openmenu;
    }
	for(var j=0;j<descriptions.length;j++)
	{
		heightsDesc[j] = descriptions[j].offsetHeight;
		descriptions[j].style.display="none";
		descriptions[j].style.height = 0;
	}
	for(i=0; i<submenus.length; i++)
	{
        heightsLink[i] = submenus[i].offsetHeight;
        submenus[i].style.height = submenus[i].offsetHeight+"px";
    }
	for(i=0; i<subcategories.length; i++)
	{
    	heights[i] = subcategories[i].offsetHeight;
		subcategories[i].style.height = subcategories[i].offsetHeight+"px";
		subcategories[i].onclick = openmenu;
    }
	contractall() 
}
//////////////////////////////////////////////////////////////////
function openmenu(e) {
   //alert("open menu: "+e);
	var maxcategories = 0;
    if (!e)
        var e = window.event;
	
    var ce = (e.target) ? e.target : e.srcElement;
	
	ce = detectParent(ce);
	
	if(ce.className != "about") 
	{
		var elem;
		var menutitle = "";
		for(var i in titles) 
		{
			if(titles[i] == ce || arrows[i] == ce)
			{
				menutitle = i;
				elem = i;				
			}
		}
		if(menutitle == '')//Ouvre le deuxième menu
		{
			for(var i in subcategories) 
			{
				if(subcategories[i] == ce || arrowsCat[i] == ce)
				{
					menutitle = i;
					elem = i;
					
				}
			}
			showsubmenu(elem, true);
		}
		else // Ouvre le premier menu
		{
			maxcategories = findCategorie(menutitle);
			if(maxcategories != 0 )
			{
			}
			else //Ouvre le menu n'ayant pas de 2ieme niveau
			{
				showsubmenu(elem, false);
			}
		}
		for(var a in submenus)
		{
			if((typeof submenus[a] != "function") && (parseInt(submenus[a].style.height) != 0))
			{
				if(!subcategories[a]) 
				{
					//alert("hidemenu in openmenu");
					hidemenu(a);	
				}	
			}
		}
	}
}
//////////////////////////////////////////////////////////////////
function findCategorie(menutitle)
{
	var nb = 0;
	for(var i = 0; i<subcategories.length;i++)
	{
		if(!subcategories[i])
			nb = 0;
		else if(subcategories[i].id.substr(9,1) == menutitle)
			nb += 1;
	}
	return nb;
}
//////////////////////////////////////////////////////////////////
function hidemenu(elem)
{
	//alert("function: hide menu:"+elem);
	var nr = submenus[elem].getElementsByTagName("a").length*pixel;
	submenus[elem].style.height = (parseInt(submenus[elem].style.height)-nr)+"px";
  	var to = setTimeout("hidemenu("+elem+")", 30);
	if(parseInt(submenus[elem].style.height) <= nr) 
	{
    	clearTimeout(to);
		submenus[elem].style.display = "none";
    	submenus[elem].style.height = "0px";
		arrows[Math.floor(elem)].src = document.form.path.value + 'collapsed.gif';
		//arrows[Math.floor(elem/2)].src = document.form.path.value + 'collapsed.gif';
		titles[Math.floor(elem/2)].onclick = openmenu;
	}
	
}

//////////////////////////////////////////////////////////////////
function showsubmenu(elem,exist)
{
  if (submenus[elem] != null) {
	var nr = submenus[elem].getElementsByTagName("a").length*pixel;	
	//alert(submenus[elem].getElementsByTagName("a").id);	
	submenus[elem].style.display = "";
    submenus[elem].style.height = (parseInt(submenus[elem].style.height)+nr)+"px";
	
	if(exist == true)
	{
		subcategories[elem].style.display = "";
		subcategories[elem].style.height = parseInt(submenus[elem].style.height) + eval(heights[elem]-heightsLink[elem]);
	}
    var to = setTimeout("showsubmenu("+elem+","+exist+")", 30);
	
    if(parseInt(submenus[elem].style.height) >= (parseInt(heightsLink[elem])-nr))
	{
        clearTimeout(to);
        submenus[elem].style.height = heightsLink[elem]+"px";
		if(exist == true)
			subcategories[elem].style.height = heights[elem]+"px";
	    if(!arrowsCat[elem])
		{
			
			arrows[Math.floor(elem)].src = document.form.path.value + 'expanded.gif';
			titles[Math.floor(elem/2)].onclick = openmenu;
		}
		else
		{
			arrowsCat[elem].src = document.form.path.value + 'expanded.gif';
			subcategories[elem].onclick = contract_title;
		}
    }
  }
}
//////////////////////////////////////////////////////////////////
// Fontion qui permet d'obtenir un tableau d'éléments ayant tous le meme nom de classe.
function getElementsByClassName(strClassName, strTagName, oElm){
	if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 
	{
		var arrElements = (strTagName == "*" && document.layers)? document.layers : oElm.document.layers[strTagName]; 
	}
	else
		var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName); 
	var arrReturnElements = new Array();
    strClassName = strClassName.replace(/\-/g, "\\-");
    var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
    var oElement;
     for(var i=0; i<arrElements.length;i++)
	 {
        oElement = arrElements[i]; 
        if(oRegExp.test(oElement.className))
		{		
			arrReturnElements.push(oElement);
        }   
    }
    return (arrReturnElements)
}
//////////////////////////////////////////////////////////////////

// Fonction qui vérifie si l'object est défini.
function isUndefined(property) 
{
	//alert("function: isUndefined");
  return (typeof property == 'undefined');
}

function nothing()
{
 	//alert("function: nothing");	
}





function createYear(year)
{

	 tx ('<TABLE class=title id=categorie style="BORDER-RIGHT: #333333 1px solid; BORDER-TOP: #333333 1px solid; BORDER-LEFT: #333333 1px solid; BORDER-BOTTOM: #333333 1px solid; BACKGROUND-COLOR: #993333"  width=120><TBODY> <TR id=categorie><TD width=120>');
	 tx ('<A id=access title=alttitle href="javascript:nothing()"><IMG border =0 class=arrow id=0 alt=altitle src="images/collapsed.gif"></A>');
	 tx (year +'</TD></TR></TBODY></TABLE>');
		

}

function createMonth(month, link_page, link_id)
{
	  tx ('<A  id=link' + link_id + 'onmouseover="this.style.backgroundColor=');
	  tx ("#AFB3C0");
	  tx ('"  style="border-top:1px solid; border-color:#333333 ;" onmouseout="this.style.backgroundColor=');
	  tx ("'' border-top:1px solid; border-bottom:1px solid;");
      tx ('" href="javascript:changeContent(');
	  tx ("'" + link_page + "')");
      tx ('">' + month +'</A> ');
		
}