function getObjectRef(ostr) {

	//alert(eval(ostr));

	var o = new Object;

	if (ostr.id) {o=ostr;}
	else if (ns6){o=document.getElementById(ostr);}
	else if (ie4){o=document.all[ostr];}

	return o;
}


function fnMakeMenuContents(arrMenu, generation) {

	strTemp = ""
	for (i=0;i<arrMenu.length;i++) {
		strTemp+='<a href="' + arrMenu[i].split(',')[0] + '" onmouseover="changeImages(&quot;submenu_' + i + '_' + generation + '&quot;, &quot;images/arrow-over.gif&quot;); clearhidemenu(' + generation + ');';
		if (arrMenu[i].split(',')[2]!=''){strTemp+=' dropdownmenu(this, event, ' + arrMenu[i].split(',')[2] + ', &quot;150px&quot;, ' + (generation+1) + ');';}
		strTemp+=' return true;"';
		strTemp+=' onmouseout="changeImages(&quot;submenu_' + i + '_' + generation + '&quot;, &quot;images/arrow.gif&quot;);';
		if (arrMenu[i].split(',')[2]!=''){strTemp+=' delayhidemenu(' + (generation+1) + ');';}
		strTemp+=' return true;" class="link">';
		strTemp+='<img name="submenu_' + i + '_' + generation + '" src="images/arrow.gif" width="10" height="16" border="0" alt="" align="left">';
		if (arrMenu[i].split(',')[2]!=''){strTemp+='<img src="images/arrow-wht.gif" width="10" height="16" border="0" alt="" align="right">';}
		strTemp+='&nbsp;' + arrMenu[i].split(',')[1] + '</a><br>';
		
	}
	
	return strTemp;
}

var iLeftMenu = 0;

function fnMakeLeftMenu(arrMenu, indent) {

	strTemp = ""
	
	var i = 0;
	
	for (i=0;i<arrMenu.length;i++) {
		
		iLeftMenu++;
		
		strTemp+='<div style="padding-left:' + (indent+10) + 'px;"><img name="submenu_' + iLeftMenu + '" src="images/arrow.gif" width="10" height="16" border="0" alt="" hspace="0" style="float:left; margin-left:-10px;"><div><a href="' + arrMenu[i].split(',')[0] + '" onmouseover="changeImages(&quot;submenu_' + iLeftMenu + '&quot;, &quot;images/arrow-over.gif&quot;);';
		strTemp+=' return true;"';
		strTemp+=' onmouseout="changeImages(&quot;submenu_' + iLeftMenu + '&quot;, &quot;images/arrow.gif&quot;);';
		strTemp+=' return true;" class="linkleft">';
		strTemp+= arrMenu[i].split(',')[1] + '</a></div></div>';

		if (arrMenu[i].split(',')[2]!=''){strTemp+=fnMakeLeftMenu(eval(arrMenu[i].split(',')[2]), indent+10);}
		
	}
	
	if (indent==11) {strTemp+="<img src='images/spacer.gif' width='50' height='8'>";}
	
	return strTemp;
}


var menu1=new Array();
menu1[0]='vision.html,Mission Statement,';
menu1[2]='directors.html,Governance,menu6';
menu1[4]='contact.html,Contact,';
menu1[5]='privacy.html,Privacy Policy,';
menu1[1]='charter.html,Charter,';
menu1[3]='updates.html,Updates,';

var menu2=new Array();
menu2[0]='international.html,International Initiatives,menu7';
menu2[1]='domesticprojects.html,Domestic Initiatives,menu15';
//menu2[4]='canabroad.html,Canadians Abroad,';

var menu3=new Array();
menu3[0]='articles.html,Articles of Interest,';
menu3[1]='CLANewsletter-2008.pdf,CLA-ACE Newsletter,menu17';
menu3[2]='press.html,CLA-ACE News,';
menu3[3]='reports.html,Project Reports,';
menu3[4]='links.html,Links,';

var menu17=new Array();
menu17[0]='CLANewsletter-2008.pdf,2008 Newsletter,';
menu17[1]='CLANewsletter-2007.pdf,2007 Newsletter,';
menu17[2]='CLANewsletter.pdf,2006 Newsletter,';

var menu4=new Array();
menu4[1]='currentdonors.html,Donors,';
menu4[0]='howtodonate.html,How to Donate,';

var menu5=new Array();
menu5[0]='whyjoin.html,How to Join,menu8';
//menu5[1]='signupfrm.html,Sign-up Form,';

var menu6=new Array();
menu6[0]='directors.html,Board of Directors,';
menu6[1]='advisoryboard.html,Advisory Board,';
menu6[2]='staff.html,Staff,';

var menu7=new Array();
menu7[0]='internship.html,Student Internships,menu13';
menu7[1]='probono.html,Projects,menu14';

var menu14=new Array();
menu14[0]='acwhrp.html,African and Canadian Women&rsquo;s Human Rights Project,';
menu14[1]='ulcp.html,University Legal Clinic Project (Kumasi Ghana),';
menu14[2]='klc.html,Kosovo Law Center,';

var menu13=new Array();
menu13[0]='opportunities2010.html,Internships 2010,menu26';
menu13[1]='opportunities2009.html,Internships 2009,menu24';
menu13[2]='opportunities2008.html,Internships 2008,menu23';
menu13[3]='opportunities2007.html,Internships 2007,menu22';
menu13[4]='opportunities2006.html,Internships 2006,menu9';
menu13[5]='opportunities2005.html,Internships 2005,menu11';

var menu10=new Array();
menu10[0]='chapters.html,Chapter Locations,';

var menu15=new Array();
menu15[0]='studentchapter.html,Student Chapters,menu10';
menu15[1]='probono_dom.html,Pro Bono Projects,menu16';
menu15[2]='CLA2008-Article.html,CLA-ACE Conference,menu25';

var menu19=new Array();
menu19[0]='CLA2007-Article.html,2007 Conference,';
menu19[1]='CLA2006-Article.html,2006 Conference,';
menu19[2]='CLA2005-Article.html,2005 Conference,';

var menu18=new Array();
//menu18[0]='CLA2007-Videos.html,Photos &amp; Videos,';
menu18[0]='CLA2007-Agenda.pdf,Conference Agenda (PDF),';
menu18[1]='CLA2007-Press.pdf,Press Release (PDF),';


var menu16=new Array();
menu16[0]='aac.html,Arctic Athabaskan Council,';

var menu8=new Array();
menu8[0]='signupfrm.html,Membership Form,';

var menu12=new Array();
menu12[0]='summerappfrm.html,Online Application Form,';

var menu9=new Array();
menu9[0]='opportunities2006.html,Interns,';
menu9[1]='rftf2006.html,Reflections from the Field,';

var menu22=new Array();
menu22[0]='opportunities2007.html,Interns,';
menu22[1]='rftf2007.html,Reflections from the Field,';

var menu23=new Array();
menu23[0]='opportunities2008.html,Interns,';
menu23[1]='rftf2008.html,Reflections from the Field,';

var menu24=new Array();
menu24[0]='internbios2009.html,Interns,';

var menu26=new Array();
menu26[0]='internbios2010.html,Interns,';

var menu11=new Array();
menu11[0]='opportunities2005.html,Interns,';
menu11[1]='rftf2005.html,Reflections from the Field,';

var menu25=new Array();
menu25[0]='CLA2008-Article.html,2008 Conference,';
menu25[1]='CLA2007-Article.html,2007 Conference,';
menu25[2]='CLA2006-Article.html,2006 Conference,';
menu25[3]='CLA2005-Article.html,2005 Conference,';

var menuwidth='150px'; //default menu width
var menubgcolor='B7181C';  //menu bgcolor
var disappeardelay=250;  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes"; //hide menu when user clicks within menu?
var CurrentMenus = new Array();
var CurrentMenu = 0;
var delayhide = new Array();
/////No further editting needed

var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6) {
	document.write('<div id="dropmenudiv0" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu(0)" onMouseout="dynamichide(event,0)" class="dropmenudiv"></div>');
}
function getposOffset(what, offsettype, generation, menuwidth){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null && generation==0){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
if (generation>0 && offsettype=="left") {totaloffset+=parseInt(menuwidth)-15;}
if (generation>0 && offsettype!="left") {totaloffset-=15;}
return totaloffset;
}


function showhide(generation, e, visible, hidden, menuwidth){
if (ie4||ns6)
CurrentMenus[generation].style.left=CurrentMenus[generation].style.top=-500;
if (menuwidth!=""){
CurrentMenus[generation].widthobj=CurrentMenus[generation].style;
CurrentMenus[generation].widthobj.width=menuwidth;
}
if (e.type=="click" && CurrentMenus[generation].style.visibility==hidden || e.type=="mouseover")
CurrentMenus[generation].style.visibility=visible;
else if (e.type=="click")
CurrentMenus[generation].style.visibility=hidden;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge,generation){
var edgeoffset=0;
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
CurrentMenus[generation].contentmeasure=CurrentMenus[generation].offsetWidth;
if (windowedge-CurrentMenus[generation].x < CurrentMenus[generation].contentmeasure)
edgeoffset=CurrentMenus[generation].contentmeasure-obj.offsetWidth;
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
CurrentMenus[generation].contentmeasure=CurrentMenus[generation].offsetHeight;
if (windowedge-CurrentMenus[generation].y < CurrentMenus[generation].contentmeasure)
edgeoffset=CurrentMenus[generation].contentmeasure+obj.offsetHeight;
}
return edgeoffset;
}

function populatemenu(what, generation){
if (ie4||ns6)
CurrentMenus[generation].innerHTML=fnMakeMenuContents(what, generation) + '<div id="dropmenudiv' + (generation+1) + '" style="position:absolute;left:'+menuwidth+'px;visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu(' + (generation+1) + ')" onMouseout="dynamichide(event,' + (generation+1) + ')" class="dropmenudiv"></div>';
}


function dropdownmenu(obj, e, menucontents, menuwidth, generation){
if (window.event) event.cancelBubble=true;
else if (e.stopPropagation) e.stopPropagation();
clearhidemenu(generation);
CurrentMenus[generation] = getObjectRef("dropmenudiv" + generation);
populatemenu(menucontents, generation);

if (ie4||ns6){
showhide(generation, e, "visible", "hidden", menuwidth);
CurrentMenus[generation].x=getposOffset(obj, "left", generation, menuwidth);
CurrentMenus[generation].y=getposOffset(obj, "top", generation, menuwidth);
CurrentMenus[generation].style.left=CurrentMenus[generation].x-clearbrowseredge(obj, "rightedge", generation)+"px";
CurrentMenus[generation].style.top=CurrentMenus[generation].y-clearbrowseredge(obj, "bottomedge", generation)+obj.offsetHeight+"px";
}

return clickreturnvalue()
}

function clickreturnvalue(){
//if (ie4||ns6) return false;
//else return true;
return true;
}

function contains_ns6(a, b) {
while (b.parentNode){
	if ((b = b.parentNode) == a) {return true;}
}
return false;
}

function dynamichide(e,generation){
if (ie4&&!CurrentMenus[generation].contains(e.toElement))
delayhidemenu(generation);
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu(generation);
}

function hidemenu(generation){
if (typeof CurrentMenus[generation]!="undefined"){
if (ie4||ns6)
CurrentMenus[generation].style.visibility="hidden";
}
}

function delayhidemenu(generation){
if (ie4||ns6)
delayhide[generation]=setTimeout("hidemenu("+ generation +")",disappeardelay);
}

function clearhidemenu(generation){
if (typeof delayhide[generation]!="undefined")
clearTimeout(delayhide[generation]);
}

//if (hidemenu_onclick=="yes")
//document.onclick=hidemenu(0);
