var isIE = document.all?1:0;
var isNS = document.layers?1:0;
var isDOM = ( document.getElementById && !isIE )?1:0;
var isIE4 = ( !isDOM && isIE )?1:0;
var isNS6 = ( isDOM && navigator.appName=="Netscape")?1:0;

var useMac = ( navigator.appVersion.indexOf("Mac") != -1 );
var isIE4M = isIE4 && useMac;
var isNS4M = isNS && useMac;
var useOpera = ( navigator.userAgent.indexOf("Opera") != -1 );
var useKonqueror = ( navigator.userAgent.indexOf("Konqueror") !=-1 );

var win_width = 0;
var win_height = 0;
var win_page = 780;

var rootTD = "";
var rootTX = "";
var rootBG = "";
var rootTC = "";

var mBlock = "";
var m_Left = 0;
var m_Top = 0;
var mShow = 0;
var mTime;

var mTD = "";
var mTX = "";
var mBG = "";
var mTC = "";

var sBlock = "";
var s_Left = 0;
var s_Top = 0;
var sShow = 0;
var sTime;

var sTD = "";
var sTX = "";
var sBG = "";
var sTC = "";

var xBlock = "";
var x_Left = 0;
var x_Top = 0;
var xShow = 0;
var xTime;

var xTD = "";
var xTX = "";
var xBG = "";
var xTC = "";

function row_over( level, OB, TX, BGC, BGO, TXC, TXO ) {
	if ( level == 0 ) {
		if ( rootTD != "" ) isIE?document.all( rootTD ).style.background = rootBG : document.getElementById( rootTD ).style.background = rootBG;
		if ( rootTX != "" ) isIE?document.all( rootTX ).style.color = rootTC : document.getElementById( rootTX ).style.color = rootTC;

		rootTD = OB;
		rootTX = TX;
		rootBG = BGC;
		rootTC = TXC;

		var mxOB = isIE?document.all( rootTD ) : document.getElementById( rootTD );
		var mxTX = isIE?document.all( rootTX ) : document.getElementById( rootTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;
	}
	else if ( level == 1 ) {
		if ( mTD != "" ) isIE?document.all( mTD ).style.background = mBG : document.getElementById( mTD ).style.background = mBG;
		if ( mTX != "" ) isIE?document.all( mTX ).style.color = mTC : document.getElementById( mTX ).style.color = mTC;

		mTD = OB;
		mTX = TX;
		mBG = BGC;
		mTC = TXC;

		var mxOB = isIE?document.all( mTD ) : document.getElementById( mTD );
		var mxTX = isIE?document.all( mTX ) : document.getElementById( mTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;
	}
	else if ( level == 2 ) {
		if ( sTD != "" ) isIE?document.all( sTD ).style.background = sBG : document.getElementById( sTD ).style.background = sBG;
		if ( sTX != "" ) isIE?document.all( sTX ).style.color = sTC : document.getElementById( sTX ).style.color = sTC;

		sTD = OB;
		sTX = TX;
		sBG = BGC;
		sTC = TXC;

		var mxOB = isIE?document.all( sTD ) : document.getElementById( sTD );
		var mxTX = isIE?document.all( sTX ) : document.getElementById( sTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;
	}
	else if ( level == 3 ) {
		if ( xTD != "" ) isIE?document.all( xTD ).style.background = xBG : document.getElementById( xTD ).style.background = xBG;
		if ( xTX != "" ) isIE?document.all( xTX ).style.color = xTC : document.getElementById( xTX ).style.color = xTC;

		xTD = OB;
		xTX = TX;
		xBG = BGC;
		xTC = TXC;

		var mxOB = isIE?document.all( xTD ) : document.getElementById( xTD );
		var mxTX = isIE?document.all( xTX ) : document.getElementById( xTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;
	}
}

function row_out( level ) {
	if ( level == 0 ) {
		if ( rootTD != "" ) isIE?document.all( rootTD ).style.background = rootBG : document.getElementById( rootTD ).style.background = rootBG;
		if ( rootTX != "" ) isIE?document.all( rootTX ).style.color = rootTC : document.getElementById( rootTX ).style.color = rootTC;

		rootTD = "";
		rootTX = "";
		rootBG = "";
		rootTC = "";
	}
	else if ( level == 1 ) {
		if ( mTD != "" ) isIE?document.all( mTD ).style.background = mBG : document.getElementById( mTD ).style.background = mBG;
		if ( mTX != "" ) isIE?document.all( mTX ).style.color = mTC : document.getElementById( mTX ).style.color = mTC;

		mTD = "";
		mTX = "";
		mBG = "";
		mTC = "";
	}
	else if ( level == 2 ) {
		if ( sTD != "" ) isIE?document.all( sTD ).style.background = sBG : document.getElementById( sTD ).style.background = sBG;
		if ( sTX != "" ) isIE?document.all( sTX ).style.color = sTC : document.getElementById( sTX ).style.color = sTC;

		sTD = "";
		sTX = "";
		sBG = "";
		sTC = "";
	}
	else if ( level == 3 ) {
		if ( xTD != "" ) isIE?document.all( xTD ).style.background = xBG : document.getElementById( xTD ).style.background = xBG;
		if ( xTX != "" ) isIE?document.all( xTX ).style.color = xTC : document.getElementById( xTX ).style.color = xTC;

		xTD = "";
		xTX = "";
		xBG = "";
		xTC = "";
	}
}

function show_menu( level, OB, TX, BGC, BGO, TXC, TXO, xSub, xLeft, xTop ) {
//	if ( win_width == 0 ) menu_resize();
	if ( level == 0 ) {
		hide_menu( 2 );
		hide_menu( 1 );
//		if ( rootTD != "" ) isIE?document.all( rootTD ).style.background = rootBG : document.getElementById( rootTD ).style.background = rootBG;
//		if ( rootTX != "" ) isIE?document.all( rootTX ).style.color = rootTC : document.getElementById( rootTX ).style.color = rootTC;
		if ( rootTX != "" ) picChange( rootTX , rootTC );

		rootTD = OB;
		rootTX = TX;
		rootBG = BGC;
		rootTC = TXC;

		if ( mTime ) clearInterval( mTime );
		if ( mBlock != "" ) {
			isIE?document.all( mBlock ).style.left = 0 : document.getElementById( mBlock ).style.left = 0;
			isIE?document.all( mBlock ).style.visibility = "hidden" : document.getElementById( mBlock ).style.visibility = "hidden";
		}

		var mxOB = isIE?document.all( rootTD ) : document.getElementById( rootTD );
		var mxTX = isIE?document.all( rootTX ) : document.getElementById( rootTX );

//		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
//		mxTX.style.color = TXO;
		if ( TXO != "" ) document.images[ rootTX ].src = TXO;

		mBlock = xSub;
		m_Left = xLeft;
		m_Top = xTop;
		var uSUB = isIE?document.all( mBlock ) : document.getElementById( mBlock );

/*
		if ( win_width <= win_page ) {
			if ( isIE ) {
				showLeft = xLeft + 1;
			} else {
				showLeft = xLeft + 10;
				if ( win_width > 777 && win_width < 780 ) showLeft--;
				else if ( win_width < 778 ) showLeft-=2;
			}
		}
		else {
			showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? xLeft : ( xLeft + 10 ) );
			if ( isIE ) {
				if ( ( win_width % 2 ) == 1 ) showLeft++;
			}
			else if ( ( win_width % 2 ) == 1 ) showLeft--;
		}

		uSUB.style.left = showLeft;
*/
		uSUB.style.left = xLeft;
		if ( isIE ) {
			uSUB.style.top = xTop;
		} else {
			uSUB.style.top = xTop - 8;
		}
		uSUB.style.visibility = "visible";

		mShow = 1;
		sShow = 0;
		xShow = 0;
		mTime = setInterval("show_delay(" + level + ")", 1000);
	}
	else if ( level == 1 ) {
		hide_menu( 2 );
		if ( mTD != "" ) isIE?document.all( mTD ).style.background = mBG : document.getElementById( mTD ).style.background = mBG;
		if ( mTX != "" ) isIE?document.all( mTX ).style.color = mTC : document.getElementById( mTX ).style.color = mTC;

		mTD = OB;
		mTX = TX;
		mBG = BGC;
		mTC = TXC;

		if ( sTime ) clearInterval( sTime );
		if ( sBlock != "" ) {
			isIE?document.all( sBlock ).style.left = 0 : document.getElementById( sBlock ).style.left = 0;
			isIE?document.all( sBlock ).style.visibility = "hidden" : document.getElementById( sBlock ).style.visibility = "hidden";
		}

		var mxOB = isIE?document.all( mTD ) : document.getElementById( mTD );
		var mxTX = isIE?document.all( mTX ) : document.getElementById( mTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;

		sBlock = xSub;
		s_Left = xLeft;
		s_Top = xTop;
		var uSUB = isIE?document.all( sBlock ) : document.getElementById( sBlock );

/*
		if ( win_width <= win_page ) {
			if ( isIE ) {
				showLeft = xLeft + 1;
			} else {
				showLeft = xLeft + 10;
				if ( win_width > 777 && win_width < 780 ) showLeft--;
				else if ( win_width < 778 ) showLeft-=2;
			}
		}
		else {
			showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? xLeft : ( xLeft + 10 ) );
			if ( isIE ) {
				if ( ( win_width % 2 ) == 1 ) showLeft++;
			}
			else if ( ( win_width % 2 ) == 1 ) showLeft--;
		}
		
		uSUB.style.left = showLeft;
*/
		uSUB.style.left = xLeft;
		if ( isIE ) {
			uSUB.style.top = xTop;
		} else {
			uSUB.style.top = xTop - 8;
		}
		uSUB.style.visibility = "visible";

		sShow = 1;
		xShow = 0;
		sTime = setInterval("show_delay(" + level + ")", 1000);
	}
	else if ( level == 2 ) {
		if ( sTD != "" ) isIE?document.all( sTD ).style.background = sBG : document.getElementById( sTD ).style.background = sBG;
		if ( sTX != "" ) isIE?document.all( sTX ).style.color = sTC : document.getElementById( sTX ).style.color = sTC;

		sTD = OB;
		sTX = TX;
		sBG = BGC;
		sTC = TXC;

		if ( xTime ) clearInterval( xTime );
		if ( xBlock != "" ) {
			isIE?document.all( xBlock ).style.left = 0 : document.getElementById( xBlock ).style.left = 0;
			isIE?document.all( xBlock ).style.visibility = "hidden" : document.getElementById( xBlock ).style.visibility = "hidden";
		}

		var mxOB = isIE?document.all( sTD ) : document.getElementById( sTD );
		var mxTX = isIE?document.all( sTX ) : document.getElementById( sTX );

		mxOB.style.background = BGO;
		mxOB.style.cursor = isIE?"hand" : "pointer";
		mxTX.style.color = TXO;

		xBlock = xSub;
		x_Left = xLeft;
		x_Top = xTop;
		var uSUB = isIE?document.all( xBlock ) : document.getElementById( xBlock );

/*
		if ( win_width <= win_page ) {
			if ( isIE ) {
				showLeft = xLeft + 1;
			} else {
				showLeft = xLeft + 10;
				if ( win_width > 777 && win_width < 780 ) showLeft--;
				else if ( win_width < 778 ) showLeft-=2;
			}
		}
		else {
			showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? xLeft : ( xLeft + 10 ) );
			if ( isIE ) {
				if ( ( win_width % 2 ) == 1 ) showLeft++;
			}
			else if ( ( win_width % 2 ) == 1 ) showLeft--;
		}

		uSUB.style.left = showLeft;
*/
		uSUB.style.left = xLeft;
		if ( isIE ) {
			uSUB.style.top = xTop;
		} else {
			uSUB.style.top = xTop - 8;
		}
		uSUB.style.visibility = "visible";

		xShow = 1;
		xTime = setInterval("show_delay(" + level + ")", 1000);
	}
}

function show_delay( level ) {
	if ( level == 2 && xShow == 0 ) hide_menu( level );
	else if ( level == 1 && sShow == 0 ) hide_menu( level );
	else if ( level == 0 && mShow == 0 ) hide_menu( level );
}

function hide_menu( level ) {
	if ( level == 2 ) {
		if ( xTime ) clearInterval( xTime );
		if ( xBlock != "" ) {
			isIE?document.all( xBlock ).style.left = 0 : document.getElementById( xBlock ).style.left = 0;
			isIE?document.all( xBlock ).style.visibility = "hidden" : document.getElementById( xBlock ).style.visibility = "hidden";
		}
		xBlock = "";
		x_Left = 0;
		x_Top = 0;

		if ( sTD != "" ) isIE?document.all( sTD ).style.background = sBG : document.getElementById( sTD ).style.background = sBG;
		if ( sTX != "" ) isIE?document.all( sTX ).style.color = sTC : document.getElementById( sTX ).style.color = sTC;

		sTD = "";
		sTX = "";
		sBG = "";
		sTC = "";

		xShow = 0;
		sShow = 0;
		mShow = 0;
	}
	if ( level == 1 ) {
		hide_menu( 2 );
		if ( sTime ) clearInterval( sTime );
		if ( sBlock != "" ) {
			isIE?document.all( sBlock ).style.left = 0 : document.getElementById( sBlock ).style.left = 0;
			isIE?document.all( sBlock ).style.visibility = "hidden" : document.getElementById( sBlock ).style.visibility = "hidden";
		}
		sBlock = "";
		s_Left = 0;
		s_Top = 0;

		if ( mTD != "" ) isIE?document.all( mTD ).style.background = mBG : document.getElementById( mTD ).style.background = mBG;
		if ( mTX != "" ) isIE?document.all( mTX ).style.color = mTC : document.getElementById( mTX ).style.color = mTC;

		mTD = "";
		mTX = "";
		mBG = "";
		mTC = "";

		sShow = 0;
		mShow = 0;
	}
	if ( level == 0 ) {
		hide_menu( 1 );
		if ( mTime ) clearInterval( mTime );
		if ( mBlock != "" ) {
			isIE?document.all( mBlock ).style.left = 0 : document.getElementById( mBlock ).style.left = 0;
			isIE?document.all( mBlock ).style.visibility = "hidden" : document.getElementById( mBlock ).style.visibility = "hidden";
		}
		mBlock = "";
		m_Left = 0;
		m_Top = 0;

//		if ( rootTD != "" ) isIE?document.all( rootTD ).style.background = rootBG : document.getElementById( rootTD ).style.background = rootBG;
//		if ( rootTX != "" ) isIE?document.all( rootTX ).style.color = rootTC : document.getElementById( rootTX ).style.color = rootTC;
		if ( rootTX != "" ) picChange( rootTX , rootTC );

		rootTD = "";
		rootTX = "";
		rootBG = "";
		rootTC = "";

		mShow = 0;
	}
}

function menu_resize() {
	win_width = isNS? window.outerWidth : ( isIE? window.document.body.clientWidth : window.document.body.clientWidth - 20 );
	win_height = isNS? window.outerHeight : ( isIE? window.document.body.clientHeight : window.document.body.clientHeight + 12 );

	var showLeft;
	showLeft = 0;
	if ( xBlock != "" ) {
		var uSUB = isIE?document.all( xBlock ) : document.getElementById( xBlock );

		if ( uSUB.style.visibility == "visible" ) {
			if ( win_width <= win_page ) {
				if ( isIE ) {
					showLeft = x_Left + 1;
				} else {
					showLeft = x_Left + 10;
					if ( win_width > 777 && win_width < 780 ) showLeft--;
					else if ( win_width < 778 ) showLeft-=2;
				}
			}
			else {
				showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? x_Left : ( x_Left + 10 ) );
				if ( isIE ) {
					if ( ( win_width % 2 ) == 1 ) showLeft++;
				}
				else if ( ( win_width % 2 ) == 1 ) showLeft--;
			}

			uSUB.style.left = showLeft;
			uSUB.style.top = x_Top;
		}
	}
	showLeft = 0;
	if ( sBlock != "" ) {
		var uSUB = isIE?document.all( sBlock ) : document.getElementById( sBlock );

		if ( uSUB.style.visibility == "visible" ) {
			if ( win_width <= win_page ) {
				if ( isIE ) {
					showLeft = s_Left + 1;
				} else {
					showLeft = s_Left + 10;
					if ( win_width > 777 && win_width < 780 ) showLeft--;
					else if ( win_width < 778 ) showLeft-=2;
				}
			}
			else {
				showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? s_Left : ( s_Left + 10 ) );
				if ( isIE ) {
					if ( ( win_width % 2 ) == 1 ) showLeft++;
				}
				else if ( ( win_width % 2 ) == 1 ) showLeft--;
			}

			uSUB.style.left = showLeft;
			uSUB.style.top = s_Top;
		}
	}
	showLeft = 0;
	if ( mBlock != "" ) {
		var uSUB = isIE?document.all( mBlock ) : document.getElementById( mBlock );

		if ( uSUB.style.visibility == "visible" ) {
			if ( win_width <= win_page ) {
				if ( isIE ) {
					showLeft = m_Left + 1;
				} else {
					showLeft = m_Left + 10;
					if ( win_width > 777 && win_width < 780 ) showLeft--;
					else if ( win_width < 778 ) showLeft-=2;
				}
			}
			else {
				showLeft = ( ( win_width - win_page ) / 2 ) + ( isIE? m_Left : ( m_Left + 10 ) );
				if ( isIE ) {
					if ( ( win_width % 2 ) == 1 ) showLeft++;
				}
				else if ( ( win_width % 2 ) == 1 ) showLeft--;
			}

			uSUB.style.left = showLeft;
			uSUB.style.top = m_Top;
		}
	}
}

//	 blockID, Width, BGC, BGO, TXC, TXO, TAlign, Level, [ menuID, textID, Text, Link, Target, Sub, subLeft, subTop ]
function makeMenu() {
	var mk = makeMenu.arguments;
	var hs = "";
	hs += ( isNS?'<layers' : '<div' ) + ' id="' + mk[0] + '" style="position: absolute; visibility: hidden; z-Index: 100; width: ' + mk[1] + ';">';
	hs += '<table border="0" cellpadding="1" cellspacing="0" width="' + mk[1] + '" class="block" style="background: ' + mk[2] + '"';
	hs += ' onmouseover="' +( (mk[7]>=3) ? 'xShow=1; ' : '' ) + ( (mk[7]>=2) ? 'sShow=1; ' : '' ) + ( (mk[7]>=1) ? 'mShow=1;' : '' ) + '"';
	hs += ' onmouseout="' + ( (mk[7]==3) ? 'xShow=0; ' : ( (mk[7]==2) ? 'sShow=0; ' : ( (mk[7]==1) ? 'mShow=0;' : '' ) ) ) + '"';
	hs += '>';
	for (var i = 8; i < mk.length; i+=8) {
		if ( mk[i+2] != '' ) {
			hs += '<tr><td id="' + mk[i] + '" class="row"';
			hs += ' onmouseover="' + ( (mk[7]==3) ? 'row_over(' + mk[7] + ',\'' + mk[i] + '\',\'' + mk[i+1] + '\',\'' + mk[2] + '\',\'' + mk[3] + '\',\'' + mk[4] + '\',\'' + mk[5] + '\')' : ( (mk[i+5] != "") ? 'show_menu(' + mk[7] + ',\'' + mk[i] + '\',\'' + mk[i+1] + '\',\'' + mk[2] + '\',\'' + mk[3] + '\',\'' + mk[4] + '\',\'' + mk[5] + '\',\'' + mk[i+5] + '\',' + mk[i+6] + ',' + mk[i+7] + ')' : 'hide_menu(' + mk[7] + '); row_over(' + mk[7] + ',\'' + mk[i] + '\',\'' + mk[i+1] + '\',\'' + mk[2] + '\',\'' + mk[3] + '\',\'' + mk[4] + '\',\'' + mk[5] + '\')' ) ) + '"';
			hs += ' onmouseout="' + ( (mk[7]==3) ? 'row_out(' + mk[7] + ')' : ( (mk[i+5] != "") ? ( (mk[7]==2) ? 'xShow=0; ' : ( (mk[7]==1) ? 'sShow=0; ' : '' ) ) : 'row_out(' + mk[7] + ');' ) ) + '"';
			if ( mk[i+3] != "") hs += ' onclick="openweb(\'' + mk[i+3] + '\' , \'' + mk[i+4] + '\')"';
			hs += '>';
			hs += '<table border="0" cellpadding="0" cellspacing="0" width="' + mk[1] + '">';
			hs += '<tr>';
			if ( mk[6] != "right" && mk[6] != "center" ) hs += '<td width="3"></td>';
			hs += '<td id="' + mk[i+1] + '" class="e10" style="color: ' + mk[4] + '" align="' + mk[6] + '">' + mk[i+2] + '</td><td width="3"></td>';
			if ( mk[i+5] != "" ) hs += '<td width="10" align="center"><img src="images/flyout-arrow.gif" border="0"></td><td width="2"></td>';
			hs += '</tr>';
			hs += '</table>';
			hs += '</td></tr>';
		}
	}
	hs += '</table>';
	hs += ( isNS?'</layers' : '</div' ) + '>';
	document.writeln ( hs );
}

function openweb( p , tg ) {
	if ( tg == "new" ) {
		var webnew = window.open( p, tg );
		webnew.focus();
	}
	else if ( tg == "on" ) window.location.href = p;
}

function msOver( ob ) {
	var eex;
	isIE ? eex = "hand" : eex = "pointer";
	ob.style.cursor = eex;
}

function picChange( ob, p ) {
	document.images[ob].src = p;
}

function preload() { //v3.0
	var d = document; 
	if (d.images) { 
		if (!d.pic) d.pic = new Array();
		var i, j = d.pic.length, a = preload.arguments;
		for (i=0; i<a.length; i++) if (a[i].indexOf("#")!=0) { d.pic[j]=new Image; d.pic[j++].src=a[i]; }
	}
}

function colorP( ob , co ) {
	ob.style.color = co;
}

function openLink( p, w, h ) {
	var wnew = window.open( p ,"pro","toolbar=0,status=0,scroller=1,resized=1,width=" + w + ",height=" + h );
	if ( ! wnew.opener ) wnew.opener = self;
	wnew.focus();
}

function leftOver( idfont, idTD) {
	isIE ? document.all( idTD ).style.cursor = "hand" : document.getElementById( idTD ).style.cursor = "pointer";
	isIE? document.all( idTD ).style.background = "#f0f0f0" : document.getElementById( idTD ).style.background = "#f0f0f0";
	isIE? document.all( idfont ).style.color = "#cc3300" : document.getElementById( idfont ).style.color = "#cc3300";
}

function leftOut( idfont, idTD) {
	isIE? document.all( idTD ).style.background = "#ffffff" : document.getElementById( idTD ).style.background = "#ffffff";
	isIE? document.all( idfont ).style.color = "#000000" : document.getElementById( idfont ).style.color = "#000000";

}



