var r2_cnt;
var curr_row;

function SubI_Mkr(pL){
	var left_crd, top_crd, hO, vO, bL, eL;
	bL=CBBeginSubILayer;
	eL=CBEndSubILayer;
	if (j%2==1) {
		hO=113;
		r2_cnt++;
		if (ie) {
			bL = '<TD WIDTH=1' + CBMouseOver + '></TD><TD ';
		}
	} else {
		hO = 0;
		curr_row++;
		if (ie) {
			eL = '</TD><TD ';
		}
	}
	vO = -16 * r2_cnt;
	temp_s_i = bL + ' WIDTH=112 HEIGHT=15 BGCOLOR="';
	left_crd =  1 + hO;
	top_crd = j * 16 + vO;
	if (curr_row % 2 == 1) {
		temp_s_i += Menu.SI_EVEN_BGCOLOR;
		temp_bgcolor = Menu.SI_EVEN_BGCOLOR;
	} else {
		temp_s_i += Menu.SI_ODD_BGCOLOR;
		temp_bgcolor = Menu.SI_ODD_BGCOLOR;
	}
	temp_s_i += '" TOP=' + top_crd + ' LEFT=' + left_crd + ' ID="' + this.id_name + '" class="menucursor" onclick="top.location.href=\''+ this.url_name + '\'" onmouseover="si_rovr(\'' + pL + '\', \'' + this.id_name + '\', \'' + temp_bgcolor + '\')\;" onmouseout="si_rout()\;">';
	temp_s_i += '<A CLASS="si" onclick="this.blur()" HREF="' + this.url_name + '">&nbsp\;' + this.value_name + '</A>' + eL;
	return temp_s_i;
}

function SubI(iN, vN, uN){
	this.id_name = iN;
	this.value_name = vN;
	this.url_name = uN;
}

SubI.prototype.mk_si = SubI_Mkr;

function SubMenu_Mkr(){
	var y_rows = this.s_i.length;
	curr_row=0;
	var sW;
	var col_cnt=1;
	if (this.s_i.length == 0) {
		sW=1;
	} else {
		y_rows=Math.ceil(y_rows/2);
		sW=228;
		col_cnt=2;
	}
	temp_s_m = CBBeginSubMenuLayer;
	temp_s_m += ' WIDTH=' + sW + ' HEIGHT=' + (y_rows * 16 + 1) + ' BGCOLOR="' + Menu.SM_BGCOLOR + '" ID="' + this.id_name + '" ' + CBTop + Menu.SM_TOP_COORD + CBLeft + '-596' + CBEndSubMenuLayer;
	if (ns) temp_s_m += CBBeginSubILayer + ' WIDTH=' + sW + ' HEIGHT=' + (y_rows * 16 + 1) + ' TOP=0 LEFT=0 BGCOLOR="' + Menu.SM_BGCOLOR + '" onmouseover="si_rovr()\;" onmouseout="si_rout()\;">' + CBEndSubILayer;
	r2_cnt = 0;
	for (j = 0; j < this.s_i.length; j++){
		temp_s_m += this.s_i[j].mk_si(this.id_name, col_cnt);
		if (j < (this.s_i.length - 1) && (j%2 == 1) && (ie)) temp_s_m += '</TR>';
	}
	if (this.s_i.length % 2 == 1 && j > 0) {
		temp_s_m += eF + ' WIDTH=112 HEIGHT=15 TOP=' + (parseInt(this.s_i.length / 2) * 16) + ' LEFT=114 BGCOLOR="';
	if (this.s_i.length % 4 == 1) {
		temp_s_m += Menu.SI_EVEN_BGCOLOR;
	} else {
		temp_s_m += Menu.SI_ODD_BGCOLOR;
	}
	temp_s_m +=  '" onmouseover="si_rovr()\;" onmouseout="si_rout()\;">' + CBEndSubILayer;
	}
	temp_s_m += SG + CBCloseTable + CBCloseLayer;
	return temp_s_m;
}

function SubMenu(iN, vN, uM, lstrt){
	this.lstrt = lstrt;
	this.value_name = vN;
	this.id_name = iN;
	this.menu_url = uM;
	this.s_i = new Array();
}

SubMenu.prototype.mk_submenu = SubMenu_Mkr;

function MenuI_Mkr(){
	temp_m_i = CBBeginLayer + ' BGCOLOR="' + Menu.MI_BGCOLOR[0] + '" WIDTH=' + this.cell_width + ' HEIGHT=18 ID="' + this.id_name + '" onclick="top.location.href=\''+ this.menu_url + '\'" onmouseover="mi_rovr(\'' + this.id_name + '\', \'' + this.s_m.id_name + '\','+this.lstrt + ')\;" onmouseout="mi_rout()\;" CLASS="menucursor" ' + CBTop  + Menu.TOP_COORD + CBLeft + left_start + CBEndLayer;
	temp_m_i += '<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 width='+this.cell_width+'><TR valign=top><td width=1 bgcolor=#5858A8><img src="/images/spacer.gif" height=1 width=1></td><TD width='+ (this.cell_width - 2) +' bgcolor=#88C8F8><img src="/images/spacer.gif" height=1 width=1></td><td width=1 bgcolor=#5858A8><img src="/images/spacer.gif" height=1 width=1></td></tr><tr valign=top><td width=1 bgcolor=#88C8F8><img src="/images/spacer.gif" height=17 width=1></td><td width=' + (this.cell_width - 1) + ' colspan=2><A HREF="' + this.menu_url + '" onclick="this.blur()" CLASS="mi">&nbsp\;<B>' + this.value_name + '</B><BR><IMG SRC="/dhtml/hnavbar/images/dn_arrow.gif" height=3 width=5 border=0 hspace='+ (ns ? 3 : 5) + '></A></TD></TR></TABLE>';
	left_start += this.cell_width+3;
	temp_m_i += CBCloseLayer;
	temp_m_i += this.s_m.mk_submenu(); 
	return temp_m_i;
}

function MenuI(iN, vN, sM, uM, cW, lmenu){
	this.id_name = iN;
	this.lstrt = lmenu;
	this.value_name = vN;
	this.cell_width = cW;
	this.menu_url = uM;
	this.s_m = new SubMenu(sM, vN, uM, lmenu);
}

MenuI.prototype.mk_mi = MenuI_Mkr;

function Menu_Mkr(){
	temp_menu = '';
	for (i = 0; i < this.m_i.length; i++){
		temp_menu += this.m_i[i].mk_mi();
	}
	return temp_menu;
}

function Menu(){
	this.m_i = new Array();
}

Menu.prototype.mk_menu = Menu_Mkr;
