/*
 * $Id: menu.js 256 2004-06-30 19:37:15Z tim $
 */
// 1k DHTML API
var ua=navigator.userAgent.toLowerCase();
var d=document;var l=(d.layers)?1:0;var op=ua.indexOf('opera')!=-1;
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e]){return V[e]};for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){if(l)e.visibility='show';else e.style.visibility='visible';}
function hE(e){if(l)e.visibility='hide';else e.style.visibility='hidden';}
function sZ(e,z){if(l)e.zIndex=z;else e.style.zIndex=z;}
function sX(e,x){if(l)e.left=x;else if(op)e.style.pixelLeft=x;else e.style.left=x+'px';}
function sY(e,y){if(l)e.top=y;else if(op)e.style.pixelTop=y;else e.style.top=y+'px';}
function sW(e,w){if(l)e.clip.width=w;else if(op)e.style.pixelWidth=w;else e.style.width=w+'px';}
function sH(e,h){if(l)e.clip.height=h;else if(op)e.style.pixelHeight=h;else e.style.height=h+'px';}
function sC(e,t,r,b,x){if(l){X=e.clip;X.top=t;X.right=r;X.bottom=b;X.left=x;}else e.style.clip='rect('+t+' '+r+' '+b+' '+x+')';}
function wH(e,h){if(l){Y=e.document;Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}

function gW(e) {l?w=e.document.width:w=e.offsetWidth;return w;}
function gH(e) {l?h=e.document.height:h=e.offsetHeight;return h;}

// 1k DHTML API - Extended Functions
// author:tim morgan <mailto:tim@timmorgan.info>
// modified March 5/2002 by tim glen <tim@nonfiction.ca>
var dom=(d.getElementById)?1:0;var ie4=(d.all&&!dom)?1:0;var ie5=(d.all&&dom)?1:0;var ie=(d.all)?1:0;var nn=(d.layers)?1:0;var ns6=(dom&&navigator.appName=="Netscape")?1:0;
function sP(e,x,y){sX(e,x);sY(e,y)}
function sS(e,w,h){sW(e,w);sH(e,h)}
function aE(o,e,f,c){if(o.addEventListener)o.addEventListener(e,f,c);else if(o.attachEvent)o.attachEvent("on"+e,f);else {if(nn){eval('document.captureEvents(Event.'+e+')');}eval("o.on"+e+"="+f)}}
function docW(){return ie&&d.body.clientWidth||innerWidth||0}
function docH(){return ie&&d.body.clientHeight||innerHeight||0}
var menu_offset_x = 0;
var menu_offset_y = 0;
if (op) {
	menu_offset_x = 4;
	menu_offset_y = 13;
} else if (ie && ua.indexOf('win')>-1) {
	menu_offset_x = 1;
	menu_offset_y = 14;
} else if (ie && ua.indexOf('mac')>-1) {
	menu_offset_x = 4;
	menu_offset_y = 13;
} else if (nn) {
	menu_offset_x = 20;
	menu_offset_y = 18;
} else if (ua.indexOf('gecko')>-1 && ua.indexOf('khtml')==-1) {
	menu_offset_x = 1;
	menu_offset_y = 14;
} else {
	menu_offset_x = 1;
	menu_offset_y = 13;
}
function getPos(p,c) {if(dom||ie){var current=(dom)?document.getElementById(p):eval('document.images["'+p+'"]');posx=0;posy=0;while(current.offsetParent!=null){posx+=current.offsetLeft;posy+=current.offsetTop;current=current.offsetParent;}}else if(nn){if(c){posx=eval('document.'+c+'.document.images["'+p+'"].x');posy=eval('document.'+c+'.document.images["'+p+'"].y');}else{posx=eval('document.images["'+p+'"].x');posy=eval('document.images["'+p+'"].y');}}posx+=menu_offset_x;posy+=menu_offset_y;plchld=new Array(posx, posy);return plchld;}
function getWidth(p,c) {if(dom||ie){var current=(dom)?document.getElementById(p):eval('document.images["'+p+'"]');}else if(nn){if(c){current=eval('document.'+c+'.document.images["'+p+'"]');}else{current=eval('document.images["'+p+'"]');}}width=current.width;return width;}
function getHeight(p,c) {if(dom||ie){var current=(dom)?document.getElementById(p):eval('document.images["'+p+'"]');}else if(nn){if(c){current=eval('document.'+c+'.document.images["'+p+'"]');}else{current=eval('document.images["'+p+'"]');}}height=current.height;return height;}
function getSize(p,c){width=getWidth(p,c);height=getHeight(p,c);return new Array(width,height);}

// 1k DHTML API - Menu System (requires 1k.js, ext.js)
// author:tim glen <tim@nonfiction.ca>
var test = false;
var m_o = new Array(); // an array to contain either null or the id of the menu(s) currently open
var m_on = false; // boolean to tell whether any menu is currently 'on'
var m_width = new Array(); // an array to contain menu widths for positioning
m_width[0] = 75;
m_width[1] = 75;
m_width[2] = 75;
var l_height = 13;
var nav_img = false;
var menusloaded = false;
var menuopen= false;
var aw=8; // arrow width for submenus
var ah=8; // arrow height for submenus
var	current_over = new Array();

function closeOpenMenus(){
 	if(m_o.length == 0){
    	return true;
    } else {
		for (i=0;i<m_o.length;i++) {
	    	if (i == 0) {
				e = d.getElementById(m_o[i]);
				if (e) {
					e.style.display = 'none';
					m_o[0] = null;
				}
			} else {
				cTM();
				hideMenu(i);
			}
	    }
	    return false;
    }
}

function toggleMenus(x) {
	if(menusloaded) {
		current_x = -1;
		if (m_o.length) {
			current_x = m_o[0];
			closeOpenMenus();
		}
		menu_open = false;
		if (current_x == -1) {
			menu_open = true;
		} else if ('menu'+x != current_x) {
			menu_open = true;
		}
		if (menu_open) {
			e = d.getElementById('menu'+x);
			if (e) {
				e.style.display = 'block';
				m_o[0] = 'menu'+x;
			}
		}
	}
}

function cM(m,x,y) {m=gE(m);sP(m,x,y);}
function sM(){
	if(menusloaded) {
		lvl = sM.arguments.length;
		cTM();
		hideMenu(lvl);
		for (i=1;i<lvl;i++) {
			m = sM.arguments[i];
			m_o[i]=m;m=gE(m);if(m)sE(m);
		}
	}
}
function hideMenu(lvl) {
	if (typeof lvl == "undefined" || lvl == 0) {
		lvl = 0;
		if(nav_img) rI();
	}
	if (lvl > 0) lvl--;
	for(i=lvl;i<m_o.length;i++) {
		if(m_o[i] && i > 0) {
			hM(m_o[i]);
			m_o[i] = null;
		}
	}
}
function hM(m) {m=gE(m);if(m)hE(m);}
function cTM() {clearTimeout(m_on);}
function tM() {m_on=setTimeout("hideMenu()", 800);}
function cI(i,r,o) {nav_img=new Array(i,o);changeImages(i,r);}
function cIO(){if(nav_img){changeImages(nav_img[0], nav_img[2])}}
function clickCI(i,r,o){
	menu_open = true;
	if (current_over.length && i == current_over[0]) {
		menu_open = false;
	}
	if (current_over.length){
		changeImages(current_over[0], current_over[2]);
		current_over = new Array();
	}
	if (menu_open) {
		changeImages(i,r);
		current_over[0] = i;
		current_over[1] = r;
		current_over[2] = o;
	}
}
function mRI(){
	if(m_o.length == 0) {
		rI();
	} else {
		if(current_over.length){
			if(nav_img[0] != current_over[0]){
				rI();
			}
		} else {
			changeImages(nav_img[0], nav_img[1])
		}
	}
}


function rI() {if(nav_img){changeImages(nav_img[0],nav_img[1]);nav_img=false;}}
function fixPos(posi, posx) {
	posi[0]+=2;
	posi[1]-=7;
	posi[0]+=(aw+1);posi[1]-=(ah*2);
	if (typeof posx == "undefined") {
		posx = new Array();
		posx[0] = 0;
		posx[1] = 0;
	}
	if(nn){posi[0]+=posx[0];posi[1]+=posx[1];}
	if (posi[0] + m_width[0] > docW()) {
		posi[0] = docW()-m_width[0];
	}
	return posi;
}

var menus = false;
function initMenus() {
	if (!menus) {
		menusloaded = true;
		return;
	}
	for (i=0;i<menus.length;i++) {
		ancestors = menus[i].split('_');
		ancestor = '';
		for(x=0;x<ancestors.length-1;x++) {
			if (ancestor != '') ancestor+='_';
			ancestor+=ancestors[x];
		}
		if(ancestor != '') ancestor = 'menu'+ancestor;
		else ancestor = false;
		if (ancestors.length == 1) {
			pos1=getPos('mp'+menus[i],ancestor);pos1=fixPos(pos1);
			img_size = getSize('mp'+menus[i]);
			pos1[1]+=img_size[1];
			pos1[1]+=13;
			if (op) {
				pos1[0]-=3;
				pos1[1]-=0;
			} else if (ie && ua.indexOf('win')>-1) {
				if (ua.indexOf('msie 5.0')!=-1 || ua.indexOf('msie 5.5')!=-1) {
					pos1[0]-=10;
					pos1[1]-=11;
				} else {
					pos1[0]-=0;
					pos1[1]-=1;
				}
			} else if (ie && ua.indexOf('mac')>-1) {
				pos1[0]+=1;
				pos1[1]-=13;
			} else if (nn) {
				pos1[0]-=15;
				pos1[1]-=18;
			} else if (ua.indexOf('gecko')>-1 && ua.indexOf('khtml')==-1) {
				pos1[0]-=1;
				pos1[1]-=14;
			} else {
				pos1[0]+=4;
				pos1[1]-=13;
			}
			//cM('menu'+menus[i],pos1[0],pos1[1]);
		} else if (ancestors.length == 2) {
			pos2=getPos('mp'+menus[i],ancestor);
			pos2=fixPos(pos2, pos1);
			cM('menu'+menus[i],pos2[0],pos2[1]);
		} else if (ancestors.length == 3) {
			pos3=getPos('mp'+menus[i],ancestor);
			pos3=fixPos(pos3, pos2);
			cM('menu'+menus[i],pos3[0],pos3[1]);
		} else if (ancestors.length == 4) {
			pos4=getPos('mp'+menus[i],ancestor);
			pos4=fixPos(pos4, pos3);
			cM('menu'+menus[i],pos4[0],pos4[1]);
		} else if (ancestors.length == 5) {
			pos5=getPos('mp'+menus[i],ancestor);
			pos5=fixPos(pos5, pos4);
			cM('menu'+menus[i],pos5[0],pos5[1]);
		}
	}
	menusloaded = true;
}

function reloadMenus() {
if (nn) document.location.reload();
else initMenus();
}

onload=function(){
initMenus();
}
onresize=function(){
if (nn) document.location.reload();
else initMenus();
}
