 /*

This code is used to display popup menus. This code is provided only for the purpose
of providing a menu system for www.mcnallyvaluations.com. It can be modified and 
distributed freely, with all the implications of that term, but please read the legal 
disclaimer below.

Any execution, copying, modification, or redistribution of this file constitutes acceptance
of the following terms. THE CREATOR OF THIS SOFTWARE MAKES NO WARRANTIES, EXPRESS OR IMPLIED, 
INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND 
FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE SOFTWARE OR ITS USE AND OPERATION ALONE OR 
IN COMBINATION WITH OTHER PRODUCTS. 

IN NO EVENT SHALL THE CREATOR OF THIS SOFTWARE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL 
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF 
THE USE, REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE SOFTWARE, HOWEVER CAUSED 
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, 
EVEN IF THE CREATOR OF THIS SOFTWARE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*
myWindow holds information on the state of the browser window
menuIDs contains the id values for each seperate menu on the page
mouseStateStrings hold the strings for possible mouse actions on a menu item for writing to the document.
tablewidth is the width of the main table on our page. Crude but necessary.
*/
var myWindow,menuIDs=[],mouseStateStrings=['mout','mover','mdown'], tablewidth = 750, menu_xoffset = 64, menu_milliseconds = 2000, cell_height = 20, menu_top = 22, cell_block_top = 18, cell_block_left = -1, menu_left = 120, block_width = [0,160,150,205,155,90,220,0];


//This function is used to set up functions to query the state of the browser window to our myWindow. 
//(this == myWindow)
function initWindowState(){
	
	if(window.innerWidth!=null) {
		this.windowWidthFunc = function(){return window.innerWidth};
		}
	else
		this.windowWidthFunc = function(){return document.body.clientWidth};
	
	if(window.innerHeight!=null)
		this.windowHeightFunc = function(){return window.innerHeight};
	else
		this.windowHeightFunc = function(){return document.body.clientHeight};
	
	if(window.pageXOffset!=null)
		this.windowXOffsetFunc = function(){return window.pageXOffset};
	else
		this.windowXOffsetFunc = function(){return document.body.scrollLeft};
	
	if(window.pageYOffset!=null)
		this.windowYOffsetFunc=function(){return window.pageYOffset};
	else
		this.windowYOffsetFunc=function(){return document.body.scrollTop};
	
	if(document.all)
		this.documentElementsFunc = function(i){return document.all[i]};
	else 
		this.documentElementsFunc = function(i){return document.getElementById(i)};
		
	
	this.windowCallback = windowCheck;
	this.windowAlignCallback = windowAlign;
	
}

/*periodically poll the dimensions to handle updates to window position and size*/
/* (this == myWindow) */
function windowCheck(){
	var dimTemp,altered;
	if(this.width!=(dimTemp=this.windowWidthFunc())){
		this.width=dimTemp;
		altered=true;
	}
	if(this.height!=(dimTemp=this.windowHeightFunc())){
		this.height=dimTemp;
		altered=true;
	}
	if(this.xoffset!=(dimTemp=this.windowXOffsetFunc())){
		this.xoffset=dimTemp;
		altered=true;
	}
	if(this.yoffset!=(dimTemp=this.windowYOffsetFunc())){
		this.yoffset=dimTemp;
		altered=true;
	}
	if(altered){
		if(this.windowAlignmentTimeout)
			clearTimeout(this.windowAlignmentTimeout);
		this.windowAlignmentTimeout=setTimeout('myWindow.windowAlignCallback()',200);
	}
	window.setTimeout('myWindow.windowCallback()',50);
}

function windowAlign(){
	for(var i=0;i<menuIDs.length;i++)
		if(menuIDs[i].alignMe)
			menuIDs[i].menuAlignCallback();
}

/*The main function*/
/*(this == the currently called menu) (which is not necessarily the only one)*/
function menu(items){
	this.items=items;
	this.menuSubSubElements=[];
	this.menuSubElements=[];
	this.menuElements=[];
	this.menuDimensions=[];
	this.activeCounter=0; // active menu counter
	// setup callback functions
	this.hide=hideFunc;
	this.onclick=mouseClickFunc;
	this.onmouseout=mouseOutFunc;
	this.onmouseover=mouseOverFunc;
	this.onmousedown=mouseDownFunc;
	this.dimensionReference=menuDimensionsFunc;
	this.menuAlignCallback=alignFunc;
	if(!myWindow){
		myWindow=new initWindowState();
		myWindow.windowCallback();
	}
	this.id=menuIDs.length;
	menuIDs[this.id]=this;
	for(var i=0;i<this.items.length;i++)
		new recurse(i,this,this);
	var temp;maxRight=0,maxBottom=0,minLeft=Number.POSITIVE_INFINITY,minTop=Number.POSITIVE_INFINITY;
	for(var i=0;i<this.menuElements.length;i++){
		if((temp=this.menuElements[i].dimensionReference('left')+this.menuElements[i].dimensionReference('width')) > maxRight)
			maxRight = temp;
		if((temp=this.menuElements[i].dimensionReference('top')+this.menuElements[i].dimensionReference('height')) > maxBottom)
			maxBottom = this.menuElements[i].dimensionReference('top')+this.menuElements[i].dimensionReference('height');
		if((temp=this.menuElements[i].dimensionReference('left')) < minLeft)
			minLeft = temp;
		if((temp=this.menuElements[i].dimensionReference('top')) < minTop)
			minTop = temp;
	}
	this.menuDimensions.top=0;
	this.menuDimensions.left=0;
	this.menuDimensions.width=maxRight-minLeft;
	this.menuDimensions.height=maxBottom-minTop;
	this.alignMe=true;
	// finally draw everything
	this.menuAlignCallback();
}

// "this" is a menu
function hideFunc(){
	if(!this.timeoutPointer||this.activeCounter||!this.activeElement)
		return;
	this.activeElement.hideElementFunc(0);
	this.activeElement=null;
}

// "this" is a menu. Should not be confused with windowAlign, which calls alignFunc
// for all affected menus in the window
function alignFunc(){
	this.menuDimensions.top=this.menuDimensions.left=0;

	if(myWindow.width>tablewidth){
		this.menuDimensions.left=Math.round((myWindow.width-this.menuDimensions.width)/2);
	}
	else {
		this.menuDimensions.left=menu_xoffset;
	}

	
	// make sure everything is not mover and hidden
	for(var i=0;i<this.menuElements.length;i++){
		this.menuElements[i].stateReference('hidden',true);
		this.menuElements[i].repositionCallback(true);
		this.menuElements[i].stateReference('mout');
	}
}
	
function menuDimensionsFunc(parameterString){
	// if this parameter is defined to the reciever
	if(this.menuDimensions[parameterString] != null)
		return this.menuDimensions[parameterString];
	else
		return 0;
}

// "this" is a menu. id is the id of a menu element
function mouseClickFunc(id){
	// if we have a link
	if(this.menuSubElements[id].elementData[1]!=null)
		return true;
	else
		return false;
}

// "this" is a menu. id is the id of a menu element
function mouseOutFunc(id){
	this.activeCounter--;
	this.timeoutPointer=setTimeout('menuIDs['+this.id+'].hide();',menu_milliseconds);
}

// "this" is a menu. id is the id of a menu element
function mouseOverFunc(id){
	this.activeCounter++;
	// clear the timeout for the old active element
	clearTimeout(this.timeoutPointer);
	this.timeoutPointer=null;
	// 
	this.menuSubElements[id].showElementFunc();
	// set the current active element to the given element
	this.activeElement=this.menuSubElements[id];
}

// "this" is a menu. id is the id of a menu element
function mouseDownFunc(id){
	this.menuSubElements[id].stateReference('mdown');
}

/*Recursive function to go though menu items and add them*/
/*Recursion stack is tracked through the stackString, which is ',' delimited*/
function recurse(stackString,parent,ancestor){
	this.stackString=new String(stackString);
	this.parent=parent;
	this.ancestor=ancestor;
	this.stackIDs=this.stackString.split(',');
	this.currDepth=this.stackIDs.length-1;
	if(this.currDepth == 0) {
		this.elementData = this.ancestor.items[Number(this.stackIDs[0])];
	}
	if(this.currDepth == 1) {
		this.elementData = this.ancestor.items[Number(this.stackIDs[0])][Number(this.stackIDs[1])+4];
	}
	if(this.currDepth == 2) {
		this.elementData = this.ancestor.items[Number(this.stackIDs[0])][Number(this.stackIDs[1])+4][Number(this.stackIDs[2])+2];
	}
	if(!this.elementData)
		return; // below bottom recursion layer
	//if(this.currDepth < 3) {
		this.id=this.ancestor.menuSubElements.length;
		this.ancestor.menuSubElements[this.id]=this;
		// add this recursion to the parent element
		parent.menuElements[parent.menuElements.length]=this;
	//}
	//else {
		//this.id = this.parent.menuSubElements.length;
		//this.parent.menuSubElements[this.id] = this;
	//}
	
	if(document.layers){
		this.write=write_layers;
		this.stateReference=stateRef_layers;
		this.dimensionReference=dimRef_layers;
		this.dimensionSet=dimRefSet_layers;
	}
	else{
		this.write=write_nolayers;
		this.stateReference=stateRef_nolayers;
		this.dimensionReference=dimRef_nolayers;
		this.dimensionSet=dimRefSet_nolayers;
	}
	this.hideElementFunc=hideElement;
	this.showElementFunc=showElement;
	this.repositionCallback=mitem_reposition;
	this.currDimensions=[];
	this.pageElementRefs=[];
	this.write(this.repositionCallback(false));
	this.state='hidden';
	this.menuElements=[];
	var a;
	if(this.currDepth == 0)
		a = this.elementData.length-4;
	else 
		a = this.elementData.length-2;
	for(var i=0;i<a;i++)
		new recurse(this.stackString+','+i,this,this.ancestor);
}

function hideElement(h){
	for(var i=0;i<this.menuElements.length;i++)
		this.menuElements[i].stateReference('hidden');
	if(h>=this.currDepth)
		this.stateReference('mout');
	else 
		this.parent.hideElementFunc(h);
}

function showElement(){
	// turn off the old active elemnt
	if(this.ancestor.activeElement&&this.currDepth<=this.ancestor.activeElement.currDepth) {
		if(this.ancestor.activeElement.parent!=this) {
			this.ancestor.activeElement.hideElementFunc(this.currDepth);
		}
		else {
			this.ancestor.activeElement.hideElementFunc(this.currDepth+1);
		}
	}
	// turn off its sub-elements
	if(!this.ancestor.activeElement||this.ancestor.activeElement.parent!=this)
		for(var i=0;i<this.menuElements.length;i++)
			this.menuElements[i].stateReference('mout');
	// turn on this element
	this.stateReference('mover');
}

function mitem_reposition(reposition){
	if(this.stackIDs[this.currDepth]==0){
		if(this.currDepth==0&&this.elementData[2]!=null) {
			this.currDimensions.left=this.parent.dimensionReference('left')+this.elementData[2];
			this.currDimensions.top=this.parent.dimensionReference('top') + menu_top;
		}
		else if(this.currDepth==0) {
			this.currDimensions.left=this.parent.dimensionReference('left')+cell_block_left;
			this.currDimensions.top=this.parent.dimensionReference('top') + menu_top;
		}
		else if(this.currDepth==1){
			this.currDimensions.left=this.parent.dimensionReference('left');
			this.currDimensions.top=this.parent.dimensionReference('top') + cell_block_top;
		}
		else {
			//this.currDimensions.left=this.parent.currDimensions.left+this.parent.currDimensions.width;
			this.currDimensions.left=this.parent.dimensionReference('left')+this.parent.dimensionReference('width') + 1;
			this.currDimensions.top=this.parent.dimensionReference('top');
			
		}
	}
	else{
		
		if(this.elementData[2]!=null) {
			if(this.currDepth==0)
				this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left')+this.elementData[2];
			else
				this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left');
			if(this.currDepth!=0) {
				this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top')+cell_height;
			}
			else {
				this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top');
			}
		}
		else {
 			 if(this.currDepth==0) {
				this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left')+menu_left;
				this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top');
			}
			else if(this.currDepth==1) {
				this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left');
				this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top')+cell_height;
				
			}
			else {
				//this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left') + this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('width');
				this.currDimensions.left=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('left');
				//this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top')+cell_height;
				this.currDimensions.top=this.parent.menuElements[this.stackIDs[this.currDepth]-1].dimensionReference('top')+cell_height;
			}
		}
	}
	//if(this.elementData[3] != null) {
	if(this.currDepth == 0) {
		this.currDimensions.width = this.elementData[3];
	}
	else {
		//this.currDimensions.width = block_width[this.stackIDs[this.currDepth - 1]];
		this.currDimensions.width=this.elementData[0][1];
	}
	this.currDimensions.height=(cell_height);
	if(reposition) {	
		// assign the newly aligned position to left and top
		this.dimensionSet('left',this.currDimensions.left);
		this.dimensionSet('top',this.currDimensions.top);
		for(var i=0;i<this.menuElements.length;i++) // recurse for all lower elements
			this.menuElements[i].repositionCallback(true);
	}
	else 
		return this.currDimensions;
}

/*This is our code for non-layered browsers*/
function write_nolayers(elementDimensions){
	for(var i=0;i<mouseStateStrings.length;i++){
		document.write('<div id="M'+this.ancestor.id+':'+this.id+mouseStateStrings[i]+'N" style="position:absolute;left:'+elementDimensions.left+'px;top:'+(elementDimensions.top)+'px;width:'+elementDimensions.width+'px;height:'+elementDimensions.height+'px;visibility:hidden;z-index:'+this.currDepth*2+';" class="m'+this.ancestor.id+'l'+this.currDepth+mouseStateStrings[i]+'o"><div class="m'+this.ancestor.id+'l'+this.StackTop+mouseStateStrings[i]+'i">'+(typeof(this.elementData[0])!='string'?child_html_format(this.elementData[0][0],this.elementData[0][1],((this.elementData.length > 2)))[i]:parent_html_format(this.elementData[0])[i])+'</div></div>');
		this.pageElementRefs[mouseStateStrings[i]]=myWindow.documentElementsFunc('M'+this.ancestor.id+':'+this.id+mouseStateStrings[i]+'N');
	}
	document.write('<div id="M'+this.ancestor.id+':'+this.id+'M" style="position:absolute;left:'+elementDimensions.left+'px;top:'+(elementDimensions.top)+'px;width:'+elementDimensions.width+'px;height:'+elementDimensions.height+'px;visibility:hidden;z-index:'+(this.currDepth*2+1)+';"><a href="'+this.elementData[1]+'" onclick="return menuIDs['+this.ancestor.id+'].onclick('+this.id+');" onmouseout="menuIDs['+this.ancestor.id+'].onmouseout('+this.id+');" onmouseover="menuIDs['+this.ancestor.id+'].onmouseover('+this.id+');" onmousedown="menuIDs['+this.ancestor.id+'].onmousedown('+this.id+');"><img src="img/spacer.gif" width="'+elementDimensions.width+'" height="'+elementDimensions.height+'" border="0"></a></div>');
	this.link=myWindow.documentElementsFunc('M'+this.ancestor.id+':'+this.id+'M');
}

function stateRef_nolayers(stateParameter,state){
	if(!this.currDepth&&stateParameter=='hidden'&&!state)
		stateParameter='mout';
	if(this.state==stateParameter)
		return;
	else if(this.state=='hidden')
		this.link.style.visibility='visible';
	else 
		this.pageElementRefs[this.state].style.visibility='hidden';
	if(stateParameter=='hidden')
		this.link.style.visibility='hidden';
	else this.pageElementRefs[stateParameter].style.visibility='visible';
	this.state=stateParameter;
}

function dimRefSet_nolayers(dimensionParameterString,dimensionValue){
	if(!dimensionParameterString)
		return;
	if(dimensionValue){
		for(var i=0;i<mouseStateStrings.length;i++)
			this.pageElementRefs[mouseStateStrings[i]].style[dimensionParameterString]=dimensionValue;
		this.link.style[dimensionParameterString]=dimensionValue;
		return(this.currDimensions[dimensionParameterString]=dimensionValue);
	}
	return this.currDimensions[dimensionParameterString];
}

function dimRef_nolayers(dimensionParameterString){
	if(!dimensionParameterString)
		return;
	else {
		return this.currDimensions[dimensionParameterString];
	}
}

/*This is the code for writing in layered browsers*/
function write_layers(elementDimensions){
	for(var i=0;i<mouseStateStrings.length;i++){
		document.write('<layer name="M'+this.ancestor.id+':'+this.id+mouseStateStrings[i]+'N" left="'+elementDimensions.left+'" top="'+(elementDimensions.top)+'" z-index="'+this.currDepth*2+'" width="'+elementDimensions.width+'" height="'+elementDimensions.height+'" visibility="hide"><table cellpadding="0" cellspacing="0" border="0" width="'+elementDimensions.width+'" height="'+elementDimensions.height+'" class="m'+this.ancestor.id+'l'+this.currDepth+mouseStateStrings[i]+'o"><tr><td><div class="m'+this.ancestor.id+'l'+this.currDepth+mouseStateStrings[i]+'o"><div class="m'+this.ancestor.id+'l'+this.currDepth+mouseStateStrings[i]+'i">'+(typeof(this.elementData[0])!='string'?child_html_formal(this.elementData[0][0],this.elementData[0][1])[i]:parent_html_format(this.elementData[0])[i])+'</div></div></td></tr></table></layer>');
		this.pageElementRefs[mouseStateStrings[i]]=document.layers['M'+this.ancestor.id+':'+this.id+mouseStateStrings[i]+'N'];
	}
	document.write('<layer name="M'+this.ancestor.id+':'+this.id+'M" left="'+elementDimensions.left+'" top="'+(elementDimensions.top)+'" z-index="'+(this.currDepth*2+1)+'" visibility="hide" width="'+elementDimensions.width+'" height="'+elementDimensions.height+'"><a href="'+(this.elementData[1])+'" onclick="return menuIDs['+this.ancestor.id+'].onclick('+this.id+');" onmouseout="menuIDs['+this.ancestor.id+'].onmouseout('+this.id+');" onmouseover="menuIDs['+this.ancestor.id+'].onmouseover('+this.id+');" onmousedown="menuIDs['+this.ancestor.id+'].onmousedown('+this.id+');"><img src="img/spacer.gif" width="'+elementDimensions.width+'" height="'+elementDimensions.height+'" border="0"></a></layer>');
	this.link=document.layers['M'+this.ancestor.id+':'+this.id+'M'];
}

function stateRef_layers(state){
	if(!this.currDepth&&state=='hidden')
		state='mout';
	if(state==this.state)
		return;
	if(this.state=='hidden')
		this.link.visibility='show';
	else 
		this.pageElementRefs[this.state].visibility='hide';
	if(state=='hidden')
		this.link.visibility='hide';
	else 
		this.pageElementRefs[state].visibility='show';
	this.state=state;
}

function dimRef_layers(dimensionParameterString){
	if(!dimensionParameterString)
		return;
	return this.currDimensions[dimensionParameterString];
}

function dimRefSet_layers(dimensionParameterString,dimensionValue){
	if(!dimensionParameterString)
		return;
	if(dimensionValue){
		this.currDimensions[dimensionParameterString]=dimensionValue;
		for(var i=0;i<mouseStateStrings.length;i++){
			this.pageElementRefs[mouseStateStrings[i]].moveTo(this.currDimensions.left,this.currDimensions.top);
			this.pageElementRefs[mouseStateStrings[i]].resizeTo(this.currDimensions.width,this.currDimensions.height);
		}
		this.link.moveTo(this.currDimensions.left,this.currDimensions.top);
		this.link.resizeTo(this.currDimensions.width,this.currDimensions.height);
	}
	return this.currDimensions[dimensionParameterString];
}


var states = ['mout', 'mover', 'mdown'];
var imageparentstates = ['greybookend.gif', 'spacer.html', 'spacer.gif'];
var imagechildstates = ['greymenusubarrow.gif']
var bgcolors = ['#DDDDDD', '#18426B', '#18426B'];
var textcolors = [ '#4A5A8C', '#EEEEEE', '#FFFFFF'];
var child_bgcolors = ['#18426B', '#4A5A8C', '#5A6A9C'];
var child_textcolors = [ '#EEEEEE', '#EEEEEE', '#FFFFFF'];

// top level items -> Name, link, positional modifier, width.
var menu_items = [
	['Home', 'index-2.html', -32, 75],
	['About Us', 'about.html', 75, 100,
		[['Company Profile', 160],'profile.html'],
		[['Mission', 160],'mission.html'],
		[['Our People', 160],'people.html',
			[['Bob McNally, MBA, CA&middot;CBV', 280], 'bobmcnally.html'],
			[['Chris Perret, B. Comm, AACI, CBV', 280], 'chrisperret.html'],
			[['David Bawol, B. Comm, CBV', 280], 'davebawol.html'],
			[['Agnes Leung, B. Comm, CA, CBV', 280], 'agnesleung.html'],
			[['Trisha Daz&eacute;, B. Ed', 280], 'trishadaze.html'],
			[['Paul Leung, ASA', 280], 'paulleung.html'],
			[['Matthew Tozer, B. Comm, AACI, P.App', 280], 'matthewtozer.html'],
			[['Aubrey Winquist, B. Sc.', 280], 'aubreywinquist.html'],
			[['Dany Le, B. Comm', 280], 'danyle.html'],
			[['Joni Treen', 280], 'jonitreen.html'],
			[['Lina Ng', 280], 'linang.html']
		],
		[['Locations', 160],'locations.html',
			[['Edmonton Branch', 180], 'edmontonbranch.html'],
			[['Medicine Hat Branch', 180], 'medicinehatbranch.html']
		],
		[['Professional Designations', 160], 'designations.html', 
			[['CBV', 70], 'designations_cbv.html'] ,
			[['AACI', 70], 'designations_aaci_papp.html'], 
			[['CA', 70], 'designations_ca.html'],
			[['ASA', 70], 'designations_asa.html']
		],
		[['Privacy Policy', 160],'privacy.pdf'],
		[['News', 160], 'news.html',
			[['General News', 200], 'news_general.html'],
			[['Recent Engagements', 200], 'news_engagements.html'],
			/*[['New Employees', 160], 'news_employees.html'],*/
			[['Community Involvement', 200], 'news_community.html'],
			[['Presentations/Articles', 200], 'news_professional.html']
		]
	],
	['Our Services', 'services.html', 100,120, 
		[['Business Valuations', 250], 'services_business.html',
			[['About Business Valuations', 200], 'services_business.html'],
			[['Levels of Valuation Reports', 200], 'services_businessb.html'],
			[['Valuation Process', 200], 'services_businessc.html']
		],
		[['Real Estate Valuations', 250], 'services_realestate.html',
			[['About Real Estate Valuations', 220], 'services_realestate.html'],
			[['Why A Real Estate Valuation?', 220], 'services_realestateb.html'],
			[['Valuation Process', 220], 'services_realestatec.html'],
			[['Track Record', 220], 'services_realestated.html']
		],
		[['Machinery and Equipment Appraisals', 250], 'services_equipment.html',
			[['About Machinery and Equipment Appraisals', 310], 'services_equipment.html'],
			[['Premise of Value', 310], 'services_equipmentb.html'],
			[['Valuation Process', 310], 'services_equipmentc.html']
		],
		[['Litigation Support', 250], 'services_litigation.html',
			[['About Litigation Support', 220], 'services_litigation.html']
		],
		[['Financial Assessments', 250], 'services_financial.html']
	],
	['Employment Opportunities', 'employment.html', 120, 230,
		//[['Valuation Consultant', 160], 'employment_valuationconsultant.html']
	],
	['Links', 'links.html', 230, 70,
		[['General', 280], 'links_general.html'],
		[['Litigation Reference', 280], 'links_litigation.html'],
		[['Valuation Reference', 280], 'links_valuation.html'],
		[['Economics', 280], 'links_economics.html'],
		[['Professional Organizations', 280], 'links_professional.html'],
		[['Publicly Traded Company Reference', 280], 'links_public.html'],
		[['Corporate Financing', 280], 'links_financing.html'],
		[['Business/Financial Advisors', 280], 'links_advisors.html'],
		[['Compensation Reference', 280], 'links_compensation.html'],
		[['Tax Reference', 280], 'links_tax.html'],
		[['Industry Classifications Systems', 280], 'links_classification.html'],
		[['Canadian Business Search', 280], 'links_search.html'],
		[['Community', 280], 'links_community.html']
	],
	['Contacts', 'contacts.html', 70, 90,
	]
];

// <base> header tag doesnt' work for all browsers. Having 
// different relative links for pages a layer down works,
// although it's not that elegant.
var menu_items2 = [
	['Home', 'index-2.html', -32, 75],
	['About Us', 'about.html', 75, 100,
		[['Company Profile', 160],'../profile.html'],
		[['Mission', 160],'../mission.html'],
		[['Our People', 160],'people.html',
			[['Bob McNally, MBA, CA&middot;CBV', 280], '../bobmcnally.html'],
			[['Chris Perret, B. Comm, AACI, CBV', 280], '../chrisperret.html'],
			[['David Bawol, B. Comm, CBV', 280], '../davebawol.html'],
			[['Agnes Leung, B. Comm, CA, CBV', 280], '../agnesleung.html'],
			[['Trisha Daz&eacute;, B. Ed', 280], '../trishadaze.html'],
			[['Paul Leung, ASA', 280], '../paulleung.html'],
			[['Matthew Tozer, B. Comm, AACI, P.App', 280], '../matthewtozer.html'],
			[['Aubrey Winquist, B. Sc.', 280], '../aubreywinquist.html'],
			[['Dany Le, B. Comm', 280], '../danyle.html'],
			[['Joni Treen', 280], '../jonitreen.html'],
			[['Lina Ng', 280], '../linang.html']
		],
		[['Locations', 160],'locations.html',
			[['Edmonton Branch', 180], '../edmontonbranch.html'],
			[['Medicine Hat Branch', 180], '../medicinehatbranch.html']
		],
		[['Professional Designations', 160], 'designations.html', 
			[['CBV', 70], '../designations_cbv.html'] ,
			[['AACI', 70], '../designations_aaci_papp.html'], 
			[['CA', 70], '../designations_ca.html'],
			[['ASA', 70], '../designations_asa.html']
		],
		[['Privacy Policy', 160],'../privacy.pdf'],
		[['News', 160], 'news.html',
			[['General News', 200], '../news_general.html'],
			[['Recent Engagements', 200], '../news_engagements.html'],
			/*[['New Employees', 200], 'news_employees.html'],*/
			[['Community Involvement', 200], '../news_community.html'],
			[['Presentations/Articles', 200], '../news_professional.html']
		]
	],
	['Our Services', 'services.html', 100,120, 
		[['Business Valuations', 250], 'services_business.html',
			[['About Business Valuations', 200], '../services_business.html'],
			[['Levels of Valuation Reports', 200], '../services_businessb.html'],
			[['Valuation Process', 200], '../services_businessc.html']
		],
		[['Real Estate Valuations', 250], 'services_realestate.html',
			[['About Real Estate Valuations', 220], '../services_realestate.html'],
			[['Why A Real Estate Valuation?', 220], '../services_realestateb.html'],
			[['Valuation Process', 220], '../services_realestatec.html'],
			[['Track Record', 220], '../services_realestated.html']
		],
		[['Machinery and Equipment Appraisals', 250], 'services_equipment.html',
			[['About Machinery and Equipment Appraisals', 310], '../services_equipment.html'],
			[['Premise of Value', 310], '../services_equipmentb.html'],
			[['Valuation Process', 310], '../services_equipmentc.html']
		],
		[['Litigation Support', 250], 'services_litigation.html',
			[['About Litigation Support', 220], '../services_litigation.html']
		],
		[['Financial Assessments', 250], '../services_financial.html']
	],
	['Employment Opportunities', 'employment.html', 120, 230,
		//[['Valuation Consultant', 140], '../employment_valuationconsultant.html']
	],
	['Links', 'links.html', 230, 70,
		[['General', 280], '../links_general.html'],
		[['Litigation Reference', 280], '../links_litigation.html'],
		[['Valuation Reference', 280], '../links_valuation.html'],
		[['Economics', 280], '../links_economics.html'],
		[['Professional Organizations', 280], '../links_professional.html'],
		[['Publicly Traded Company Reference', 280], '../links_public.html'],
		[['Corporate Financing', 280], '../links_financing.html'],
		[['Business/Financial Advisors', 280], '../links_advisors.html'],
		[['Compensation Reference', 280], '../links_compensation.html'],
		[['Tax Reference', 280], '../links_tax.html'],
		[['Industry Classifications Systems', 280], '../links_classification.html'],
		[['Canadian Business Search', 280], '../links_search.html'],
		[['Community', 280], '../links_community.html']
	],
	['Contacts', 'contacts.html', 70, 90,
	]
];


function parent_html_format (text) {
	var res = new Array;
	for (var i=0; i<states.length; i++)
		res[i] =  '<table cellpadding="0" cellspacing="0" border="0" bgcolor="#18426B" width="100%"><tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%" height="15" bgcolor="' + bgcolors[i] + '"><tr><td valign="middle" align="center" width="100%"><font face="Geneva, Arial, Helvetica, SunSans-Regular, sans-serif" color="' + textcolors[i] + '"><span style="font-size: 11pt">' + text + '</span></font></td><td valign="middle"><img src="img/'+imageparentstates[i]+'" width="1", height="15"></td></tr></table></td></tr></table>';
	return res;
}


function child_html_format (text, width, hasSubMenu) {
	var res = new Array;
	for (var i=0; i<states.length; i++)
		if(hasSubMenu) {
			res[i] = '<table cellpadding="1" cellspacing="0" border="0" bgcolor="#ffffff" width="'+width+'"><tr><td><table cellpadding="1" cellspacing="0" border="0" width="'+width+'" height="17" bgcolor="#FFFFFF"><tr><td bgcolor="' + child_bgcolors[i] + '" valign="middle"><font face=" Geneva, Arial, Helvetica, SunSans-Regular, sans-serif" color="' + child_textcolors[i] + '"><span style="font-size: 11pt;">&nbsp;' + text + '</span></font></td><td align="right" valign="bottom" bgcolor="' + child_bgcolors[i] + '"><font face=" Geneva, Arial, Helvetica, SunSans-Regular, sans-serif" color="white"><span style="font-size: 11pt;">&nbsp;</span></font><img src="img/'+imagechildstates[0]+'" width="10", height="12"></td></tr></table></td></tr></table>';
		}
		else {
			res[i] =  '<table cellpadding="1" cellspacing="0" border="0" bgcolor="#ffffff" width="'+width+'"><tr><td><table cellpadding="1" cellspacing="0" border="0" width="'+width+'" height="17" bgcolor="#FFFFFF"><tr><td bgcolor="' + child_bgcolors[i] + '" valign="middle"><font face=" Geneva, Arial, Helvetica, SunSans-Regular, sans-serif" color="' + child_textcolors[i] + '"><span style="font-size: 11pt;">&nbsp;' + text + '</span></font></td><td align="right" valign="bottom" bgcolor="' + child_bgcolors[i] + '"><font face=" Geneva, Arial, Helvetica, SunSans-Regular, sans-serif" color="white"><span style="font-size: 11pt;">&nbsp;</span></font></td></tr></table></td></tr></table>';
		}
	return res;
}