/********************************************
* Requires BrowseInf.js, DetectIE.js
* Written on October 04, 2002
* It is getting too complicated to accomodate
* menus for the following version sets.
*
* 1) Netscape 4.7 (below 4.7x)
* 2) Netscape 4.7x up but below 6
* 3) Netscape 6 up
* 4) Internet Explorer
*
* by Mariano S. Tanenglian, Jr.
*
* requires menucontainer.js
*
*********************************************/

var isLayer;//Netscape 4.7
var isPartLayer;	//Netscape 4.7x
var isNoLayer;		//Netscape 6up
var isIE;			//Internet Explorer UP
var vLayer;
var doMenu;

/***********************************************
*
* Determine Which Browser
*
************************************************/




/***********************************************
*
*	function to write menus
*
************************************************/


isLayer = false;
vLayer = parseFloat(navigator.appVersion);
//alert(vLayer);
if ((!detectIE())&&(vLayer < 4.71)){
	//Not NS 6
	isLayer = true;
}//end condition
isPartLayer = false;
if((soy_nav4up)&&(!soy_nav6up)){
	isPartLayer = true;
}//end condition
isNoLayer = false;
if(soy_nav6up){
	isNoLayer = true;
}//end condition
isIE = detectIE();

doMenu = false;
if((isLayer)||(isPartLayer)||(isNoLayer)||(isIE)){
	doMenu = true;
}//end if condition




function writemenu(){


	var tempout;
	var tempvar;
	tempout = "";
	if(!doMenu){
		alert("Browser Incompatible.\n\nSupported Browsers are:\n\n1) Netscape Navigator4.7 or higher;\n\n2) Internet Explorer 5 or higher");
	} else {
		for(var i = 0; i < menuData.length; i++){
			//array [i][0] = span/container data

			//---> SPAN/LAYER container HEAD
			tempvar = menuData[i][0];
			if((isLayer)){
				tempout += ("<layer id=\"" + tempvar.spanid + "\" class=\""+ tempvar.classid +"\" top=\""+ tempvar.top +"\" left=\""+ tempvar.left +"\" visibility=\""+ tempvar.visibility + "\">\n");
			} else if ((isPartLayer)||(isNoLayer)||(isIE)){
				tempout += ("<span id=\"" + tempvar.spanid + "\" class=\"" + tempvar.classid + "\">\n");
				//tempout += ("<span id=\"" + tempvar.spanid + "\" class=\"" + tempvar.classid + "\" style=\"top:" + tempvar.top + "; left:" + tempvar.left + ";\">\n");
				//alert(tempvar.top);
				//alert(tempvar.left);
				//alert(tempout);
			}//end condition

					for(var k = 1; k < menuData[i].length; k++){
						tempvar = menuData[i][k];
						//---> INNER SPAN/LAYER for Netscape -- NONE FOR IE
						if((isLayer)||(isPartLayer)){
							//---> NETSCAPE 4.7 & Below 6 Solution
								tempout += ("<layer id=\"" + tempvar.id + "\" top=\"" + tempvar.top + "\" left=\"" + tempvar.left + "\" bgcolor=\"" + tempvar.dcolor + "\" class=\"" + tempvar.borderclass + "\"");
							//alert(tempout);
							if((!tempvar.activeopen)&&(!tempvar.activecolor)){
								tempout += (">\n");
							} else {
								if((!tempvar.activeopen)&&(tempvar.activecolor)){
									tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(\'" + menuData[i][0].spanid) + "\'";
											for (var j = 0; j < tempvar.open.length; j++){
													tempout += (",\'" + tempvar.open[j] + "\'");
											}//end loop
									tempout +=  ("); keepOpen(); changeStyleBG(\'" + tempvar.ocolor + "\', this");
										for (var j = 0; j < tempvar.coldelta.length; j ++){
											tempout += (",\'" + tempvar.coldelta[j] + "\'");
										}//end loop
									tempout +=(");\"");
									tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
										for (var j = 0; j < tempvar.coldelta.length; j ++){
											tempout += (",\'" + tempvar.coldelta[j] + "\'");
										}//end loop
									tempout +=(");\">\n");
								} else {
									tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(");
										for (var j = 0; j < tempvar.open.length; j++){
											if (j == 0){
												tempout += ("\'" + tempvar.open[j] + "\'");
											} else {
												tempout += (",\'" + tempvar.open[j] + "\'");
											}//end if condition
										}//end loop
									tempout += ("); keepOpen(); openMenu(" + tempvar.nstop + "," + tempvar.nsleft);
										for (var j = 0; j < tempvar.open.length; j++){
												tempout += (",\'" + tempvar.open[j] + "\'");
										}//end loop
									tempout += ("); changeStyleBG(\'" + tempvar.ocolor + "\', this");
										for (var j = 0; j < tempvar.coldelta.length; j ++){
											tempout += (",\'" + tempvar.coldelta[j] + "\'");
										}//end loop
									tempout +=(");\"");
									tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
										for (var j = 0; j < tempvar.coldelta.length; j ++){
											tempout += (",\'" + tempvar.coldelta[j] + "\'");
										}//end loop
									tempout +=(");\">\n");
								}//end if condition
							}//end if condition
						} else if(isNoLayer){
							//---> Netscape 6 and Above Solution
								tempout += ("<div id=\"" + tempvar.id + "\" style=\"background-color:" + tempvar.dcolor + "; " + tempvar.borderstyle + "\"");
								if((!tempvar.activeopen)&&(!tempvar.activecolor)){
									tempout += (">\n");
								} else {
									if((!tempvar.activeopen)&&(tempvar.activecolor)){
										tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(\'" + menuData[i][0].spanid) + "\'";
											for (var j = 0; j < tempvar.open.length; j++){
													tempout += (",\'" + tempvar.open[j] + "\'");
											}//end loop
										tempout +=  ("); keepOpen(); changeStyleBG(\'" + tempvar.ocolor + "\', this");
											for (var j = 0; j < tempvar.coldelta.length; j ++){
												tempout += (",\'" + tempvar.coldelta[j] + "\'");
											}//end loop
										tempout +=(");\"");
										tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
											for (var j = 0; j < tempvar.coldelta.length; j ++){
												tempout += (",\'" + tempvar.coldelta[j] + "\'");
											}//end loop
										tempout +=(");\">\n");
									} else {
										tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(");
											for (var j = 0; j < tempvar.open.length; j++){
												if (j == 0){
													tempout += ("\'" + tempvar.open[j] + "\'");
												} else {
													tempout += (",\'" + tempvar.open[j] + "\'");
												}//end if condition
											}//end loop
										tempout += ("); keepOpen(); openMenu(" + tempvar.moztop + "," + tempvar.mozleft);
											for (var j = 0; j < tempvar.open.length; j++){
													tempout += (",\'" + tempvar.open[j] + "\'");
											}//end loop
										tempout += ("); changeStyleBG(\'" + tempvar.ocolor + "\', this");
											for (var j = 0; j < tempvar.coldelta.length; j ++){
												tempout += (",\'" + tempvar.coldelta[j] + "\'");
											}//end loop
										tempout +=(");\"");
										tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
											for (var j = 0; j < tempvar.coldelta.length; j ++){
												tempout += (",\'" + tempvar.coldelta[j] + "\'");
											}//end loop
										tempout +=(");\">\n");
									}//end if condition
								}//end if condition
						}//end if
								//---> Continue
								if(isNoLayer){
									tempout += ("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"" + tempvar.width + "\" height=\"" + tempvar.height + "\"><tr>");
								} else {
									tempout += ("<table class=\"" + tempvar.borderclass + "\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"" + tempvar.width + "\" height=\"" + tempvar.height + "\"><tr>");
								}//end if condition
									//---> Table Inner Content
									if(isIE){
										//---> IE Solution
											tempout += ("<td id=\"" + tempvar.id + "\" valign=\"middle\" align=\"left\"");
											if((!tempvar.activeopen)&&(!tempvar.activecolor)){
												tempout += (">\n");
											} else {
												if((!tempvar.activeopen)&&(tempvar.activecolor)){
													tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(\'" + menuData[i][0].spanid) + "\'";
														for (var j = 0; j < tempvar.open.length; j++){
																tempout += (",\'" + tempvar.open[j] + "\'");
														}//end loop
													tempout += ("); keepOpen(); changeStyleBG(\'" + tempvar.ocolor + "\', this");
														for (var j = 0; j < tempvar.coldelta.length; j ++){
															tempout += (",\'" + tempvar.coldelta[j] + "\'");
														}//end loop
													tempout +=(");\"");
													tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
														for (var j = 0; j < tempvar.coldelta.length; j ++){
															tempout += (",\'" + tempvar.coldelta[j] + "\'");
														}//end loop
													tempout +=(");\">\n");
												} else {
													tempout += ("onMouseOver = \"mouseHandler(0, this, \'" + tempvar.url + "\'); forceDeMenu(");
														for (var j = 0; j < tempvar.open.length; j++){
															if (j == 0){
																tempout += ("\'" + tempvar.open[j] + "\'");
															} else {
																tempout += (",\'" + tempvar.open[j] + "\'");
															}//end if condition
														}//end loop
													tempout += ("); keepOpen(); openMenu(" + tempvar.ietop + "," + tempvar.ieleft);
														for (var j = 0; j < tempvar.open.length; j++){
																tempout += (",\'" + tempvar.open[j] + "\'");
														}//end loop
													tempout += ("); changeStyleBG(\'" + tempvar.ocolor + "\', this");
														for (var j = 0; j < tempvar.coldelta.length; j ++){
															tempout += (",\'" + tempvar.coldelta[j] + "\'");
														}//end loop
													tempout +=(");\"");
													tempout += ("onMouseOut = \"closeMenu(); changeStyleBG(\'" + tempvar.dcolor + "\', this");
														for (var j = 0; j < tempvar.coldelta.length; j ++){
															tempout += (",\'" + tempvar.coldelta[j] + "\'");
														}//end loop
													tempout +=(");\">\n");
													//alert(tempout);
												}//end if condition
											}//end if condition
									} else if (isNoLayer){
												tempout += ("<td valign=\"middle\" align=\"left\">");
									} else {
												tempout += ("<td class=\"" + tempvar.textclass + "\" valign=\"middle\" align=\"left\">");
									}//end if condition
									//---> BEGIN A HREF TAG OR TEXT TAG
										if((!tempvar.activeopen)&&(!tempvar.activecolor)){
											if(isNoLayer){
												tempout += ("<span style=\"" + tempvar.textstyle + "\">" + tempvar.text + "</span>");
											} else if (isIE){
												tempout += ("<span style=\"" + tempvar.textstyle + "display: block;" + "\">" + tempvar.text + "</span>");
											} else {
												tempout += tempvar.text;
												//alert(tempout);
											}//End Conditon
										} else {
											if(isNoLayer){
												tempout += ("<a href=\"" + tempvar.url + "\" style=\"" + tempvar.textstyle + "\">" + tempvar.text + "</a>");
											} else if(isIE) {
												tempout += ("<a href=\"" + tempvar.url + "\" style=\"" + tempvar.textstyle + "display: block; width:" + tempvar.width + "px;" + "\">" + tempvar.text + "</a>");
											} else {
												tempout += ("<a href=\"" + tempvar.url + "\" class=\"" + tempvar.textclass + "\">" + tempvar.text + "</a>");
												//alert(tempout);
											}//End Conditon
										}//end if condition
								//---> End Table Tag
								tempout += ("</td></tr></table>\n");
						//---> INNER SPAN/LAYER for Netscape -- NONE FOR IE
						if((isLayer)||(isPartLayer)){
							tempout += "</layer>\n";
						} else if(isNoLayer){
							tempout += "</div>\n";
						}//end if

					}//end inner loop

			//---> SPAN/LAYER container FOOT
			tempvar = menuData[i][0];
			if((isLayer)){
				tempout += "</layer>\n\n";
			} else if ((isPartLayer)||(isNoLayer)||(isIE)){
				tempout += "</span>\n\n";
				//alert(tempout);
			}//end condition


			//---> Write To Browser Each Span =)
				//alert(tempout);
			document.write(tempout);

			//---> Clear tempout cache;
			tempout = "";
		}//end for loop outer for menuData()
	}//end if condition great outer

}//end function writemenu()