menu_width=101;
menu_top=10;
menu_left=00;
menu_font="Verdana,Geneva,Arial,Helvetica";

sidemenu_top = 124;
sidemenu_width = 100;
sidemenu_space = 4;

menu = new Array()

menu[0] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_entree.gif' border=0>&nbsp;Entr&eacute;e",
	"99CC33","CCCC99",
	"Site français","http://www.onf.ca/F/",
	"English Website","http://www.onf.ca/E/",
	"Le Prince et moi","http://www.onf.ca/jeunesse/main2.html",
	"Animation","http://www.onf.ca/animation",
	"International","http://www.onf.ca/F/5/index.html",
	"Plans d'archives","http://www.onf.ca/F/4/6/index.html");

menu[1] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_onf.gif' border=0>&nbsp;L'ONF en bref",
	"99CC33","CCCC99",
	"Organisme","http://www.onf.ca/F/2/index.html",
	"Production","http://www.onf.ca/F/3/index.html",
	"Distribution","http://www.onf.ca/F/2/5/index.html",
	"Communiqués<BR>de presse","http://www.onf.ca/F/1/2/index.html",
	"Courrier","http://www.onf.ca/cgi-bin/contact/postf.pl",
	"Questions<BR>fréquentes","http://www.onf.ca/F/2/faq.html");

menu[2] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_rechercher.gif' border=0>&nbsp;Rechercher...",
	"99CC33","CCCC99",
	"Une page","http://www.onf.ca/F/1/4/index.html",
	"Un film","http://www.onf.ca/F/4/5/index.html",
	"Une adresse","http://www.onf.ca/F/2/2/index.html",
	"Un plan d'archives","http://images.nfb.ca:8080/stockshot/owa/simple.search?lang=F",
	"Aide au cinéma<BR>ACIC","http://www.onf.ca/acic",
	"Autres sites<br>cinéma","http://www.onf.ca/F/1/3/sites.html");
	
menu[3] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_collection.gif' border=0>&nbsp;Collections",
	"99CC33","CCCC99",
	"Collection","http://www.onf.ca/F/4/5/index.html",
	"Titres","http://www.onf.ca/F/4/5/1/index.html",
	"Réalisateurs","http://www.onf.ca/F/4/5/2/index.html",
	"Producteurs","http://www.onf.ca/F/4/5/3/index.html",
	"Interprètes","http://www.onf.ca/F/4/5/4/index.html",
	"Sujets","http://www.onf.ca/F/4/5/5/index.html",
	"Autres listes","http://www.onf.ca/F/4/5/6/index.html",
	"Éducation/Jeunes","http://www.onf.ca/F/4/4/index.html",
	"Plans d'archives","http://www.onf.ca/F/4/6/index.html");

menu[4] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_boutique.gif' border=0>&nbsp;Boutique",
	"99CC33","CCCC99",
	"Entrée","http://www.onf.ca/F/4/1/1/index.html",
	"Boutique vidéo","http://www.onf.ca/F/4/1/2/index.html",
	"<STRONG>@ctiONFilm</STRONG><br>Nouveautés","http://www.onf.ca/actionfilm",
	"Institutions","http://www.onf.ca/F/4/1/3/index.html",
	"Hors Canada","http://www.onf.ca/F/5/contact.html",
	"Catalogues","http://www.onf.ca/F/4/1/5/index.html",
	"Questions ?","http://www.onf.ca/cgi-bin/contact/postf.pl",
	"Votre panier","http://www.easycarts.net/ecarts/cgi-bin/ONF/order.cgi?view_cart",
	"Passez la commande","http://www.easycarts.net/ecarts/cgi-bin/ONF/order.cgi?checkout");

menu[5] = new Array(
	"<img src='http://www.onf.ca/F/template/petit_affiche.gif' border=0>&nbsp;&Agrave; l'affiche...",
	"99CC33","CCCC99",
	"Horaire télé","http://www.nfb.ca/actionfilm/cour13/tv.htm",
	"Cinéma ONF","http://www.onf.ca/F/4/3/2/cinema.html");

mac = (navigator.appVersion.indexOf("Mac") != -1);

function init()
	{
	if(document.layers || document.all)
		{
		create_buttons();
		//create_sidelinks();
		}
	else
		{
		document.navigimg.src="menu_alt.gif"
		}
	}

created = new Array(0,0,0,0,0,0,0,0);
opened = new Array(0,0,0,0,0,0,0,0);
last_menu = -1;

function show_menu(sec)
	{
	opened[sec]=1;
	if((last_menu>=0) && (last_menu!=sec)) hide_menu(last_menu);
	last_menu=sec;
	if(created[sec])
		{
		for(q=0;q<((menu[sec].length-3)/2)+1;q++)
			{
			tmp = eval("bt" + sec + "t" + q);
			tmp.show();
			}
		}
	else
		{
		create_menu(sec);
		}
	}

function hide_menu(sec)
	{
	if(created[sec]==1)
		{
		for(w=0;w<((menu[sec].length-3)/2)+1;w++)
			{
			tmp = eval("bt" + sec + "t" + w);
			tmp.hide();
			}
		}
	opened[sec]=0;
	}

function create_buttons()
	{
	for(m=0;m<menu.length;m++)
		{
		create_button(m);		
		}
	}

function create_menu(section)
	{
	created[section]=1;
	for(i=0;i<((menu[section].length-3)/2)+1;i++)
		{
		create_link(section,i);
		}
	}



function create_link(section,item)
	{
	name = "bt" + section + "t" + item;
	initLayer(name);
	div = eval(name);
	tmp = "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=" + menu_width + " BORDER=0>";
	tmp += "<TR>";
	tmp += "<TD BGCOLOR=000000 WIDTH=1><IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=1 HEIGHT=10></TD>";
	tmp += "<TD WIDTH=3><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=3 HEIGHT=10></TD>";
	tmp += "<TD CLASS=\"tiroir\" WIDTH=" + (menu_width-5) + "><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=" + (menu_width-5) + " HEIGHT=3><BR CLEAR=ALL><A HREF=\"" + menu[section][2+(item*2)] + "\" CLASS=x><FONT FACE=\"" + menu_font + "\" SIZE=-2>" + menu[section][1+(item*2)] + "</A></FONT><BR><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=" + (menu_width-5) + " HEIGHT=3></TD>"
	tmp += "<TD BGCOLOR=000000 WIDTH=1><IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=1 HEIGHT=10></TD>";
	tmp += "</TR>";
	tmp += "<TR><TD COLSPAN=4>"
	tmp += "<IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=" + menu_width + " HEIGHT=1></TD></TR>";
	tmp += "</TABLE>"
	div.html(tmp)
	div.width=menu_width;
	div.section = section;
	div.item = item;
	div.onmouseover = over;
	div.onmouseout = out;
	div.bg(menu[section][1]);
	tmp = eval("bt" + section)
	y = menu_top + tmp.heig();
	for(p=item-1;p>0;p--)
		{
		tmp = eval("bt" + section + "t" + p)
		y += tmp.heig();
		}
	div.sety(y);
	div.setx(menu_left+((menu_width-1)*section));
	div.show();
	}

function create_button(section)
	{
	name = "bt" + section;
	initLayer(name);
	div = eval(name);
	tmp = "<IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=" + menu_width + " HEIGHT=1>";
	tmp += "<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=" + menu_width + " BORDER=0>";
	tmp += "<TR>";
	tmp += "<TD BGCOLOR=000000 WIDTH=1><IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=1 HEIGHT=10></TD>";
	tmp += "<TD WIDTH=3><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=3 HEIGHT=10></TD>";
	tmp += "<TD CLASS=\"tiroir\" WIDTH=" + (menu_width-8) + "><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=" + (menu_width-8) + " HEIGHT=3><BR CLEAR=ALL><A HREF=\"\" onClick=\"clic_menu(" + section + ");return false\" CLASS=x><FONT FACE=\"" + menu_font + "\" SIZE=-2><B>" + menu[section][0] + "</B></A></FONT><BR><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=" + (menu_width-8) + " HEIGHT=3></TD>"
	tmp += "<TD WIDTH=3><IMG SRC=\"http://www.onf.ca/F/images/spc.gif\" WIDTH=3 HEIGHT=10></TD>";
	tmp += "<TD BGCOLOR=000000 WIDTH=1><IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=1 HEIGHT=10></TD>";
	tmp += "</TR>";
	tmp += "</TABLE>"
	tmp += "<IMG SRC=\"http://www.onf.ca/F/images/black.gif\" WIDTH=" + menu_width + " HEIGHT=1>";

	div.html(tmp)
	div.section = section;
	div.item = -1;
	div.onmouseover = over;
	div.onmouseout = out;
	div.width=menu_width;
	div.bg(menu[section][1]);
	div.sety(menu_top);
	div.setx(menu_left+((menu_width-1)*section));
	div.show();
	}

function clic_link()
	{
	window.location = menu[this.section][2+(this.item*2)]
	}

function clic_link_n3(section)
	{
	window.location = menu[section][4];
	}

function clic_menu(section)
	{
	if(opened[section]==1)
		{
		hide_menu(section);
		}
	else
		{
		show_menu(section);
		}
	}

wait=0;

function over()
	{
	wait=1;
	this.bg(menu[this.section][2]);

	if(created[this.section]==1)
		{
		for(h=0;h<((menu[this.section].length-3)/2)+1;h++)
			{
			tmp = eval("bt" + this.section + "t" + h)
			if(h!=this.item)
				{
				tmp.bg(menu[this.section][1]);
				}
			}
		}
	for(i=0;i<menu.length;i++)
		{
		if(i!=this.section)
			{
			tmp = eval("bt" + i);
			tmp.bg(menu[i][1]);
			hide_menu(i);
			}
		}
	}

function out()
	{
	delay=setTimeout('hide_menu_wait();',100)
	wait=0;
	}

function hide_menu_wait()
	{
	if(!wait)
		{
		hide_all()
		}
	}

function hide_all()
	{
	for(i=0;i<menu.length;i++)
		{
		tmp = eval("bt" + i);
		tmp.bg(menu[i][1]);
		hide_menu(i);
		}
	}

//===============================================

function create_sidelinks()
	{
	for(s=0;s<button.length;s++)
		{
		create_sidelink(s);		
		}
	}

function create_sidelink(item)
	{
	name = "sbt" + item;
	initLayer(name);
	div = eval(name);
	tmp = "<TABLE CELLPADDING=4 CELLSPACING=0 WIDTH=" + sidemenu_width + " BORDER=0 HEIGHT=35>";
	tmp += "<TR><TD VALIGN=TOP>";
	tmp += "<A HREF=\"" + button[item][1] + "\" CLASS=x><FONT FACE=\"" + menu_font + "\" SIZE=-2>" + button[item][0] + "</A></FONT></TD>"
	tmp += "</TR>";
	tmp += "</TABLE>"
	div.item=item;
	div.html(tmp)
	div.width=sidemenu_width;
	div.onmouseover = overside;
	div.onmouseout = outside;
	div.bg(button_color[0]);
	y = sidemenu_top;
	for(p=item;p>0;p--)
		{
		tmp = eval("sbt" + p)
		y += tmp.heig();
		y += sidemenu_space;
		}
	div.sety(y);
	div.setx(0);
	div.show();
	}

sidewait=0;

function overside()
	{
	sidewait=1;
	this.bg(button_color[1]);

	for(h=0;h<button.length;h++)
		{
		tmp = eval("sbt" + h)
		if(h!=this.item)
			{
			tmp.bg(button_color[0]);
			}
		}
	}

function outside()
	{
	delay=setTimeout('hide_sidemenu_wait();',100)
	sidewait=0;
	}

function hide_sidemenu_wait()
	{
	if(!sidewait)
		{
		for(h=0;h<button.length;h++)
			{
			tmp = eval("sbt" + h)
			tmp.bg(button_color[0]);
			}
		}
	}

// ==================================================================
// cross browser dhtml library
// ==================================================================

function initLayer()
	{
	for(l=0;l<arguments.length;l++)
		{
		if(document.layers)
			{
			eval(arguments[l] + "=document." + arguments[l]);
			}
		eval("div = " + arguments[l]);
		div.setx = setx;
		div.sety = sety;
		div.getx = getx;
		div.gety = gety;
		div.show = show;
		div.hide = hide;
		div.html = html;
		div.bg = bg;
		div.heig = heig;
		}
	}

function setx(x)
	{
	if(document.layers)	this.left = x;
	else this.style.pixelLeft = x;
	}

function sety(y)
	{
	if(document.layers) this.top = y;
	else this.style.pixelTop = y;
	}

function getx()
	{
	return (document.layers) ? this.left : this.style.pixelLeft;
	}

function gety()
	{
	if(document.layers) return(this.top);
	else return(this.style.pixelTop);
	}

function show()
	{
	if(document.layers) this.visibility="visible";
	else this.style.visibility="visible";
	}

function hide()
	{
	if(document.layers) this.visibility="hidden";
	else this.style.visibility="hidden";
	}

function heig()
	{
	if(document.layers)	return this.document.height;
	else
		{
		if(mac) return this.offsetHeight;
		else return this.scrollHeight;
		}
	}

function html(content)
	{
	if(document.layers)
		{
		this.document.open();
		this.document.write(content);
		this.document.close();
		}
	else
		{
		this.innerHTML = content;
		}
	}

function bg(color)
	{
	if(document.layers) this.bgColor = color;
	else this.style.backgroundColor = color;
	}



